31 #ifndef __adevs_simpledigraph_h_
32 #define __adevs_simpledigraph_h_
74 std::map<Component*,Bag<Component*> > graph;
77 template <
class VALUE,
class T>
80 assert(model !=
this);
85 template <
class VALUE,
class T>
88 if (src !=
this) add(src);
89 if (dst !=
this) add(dst);
90 graph[src].insert(dst);
93 template <
class VALUE,
class T>
99 template <
class VALUE,
class T>
105 typename std::map<Component*,Bag<Component*> >::iterator graph_iter;
106 graph_iter = graph.find(model);
108 if (graph_iter == graph.end())
return;
112 for (node_iter = (*graph_iter).second.begin();
113 node_iter != (*graph_iter).second.end(); node_iter++)
115 event.model = *node_iter;
121 template <
class VALUE,
class T>
125 for (i = models.begin(); i != models.end(); i++)
void getComponents(Set< Component * > &c)
Puts the network's set of components into c.
Definition: adevs_simpledigraph.h:94
void route(const VALUE &x, Component *model, Bag< Event< VALUE, T > > &r)
Route an event according to the network's couplings.
Definition: adevs_simpledigraph.h:101
Definition: adevs_set.h:42
Definition: adevs_simpledigraph.h:46
Devs< VALUE, T > Component
A component of the SimpleDigraph model.
Definition: adevs_simpledigraph.h:51
Definition: adevs_models.h:46
~SimpleDigraph()
Destructor. Destroys all of the component models.
Definition: adevs_simpledigraph.h:122
void setParent(Network< X, T > *parent)
Definition: adevs_models.h:96
A bidirectional iterator for the Bag.
Definition: adevs_bag.h:49
void add(Component *model)
Add a model to the network.
Definition: adevs_simpledigraph.h:78
Definition: adevs_models.h:142
SimpleDigraph()
Construct a network without components.
Definition: adevs_simpledigraph.h:54
void couple(Component *src, Component *dst)
Couple the source model to the destination model.
Definition: adevs_simpledigraph.h:86
Definition: adevs_bag.h:45