openETCS
case study for the European Train Control System developed for the authors dissertation
Graph.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2010-2011
3  Johannes Feuser <feuser@uni-bremen.de>
4  This file is part of the openETCS library.
5 
6  The openETCS library is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  any later version.
10 
11  The openETCS library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with the openETCS library. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 /*!
21  * \author Johannes Feuser <feuser@uni-bremen.de>
22  * \brief
23  */
24 
25 #ifndef __GOPPRR_GRAPH_H__
26 #define __GOPPRR_GRAPH_H__
27 
28 
29 
30 
31 #include <string>
32 #include <map>
33 #include <vector>
34 #include "Error/ExceptionTypes.h"
35 #include "NonProperty.h"
36 
37 
38 namespace GOPPRR { struct CRole; }
39 namespace GOPPRR { struct CObject; }
40 namespace GOPPRR { struct CPort; }
41 namespace GOPPRR { struct CRelationship; }
42 namespace GOPPRR { struct CBinding; }
43 namespace GOPPRR { struct CGraphicalContainer; }
44 
45 
46 namespace GOPPRR {
47 
48 
49 /*!
50  * \brief graph class
51  */
52 struct CGraph : public GOPPRR::CNonProperty
53 {
54  /*!
55  * \brief general constructor
56  *
57  * \param[in] OID object identifier
58  * \param[in] Type literal name of the type
59  * \param[in] ID identifier
60  * \param[in] Properties set of property references
61  * \param[in] BindingSet set of bindings
62  * \param[in] Containers set of graphical containers
63  * \param[in] ObjectSet set of objects
64  * \param[in] PortSet set of ports
65  * \param[in] RelationshipSet set of relationships
66  * \param[in] RoleSet set of roles
67  */
68  CGraph(const ::std::string& OID = "", const ::std::string& Type = "", const ::std::string& ID = "", const std::map< ::std::string, ::GOPPRR::CProperty* >& Properties = std::map< ::std::string, ::GOPPRR::CProperty* >(), const std::vector< ::GOPPRR::CBinding >& BindingSet = std::vector< ::GOPPRR::CBinding >(), const std::vector< ::GOPPRR::CGraphicalContainer >& Containers = std::vector< ::GOPPRR::CGraphicalContainer >(), const std::map< std::string, ::GOPPRR::CObject* >& ObjectSet = std::map< std::string, ::GOPPRR::CObject* >(), const std::map< std::string, ::GOPPRR::CPort* >& PortSet = std::map< std::string, ::GOPPRR::CPort* >(), const std::map< std::string, ::GOPPRR::CRelationship* >& RelationshipSet = std::map< std::string, ::GOPPRR::CRelationship* >(), const std::map< std::string, ::GOPPRR::CRole* >& RoleSet = std::map< std::string, ::GOPPRR::CRole* >()) throw();
69 
70 
71 
72  /*!
73  * \brief copy constructor
74  *
75  * \param[in] Source source object to copy
76  */
77  CGraph(const CGraph& Source) throw();
78 
79 
80 
81  /*!
82  * \brief destructor
83  */
84  virtual ~CGraph() throw();
85 
86 
87 
88  /*!
89  * \brief abstraction method
90  *
91  * Gets all roles connected to a certain object in a certain graph.
92  *
93  * \param[in] pObject pointer to the object
94  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
95  *
96  * \return map of pointers to roles
97  */
98  ::std::map< ::std::string, GOPPRR::CRole* > Roles(GOPPRR::CObject * const pObject, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
99 
100 
101 
102  /*!
103  * \brief abstraction method
104  *
105  * Gets certain roles connected to a certain object in a certain graph.
106  *
107  * \param[in] pObject pointer to the object
108  * \param[in] Type role type
109  * \param[in] bSubString if true, Type only must be a substring of role type
110  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
111  *
112  * \return map of pointers to roles
113  */
114  ::std::map< ::std::string, GOPPRR::CRole* > Roles(GOPPRR::CObject * const pObject, const ::std::string & Type, const bool & bSubString = false, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
115 
116 
117 
118  /*!
119  * \brief abstraction method
120  *
121  * Gets all roles connected to a certain port and object in a certain graph.
122  *
123  * \param[in] pPort pointer to the port
124  * \param[in] pObject pointer to the object
125  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
126  *
127  * \return map of pointers to roles
128  */
129  ::std::map< ::std::string, GOPPRR::CRole* > Roles(GOPPRR::CObject * const pObject, GOPPRR::CPort * const pPort, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
130 
131 
132 
133  /*!
134  * \brief abstraction method
135  *
136  * Gets all roles connected to a certain relationship in a certain graph.
137  *
138  * \param[in] pRelationship pointer to the relationship
139  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
140  *
141  * \return map of pointers to roles
142  */
143  ::std::map< ::std::string, GOPPRR::CRole* > Roles(GOPPRR::CRelationship * const pRelationship, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
144 
145 
146 
147  /*!
148  * \brief abstraction method
149  *
150  * Gets all certain types of roles connected to a certain port and object in a certain graph.
151  *
152  * \param[in] pPort pointer to the port
153  * \param[in] pObjectt pointer to the object
154  * \param[in] Type role type
155  * \param[in] bSubString if true, Type only must be a substring of role type
156  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
157  *
158  * \return map of pointers to roles
159  */
160  ::std::map< ::std::string, GOPPRR::CRole* > Roles(GOPPRR::CObject * const pObject, GOPPRR::CPort * const pPort, const ::std::string & Type, const bool & bSubString = false, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
161 
162 
163 
164  /*!
165  * \brief abstraction method
166  *
167  * Gets all certain types of roles connected to a certain relationship in a certain graph.
168  *
169  * \param[in] pRelationship pointer to the relationship
170  * \param[in] Type role type
171  * \param[in] bSubString if true, Type only must be a substring of role type
172  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
173  *
174  * \return map of pointers to roles
175  */
176  ::std::map< ::std::string, GOPPRR::CRole* > Roles(GOPPRR::CRelationship * const pRelationship, const ::std::string & Type, const bool & bSubString = false, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
177 
178 
179 
180  /*!
181  * \brief abstraction method
182  *
183  * Gets all certain types of roles connected to a certain another role in a certain graph.
184  * This skips the navigation via the related relationship.
185  *
186  * \param[in] pRole pointer to the role
187  * \param[in] Type role type
188  * \param[in] bSubString if true, Type only must be a substring of role type
189  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
190  *
191  * \return map of pointers to roles
192  */
193  ::std::map< ::std::string, GOPPRR::CRole* > Roles(GOPPRR::CRole * const pRole, const ::std::string & Type, const bool & bSubString = false, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
194 
195 
196 
197  /*!
198  * \brief abstraction method
199  *
200  * Gets all relationships connected to a certain role in a certain graph.
201  *
202  * \param[in] pRole pointer to the role
203  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
204  *
205  * \return map of pointers to relationships
206  */
207  ::std::map< ::std::string, GOPPRR::CRelationship* > Relationships(GOPPRR::CRole * const pRole, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
208 
209 
210 
211  /*!
212  * \brief abstraction method
213  *
214  * Gets certain types of relationships connected to a certain role in a certain graph.
215  *
216  * \param[in] pRole pointer to the role
217  * \param[in] Type relationship type
218  * \param[in] bSubString if true, Type only must be a substring of relationship type
219  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
220  *
221  * \return map of pointers to relationships
222  */
223  ::std::map< ::std::string, GOPPRR::CRelationship* > Relationships(GOPPRR::CRole * const pRole, const ::std::string & Type, const bool & bSubString = false, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
224 
225 
226 
227  /*!
228  * \brief abstraction method
229  *
230  * Gets all ports connected to a certain role in a certain graph.
231  *
232  * \param[in] pRole pointer to the role
233  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
234  *
235  * \return map of pointers to ports
236  */
237  ::std::map< ::std::string, GOPPRR::CPort* > Ports(GOPPRR::CRole * const pRole, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
238 
239 
240 
241  /*!
242  * \brief abstraction method
243  *
244  * Gets all ports connected to a certain object in a certain graph.
245  *
246  * \param[in] pObject pointer to the object
247  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
248  *
249  * \return map of pointers to ports
250  */
251  ::std::map< ::std::string, GOPPRR::CPort* > Ports(GOPPRR::CObject * const pObject, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
252 
253 
254 
255  /*!
256  * \brief abstraction method
257  *
258  * Gets certain types of ports connected to a certain object in a certain graph.
259  *
260  * \param[in] pObject pointer to the object
261  * \param[in] Type port type
262  * \param[in] bSubString if true, Type only must be a substring of port type
263  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
264  *
265  * \return map of pointers to ports
266  */
267  ::std::map< ::std::string, GOPPRR::CPort* > Ports(GOPPRR::CObject * const pObject, const ::std::string & Type, const bool & bSubString = false, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
268 
269 
270 
271  /*!
272  * \brief abstraction method
273  *
274  * Gets all objects connected to a certain port and role in a certain graph.
275  *
276  * \param[in] pPort pointer to the port
277  * \param[in] pRole pointer to the role
278  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
279  *
280  * \return map of pointers to objects
281  */
282  ::std::map< ::std::string, GOPPRR::CObject* > Objects(GOPPRR::CPort * const pPort, GOPPRR::CRole * const pRole, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
283 
284 
285 
286  /*!
287  * \brief abstraction method
288  *
289  * Gets all objects connected to a certain role in a certain graph.
290  *
291  * \param[in] pRole pointer to the role
292  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
293  *
294  * \return map of pointers to objects
295  */
296  ::std::map< ::std::string, GOPPRR::CObject* > Objects(GOPPRR::CRole * const pRole, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
297 
298 
299 
300  /*!
301  * \brief abstraction method
302  *
303  * Gets certain types of objects connected to a certain role in a certain graph.
304  *
305  * \param[in] pRole pointer to the role
306  * \param[in] Type object type
307  * \param[in] bSubString if true, Type only must be a substring of object type
308  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
309  *
310  * \return map of pointers to objects
311  */
312  ::std::map< ::std::string, GOPPRR::CObject* > Objects(GOPPRR::CRole * const pRole, const ::std::string & Type, const bool & bSubString = false, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
313 
314 
315 
316  /*!
317  * \brief abstraction method
318  *
319  * Gets certain types of objects in a certain graph.
320  *
321  * \param[in] Type object type
322  * \param[in] bSubString if true, Type only must be a substring of object type
323  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
324  *
325  * \return map of pointers to objects
326  */
327  ::std::map< ::std::string, GOPPRR::CObject* > Objects(const ::std::string & Type, const bool & bSubString = false, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
328 
329 
330 
331  /*!
332  * \brief abstraction method
333  *
334  * Gets all objects which graphical contain another one in a certain graph.
335  *
336  * \param[in] pObject pointer to the object
337  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
338  *
339  * \return map of pointers to objects
340  */
341  ::std::map< ::std::string, GOPPRR::CObject* > Container(GOPPRR::CObject * const pObject, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
342 
343 
344 
345  /*!
346  * \brief abstraction method
347  *
348  * Gets all objects graphical contained by a another one in a certain graph.
349  *
350  * \param[in] pObject pointer to the object
351  * \param[in] bUseException optional boolean flag for throwing a exception in case of an empty map
352  *
353  * \return map of pointers to objects
354  */
355  ::std::map< ::std::string, GOPPRR::CObject* > Contained(GOPPRR::CObject * const pObject, const bool & bUseException = true) const throw(::GOPPRR::Error::CEmpty);
356 
357 
358 
359  /*!
360  * \brief assignment operator
361  *
362  * \param[in] Source object instance to assign from
363  */
364  CGraph & operator=(const CGraph& Source) throw();
365 
366 
367 
368  /*!
369  * \brief set of bindings in a graph
370  *
371  * Set of bindings in a graph.
372  */
373  ::std::vector< GOPPRR::CBinding > m_BindingSet;
374 
375 
376 
377  /*!
378  * \brief set of objects in a graph
379  *
380  * Set of objects in a graph indexed by
381  * their OID.
382  */
383  ::std::map< std::string,GOPPRR::CObject* > m_ObjectSet;
384 
385 
386 
387  /*!
388  * \brief set of ports
389  *
390  * Set of ports indexed by
391  * their OID.
392  */
393  ::std::map< std::string,GOPPRR::CPort* > m_PortSet;
394 
395 
396 
397  /*!
398  * \brief set of relationships in a graph
399  *
400  * Set of relationships in a graph indexed
401  * by their OID
402  */
403  ::std::map< std::string,GOPPRR::CRelationship* > m_RelationshipSet;
404 
405 
406 
407  /*!
408  * \brief role set of a graph
409  *
410  * Role set of a graph indexed by
411  * their OID.
412  */
413  ::std::map< std::string,GOPPRR::CRole* > m_RoleSet;
414 
415 
416 
417  /*!
418  * \brief graphical containments in a graph
419  */
420  ::std::vector< GOPPRR::CGraphicalContainer > m_Containers;
421 
422 
423 
424 
425 }; // struct CGraph : public GOPPRR::CNonProperty
426 
427 
428 
429 
430 
431 } // namespace GOPPRR
432 
433 #endif // __ GOPPRR_GRAPH_H__

Copyright (C) 2010-2012 Johannes Feuser (feuser@uni-bremen.de)
The openETCS library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
The openETCS library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with the openETCS library. If not, see "http://www.gnu.org/licenses/.