SyDEVS  v0.6.7
Multiscale Simulation and Systems Modeling Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
collection_node_base.h
Go to the documentation of this file.
1 #pragma once
2 #ifndef SYDEVS_SYSTEMS_COLLECTION_NODE_BASE_H_
3 #define SYDEVS_SYSTEMS_COLLECTION_NODE_BASE_H_
4 
6 
7 namespace sydevs {
8 namespace systems {
9 
10 
22 {
23 public:
24  virtual ~collection_node_base() = default;
25 
26  data_mode node_dmode() const;
27 
28 protected:
39  collection_node_base(const std::string& node_name, const node_context& external_context);
40 
43 
44 private:
45  node_context prototype_context_;
46 };
47 
48 
50 {
51  return message;
52 }
53 
54 
55 inline collection_node_base::collection_node_base(const std::string& node_name, const node_context& external_context)
56  : system_node(node_name, external_context)
57  , prototype_context_(&const_cast<node_interface&>(external_interface()),
58  const_cast<node_context&>(external_context))
59 {
60 }
61 
62 
64 {
65  return const_cast<const node_context&>(prototype_context_);
66 }
67 
68 
70 {
71  return prototype_context_.internal_structure();
72 }
73 
74 
75 } // namespace
76 } // namespace
77 
78 #endif
collection_node_base(const std::string &node_name, const node_context &external_context)
Constructs a collection_node_base.
Definition: collection_node_base.h:55
const std::string & node_name() const
Returns the name of the node.
Definition: system_node.h:135
data_mode
Indicates the relevant data communication paradigm: dataflow (flow) or message-passing (message)...
Definition: data_mode.h:16
A base class for all nodes from which systems models are constructed.
Definition: system_node.h:41
A base class for the collection node class template.
Definition: collection_node_base.h:21
virtual ~collection_node_base()=default
Destructor.
node_structure & internal_structure()
Definition: node_context.h:50
Definition: node_context.h:16
const node_context & prototype_context()
Returns a const reference to the prototype node's context object.
Definition: collection_node_base.h:63
Definition: node_interface.h:16
node_structure & prototype_structure()
Returns a non-const reference to the prototype node's encompassing structure object.
Definition: collection_node_base.h:69
Indicates message-passing.
data_mode node_dmode() const
Returns message for all collection nodes.
Definition: collection_node_base.h:49
Definition: node_structure.h:15