Class FrameContainer#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Type#

Class Documentation#

class FrameContainer : public Karana::Core::LockingBase#

A container class for managing frames and their relationships.

This class provides functionality to create, register, and manage frames, as well as establish relationships between frames.

See Coordinate Frames for more discussion on the frames layer.

Public Functions

FrameContainer()#

Constructs a FrameContainer with a root frame.

virtual ~FrameContainer()#

FrameContainer destructor.

std::string dumpString(std::string_view prefix = "", const Base::DumpOptions *options = nullptr) const override#

Return a formatted string containing information about this object.

Parameters:
  • prefix – String prefix to use for formatting.

  • options – Dump options (if null, defaults will be used).

Returns:

A string representation of the object.

const kc::ks_ptr<Frame> &root() const#

Returns the root frame of the tree.

Returns:

The root frame.

std::vector<kc::ks_ptr<Frame>> lookupFrame(std::string_view name)#

Return a vector of all Frames with the given name.

Parameters:

name – name of the Frame instances to look up

Returns:

A vector of all the Frames with the given name.

bool isAncestorOf(const Frame &oframe, const Frame &pframe, bool strict)#

Checks if one frame is an ancestor of another.

Parameters:
  • oframe – The potential ancestor frame.

  • pframe – The potential descendant frame.

  • strict – If false, a frame can be its own ancestor

Returns:

True if oframe is an ancestor of pframe, false otherwise.

const kc::ks_ptr<Frame> &getAncestor(const Frame &frame1, const Frame &frame2)#

Gets the common ancestor of two frames.

Parameters:
  • frame1 – The first frame.

  • frame2 – The second frame.

Returns:

The common ancestor frame.

void trackUsageFrame(const kc::ks_ptr<Frame> &frame)#

Method to track usage of a Frame instance.

These methods need to be public to allow specialized classes (e.g., multibody) ones to call them

Parameters:

frame – the new Frame to track

void trackUsageEdgeFrameToFrame(const kc::ks_ptr<EdgeFrameToFrame> &f2f)#

Method to track usage of an EdgeFrameToFrame instance.

These methods need to be public to allow specialized classes (e.g., multibody) ones to call them

Parameters:

f2f – the new EdgeFrameToFrame to track

void trackUsageOrientedChainedFrameToFrame(const kc::ks_ptr<OrientedChainedFrameToFrame> &of2f)#

Method to track usage of an OrientedChainedFrameToFrame instance.

These methods need to be public to allow specialized classes (e.g., multibody) ones to call them

Parameters:

of2f – the new Frame to track

void trackUsageChainedFrameToFrame(const kc::ks_ptr<ChainedFrameToFrame> &cf2f)#

Method to track usage of an ChainedFrameToFrame instance.

These methods need to be public to allow specialized classes (e.g., multibody) ones to call them

Parameters:

cf2f – the new Frame to track

std::vector<kc::ks_ptr<ChainedFrameToFrame>> chainedFrameToFrames()#

Return a vector of all the ChainedFrameToFrames in the FrameContainer.

Returns:

List of all the chain elements.

std::vector<kc::ks_ptr<Frame>> frames()#

Return a vector of all the frames in the FrameContainer.

Returns:

List of all the frame elements.

std::vector<kc::ks_ptr<EdgeFrameToFrame>> edgeFrameToFrames()#

Return a vector of all the EdgeFrameToFrames in the FrameContainer.

Returns:

List of all the edge elements.

void freezeUpstream(const kc::ks_ptr<Frame> &frame)#

Freeze the OrientedChainedFrameToFrame that connects this frame to the root. This will effectively freeze all edges in the path.

Parameters:

frame – the downstream terminal frame

void unfreezeUpstream(const kc::ks_ptr<Frame> &frame)#

Unfreeze the OrientedChainedFrameToFrame that connects this frame to the root. This will effectively unfreeze all edges in the path.

Parameters:

frame – the downstream terminal frame

void setEphemerisTime(double ephemeris_time)#

Set the ephemeris time.

The ephemeris time is needed by Spice frames

Parameters:

ephemeris_time – the ephemeris time

double getEphemerisTime()#

Return the current ephemeris time.

The ephemeris time is needed by Spice frames

Returns:

the current ephemeris time

bool isUsingSpice()#

Return true if this FrameContainer is using spice frames, false otherwise.

Returns:

true if this FrameContainer is using spice frames, false otherwise.

void dumpFrameTree(std::string_view prefix, const Frame &f, const std::function<std::string(const Frame&)> &callback) const#

Display the frame tree hierarchy starting from a specific frame.

Parameters:
  • prefix – the string prefix for each line of the displayed output

  • f – the root Frame for the start of the tree display

  • callback – the function to generate each frame’s display string

inline const std::unique_ptr<const kc::Tree<kc::id_t>> &tree()#

Return the frame ids tracking their hierarchy.

Returns:

the ids tree

Public Static Functions

static kc::ks_ptr<FrameContainer> create(std::string_view root_frame_name)#

Create a FrameContainer.

Parameters:

root_frame_name – Name for the root frame

Returns:

The frame container.

Protected Functions

void _discard(kc::ks_ptr<Base> &base) override#

Parameters:

base – - Pointer to the FrameContainer.

virtual void _makeNotHealthy() override#

Derived classes override this to define how to mark themselves as not healthy.

virtual void _makeHealthy() override#

Derived classes override this to define how to make themselves healthy.

std::optional<bool> _subchainOrientation(const FrameToFrame &f2f, const FrameToFrame &sub_f2f) const#

Return true if the sub_f2f path is contained within the f2f’s oframe/pframe path and oriented with the path, false if it has opposed orientation, and nullopt if it is not full contained on the path at all.

Parameters:
  • f2f – The frame to frame we want to check if sub_f2f is contained within.

  • sub_f2f – The sub-frame this method checks is contained within f2f.

Returns:

true if the sub_f2f path is contained within the f2f’s oframe/pframe path, false if it has opposed orientation, and nullopt if it is not contained in the path.

Protected Attributes

kc::RegistryList<FrameToFrame> _spice_f2fs_list#

List of all SpiceFrameToFrame instances

struct DumpOptions : public LockingBase::DumpOptions#

options struct for dumpString

Public Functions

inline DumpOptions &operator=(const DumpOptions &p)#

Copy assignment operator.

Parameters:

pDumpOptions to copy from.

Returns:

A reference to the assigned DumpOptions.

Public Members

bool frames = false#

frames usage map

bool edges = false#

edge usage map

bool oriented = false#

oriented f2fs usage map

bool chains = false#

regular chains usage map