View on GitHub

Vistle

Distributed Data-parallel Scientific Visualization in VR

porttracker.h
Go to the documentation of this file.
1#ifndef PORTTRACKER_H
2#define PORTTRACKER_H
3
4#include <string>
5#include <map>
6#include <vector>
7#include <set>
8#include <iostream>
9
10#include "export.h"
11#include "port.h"
12#include "message.h"
13
14namespace vistle {
15
16class StateTracker;
17
19public:
21 virtual ~PortTracker();
22 void setTracker(StateTracker *tracker);
23 StateTracker *tracker() const;
24
25 const Port *addPort(const int moduleID, const std::string &name, const std::string &description,
26 const Port::Type type, int flags = 0);
27 const Port *addPort(const Port &port);
28 virtual std::vector<message::Buffer> removePort(const Port &port);
29
30 bool addConnection(const Port &out, const Port &in);
31 bool addConnection(const int a, const std::string &na, const int b, const std::string &nb);
32
33 bool removeConnection(const Port &from, const Port &to);
34 bool removeConnection(const int a, const std::string &na, const int b, const std::string &nb);
35
36 typedef std::vector<const Port *> ConnectionList;
37
38 const Port::ConstPortSet *getConnectionList(const Port *port) const;
39 const Port::ConstPortSet *getConnectionList(const int moduleID, const std::string &name) const;
40
41 virtual const Port *getPort(const int moduleID, const std::string &name);
42 Port *findPort(const Port &p) const;
43 Port *findPort(const int moduleID, const std::string &name) const;
44
45 std::vector<std::string> getPortNames(const int moduleID, Port::Type type) const;
46 std::vector<std::string> getInputPortNames(const int moduleID) const;
47 std::vector<std::string> getOutputPortNames(const int moduleID) const;
48 std::vector<Port *> getPorts(const int moduleID, Port::Type type, bool connectedOnly = false) const;
49 std::vector<Port *> getInputPorts(const int moduleID) const;
50 std::vector<Port *> getConnectedInputPorts(const int moduleID) const;
51 std::vector<Port *> getOutputPorts(const int moduleID) const;
52 std::vector<Port *> getConnectedOutputPorts(const int moduleID) const;
53
54 virtual std::vector<message::Buffer> removeModule(int moduleId);
55
56protected:
57 bool check() const;
58
59
61
62 typedef std::map<std::string, Port *> PortMap;
63 // module ID -> list of ports belonging to the module
64 typedef std::map<int, PortMap *> ModulePortMap;
66
67 typedef std::map<int, std::string> PortOrder;
68 std::map<int, PortOrder *> m_portOrders;
69};
70} // namespace vistle
71
72#endif
Definition: porttracker.h:18
std::map< std::string, Port * > PortMap
Definition: porttracker.h:62
StateTracker * m_stateTracker
Definition: porttracker.h:60
std::map< int, PortMap * > ModulePortMap
Definition: porttracker.h:64
ModulePortMap m_ports
Definition: porttracker.h:65
std::vector< const Port * > ConnectionList
Definition: porttracker.h:36
std::map< int, std::string > PortOrder
Definition: porttracker.h:67
std::map< int, PortOrder * > m_portOrders
Definition: porttracker.h:68
Definition: port.h:29
std::set< const Port *, detail::deref_compare< Port > > ConstPortSet
Definition: port.h:54
Definition: statetracker.h:94
#define V_COREEXPORT
Definition: export.h:9
Definition: allobjects.cpp:30