57 virtual std::string
stringize(
bool pretty=
false)
const override {
60 std::array<EventsVector, NUM_SCHEDULING_PHASES>::size_type event_cnt = 0;
61 for(
const auto & ea : events_) {
62 event_cnt += ea.size();
64 ss <<
'<' <<
getLocation() <<
' ' << event_cnt <<
" events>";
75 return events_[
static_cast<uint32_t
>(phase)];
92 virtual void onAddingChild_(
TreeNode* child)
override {
94 throw SpartaException(
"Cannot add a child event once a EventSet is finalized. "
99 EventNode* event_node =
dynamic_cast<EventNode*
>(child);
100 if(
nullptr != event_node){
102 events_[
static_cast<uint32_t
>(event_node->getSchedulingPhase())].push_back(event_node);
106 throw SpartaException(
"Cannot add TreeNode child ")
108 <<
" because the child is not a CounterBase or Event";
115 std::array<EventsVector, NUM_SCHEDULING_PHASES> events_;
File that defines the EventNode class.
Set of macros for Sparta assertions. Caught by the framework.
Exception class for all of Sparta.
Set of Events that a unit (or sparta::TreeNode, sparta::Resource) contains and are visible through a ...
static constexpr char NODE_NAME[]
Name of all EventSet nodes.
virtual std::string stringize(bool pretty=false) const override
Create a string representation of this node.
EventSet(TreeNode *parent)
Constructor.
std::vector< EventNode * > EventsVector
Type for holding outside events.
EventsVector & getEvents(sparta::SchedulingPhase phase)
virtual bool isFinalized() const
Is this node (and thus the entire tree above it) "finalized".
Used to construct and throw a standard C++ exception. Inherits from std::exception.
Node in a composite tree representing a sparta Tree item.
static const group_idx_type GROUP_IDX_NONE
GroupIndex indicating that a node has no group index because it belongs to no group.
std::string getLocation() const override final
static constexpr char GROUP_NAME_BUILTIN[]
Reserved name for built-in nodes.
void addChild(TreeNode *child, bool inherit_phase=true)
Adds a TreeNode to this node as a child.
const std::string & getName() const override
Gets the name of this node.
void setExpectedParent_(const TreeNode *parent)
Tracks a node as an expected parent without actually adding this node as a child. This is used almost...
Macros for handling exponential backoff.
SchedulingPhase
The SchedulingPhases used for events (Tick, Update, PortUpdate, etc)