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.
Virtual member functions
offset
compute transformation toward WCS
offset
compute transformation toward WCS
|
(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 tf_to_WCS(hop_limit), forwarding the (already decremented)
hop_limit so the traversal counter follows the full chain.
Backend authors do not raise hop_limit_exceeded_error themselves: the public
coordsys::tf_to_WCS() decrements hop_limit before each call to offset()
and throws the exception when the counter reaches zero. An offset()
implementation should simply propagate hop_limit into whatever further
tf_to_WCS() calls it needs.
clone
create a deep copy
clone
create a deep copy
|
(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.
See also
For a step-by-step recipe on writing your own backend and pairing it with a coordinate system, see How to implement a custom backend.