Construct version 5.4.4
An agent based modeling framework
|
A container for nodesets. More...
Public Member Functions | |
Nodeset * | create_nodeset (const std::string &name) |
Creates a new nodeset and adds it to the NodesetManager. More... | |
const Nodeset & | get_nodeset (const std::string &name) const |
Finds the specified nodeset. More... | |
bool | does_nodeset_exist (const std::string &name) const noexcept |
Determines if the constant nodeset exists. More... | |
void | import_nodeset (const Nodeset *nodeset) |
Causes this manager to take ownership of the nodeset. More... | |
void | export_nodeset (const Nodeset *nodeset) noexcept |
Causes this manager to relieve its ownership of the nodeset. More... | |
A container for nodesets.
The nodeset manager contains all nodesets in Construct. Only one instance of a nodeset manager is expected in an instance of Construct. The nodeset manager can be called from Construct using Construct::get_NodesetManager.
Nodeset * NodesetManager::create_nodeset | ( | const std::string & | name | ) |
Creates a new nodeset and adds it to the NodesetManager.
Nodeset pointers are owned by the NodesetManager and should not be deallocated by anything other than the NodesetManager.
name | The nodeset's name. |
Example
Output:
my_nodeset was loaded
Complexity
Constant.
Exception Safety
A dynet::already_exists exception is thrown if a Nodeset with the same name already exists.
|
noexcept |
Determines if the constant nodeset exists.
A nodeset can be created, but it is not discoverable until Nodeset::turn_to_const has been called. Some functions may have variable functionality depending on whether a nodeset is present.
name | The nodeset's name. |
Example
Output:
my_nodeset was loaded
Complexity
Average is constant. The number of nodesets is not expected to be large. Underlying function uses unordered_map::find
Exception Safety
No-throw guarantee: this member function never throws exceptions.
|
noexcept |
Causes this manager to relieve its ownership of the nodeset.
This Nodeset is removed from the container and will not be deallocated when this manager is deallocated. This can be used to save the Nodeset for a future Construct instance without copying the old contents.
nodeset | The Nodeset that this manager is relieving its owership of. |
Exception Safety
No-throw guarantee: this member function never throws exceptions.
const Nodeset & NodesetManager::get_nodeset | ( | const std::string & | name | ) | const |
Finds the specified nodeset.
Nodeset pointers are owned by the NodesetManager and should not be deallocated by anything other than the NodesetManager.
name | The nodeset's name. |
Example
Output:
Node Mary is at index 0
Complexity
Expected to be constant. The number of nodesets is not expected to be large. Underlying function uses unordered_map::find
Iterator validity
No changes
Exception Safety
A dynet::could_not_find_nodeset is thrown if the nodeset does not exist or it has not yet had Nodeset::turn_to_const called on it.
void NodesetManager::import_nodeset | ( | const Nodeset * | nodeset | ) |
Causes this manager to take ownership of the nodeset.
This Nodeset is added to the container and it is deallocated when this manager is deallocated. This can be used to import a Nodeset from a previous Construct instance without copying the old contents.
nodeset | The Nodeset that this manager is taking owership of. |
Exception Safety
A dynet::already_exists exception is thrown if a Nodeset with the same name already exists.