|
| collection_node (const std::string &node_name, const node_context &external_context) |
| Constructs a collection_node . More...
|
|
virtual | ~collection_node ()=default |
| Destructor. More...
|
|
void | print_on_elapsed_duration (bool flag=true) const |
| If flag is true , all elapsed durations are printed for this node. More...
|
|
void | print_on_planned_duration (bool flag=true) const |
| If flag is true , all planned durations are printed for this node. More...
|
|
duration | handle_initialization_event () |
| Invoked at the beginning of a simulation; calls macro_initialization_event . More...
|
|
duration | handle_unplanned_event (duration elapsed_dt) |
| Invoked whenever a message is received; calls macro_unplanned_event . More...
|
|
duration | handle_planned_event (duration elapsed_dt) |
| Invoked when the planned duration elapses for either an agent or the overall collection; calls micro_planned_event or macro_planned_event . More...
|
|
void | handle_finalization_event (duration elapsed_dt) |
| Invoked at the end of a simulation; calls macro_finalization_event . More...
|
|
template<typename T > |
collection_node< AgentID, Node >::template flow_port_proxy< T > | get (const port< flow, input, T > &prototype_port) |
|
template<typename T > |
collection_node< AgentID, Node >::template message_port_proxy< T > | get (const port< message, input, T > &prototype_port) |
|
virtual | ~collection_node_base ()=default |
| Destructor. More...
|
|
data_mode | node_dmode () const |
| Returns message for all collection nodes. More...
|
|
| system_node (const system_node &)=delete |
| No copy constructor. More...
|
|
system_node & | operator= (const system_node &)=delete |
| No copy assignment. More...
|
|
| system_node (system_node &&)=delete |
| No move constructor. More...
|
|
system_node & | operator= (system_node &&)=delete |
| No move assignment. More...
|
|
virtual | ~system_node ()=default |
| Destructor
More...
|
|
const std::string & | node_name () const |
| Returns the name of the node. More...
|
|
const std::string & | full_name () const |
| Returns the full name of the node, including parent nodes. More...
|
|
int64 | node_index () const |
| Returns the index of the node within the parent node. More...
|
|
const node_interface & | external_interface () const |
| Returns the object responsible for exchanging information between the node and its surrounding context. More...
|
|
const timer & | event_timer () const |
| Returns the object that accumulated wallclock event durations. More...
|
|
template<typename T > |
void | print (const T &X) |
| Prints X while indicating the simulation time and node. More...
|
|
void | print (const char *raw_text) |
| Prints raw_text while indicating the simulation time and node. More...
|
|
void | print (const std::string &text) |
| Prints text while indicating the simulation time and node. More...
|
|
void | print_on_event (bool flag=true) const |
| If flag is true , all event types are printed for this node. More...
|
|
void | adopt_print_flags (const system_node &node) const |
| Adopts the print flags of node . More...
|
|
virtual scale | time_precision () const =0 |
| Returns the time precision associated with the node, or no_scale . More...
|
|
duration | process_initialization_event () |
| Processes an initialization event; returns a planned duration. More...
|
|
duration | process_unplanned_event (duration elapsed_dt) |
| Processes an unplanned event after an elapsed duration elapsed_dt ; returns a planned duration. More...
|
|
duration | process_planned_event (duration elapsed_dt) |
| Processes a planned event after an elapsed duration elapsed_dt ; returns a planned duration. More...
|
|
void | process_finalization_event (duration elapsed_dt) |
| Processes a finalization event after an elapsed duration elapsed_dt . More...
|
|
|
template<typename T > |
bool | transmitted (const port< message, output, T > &prototype_port) |
| Returns true if a message was transmitted by an agent on the port corresponding to prototype_port . More...
|
|
template<typename T > |
flow_port_proxy< T > | get (const port< flow, input, T > &prototype_port) |
| Returns a proxy of the flow input port prototype_port , allowing its value to be modified. More...
|
|
template<typename T > |
message_port_proxy< T > | get (const port< message, input, T > &prototype_port) |
| Returns a proxy of the message input port prototype_port , allowing its value to be modified. More...
|
|
template<typename T > |
const T & | get (const port< message, output, T > &prototype_port) |
| Returns the value transmitted by an agent on the message output port corresponding to prototype_port . More...
|
|
template<typename T > |
const T & | get (const port< flow, output, T > &prototype_port) |
| Return the value output by an agent on the flow output port corresponding to prototype_port . More...
|
|
template<typename AgentNode > |
void | create_agent (const AgentID &agent_id) |
| Creates a new agent of type AgentNode. More...
|
|
void | create_agent (const AgentID &agent_id) |
| Creates a new agent. More...
|
|
void | affect_agent (const AgentID &agent_id) |
| Sends a message to an agent. More...
|
|
void | remove_agent (const AgentID &agent_id) |
| Finalizes and removes an agent. More...
|
|
void | invoke_agent (const AgentID &agent_id) |
| Creates, invokes, and removes an agent. More...
|
|
bool | agent_exists (const AgentID &agent_id) |
| Returns true if an agent with ID agent_id currently exists. More...
|
|
int64 | agent_count () |
| Returns the current number of agents. More...
|
|
const_iterator | agent_begin () |
| Returns an iterator pointing to the oldest agent. More...
|
|
const_iterator | agent_end () |
| Returns an iterator pointing beyond the newest agent. More...
|
|
| collection_node_base (const std::string &node_name, const node_context &external_context) |
| Constructs a collection_node_base . More...
|
|
const node_context & | prototype_context () |
| Returns a const reference to the prototype node's context object. More...
|
|
node_structure & | prototype_structure () |
| Returns a non-const reference to the prototype node's encompassing structure object. More...
|
|
| system_node (const std::string &node_name, const node_context &external_context) |
| Constructs a system_node . More...
|
|
node_interface & | external_IO () const |
| Returns a non-const reference to the node's external interface. More...
|
|
timer & | ET () const |
| Returns a non-const reference to the node's event timer. More...
|
|
duration | scale_planned_dt (duration planned_dt) const |
| Adjusts the planned duration obtained from other nodes' event handlers. More...
|
|
template<typename AgentID, typename Node>
class sydevs::systems::collection_node< AgentID, Node >
A base class template for all collection nodes.
The collection_node
base class template is inherited by classes that represent system behavior using a variable-length collection of nodes of the same type. Collection nodes feature procedurally defined behavior, similar to an atomic_node
, but can also have component nodes, similar to a composite_node
. A collection node's component nodes are referred to as agents. Collection nodes thus support agent-based modeling.
The procedurally defined behavior is specified by overriding the following pure virtual member functions:
macro_initialization_event
, which is invoked during initialization and returns a planned duration;
macro_unplanned_event
, which is invoked when a message input is received and returns a planned duration.
micro_planned_event
, which is invoked when an agent's previous planned duration elapses and returns a planned duration;
macro_planned_event
, which is invoked when the previous planned duration elapses and returns a planned duration;
macro_finalization
, which is invoked during finalization.
Data is exchanged between the collection node and the agents using a proxy agent node called prototype
of type Node
.
If agents are message nodes (prototype.node_dmode() == message
), then interactions with agents are supported by the following member functions:
create_agent
, which creates and initializes a new agent;
affect_agent
, which sends a message to an agent;
remove_agent
, which finalizes and removes an agent.
If agents are flow nodes (prototype.node_dmode() == flow
), then interactions with agents are supported by the following member function:
invoke_agent
, which creates, invokes and removes a new agent;
template<typename AgentID , typename Node >
template<typename AgentNode >
Creates a new agent of type AgentNode.
The collection node must be a collection of message node agents, not function node agents. In other words, prototype.node_dmode()
must be message
. The created agent is initialized with the flow input values found on the prototype. The prototype's flow input values are left unchanged.
The created agent will be of type AgentNode, which must be the same type as Node or a type derived from Node.
- Parameters
-
agent_id | The ID of the agent to be created. |
template<typename AgentID , typename Node >
Creates, invokes, and removes an agent.
The collection node must be a collection of function node agents, not message node agents. In other words, prototype.node_dmode()
must be flow
. Before invocation, flow input values are copied from the prototype to the agent. After invocation, flow output values are copied agent to the prototype.
- Parameters
-
agent_id | The ID of the agent to be created, invoked, and removed. |