Base class for object organization.
More...
#include <GraphTreeObject.h>
Inherited by clockwerk::Frame< T >, clockwerk::Frame< double >, modelspace::NormalRandom< double > [private]
, modelspace::UniformRandom< double > [private]
, clockwerk::DataIOBase, clockwerk::EkfFocalAnglesMeasUpdate::Inputs, clockwerk::EkfFocalAnglesMeasUpdate::Outputs, clockwerk::EkfFocalAnglesMeasUpdate::Params, clockwerk::EkfOrbitJ2J3Update::Inputs, clockwerk::EkfOrbitJ2J3Update::Outputs, clockwerk::EkfOrbitJ2J3Update::Params, clockwerk::EkfOrbitStateRelState::Inputs, clockwerk::EkfOrbitStateRelState::Outputs, clockwerk::EkfOrbitStateRelState::Params, clockwerk::EkfRangeRangerateMeasUpdate::Inputs, clockwerk::EkfRangeRangerateMeasUpdate::Outputs, clockwerk::EkfRangeRangerateMeasUpdate::Params, clockwerk::Executive, clockwerk::Frame< T >, clockwerk::IterativeLambertTargetTask::Inputs, clockwerk::IterativeLambertTargetTask::Outputs, clockwerk::IterativeLambertTargetTask::Params, clockwerk::LambertTargetTask::Inputs, clockwerk::LambertTargetTask::Outputs, clockwerk::LambertTargetTask::Params, clockwerk::PidAttitudeControl::Inputs, clockwerk::PidAttitudeControl::Outputs, clockwerk::PidAttitudeControl::Params, clockwerk::PidTranslationalControl::Inputs, clockwerk::PidTranslationalControl::Outputs, clockwerk::PidTranslationalControl::Params, clockwerk::Scheduler, clockwerk::SimLogger, clockwerk::SimpleDiscreteProcessNoise::Inputs, clockwerk::SimpleDiscreteProcessNoise::Outputs, clockwerk::SimpleDiscreteProcessNoise::Params, clockwerk::Task, clockwerk::Time, clockwerk::TimeManager, clockwerk::TriadGuidance::Inputs, clockwerk::TriadGuidance::Outputs, clockwerk::TriadGuidance::Params, modelspace::Accelerometer::Inputs, modelspace::Accelerometer::Outputs, modelspace::Accelerometer::Params, modelspace::AsphericalGravityModel::Inputs, modelspace::AsphericalGravityModel::Outputs, modelspace::AsphericalGravityModel::Params, modelspace::BiasNoiseModel::Inputs, modelspace::BiasNoiseModel::Outputs, modelspace::BiasNoiseModel::Params, modelspace::CR3BPDynamicsModel::Inputs, modelspace::CR3BPDynamicsModel::Outputs, modelspace::CR3BPDynamicsModel::Params, modelspace::DispersionEngine, modelspace::EffectiveSolarAreaModel::Inputs, modelspace::EffectiveSolarAreaModel::Outputs, modelspace::EffectiveSolarAreaModel::Params, modelspace::FlatPlateDragModel::Inputs, modelspace::FlatPlateDragModel::Outputs, modelspace::FlatPlateDragModel::Params, modelspace::FrameStateSensorModel::Inputs, modelspace::FrameStateSensorModel::Outputs, modelspace::FrameStateSensorModel::Params, modelspace::GravityGradientModel::Inputs, modelspace::GravityGradientModel::Outputs, modelspace::GravityGradientModel::Params, modelspace::GroundStationModel::Inputs, modelspace::GroundStationModel::Outputs, modelspace::GroundStationModel::Params, modelspace::GroundStationSensor::Inputs, modelspace::GroundStationSensor::Outputs, modelspace::GroundStationSensor::Params, modelspace::Gyro::Inputs, modelspace::Gyro::Outputs, modelspace::Gyro::Params, modelspace::IMU::Inputs, modelspace::IMU::Outputs, modelspace::IMU::Params, modelspace::ImpulseModel::Inputs, modelspace::ImpulseModel::Outputs, modelspace::ImpulseModel::Params, modelspace::LogEvent::Inputs, modelspace::LogEvent::Outputs, modelspace::LogEvent::Params, modelspace::LogManager, modelspace::LvcStateSensorModel::Inputs, modelspace::LvcStateSensorModel::Outputs, modelspace::LvcStateSensorModel::Params, modelspace::LvlhFrameManagerModel::Inputs, modelspace::LvlhFrameManagerModel::Outputs, modelspace::LvlhFrameManagerModel::Params, modelspace::NormalRandom< T > [private]
, modelspace::OrbitalElementsSensorModel::Inputs, modelspace::OrbitalElementsSensorModel::Outputs, modelspace::OrbitalElementsSensorModel::Params, modelspace::OrbitalElementsStateInit::Inputs, modelspace::OrbitalElementsStateInit::Outputs, modelspace::OrbitalElementsStateInit::Params, modelspace::PlanetInfo::Inputs, modelspace::PlanetInfo::Outputs, modelspace::PlanetInfo::Params, modelspace::PlanetRelativeStatesModel::Inputs, modelspace::PlanetRelativeStatesModel::Outputs, modelspace::PlanetRelativeStatesModel::Params, modelspace::PointMassGravityModel::Inputs, modelspace::PointMassGravityModel::Outputs, modelspace::PointMassGravityModel::Params, modelspace::ProximityMonitor::Inputs, modelspace::ProximityMonitor::Outputs, modelspace::ProximityMonitor::Params, modelspace::RangeAzElSensorModel::Inputs, modelspace::RangeAzElSensorModel::Outputs, modelspace::RangeAzElSensorModel::Params, modelspace::RateMonitor::Inputs, modelspace::RateMonitor::Outputs, modelspace::RateMonitor::Params, modelspace::SimScheduler::Inputs, modelspace::SimScheduler::Outputs, modelspace::SimScheduler::Params, modelspace::SimTerminationEvent::Inputs, modelspace::SimTerminationEvent::Outputs, modelspace::SimTerminationEvent::Params, modelspace::SimpleCameraSensor::Inputs, modelspace::SimpleCameraSensor::Outputs, modelspace::SimpleCameraSensor::Params, modelspace::SimplePlanet::Inputs, modelspace::SimplePlanet::Outputs, modelspace::SimplePlanet::Params, modelspace::SimpleSpacecraft::Inputs, modelspace::SimpleSpacecraft::Outputs, modelspace::SimpleSpacecraft::Params, modelspace::SimpleThrusterModel::Inputs, modelspace::SimpleThrusterModel::Outputs, modelspace::SimpleThrusterModel::Params, modelspace::SixDOFDynamicsModel::Inputs, modelspace::SixDOFDynamicsModel::Outputs, modelspace::SixDOFDynamicsModel::Params, modelspace::SolarPanelPowerModel::Inputs, modelspace::SolarPanelPowerModel::Outputs, modelspace::SolarPanelPowerModel::Params, modelspace::SolarRadiationPressureModel::Inputs, modelspace::SolarRadiationPressureModel::Outputs, modelspace::SolarRadiationPressureModel::Params, modelspace::SphericalHarmonicsGravityModel::Inputs, modelspace::SphericalHarmonicsGravityModel::Outputs, modelspace::SphericalHarmonicsGravityModel::Params, modelspace::SpicePlanet::Inputs, modelspace::SpicePlanet::Outputs, modelspace::SpicePlanet::Params, modelspace::StarTracker::Inputs, modelspace::StarTracker::Outputs, modelspace::StarTracker::Params, modelspace::SynodicFrameManagerModel::Inputs, modelspace::SynodicFrameManagerModel::Outputs, modelspace::SynodicFrameManagerModel::Params, modelspace::TimeTriggerMonitor::Inputs, modelspace::TimeTriggerMonitor::Outputs, modelspace::TimeTriggerMonitor::Params, modelspace::TimedImpulsiveBurnModel::Inputs, modelspace::TimedImpulsiveBurnModel::Outputs, modelspace::TimedImpulsiveBurnModel::Params, modelspace::UniformRandom< T > [private]
, modelspace::VisualsModel::Inputs, modelspace::VisualsModel::Outputs, and modelspace::VisualsModel::Params.
|
GraphTreeObject * | _parent = nullptr |
| Pointer to the object's parent – should be null if the object is the root. Is set to null by default.
|
|
std::vector< GraphTreeObject * > | _children |
| Pointers to the object's children – automatically set to an empty vector, and can be increased to any size.
|
|
std::string | _name = DEFAULT_NAME |
| String name for object.
|
|
uint16_t | _num_descendants = 0 |
| Total number of descendants (includes children of children) of the tree, again not including the tree itself.
|
|
uint8_t | _num_children = 0 |
| Number of direct children of the tree (not including the tree itself)
|
|
uint8_t | _rank = 0 |
| Rank for how far down on the graph tree the object is – starts at zero and maxes out at 256 via variable size.
|
|
uint8_t | _graph_tree_type = BASE_GRAPH_TREE |
| Variable to store graph tree object type.
|
|
bool | _locked = false |
| Variable to lock the graph tree object and prevent structural updates.
|
|
bool | _loggable = false |
| Variable to indicate whether the selected object is loggable. Set to false by default.
|
|
Base class for object organization.
This file defines a base class for data organization into a format we're calling here a "graph tree". The graph tree is set up to connect a single parent to any number of children, which may be done upon construction or at runtime. Graph trees allow connections between any number of inherited objects and their parents/children, allowing for recursive math and search functionality. In essence, the class is a doubly linked list with multiple children and search functionality.
Parent
|
---------------------------------------
| | | |
Child 1 Child 2 Child 3 Child 4
Also, note that trees objects are entirely independent of their position in that tree, so a child can be treated as if it were root in the case where a local search should be performed.
String Address Functionality String addressing is one of the most critical functions of the graph tree. It allows for easy access to data, in addition to search and write functions. String addresses are constructed from the names of individual objects on the tree, separated by a delimiter defined in this file (a period by default). So a standard string address could look like:
.firstObj.secondObj.thirdObj.otherThing
which would indicate four levels of heirarchy on the tree, with otherThing being the furthest down on the tree. The object at the location otherThing can be accessed by requesting the string address.
Graph tree has the following restrictions driven by data size: Number of children – restricted by variable size and uint8 size Number of descendants – restricted by uint16 size
◆ addChild()
Function to add a child to the graph tree object.
- Parameters
-
child | A pointer to the graph tree object to add to the tree |
- Returns
- An error code corresponding to success/failure
◆ address()
std::string clockwerk::GraphTreeObject::address |
( |
| ) |
|
Getter for object's string address.
- Returns
- Returns the string address for the object
◆ decomposeAddress()
std::vector< std::string > clockwerk::GraphTreeObject::decomposeAddress |
( |
std::string |
address | ) |
|
|
protected |
Function to decompose a string into a series of substrings via indexing.
- Parameters
-
address | The address to be decomposed |
- Returns
- A vector of strings containing each delimeter-separated substring
◆ dump()
Function to dump the graph node, optionally including descendents.
- Parameters
-
recursive | Parameter indicating whether to dump only one node (default/false) or the entire tree (true) |
- Note
- Recursive dumps the whole tree... be careful what you wish for
◆ findLoggable()
Function to find all loggable parameters in this node and its children.
- Parameters
-
matches | Expandable vector to hold all matches in the tree |
◆ findMatches()
Function to find all addresses mathcing the set of substrings @parem subaddresses A vector of subaddresses to match.
- Parameters
-
num_subaddresses | The number of subaddresses to match |
index | The index of subaddresses to search in |
match_found | Variable indicating whether a match was found higher in the tree |
matches | Implicit return of all matches to the specified address |
◆ getByAddress()
Function to get an object from the graph tree by string address.
- Parameters
-
address | The exact string address to access the variable with |
- Returns
- Pointer to the graph tree object at the address, or nullptr if address is not valid or returns
◆ header()
Function to pass headers for this object to the logger.
- Parameters
-
- Returns
- Error code corresponding to success/failure
Reimplemented in clockwerk::DataIO< T >, clockwerk::DataIO< bool >, clockwerk::DataIO< clockwerk::Body< double > * >, clockwerk::DataIO< clockwerk::Body< T > * >, clockwerk::DataIO< clockwerk::CartesianVector< double, 2 > >, clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > >, clockwerk::DataIO< clockwerk::CartesianVector< T, 3 > >, clockwerk::DataIO< clockwerk::Euler321< double > >, clockwerk::DataIO< clockwerk::Frame< double > * >, clockwerk::DataIO< clockwerk::Frame< T > * >, clockwerk::DataIO< clockwerk::Matrix< double, 2, 2 > >, clockwerk::DataIO< clockwerk::Matrix< double, 3, 3 > >, clockwerk::DataIO< clockwerk::Matrix< double, 6, 3 > >, clockwerk::DataIO< clockwerk::Matrix< double, 6, 6 > >, clockwerk::DataIO< clockwerk::Matrix< T, 3, 3 > >, clockwerk::DataIO< clockwerk::Node< double > * >, clockwerk::DataIO< clockwerk::Quaternion< double > >, clockwerk::DataIO< clockwerk::Quaternion< T > >, clockwerk::DataIO< clockwerk::Time >, clockwerk::DataIO< double >, clockwerk::DataIO< int >, clockwerk::DataIO< modelspace::integrator_type_e >, clockwerk::DataIO< std::string >, and clockwerk::DataIO< void * >.
◆ header_info()
virtual std::vector< std::string > clockwerk::GraphTreeObject::header_info |
( |
| ) |
const |
|
inlinevirtual |
◆ lock()
void clockwerk::GraphTreeObject::lock |
( |
bool |
recursive = true | ) |
|
Function to lock the graph tree object and its children to changes.
- Parameters
-
recursive | Flag to indicate whether lock should be recursive |
◆ log()
Function to log data to a logger.
- Parameters
-
- Returns
- Error code corresponding to success/failure
Reimplemented in clockwerk::Time, clockwerk::DataIO< T >, clockwerk::DataIO< bool >, clockwerk::DataIO< clockwerk::Body< double > * >, clockwerk::DataIO< clockwerk::Body< T > * >, clockwerk::DataIO< clockwerk::CartesianVector< double, 2 > >, clockwerk::DataIO< clockwerk::CartesianVector< double, 3 > >, clockwerk::DataIO< clockwerk::CartesianVector< T, 3 > >, clockwerk::DataIO< clockwerk::Euler321< double > >, clockwerk::DataIO< clockwerk::Frame< double > * >, clockwerk::DataIO< clockwerk::Frame< T > * >, clockwerk::DataIO< clockwerk::Matrix< double, 2, 2 > >, clockwerk::DataIO< clockwerk::Matrix< double, 3, 3 > >, clockwerk::DataIO< clockwerk::Matrix< double, 6, 3 > >, clockwerk::DataIO< clockwerk::Matrix< double, 6, 6 > >, clockwerk::DataIO< clockwerk::Matrix< T, 3, 3 > >, clockwerk::DataIO< clockwerk::Node< double > * >, clockwerk::DataIO< clockwerk::Quaternion< double > >, clockwerk::DataIO< clockwerk::Quaternion< T > >, clockwerk::DataIO< clockwerk::Time >, clockwerk::DataIO< double >, clockwerk::DataIO< int >, clockwerk::DataIO< modelspace::integrator_type_e >, clockwerk::DataIO< std::string >, and clockwerk::DataIO< void * >.
◆ parent() [1/2]
Function to assign the node's parent via reference.
- Parameters
-
new_parent | The new parent to assign the node to |
- Returns
- Error code corresponding to success/failure
- Note
- This function is the only method to ADD or REMOVE a node from a tree. To add, pass the address to a GraphTreeObject to this function. To remove, pass a nullptr. Note that parents for objects on an existing tree can be reassigned
◆ parent() [2/2]
Function to assign the node's parent via pointer.
- Parameters
-
new_parent | The new parent to assign the node to |
- Returns
- Error code corresponding to success/failure
- Note
- This function is the only method to ADD or REMOVE a node from a tree. To add, pass the address to a GraphTreeObject to this function. To remove, pass a nullptr. Note that parents for objects on an existing tree can be reassigned
◆ recurseGraphNodeInfo()
void clockwerk::GraphTreeObject::recurseGraphNodeInfo |
( |
unsigned int |
counter | ) |
|
Function to recurse through graph tree and print all node info.
- Returns
- String containing all recursive graph node information in tab cascade format
◆ removeChild()
Function to remove a child from the graph node's children.
- Parameters
-
- Returns
- Success/fail error code based on whether the child is present
◆ search()
std::vector< std::string > clockwerk::GraphTreeObject::search |
( |
const std::string & |
address | ) |
|
Function to search through the graph tree by string address.
- Parameters
-
address | `The address or address chunk to search for |
- Returns
- A vector of string addresses meeting the criteria specified by address
◆ searchNodes()
std::vector< GraphTreeObject * > clockwerk::GraphTreeObject::searchNodes |
( |
const std::string & |
address | ) |
|
|
protected |
Function to search through the graph tree by string address.
- Parameters
-
address | `The address or address chunk to search for |
- Returns
- A vector of objects addresses meeting the criteria specified by address
◆ type()
Function to indicate type – -1 by default unless implemented downstream.
- Returns
- Int indicating frame type – unimplemented always -1
◆ unlock()
void clockwerk::GraphTreeObject::unlock |
( |
bool |
recursive = true | ) |
|
Function to unlock the graph tree and its children for changes.
- Parameters
-
recursive | Flag to indicate whether unlock should be recursive |
The documentation for this class was generated from the following files:
- /home/mickey/modelspace/clockwerk/src/data_management/GraphTreeObject.h
- /home/mickey/modelspace/clockwerk/src/data_management/GraphTreeObject.cpp