7#include <boost/core/demangle.hpp>
17 : _name(std::move(name)), _description(std::move(description)), _tags(std::move(tags)) {}
22 : _name(
"**INVALID**"), _description(
"Invalid EntityOwner created by default constructor just as a place holder") {}
27 _name = std::move(other._name);
28 _description = std::move(other._description);
29 _accessorList = std::move(other._accessorList);
30 _moduleList = std::move(other._moduleList);
31 _tags = std::move(other._tags);
32 for(
auto* mod : _moduleList) {
35 for(
auto& node : _accessorList) {
36 node.setOwningModule(
this);
39 other._name =
"**INVALID**";
40 other._description =
"This EntityOwner was moved from.";
41 assert(other._accessorList.empty());
42 assert(other._moduleList.empty());
43 assert(other._tags.empty());
52 for(
const auto& tag :
_tags) {
73 auto sublist = submodule->getAccessorListRecursive();
74 list.insert(list.end(), sublist.begin(), sublist.end());
87 auto sublist = submodule->getSubmoduleListRecursive();
88 list.insert(list.end(), sublist.begin(), sublist.end());
96 for(
const auto& tag :
_tags) {
108 stream <<
"==== Hierarchy dump of module '" <<
_name <<
"':" << std::endl;
112 stream << prefix <<
"+ ";
117 stream << prefix <<
"| " << submodule->getName() << std::endl;
118 submodule->dump(prefix +
"| ", stream);
129 submodule->addTag(tag);
146 if(!tag.empty() && tag[0] ==
'!') {
147 return tag.substr(1);
155 return getQualifiedName() +
"<" + boost::core::demangle(
typeid(*this).name()) +
">";
Base class for owners of other EntityOwners (e.g.
std::list< Module * > getSubmoduleListRecursive() const
Obtain the list of submodules associated with this instance and any submodules.
std::list< VariableNetworkNode > getAccessorList() const
Obtain the list of accessors/variables directly associated with this instance.
std::list< Module * > getSubmoduleList() const
Obtain the list of submodules associated with this instance.
void registerAccessor(VariableNetworkNode accessor)
Called inside the constructor of Accessor: adds the accessor to the list.
EntityOwner()
Default constructor just for late initialisation.
std::string _name
The name of this instance.
virtual void unregisterModule(Module *module)
Unregister another module as a sub-module.
void dump(const std::string &prefix="", std::ostream &stream=std::cout) const
Print the full hierarchy to given stream.
std::list< Module * > _moduleList
List of modules owned by this instance.
bool hasReachedTestableMode()
Check whether this module has declared that it reached the testable mode.
std::atomic< bool > _testableModeReached
Flag used by the testable mode to identify whether a thread within the EntityOwner has reached the po...
void registerModule(Module *module, bool addTags=true)
Register another module as a sub-module.
virtual std::string getQualifiedName() const =0
Get the fully qualified name of the module instance, i.e.
std::string getQualifiedNameWithType() const
Get the fully qualified name of the module instance, followed by the C++ data type (in pointy bracket...
void addTag(const std::string &tag)
Add a tag to all Application-type nodes inside this group.
EntityOwner & operator=(EntityOwner &&other) noexcept
Move assignment operator.
std::unordered_set< std::string > _tags
List of tags to be added to all accessors and modules inside this module.
std::list< VariableNetworkNode > _accessorList
List of accessors owned by this instance.
std::list< VariableNetworkNode > getAccessorListRecursive() const
Obtain the list of accessors/variables associated with this instance and any submodules.
Base class for ApplicationModule and DeviceModule, to have a common interface for these module types.
Class describing a node of a variable network.
void addTag(const std::string &tag) const
Add a tag.
InvalidityTracer application module.
std::string negateTag(const std::string &tag)
negate tag using prefix '!'