The Sparta Modeling Framework
|
Object having a specific phase in the sparta construction paradigm. More...
#include <PhasedObject.hpp>
Public Types | |
Types | |
enum | TreePhase { TREE_BUILDING = 0 , TREE_CONFIGURING = 1 , TREE_FINALIZING = 2 , TREE_FINALIZED = 3 , TREE_TEARDOWN = 4 } |
Current phase of tree construction (applies to node and entire tree). More... | |
Public Member Functions | |
Construction | |
PhasedObject (PhasedObject &&)=default | |
Identification Attributes | |
virtual const std::string & | getName () const =0 |
Gets the name of this node. | |
virtual std::string | getLocation () const =0 |
Returns the location of this node in device tree which can be used to navigate the device tree in methods such as getChild if this is fully attached to the device tree. | |
Phase Attributes | |
TreePhase | getPhase () const |
Gets the trees current phase. | |
virtual bool | isBuilding () const |
Is this node (and thus the entire tree above and below it) currently in the TREE_BUILDING phase. | |
virtual bool | isBuilt () const |
Is this node (and thus the entire tree above it) "built". Checks that getPhase has passed TREE_BUILDING. | |
virtual bool | isConfigured () const |
Is this node (and thus the entire tree above it) "configured". Checks that getPhase has passed TREE_CONFIGURING (i.e. FINALIZED, FINALIZING, TEARDOWN, etc). | |
virtual bool | isConfiguring () const |
Is this node (and thus the entire tree above it) currently in the TREE_CONFIGURING phase. | |
virtual bool | isFinalizing () const |
Is this node (and thus the entire tree above it) "finalized". | |
virtual bool | isFinalized () const |
Is this node (and thus the entire tree above it) "finalized". | |
virtual bool | isTearingDown () const |
Is this node (and thus the entire tree above it) in the "teardown" phase. | |
void | setPhase_ (TreePhase phase) |
Sets the current phase. | |
Object having a specific phase in the sparta construction paradigm.
Contains methods for querying and setting phase with some transition logic.
Definition at line 26 of file PhasedObject.hpp.
Current phase of tree construction (applies to node and entire tree).
Tree construction steps through these discrete phases, which restrict what operations can be done on the tree.
Definition at line 43 of file PhasedObject.hpp.
|
inline |
Definition at line 83 of file PhasedObject.hpp.
|
inlinevirtual |
Definition at line 89 of file PhasedObject.hpp.
|
pure virtual |
Returns the location of this node in device tree which can be used to navigate the device tree in methods such as getChild if this is fully attached to the device tree.
The ',' is used to indicate expected, but unattached parents (set through setExpectedParent_) which happens during construction to avoid having to roll back any tree changes in the case of an exception while validating a node about to be attached to the tree.
If this node 'c' is attached to parent 'b':
* getLocation() => "top.a.b.c" *
If this node 'c' is expecting parent 'b' and 'b' is has expected parent 'a', which is already attached to parent 'top':
* getLocation() => "top.a,b,c" *
If this node 'c' has no parent, is not a RootTreeNode and has no expected parent:
* getLocation() => "~c" *
Implemented in sparta::TreeNode.
|
pure virtual |
|
inline |
Gets the trees current phase.
Initially TREE_BUILDING
Definition at line 157 of file PhasedObject.hpp.
|
inlinevirtual |
Is this node (and thus the entire tree above and below it) currently in the TREE_BUILDING phase.
Building phase allows new ResourceTreeNodes to be added to the tree.
Definition at line 168 of file PhasedObject.hpp.
|
inlinevirtual |
Is this node (and thus the entire tree above it) "built". Checks that getPhase has passed TREE_BUILDING.
Being built prevents new nodes from being attached to the tree.
Definition at line 179 of file PhasedObject.hpp.
|
inlinevirtual |
Is this node (and thus the entire tree above it) "configured". Checks that getPhase has passed TREE_CONFIGURING (i.e. FINALIZED, FINALIZING, TEARDOWN, etc).
Being built prevents new nodes from being attached to the tree.
Definition at line 191 of file PhasedObject.hpp.
|
inlinevirtual |
Is this node (and thus the entire tree above it) currently in the TREE_CONFIGURING phase.
Being built prevents new nodes from being attached to the tree.
Definition at line 202 of file PhasedObject.hpp.
|
inlinevirtual |
Is this node (and thus the entire tree above it) "finalized".
Being in TREE_FINALIZE prevents the tree from finalizing again.
Reimplemented in sparta::Scheduler.
Definition at line 224 of file PhasedObject.hpp.
|
inlinevirtual |
Is this node (and thus the entire tree above it) "finalized".
Being in TREE_FINALIZING prevents configuration but indicates that the tree has not yet successfully finalized.
Definition at line 213 of file PhasedObject.hpp.
|
inlinevirtual |
Is this node (and thus the entire tree above it) in the "teardown" phase.
Being in TREE_TEARDOWN supresses the exceptions normally thrown by caused by deleting nodes.
This phase exists in order to help catch the class of errors where Nodes were allocated on the stack and deleted before the tree to which they were attached is still being used. Tearing down indicates that the tree should no longer be used.
Definition at line 242 of file PhasedObject.hpp.
|
inlineprotected |
Sets the current phase.
Definition at line 254 of file PhasedObject.hpp.