iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ModuleLoaderMessages.H
Go to the documentation of this file.
1 /*! @file
2  @author Randolph Voorhies
3  @copyright GNU Public License (GPL v3)
4  @section License
5  @verbatim
6  // ////////////////////////////////////////////////////////////////////////
7  // The iLab Neuromorphic Robotics Toolkit (NRT) //
8  // Copyright 2010-2012 by the University of Southern California (USC) //
9  // and the iLab at USC. //
10  // //
11  // iLab - University of Southern California //
12  // Hedco Neurociences Building, Room HNB-10 //
13  // Los Angeles, Ca 90089-2520 - USA //
14  // //
15  // See http://ilab.usc.edu for information about this project. //
16  // ////////////////////////////////////////////////////////////////////////
17  // This file is part of The iLab Neuromorphic Robotics Toolkit. //
18  // //
19  // The iLab Neuromorphic Robotics Toolkit is free software: you can //
20  // redistribute it and/or modify it under the terms of the GNU General //
21  // Public License as published by the Free Software Foundation, either //
22  // version 3 of the License, or (at your option) any later version. //
23  // //
24  // The iLab Neuromorphic Robotics Toolkit is distributed in the hope //
25  // that it will be useful, but WITHOUT ANY WARRANTY; without even the //
26  // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
27  // PURPOSE. See the GNU General Public License for more details. //
28  // //
29  // You should have received a copy of the GNU General Public License //
30  // along with The iLab Neuromorphic Robotics Toolkit. If not, see //
31  // <http://www.gnu.org/licenses/>. //
32  // ////////////////////////////////////////////////////////////////////////
33  @endverbatim */
34 
35 
36 #ifndef INCLUDE_NRT_CORE_BLACKBOARD_MODULELOADERMESSAGES_H
37 #define INCLUDE_NRT_CORE_BLACKBOARD_MODULELOADERMESSAGES_H
38 
39 #include <nrt/Core/Typing/IntegerTypes.H> // for byte
43 
44 #include <nrt/External/cereal/types/string.hpp>
45 
46 namespace nrt
47 {
48  // ######################################################################
49  //! Request the modification of a parameter value
51  {
52  public:
53  //! The module uid
54  std::string moduleUID;
55 
56  //! The parameter path
57  std::string paramName;
58 
59  //! The parameter value
60  std::string paramValue;
61 
62  //! Serialization
63  template<class Archive>
64  inline void serialize(Archive& ar)
65  {
67  }
68  };
69 
70  // ######################################################################
71  //! The response from a parameter modification
73  {
74  public:
75  //! Default Constructor
77  success(false) {}
78 
79  //! Constructor
80  ModifyParamResponseMessage(bool success_) :
81  success(success_) {}
82 
83  //! Were any parameters set?
84  bool success;
85 
86  //! Serialization
87  template<class Archive>
88  inline void serialize(Archive& ar)
89  {
90  ar( success );
91  }
92  };
93 
94  // ######################################################################
95  //! Request the current value of a parameter
97  {
98  public:
99  //! The module uid
100  std::string moduleUID;
101 
102  //! The parameter path
103  std::string paramName;
104 
105  template<class Archive>
106  inline void serialize(Archive & ar)
107  {
108  ar( moduleUID, paramName );
109  }
110  };
111 
112  // ######################################################################
113  //! The response from a parameter query
115  {
116  public:
117  GetParamResponseMessage() : valid(false), value() {};
118 
119  GetParamResponseMessage(bool valid, std::string value = "") :
120  valid(valid), value(value) {}
121 
122  //! Whether this is the response you are looking for
123  bool valid;
124 
125  //! The parameter value as a string
126  std::string value;
127 
128  template<class Archive>
129  inline void serialize(Archive & ar)
130  {
131  ar( valid, value );
132  }
133  };
134 
135  // ######################################################################
136  //! Request a topic (filter) change in a module's port
138  {
139  public:
140  //! The module uid
141  std::string moduleUID;
142 
143  //! The name of the port
144  std::string portName;
145 
146  //! The requested topic (filter)
147  std::string topi;
148 
149  //! An enum describing the requested port type
150  enum PortType
151  {
152  ModulePoster=1, //!< Poster port
153  ModuleSubscriber=2, //!< Subscriber port
154  ModuleChecker=3 //!< Checker port
155  };
156 
157  //! The type of port
159 
160  //! Serialization
161  template<class Archive>
162  void serialize(Archive &ar)
163  {
164  ar( moduleUID, portName, topi, portType );
165  }
166  };
167 
168  // ######################################################################
169  //! Set the state of the network (start, launch, endrun, stop)
171  {
172  public:
173  //! An enum describing the requested state
174  enum State
175  {
176  Start, //!< Put the system into a started (primed) state
177  Launch, //!< Start, and launch all run() threads
178  EndRun, //!< Stop all run() threads
179  Stop //!< EndRun, and stop all communication
180  };
181 
182  //! The requested state of the system
184 
185  //! Serialization
186  template<class Archive>
187  void serialize(Archive &ar)
188  {
189  ar( state );
190  }
191  };
192 
193  // ######################################################################
194  //! A trigger message that contains only a string specifying which
195  //! which bbnick this message is targeted towards
197  {
198  public:
199  //! The nickname of the blackboard
200  std::string bbNick;
201 
202  //! Serialization
203  template<class Archive>
204  void serialize(Archive &ar)
205  {
206  ar( bbNick );
207  }
208  };
209 
210  // ######################################################################
211  //! A summary of all modules available in a ModuleLoader
213  {
214  public:
215  //! A description of a single module
216  struct moduledescr
217  {
218  //! The 'logical path' of the module (e.g. category1/category2/modulename)
219  std::string logicalpath;
220 
221  //! The entire manifest of the module
223 
224  //! The module's icon as a byte stream
225  std::vector<nrt::byte> icondata;
226 
227  //! The extension of the icon file (e.g. .jpeg, .png, etc)
228  std::string iconext;
229 
230  //! Serialization
231  template<class Archive>
232  void serialize(Archive &ar)
233  {
235  }
236  };
237 
238  //! The nickname of the blackboard where this loader resides
239  std::string bbNick;
240 
241  //! The uid of the blackboard where this loader resides
242  std::string bbUID;
243 
244  //! The module uid of the loader
245  std::string modUID;
246 
247  //! The hostname where this loader resides (e.g. localhost, etc)
248  std::string hostname;
249 
250  //! The list of all module descriptions
251  std::vector<moduledescr> modules;
252 
253  //! Serialization
254  template<class Archive>
255  void serialize(Archive &ar)
256  {
257  ar( bbNick, bbUID, modUID, hostname, modules );
258  }
259  };
260 
261  // ######################################################################
262  //! Request a port to be split
264  {
265  public:
266  //! The module uid
267  std::string moduleUID;
268 
269  //! The port name
270  std::string portName;
271 
272  //! Split (true) or unsplit (false)?
273  bool splitit;
274 
275  //! Serialization
276  template<class Archive>
277  inline void serialize(Archive& ar)
278  {
279  ar( moduleUID, portName, splitit );
280  }
281  };
282 
283  // ######################################################################
284  //! Request a Module's parameter to be exposed as a port
286  {
287  public:
288  bool create; //!< create the port if true, otherwise delete it
289  std::string moduleUID; //!< UID of the module
290  std::string descriptor; //!< descriptor of the parameter
291 
292  //! Enum describing the port type to create/destroy
293  enum PortType
294  {
295  ModulePoster=1, //!< Poster port
296  ModuleSubscriber=2, //!< Subscriber port
297  ModuleChecker=3 //!< Checker port
298  };
299  PortType portType; //!< type of port to create/delete
300 
301  //! Serialization
302  template<class Archive>
303  inline void serialize(Archive& ar)
304  {
306  }
307  };
308 
309 }
310 
311 #endif // INCLUDE_NRT_CORE_BLACKBOARD_MODULELOADERMESSAGES_H
312