coordsys_backend

namespace nin {
    template <coordsys_traits CT>
    class coordsys_backend;
}

coordsys_backend is the abstract base class for all coordinate system backends. It enables runtime polymorphism with value semantics through the non-virtual interface idiom: coordsys owns a shared_ptr<coordsys_backend> and delegates tree traversal and cloning to it.

Users who need custom coordinate system behaviour — for example, reading pose from a physics engine, a network service, or a sensor driver — derive from coordsys_backend and implement the two pure virtual functions below. The derived backend is then wrapped in a coordsys_generic or coordsys_child to become a fully functional coordinate system.

Nested types

Type Definition

coordsys_traits

CT

Virtual member functions

offset

compute transformation toward WCS

virtual tf_data_type offset(unsigned hop_limit) const = 0

(1)

Returns the transformation data from this coordinate system toward WCS. For a child backend, this typically composes the local transformation with the parent’s offset(), decrementing hop_limit at each hop. When hop_limit reaches zero, the implementation should throw hop_limit_exceeded_error.

clone

create a deep copy

virtual shared_ptr<coordsys_backend> clone() const = 0

(1)

Returns a new backend with the same state. Called by coordsys copy constructor to implement value semantics: copying a coordinate system produces an independent object, not a shared reference.