NPRPC docs

class Object

C++

class Object : public ObjectId

Client-side proxy for a remote object. npidl generates a subclass per interface with a method for each call.

Reference counted with add_ref()/release(); hold it in an ObjectPtr rather than calling them by hand.

include/nprpc/nprpc.hpp:481

Methods

uint32_t add_ref()

Adds a local reference. The first one on a transient object also registers this client with the server. Returns the new count.

include/nprpc/nprpc.hpp:511

static Object *from_string(std::string_view str)

Create an Object from a serialized string (NPRPC IOR format). Returns nullptr on parse error.

include/nprpc/nprpc.hpp:552

std::string_view get_class() const noexcept

Interface identifier; same as class_id().

include/nprpc/nprpc.hpp:499

const EndPoint &get_endpoint() const noexcept

The transport and address calls go to; see select_endpoint().

include/nprpc/nprpc.hpp:548

uint32_t get_timeout() const noexcept

Call timeout in milliseconds.

include/nprpc/nprpc.hpp:545

PoaPolicy::Lifespan policy_lifespan() const noexcept

Lifespan of the POA the object lives in.

include/nprpc/nprpc.hpp:502

std::optional<EndPointType> preferred_transport() const noexcept

The transport set with set_preferred_transport(), if any.

include/nprpc/nprpc.hpp:532

uint32_t release()

Drops a local reference. The last one tells a transient object's server that this client is done, then deletes the proxy. Returns the new count.

include/nprpc/nprpc.hpp:514

bool select_endpoint(std::optional<EndPoint> remote_endpoint = std::nullopt) noexcept

Picks the transport to call through from urls(), honouring set_preferred_transport(), or uses remote_endpoint when given. Returns false if none of the URLs is usable here.

include/nprpc/nprpc.hpp:518

void set_preferred_transport(std::optional<EndPointType> type) noexcept

Prefer a specific transport when select_endpoint() runs. Non-binding: if the transport is not advertised in urls() (or is ineligible, e.g. SharedMemory to a remote machine), the default preference order is used instead. Pass std::nullopt to clear.

include/nprpc/nprpc.hpp:525

uint32_t set_timeout(uint32_t timeout_ms) noexcept

Sets how long a call waits for its reply before raising ExceptionTimeout. Returns the previous value. Default: 1000 ms.

include/nprpc/nprpc.hpp:539

Operators

Object &operator=(Object &&other)

Takes over other's reference, connection and settings; used by narrow().

include/nprpc/nprpc.hpp:562