4#include "sparta/pevents/PeventCollector.hpp"
5#include "sparta/simulation/TreeNodePrivateAttorney.hpp"
26 CachedTapData(
const std::string& tree_dest,
28 const std::string& type,
32 treenode_dest(tree_dest),
36 std::string event_type;
37 std::string treenode_dest;
46 void cacheTap(
const std::string& file,
const std::string& type,
const bool verbose,
47 const std::string& node=
"ROOT")
49 tap_info_.emplace_back(CachedTapData(node, file, type, verbose));
58 for(
auto& tap_data : tap_info_)
60 uint32_t count_added = 0;
61 if(tap_data.treenode_dest !=
"ROOT")
63 std::vector<TreeNode*> results;
66 addTap_(node, tap_data.event_type, tap_data.file, tap_data.verbose, count_added);
70 addTap_(root, tap_data.event_type, tap_data.file, tap_data.verbose, count_added);
77 s <<
"No pevents were actually enabled for the pevent " << tap_data.event_type <<
". You likely supplied an invalid event type to the command line. ";
89 o <<
"<TreeNode Path> : Event Name" << std::endl;
90 printEventNames_(o, root);
96 void printEventNames_(std::ostream& o,
TreeNode* root)
103 o << c_node->stringize() <<
" : " << c_node->eventName() << std::endl;
105 printEventNames_(o, node);
110 bool addTap_(TreeNode* root,
const std::string& type,
const std::string& file,
const bool verbose,
111 uint32_t& count_added)
113 PeventCollectorTreeNode* c_node =
dynamic_cast<PeventCollectorTreeNode*
>(root);
116 if(c_node->addTap(type, file, verbose))
118 count_added = count_added + 1;
121 for(TreeNode* node : TreeNodePrivateAttorney::getAllChildren(root))
123 addTap_(node, type, file, verbose, count_added);
128 std::vector<CachedTapData> tap_info_;
Basic Node framework in sparta device tree composite pattern.
TreeNode which represents the root ("top") of a device tree.
GlobalTreeNode * getSearchScope()
Gets the search node "parent" of this root node which is suitable for performing searches that includ...
Used to construct and throw a standard C++ exception. Inherits from std::exception.
Node in a composite tree representing a sparta Tree item.
uint32_t findChildren(const std::string &pattern, std::vector< TreeNode * > &results, std::vector< std::vector< std::string > > &replacements)
Finds all children starting at this node with a given pattern relative to this node by matching names...
Simple class for recursively adding taps to pevents. There is probably a more efficient way than each...
void printEventNames(std::ostream &o, TreeNode *root)
Print out a nice listing of the pevents that we have in the model.
void cacheTap(const std::string &file, const std::string &type, const bool verbose, const std::string &node="ROOT")
Add knowledge of a tap that will need to be created later, right now we are only parsing the command ...
void finalize(RootTreeNode *root)
we are done parsing the command line, and simulation is setup, propagate the tap information throug t...
Macros for handling exponential backoff.