NPRPC docs

class ObjectServant

C++

class ObjectServant

Base of every server-side object. npidl generates I<Interface>_Servant from it; implement the interface's methods in a subclass and activate an instance with Poa::activate_object.

include/nprpc/nprpc.hpp:427

Methods

std::chrono::system_clock::time_point activation_time() const noexcept

When the servant was activated.

include/nprpc/nprpc.hpp:462

uint32_t add_ref() noexcept

Adds a client reference. Returns the new count.

include/nprpc/nprpc.hpp:456

virtual void destroy() noexcept

Called when the runtime is done with the servant. Deletes it by default; override for servants that are not heap-allocated.

include/nprpc/nprpc.hpp:447

virtual void dispatch(::nprpc::SessionContext &ctx, bool from_parent) = 0

Decodes a call and invokes the matching method; generated.

include/nprpc/nprpc.hpp:444

virtual std::string_view get_class() const noexcept = 0

Interface identifier; generated.

include/nprpc/nprpc.hpp:442

bool is_deleted() const noexcept

Whether the servant has been deactivated and awaits deletion.

include/nprpc/nprpc.hpp:466

bool is_unused() const noexcept

Whether no client holds a reference.

include/nprpc/nprpc.hpp:464

oid_t oid() const noexcept

The servant's object id.

include/nprpc/nprpc.hpp:452

Poa *poa() const noexcept

The POA the servant is active in.

include/nprpc/nprpc.hpp:450

poa_idx_t poa_index() const noexcept

Index of the POA the servant is active in.

include/nprpc/nprpc.hpp:454

uint32_t release() noexcept

Drops a client reference. In a transient POA the servant is deactivated and destroyed when the count reaches zero; in a persistent one this does nothing. Returns the new count.

include/nprpc/nprpc.hpp:460

bool validate_session(SessionContext &ctx) const noexcept

Whether ctx may call the servant: always, unless it was activated for one session only.

include/nprpc/nprpc.hpp:469