SCIRun  5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ModuleDescription.h
Go to the documentation of this file.
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2012 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9  License for the specific language governing rights and limitations under
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 /// @todo Documentation Dataflow/Network/ModuleDescription.h
29 
30 #ifndef DATAFLOW_NETWORK_MODULE_DESCRIPTION_H
31 #define DATAFLOW_NETWORK_MODULE_DESCRIPTION_H
32 
33 //#include <iostream>
34 #include <string>
35 #include <vector>
36 #include <iosfwd>
37 #include <boost/function.hpp>
39 #include <Dataflow/Network/share.h>
40 
41 namespace SCIRun {
42 namespace Dataflow {
43 namespace Networks {
44 
46  {
47  explicit PortId(size_t num = 0, const std::string& n = "[undefined]") : name(n), id(num)
48  {
49  //std::cout << "PortId(" << num << "," << n << "," << dyn << ")" << std::endl;
50  }
51  std::string name;
52  size_t id; /// @todo: need smart way to set
53  std::string toString() const;
54  };
55 
57  {
58  PortDescription(const PortId& p, const std::string& d, bool dyn) :
59  id(p), datatype(d), isDynamic(dyn) {}
61  std::string datatype;
62  bool isDynamic;
63  };
64 
66  {
67  public:
68  static std::string toColor(const std::string& portDatatype);
69  private:
70  static std::map<std::string, std::string> portColorMap_;
71  static void init();
72  };
73 
76 
78  {
79  std::string name_, id_;
80  int idNumber_;
81 
82  ModuleId();
83  ModuleId(const std::string& name, int idNumber);
84  explicit ModuleId(const std::string& nameIdStr);
85 
86  operator std::string() const { return id_; }
87  };
88 
89  SCISHARE bool operator==(const ModuleId& lhs, const ModuleId& rhs);
90  SCISHARE bool operator!=(const ModuleId& lhs, const ModuleId& rhs);
91  SCISHARE bool operator<(const ModuleId& lhs, const ModuleId& rhs);
92  SCISHARE std::ostream& operator<<(std::ostream& o, const ModuleId& id);
93 
94  SCISHARE bool operator==(const PortId& lhs, const PortId& rhs);
95  SCISHARE bool operator!=(const PortId& lhs, const PortId& rhs);
96  SCISHARE bool operator<(const PortId& lhs, const PortId& rhs);
97  SCISHARE std::ostream& operator<<(std::ostream& o, const PortId& id);
98 
100  {
102  ModuleLookupInfo(const std::string& mod, const std::string& cat = "", const std::string& pack = "");
103  std::string package_name_;
104  std::string category_name_;
105  std::string module_name_;
106  };
107 
108  typedef boost::function<class Module*()> ModuleMaker;
109  typedef boost::function<bool(ModuleHandle)> ModuleFilter;
110 
112  {
114  ~ModuleDescription();
116  std::string module_version_;
117  std::string moduleStatus_;
118  std::string moduleInfo_;
119  std::vector<InputPortDescription> input_ports_;
120  std::vector<OutputPortDescription> output_ports_;
121  //bool optional_;
122  //bool hide_;
123  //bool dynamic_;
124  //std::vector<std::string> authors_;
125  //std::string summary_;
127  //bool last_port_dynamic_;
128  //bool has_gui_node_;
129  };
130 }}}
131 
132 #endif
Definition: ModuleDescription.h:65
PortDescription OutputPortDescription
Definition: ModuleDescription.h:75
std::string name
Definition: ModuleDescription.h:51
ModuleLookupInfo lookupInfo_
Definition: ModuleDescription.h:115
Definition: ModuleDescription.h:99
PortDescription(const PortId &p, const std::string &d, bool dyn)
Definition: ModuleDescription.h:58
boost::function< class Module *()> ModuleMaker
Definition: ModuleDescription.h:108
#define SCISHARE
Definition: share.h:39
Definition: ModuleDescription.h:56
PortDescription InputPortDescription
Definition: ModuleDescription.h:74
SCISHARE bool operator==(const ConnectionId &lhs, const ConnectionId &rhs)
Definition: ConnectionId.cc:37
std::string module_version_
Definition: ModuleDescription.h:116
std::string module_name_
Definition: ModuleDescription.h:105
SCISHARE std::ostream & operator<<(std::ostream &o, const ModuleId &id)
Definition: ModuleDescription.cc:114
const char * name[]
Definition: BoostGraphExampleTests.cc:87
bool isDynamic
Definition: ModuleDescription.h:62
Definition: ModuleDescription.h:77
std::vector< InputPortDescription > input_ports_
Definition: ModuleDescription.h:119
std::string package_name_
Definition: ModuleDescription.h:103
std::string moduleInfo_
Definition: ModuleDescription.h:118
SCISHARE bool operator<(const ModuleId &lhs, const ModuleId &rhs)
Definition: ModuleDescription.cc:109
Definition: ModuleDescription.h:111
ModuleMaker maker_
Definition: ModuleDescription.h:126
PortId id
Definition: ModuleDescription.h:60
SCISHARE bool operator!=(const ConnectionId &lhs, const ConnectionId &rhs)
Definition: ConnectionId.cc:42
std::string category_name_
Definition: ModuleDescription.h:104
std::string moduleStatus_
Definition: ModuleDescription.h:117
PortId(size_t num=0, const std::string &n="[undefined]")
Definition: ModuleDescription.h:47
int idNumber_
Definition: ModuleDescription.h:80
std::string name_
Definition: ModuleDescription.h:79
int n
Definition: eab.py:9
Definition: ModuleDescription.h:45
boost::function< bool(ModuleHandle)> ModuleFilter
Definition: ModuleDescription.h:109
std::string datatype
Definition: ModuleDescription.h:61
std::vector< OutputPortDescription > output_ports_
Definition: ModuleDescription.h:120
size_t id
Definition: ModuleDescription.h:52