2 #ifndef SYDEVS_SYSTEMS_NODE_STRUCTURE_H_
3 #define SYDEVS_SYSTEMS_NODE_STRUCTURE_H_
49 int64 dst_port_index);
53 int64 dst_port_index);
57 int64 next_node_index_;
58 std::map<int64, system_node*> node_ptrs_;
59 std::map<int64, std::vector<std::pair<int64, int64>>> flow_inward_links_;
60 std::map<int64, std::vector<std::pair<int64, int64>>> message_inward_links_;
61 std::map<std::pair<int64, int64>, std::vector<std::pair<int64, int64>>> flow_inner_links_;
62 std::map<std::pair<int64, int64>, std::vector<std::pair<int64, int64>>> message_inner_links_;
63 std::map<std::pair<int64, int64>, std::vector<int64>> flow_outward_links_;
64 std::map<std::pair<int64, int64>, std::vector<int64>> message_outward_links_;
71 , flow_inward_links_()
72 , message_inward_links_()
74 , message_inner_links_()
75 , flow_outward_links_()
76 , message_outward_links_()
83 return node_ptrs_.size();
89 return *node_ptrs_.at(node_index);
95 node_ptrs_[next_node_index_] = node_ptr;
97 return next_node_index_ - 1;
103 node_ptrs_.erase(node_index);
110 flow_inward_links_[src_port_index].emplace_back(dst_node_index, dst_port_index);
116 static const auto no_links = std::vector<std::pair<int64, int64>>();
117 auto* links_ptr = &no_links;
118 auto links_iter = flow_inward_links_.find(src_port_index);
119 if (links_iter != std::end(flow_inward_links_)) {
120 links_ptr = &(links_iter->second);
129 message_inward_links_[src_port_index].emplace_back(dst_node_index, dst_port_index);
135 static const auto no_links = std::vector<std::pair<int64, int64>>();
136 auto* links_ptr = &no_links;
137 auto links_iter = message_inward_links_.find(src_port_index);
138 if (links_iter != std::end(message_inward_links_)) {
139 links_ptr = &(links_iter->second);
149 flow_inner_links_[std::make_pair(src_node_index, src_port_index)].emplace_back(dst_node_index, dst_port_index);
155 static const auto no_links = std::vector<std::pair<int64, int64>>();
156 auto* links_ptr = &no_links;
157 auto links_iter = flow_inner_links_.find(std::make_pair(src_node_index, src_port_index));
158 if (links_iter != std::end(flow_inner_links_)) {
159 links_ptr = &(links_iter->second);
168 message_inner_links_[std::make_pair(src_node_index, src_port_index)].emplace_back(dst_node_index, dst_port_index);
174 static const auto no_links = std::vector<std::pair<int64, int64>>();
175 auto* links_ptr = &no_links;
176 auto links_iter = message_inner_links_.find(std::make_pair(src_node_index, src_port_index));
177 if (links_iter != std::end(message_inner_links_)) {
178 links_ptr = &(links_iter->second);
185 int64 dst_port_index)
187 flow_outward_links_[std::make_pair(src_node_index, src_port_index)].emplace_back(dst_port_index);
193 static const auto no_links = std::vector<int64>();
194 auto* links_ptr = &no_links;
195 auto links_iter = flow_outward_links_.find(std::make_pair(src_node_index, src_port_index));
196 if (links_iter != std::end(flow_outward_links_)) {
197 links_ptr = &(links_iter->second);
204 int64 dst_port_index)
206 message_outward_links_[std::make_pair(src_node_index, src_port_index)].emplace_back(dst_port_index);
212 static const auto no_links = std::vector<int64>();
213 auto* links_ptr = &no_links;
214 auto links_iter = message_outward_links_.find(std::make_pair(src_node_index, src_port_index));
215 if (links_iter != std::end(message_outward_links_)) {
216 links_ptr = &(links_iter->second);
void add_message_outward_link(int64 src_node_index, int64 src_port_index, int64 dst_port_index)
Definition: node_structure.h:203
const std::vector< std::pair< int64, int64 > > & flow_inward_links(int64 src_port_index) const
Definition: node_structure.h:114
A base class for all nodes from which systems models are constructed.
Definition: system_node.h:41
int64 add_node(system_node *node_ptr)
Definition: node_structure.h:93
system_node & node(int64 node_index) const
Definition: node_structure.h:87
const std::vector< int64 > & flow_outward_links(int64 src_node_index, int64 src_port_index) const
Definition: node_structure.h:191
void add_flow_inner_link(int64 src_node_index, int64 src_port_index, int64 dst_node_index, int64 dst_port_index)
Definition: node_structure.h:146
virtual ~node_structure()=default
Destructor.
node_structure()
Definition: node_structure.h:68
const std::vector< std::pair< int64, int64 > > & message_inward_links(int64 src_port_index) const
Definition: node_structure.h:133
void add_message_inner_link(int64 src_node_index, int64 src_port_index, int64 dst_node_index, int64 dst_port_index)
Definition: node_structure.h:165
int64 node_count() const
Definition: node_structure.h:81
void add_flow_outward_link(int64 src_node_index, int64 src_port_index, int64 dst_port_index)
Definition: node_structure.h:184
node_structure & operator=(const node_structure &)=delete
No copy assignment.
const std::vector< int64 > & message_outward_links(int64 src_node_index, int64 src_port_index) const
Definition: node_structure.h:210
void erase_node(int64 node_index)
Definition: node_structure.h:101
const std::vector< std::pair< int64, int64 > > & message_inner_links(int64 src_node_index, int64 src_port_index) const
Definition: node_structure.h:172
void add_flow_inward_link(int64 src_port_index, int64 dst_node_index, int64 dst_port_index)
Definition: node_structure.h:107
void add_message_inward_link(int64 src_port_index, int64 dst_node_index, int64 dst_port_index)
Definition: node_structure.h:126
Definition: node_structure.h:15
const std::vector< std::pair< int64, int64 > > & flow_inner_links(int64 src_node_index, int64 src_port_index) const
Definition: node_structure.h:153