openETCS
case study for the European Train Control System developed for the authors dissertation
Graph.cpp
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 #include "Graph.h"
26 #include "Role.h"
27 #include "Object.h"
28 #include "Port.h"
29 #include "Relationship.h"
30 #include "Binding.h"
31 #include "GraphicalContainer.h"
32 
33 
34 namespace GOPPRR {
35 
36 
37 CGraph::CGraph(const ::std::string& OID, const ::std::string& Type, const ::std::string& ID, const std::map< ::std::string, ::GOPPRR::CProperty* >& Properties, const std::vector< ::GOPPRR::CBinding >& BindingSet, const std::vector< ::GOPPRR::CGraphicalContainer >& Containers, const std::map< std::string, ::GOPPRR::CObject* >& ObjectSet, const std::map< std::string, ::GOPPRR::CPort* >& PortSet, const std::map< std::string, ::GOPPRR::CRelationship* >& RelationshipSet, const std::map< std::string, ::GOPPRR::CRole* >& RoleSet) throw()
38 :CNonProperty(OID, Type, ID, Properties),
39  m_BindingSet(BindingSet),
40  m_ObjectSet(ObjectSet),
41  m_PortSet(PortSet),
42  m_RelationshipSet(RelationshipSet),
43  m_RoleSet(RoleSet),
44  m_Containers(Containers)
45 {
46  // Bouml preserved body begin 00022B02
47  // Bouml preserved body end 00022B02
48 
49 } // CGraph::CGraph() throw()
50 
51 
52 
53 
54 CGraph::CGraph(const GOPPRR::CGraph& Source) throw()
55 :CNonProperty(Source),
56  m_BindingSet(Source.m_BindingSet),
57  m_ObjectSet(Source.m_ObjectSet),
58  m_PortSet(Source.m_PortSet),
59  m_RelationshipSet(Source.m_RelationshipSet),
60  m_RoleSet(Source.m_RoleSet),
61  m_Containers(Source.m_Containers)
62 {
63  // Bouml preserved body begin 00024582
64  // Bouml preserved body end 00024582
65 
66 } // CGraph::CGraph() throw()
67 
68 
69 
70 
71 CGraph::~CGraph() throw()
72 {
73  // Bouml preserved body begin 00022B82
74  // Bouml preserved body end 00022B82
75 
76 } // CGraph::~CGraph() throw()
77 
78 
79 
80 
81 ::std::map< ::std::string, GOPPRR::CRole* > CGraph::Roles(GOPPRR::CObject * const pObject, const bool& bUseException) const throw(::GOPPRR::Error::CEmpty)
82 {
83  // Bouml preserved body begin 00095182
84  bool bFoundInCalls(false);
85  ::std::map< ::std::string, ::GOPPRR::CRole* > Roles;
86  unsigned int x(0);
87  unsigned int y(0);
88 
89 
90 
91  // process all bindings in this graph
92  for (x = 0; x != m_BindingSet.size(); x++)
93  {
94  // process all bindings via the current connection
95  for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
96  {
97  // check current call for object
98  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pObject == pObject)
99  {
100  // check, if role is valid
101  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole != 0)
102  {
103  // add role of current call to local map
104  Roles[m_BindingSet[x].m_Connection.m_Calls[y].m_pRole->m_OID] = m_BindingSet[x].m_Connection.m_Calls[y].m_pRole;
105 
106  // set found flag to true
107  bFoundInCalls = true;
108 
109  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole != 0)
110 
111  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pObject == pObject)
112 
113  } // for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
114 
115  // reset found flag
116  bFoundInCalls = false;
117 
118  } // for (x = 0; x != m_BindingSet.size(); x++)
119 
120 
121  // check, if exception should be used and map is empty
122  if (bUseException && Roles.empty())
123  {
124  // construct and throw exception
125  throw (::GOPPRR::Error::CEmpty("no role connected to object found"));
126 
127  } // if (bUseException && Roles.empty())
128 
129  // return map of all connected roles
130  return (Roles);
131  // Bouml preserved body end 00095182
132 
133 } // GOPPRR::CRole CGraph::Roles() const throw(::GOPPRR::Error::CEmpty)
134 
135 
136 
137 
138 ::std::map< ::std::string, GOPPRR::CRole* > CGraph::Roles(GOPPRR::CObject * const pObject, const ::std::string& Type, const bool& bSubString, const bool& bUseException) const throw(::GOPPRR::Error::CEmpty)
139 {
140  // Bouml preserved body begin 000A3582
141  bool bFoundInCalls(false);
142  ::std::map< ::std::string, ::GOPPRR::CRole* > Roles;
143  unsigned int x(0);
144  unsigned int y(0);
145 
146 
147 
148  // process all bindings in this graph
149  for (x = 0; x != m_BindingSet.size(); x++)
150  {
151  // process all bindings via the current connection
152  for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
153  {
154  // check current call for object
155  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pObject == pObject)
156  {
157  // check, if role is valid
158  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole != 0)
159  {
160  // check, if role type is correct
161  if ((!bSubString && m_BindingSet[x].m_Connection.m_Calls[y].m_pRole->m_Type == Type ) ||
162  (bSubString && m_BindingSet[x].m_Connection.m_Calls[y].m_pRole->m_Type.find(Type) != ::std::string::npos))
163  {
164  // add role of current call to local map
165  Roles[m_BindingSet[x].m_Connection.m_Calls[y].m_pRole->m_OID] = m_BindingSet[x].m_Connection.m_Calls[y].m_pRole;
166 
167  // set found flag to true
168  bFoundInCalls = true;
169 
170  } // if ((!bSubString && m_BindingSet[x].m_Connection.m_Calls[y].m_pRole->m_Type == Type ) ||
171 
172  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole != 0)
173 
174  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pObject == pObject)
175 
176  } // for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
177 
178  // reset found flag
179  bFoundInCalls = false;
180 
181  } // for (x = 0; x != m_BindingSet.size(); x++)
182 
183 
184  // check, if exception should be used and map is empty
185  if (bUseException && Roles.empty())
186  {
187  // construct and throw exception
188  throw (::GOPPRR::Error::CEmpty("no role connected to object found"));
189 
190  } // if (bUseException && Roles.empty())
191 
192  // return map of all connected roles
193  return (Roles);
194  // Bouml preserved body end 000A3582
195 
196 } // GOPPRR::CRole CGraph::Roles() const throw(::GOPPRR::Error::CEmpty)
197 
198 
199 
200 
201 ::std::map< ::std::string, GOPPRR::CRole* > CGraph::Roles(GOPPRR::CObject * const pObject, GOPPRR::CPort * const pPort, const bool & bUseException) const throw(::GOPPRR::Error::CEmpty)
202 {
203  // Bouml preserved body begin 0009E182
204  bool bFoundInCalls(false);
205  ::std::map< ::std::string, ::GOPPRR::CRole* > Roles;
206  unsigned int x(0);
207  unsigned int y(0);
208 
209 
210 
211  // process all bindings in this graph
212  for (x = 0; x != m_BindingSet.size(); x++)
213  {
214  // process all bindings via the current connection
215  for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
216  {
217  // check current call for port and object
218  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pPort == pPort && m_BindingSet[x].m_Connection.m_Calls[y].m_pObject == pObject)
219  {
220  // check, if role is valid
221  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole != 0)
222  {
223  // add role of current call to local map
224  Roles[m_BindingSet[x].m_Connection.m_Calls[y].m_pRole->m_OID] = m_BindingSet[x].m_Connection.m_Calls[y].m_pRole;
225 
226  // set found flag to true
227  bFoundInCalls = true;
228 
229  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pPort == pPort && m_BindingSet[x].m_Connection.m_Calls[y].m_pObject == pObject)
230 
231  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pPort == pPort)
232 
233  } // for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
234 
235  // reset found flag
236  bFoundInCalls = false;
237 
238  } // for (x = 0; x != m_BindingSet.size(); x++)
239 
240  // check, if exception should be used and map is empty
241  if (bUseException && Roles.empty())
242  {
243  // construct and throw exception
244  throw (::GOPPRR::Error::CEmpty("no role connected to port found"));
245 
246  } // if (bUseException && Roles.empty())
247 
248 
249  // return map of all connected roles
250  return (Roles);
251  // Bouml preserved body end 0009E182
252 
253 } // GOPPRR::CRole CGraph::Roles() const throw(::GOPPRR::Error::CEmpty)
254 
255 
256 
257 
258 ::std::map< ::std::string, GOPPRR::CRole* > CGraph::Roles(GOPPRR::CRelationship * const pRelationship, const bool& bUseException) const throw(::GOPPRR::Error::CEmpty)
259 {
260  // Bouml preserved body begin 000B2502
261  ::std::map< ::std::string, ::GOPPRR::CRole* > Roles;
262  unsigned int x(0);
263  unsigned int y(0);
264 
265 
266 
267  // process all bindings in this graph
268  for (x = 0; x != m_BindingSet.size(); x++)
269  {
270  // check, if current binding includes searched role
271  if (m_BindingSet[x].m_pRelationship == pRelationship)
272  {
273  // process all bindings via the current connection
274  for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size(); y++)
275  {
276  // check, if role is valid
277  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole != 0)
278  {
279  // add role of current call to local map
280  Roles[m_BindingSet[x].m_Connection.m_Calls[y].m_pRole->m_OID] = m_BindingSet[x].m_Connection.m_Calls[y].m_pRole;
281 
282  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole != 0)
283 
284  } // for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size(); x++)
285 
286  } // if (m_BindingSet[x].m_pRelationship == pRelationship)
287 
288  } // for (x = 0; x != m_BindingSet.size(); x++)
289 
290 
291  // check, if exception should be used and map is empty
292  if (bUseException && Roles.empty())
293  {
294  // construct and throw exception
295  throw (::GOPPRR::Error::CEmpty("no role connected to relationship found"));
296 
297  } // if (bUseException && Roles.empty())
298 
299  // return map of all connected roles
300  return (Roles);
301  // Bouml preserved body end 000B2502
302 
303 } // GOPPRR::CRole CGraph::Roles() const throw(::GOPPRR::Error::CEmpty)
304 
305 
306 
307 
308 ::std::map< ::std::string, GOPPRR::CRole* > CGraph::Roles(GOPPRR::CObject * const pObject, GOPPRR::CPort * const pPort, const ::std::string & Type, const bool & bSubString, const bool & bUseException) const throw(::GOPPRR::Error::CEmpty)
309 {
310  // Bouml preserved body begin 000A0182
311  bool bFoundInCalls(false);
312  ::std::map< ::std::string, ::GOPPRR::CRole* > Roles;
313  unsigned int x(0);
314  unsigned int y(0);
315 
316 
317 
318  // process all bindings in this graph
319  for (x = 0; x != m_BindingSet.size(); x++)
320  {
321  // process all bindings via the current connection
322  for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
323  {
324  // check current call for port and object
325  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pPort == pPort && m_BindingSet[x].m_Connection.m_Calls[y].m_pObject == pObject)
326  {
327  // check, if role is valid
328  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole != 0)
329  {
330  // check, if role type is correct
331  if ((!bSubString && m_BindingSet[x].m_Connection.m_Calls[y].m_pRole->m_Type == Type ) ||
332  (bSubString && m_BindingSet[x].m_Connection.m_Calls[y].m_pRole->m_Type.find(Type) != ::std::string::npos))
333  {
334  // add role of current call to local map
335  Roles[m_BindingSet[x].m_Connection.m_Calls[y].m_pRole->m_OID] = m_BindingSet[x].m_Connection.m_Calls[y].m_pRole;
336 
337  // set found flag to true
338  bFoundInCalls = true;
339 
340  } // if ((!bSubString && m_BindingSet[x].m_Connection.m_Calls[y].m_pRole->m_Type == Type ) ||
341 
342  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pPort == pPort && m_BindingSet[x].m_Connection.m_Calls[y].m_pObject == pObject)
343 
344  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pPort == pPort)
345 
346  } // for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
347 
348  // reset found flag
349  bFoundInCalls = false;
350 
351  } // for (x = 0; x != m_BindingSet.size(); x++)
352 
353 
354  // check, if exception should be used and map is empty
355  if (bUseException && Roles.empty())
356  {
357  // construct and throw exception
358  throw (::GOPPRR::Error::CEmpty("no role connected to port found"));
359 
360  } // if (bUseException && Roles.empty())
361 
362  // return map of all connected roles
363  return (Roles);
364  // Bouml preserved body end 000A0182
365 
366 } // GOPPRR::CRole CGraph::Roles() const throw(::GOPPRR::Error::CEmpty)
367 
368 
369 
370 
371 ::std::map< ::std::string, GOPPRR::CRole* > CGraph::Roles(GOPPRR::CRelationship * const pRelationship, const ::std::string & Type, const bool & bSubString, const bool& bUseException) const throw(::GOPPRR::Error::CEmpty)
372 {
373  // Bouml preserved body begin 000A0282
374  ::std::map< ::std::string, ::GOPPRR::CRole* > Roles;
375  unsigned int x(0);
376  unsigned int y(0);
377 
378 
379 
380  // process all bindings in this graph
381  for (x = 0; x != m_BindingSet.size(); x++)
382  {
383  // check, if current binding includes searched role
384  if (m_BindingSet[x].m_pRelationship == pRelationship)
385  {
386  // process all bindings via the current connection
387  for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size(); y++)
388  {
389  // check, if role is valid
390  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole != 0)
391  {
392  // check, if role type is correct
393  if ((!bSubString && m_BindingSet[x].m_Connection.m_Calls[y].m_pRole->m_Type == Type ) ||
394  (bSubString && m_BindingSet[x].m_Connection.m_Calls[y].m_pRole->m_Type.find(Type) != ::std::string::npos))
395  {
396  // add role of current call to local map
397  Roles[m_BindingSet[x].m_Connection.m_Calls[y].m_pRole->m_OID] = m_BindingSet[x].m_Connection.m_Calls[y].m_pRole;
398 
399  } // if ((!bSubString && m_BindingSet[x].m_Connection.m_Calls[y].m_pRole->m_Type == Type ) ||
400 
401  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole != 0)
402 
403  } // for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size(); x++)
404 
405  } // if (m_BindingSet[x].m_pRelationship == pRelationship)
406 
407  } // for (x = 0; x != m_BindingSet.size(); x++)
408 
409 
410  // check, if exception should be used and map is empty
411  if (bUseException && Roles.empty())
412  {
413  // construct and throw exception
414  throw (::GOPPRR::Error::CEmpty("no role connected to relationship found"));
415 
416  } // if (bUseException && Roles.empty())
417 
418  // return map of all connected roles
419  return (Roles);
420  // Bouml preserved body end 000A0282
421 
422 } // GOPPRR::CRole CGraph::Roles() const throw(::GOPPRR::Error::CEmpty)
423 
424 
425 
426 
427 ::std::map< ::std::string, GOPPRR::CRole* > CGraph::Roles(GOPPRR::CRole * const pRole, const ::std::string & Type, const bool & bSubString, const bool& bUseException) const throw(::GOPPRR::Error::CEmpty)
428 {
429  // Bouml preserved body begin 000A3602
430  ::std::map< ::std::string, ::GOPPRR::CRole* > Roles;
431  unsigned int x(0);
432  unsigned int y(0);
433  unsigned int z(0);
434 
435 
436 
437  // process all bindings in this graph
438  for (x = 0; x < m_BindingSet.size(); x++)
439  {
440  // process all bindings via the current connection
441  for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size(); y++)
442  {
443  // check, if role is searched one
444  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole == pRole)
445  {
446  // process all (other) roles in binding
447  for (z = 0; z < m_BindingSet[x].m_Connection.m_Calls.size(); z++)
448  {
449  // check, if role type is correct and is not parameter
450  if (((!bSubString && m_BindingSet[x].m_Connection.m_Calls[z].m_pRole->m_Type == Type ) ||
451  (bSubString && m_BindingSet[x].m_Connection.m_Calls[z].m_pRole->m_Type.find(Type) != ::std::string::npos)) &&
452  m_BindingSet[x].m_Connection.m_Calls[z].m_pRole != pRole)
453  {
454  // add role of current call to local map
455  Roles[m_BindingSet[x].m_Connection.m_Calls[z].m_pRole->m_OID] = m_BindingSet[x].m_Connection.m_Calls[z].m_pRole;
456 
457  } // if ((!bSubString && m_BindingSet[x].m_Connection.m_Calls[y].m_pRole->m_Type == Type ) ||
458 
459  } // for (z = 0; z < m_BindingSet[x].m_Connection.m_Calls.size(); z++)
460 
461  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole == pRole)
462 
463  } // for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size(); x++)
464 
465  } // for (x = 0; x < m_BindingSet.size(); x++)
466 
467 
468  // check, if exception should be used and map is empty
469  if (bUseException && Roles.empty())
470  {
471  // construct and throw exception
472  throw (::GOPPRR::Error::CEmpty("no role connected to role found"));
473 
474  } // if (bUseException && Roles.empty())
475 
476  // return map of all connected roles
477  return (Roles);
478  // Bouml preserved body end 000A3602
479 
480 } // GOPPRR::CRole CGraph::Roles() const throw(::GOPPRR::Error::CEmpty)
481 
482 
483 
484 
485 ::std::map< ::std::string, GOPPRR::CRelationship* > CGraph::Relationships(GOPPRR::CRole * const pRole, const bool& bUseException) const throw(::GOPPRR::Error::CEmpty)
486 {
487  // Bouml preserved body begin 00095282
488  bool bFoundInCalls(false);
489  ::std::map< ::std::string, ::GOPPRR::CRelationship* > Relationships;
490  unsigned int x(0);
491  unsigned int y(0);
492 
493 
494 
495  // process all bindings in this graph
496  for (x = 0; x != m_BindingSet.size(); x++)
497  {
498  // process all bindings via the current connection
499  for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
500  {
501  // check current call for role
502  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole == pRole)
503  {
504  // check, if relationship is valid
505  if (m_BindingSet[x].m_pRelationship != 0)
506  {
507  // add relationship of current binding
508  Relationships[m_BindingSet[x].m_pRelationship->m_OID] = m_BindingSet[x].m_pRelationship;
509 
510  // set found flag to true
511  bFoundInCalls = true;
512 
513  } // if (m_BindingSet[x].m_pRelationship != 0)
514 
515  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole == pRole)
516 
517  } // for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
518 
519  // reset found flag
520  bFoundInCalls = false;
521 
522  } // for (x = 0; x != m_BindingSet.size(); x++)
523 
524 
525  // check, if exception should be used and map is empty
526  if (bUseException && Relationships.empty())
527  {
528  // construct and throw exception
529  throw (::GOPPRR::Error::CEmpty("no relationship connected to role found"));
530 
531  } // if (bUseException && Relationships.empty())
532 
533  // return map of all connected relationships
534  return (Relationships);
535  // Bouml preserved body end 00095282
536 
537 } // GOPPRR::CRelationship CGraph::Relationships() const throw(::GOPPRR::Error::CEmpty)
538 
539 
540 
541 
542 ::std::map< ::std::string, GOPPRR::CRelationship* > CGraph::Relationships(GOPPRR::CRole * const pRole, const ::std::string& Type, const bool& bSubString, const bool& bUseException) const throw(::GOPPRR::Error::CEmpty)
543 {
544  // Bouml preserved body begin 000A0202
545  bool bFoundInCalls(false);
546  ::std::map< ::std::string, ::GOPPRR::CRelationship* > Relationships;
547  unsigned int x(0);
548  unsigned int y(0);
549 
550 
551 
552  // process all bindings in this graph
553  for (x = 0; x != m_BindingSet.size(); x++)
554  {
555  // process all bindings via the current connection
556  for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
557  {
558  // check current call for role
559  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole == pRole)
560  {
561  // check, if relationship is valid
562  if (m_BindingSet[x].m_pRelationship != 0)
563  {
564  // check, if relationship type is correct
565  if ((!bSubString && m_BindingSet[x].m_pRelationship->m_Type == Type ) ||
566  (bSubString && m_BindingSet[x].m_pRelationship->m_Type.find(Type) != ::std::string::npos))
567  {
568  // add relationship of current binding
569  Relationships[m_BindingSet[x].m_pRelationship->m_OID] = m_BindingSet[x].m_pRelationship;
570 
571  // set found flag to true
572  bFoundInCalls = true;
573 
574  } // if ((!bSubString && m_BindingSet[x].m_pRelationship->m_Type == Type ) ||
575 
576  } // if (m_BindingSet[x].m_pRelationship != 0)
577 
578  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole == pRole)
579 
580  } // for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; x++)
581 
582  // reset found flag
583  bFoundInCalls = false;
584 
585  } // for (x = 0; x != m_BindingSet.size(); x++)
586 
587 
588  // check, if exception should be used and map is empty
589  if (bUseException && Relationships.empty())
590  {
591  // construct and throw exception
592  throw (::GOPPRR::Error::CEmpty("no relationship connected to role found"));
593 
594  } // if (bUseException && Relationships.empty())
595 
596 
597  // return map of all connected relationships
598  return (Relationships);
599  // Bouml preserved body end 000A0202
600 
601 } // GOPPRR::CRelationship CGraph::Relationships() const throw(::GOPPRR::Error::CEmpty)
602 
603 
604 
605 
606 ::std::map< ::std::string, GOPPRR::CPort* > CGraph::Ports(GOPPRR::CRole * const pRole, const bool& bUseException) const throw(::GOPPRR::Error::CEmpty)
607 {
608  // Bouml preserved body begin 00095302
609  bool bFoundInCalls(false);
610  ::std::map< ::std::string, ::GOPPRR::CPort* > Ports;
611  unsigned int x(0);
612  unsigned int y(0);
613 
614 
615 
616  // process all bindings in this graph
617  for (x = 0; x != m_BindingSet.size(); x++)
618  {
619  // process all bindings via the current connection
620  for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
621  {
622  // check current call for role
623  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole == pRole)
624  {
625  // check, if port is valid
626  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pPort != 0)
627  {
628  // add relationship of current binding
629  Ports[m_BindingSet[x].m_Connection.m_Calls[y].m_pPort->m_OID] = m_BindingSet[x].m_Connection.m_Calls[y].m_pPort;
630 
631  // set found flag to true
632  bFoundInCalls = true;
633 
634  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pPort != 0)
635 
636  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole == pRole)
637 
638  } // for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
639 
640  // reset found flag
641  bFoundInCalls = false;
642 
643  } // for (x = 0; x != m_BindingSet.size(); x++)
644 
645 
646  // check, if exception should be used and map is empty
647  if (bUseException && Ports.empty())
648  {
649  // construct and throw exception
650  throw (::GOPPRR::Error::CEmpty("no ports connected to role found"));
651 
652  } // if (bUseException && Relationships.empty())
653 
654  // return map of all connected relationships
655  return (Ports);
656  // Bouml preserved body end 00095302
657 
658 } // GOPPRR::CPort CGraph::Ports() const throw(::GOPPRR::Error::CEmpty)
659 
660 
661 
662 
663 ::std::map< ::std::string, GOPPRR::CPort* > CGraph::Ports(GOPPRR::CObject * const pObject, const bool& bUseException) const throw(::GOPPRR::Error::CEmpty)
664 {
665  // Bouml preserved body begin 00095382
666  bool bFoundInCalls(false);
667  ::std::map< ::std::string, ::GOPPRR::CPort* > Ports;
668  unsigned int x(0);
669  unsigned int y(0);
670 
671 
672 
673  // process all bindings in this graph
674  for (x = 0; x != m_BindingSet.size(); x++)
675  {
676  // process all bindings via the current connection
677  for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
678  {
679  // check current call for object
680  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pObject == pObject)
681  {
682  // check, if port is valid
683  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pPort != 0)
684  {
685  // add port of current binding
686  Ports[m_BindingSet[x].m_Connection.m_Calls[y].m_pPort->m_OID] = m_BindingSet[x].m_Connection.m_Calls[y].m_pPort;
687 
688  // set found flag to true
689  bFoundInCalls = true;
690 
691  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pPort != 0)
692 
693  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pObject == pObject)
694 
695  } // for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
696 
697  // reset found flag
698  bFoundInCalls = false;
699 
700  } // for (x = 0; x != m_BindingSet.size(); x++)
701 
702 
703  // check, if exception should be used and map is empty
704  if (bUseException && Ports.empty())
705  {
706  // construct and throw exception
707  throw (::GOPPRR::Error::CEmpty("no ports connected to object found"));
708 
709  } // if (bUseException && Relationships.empty())
710 
711  // return map of all connected relationships
712  return (Ports);
713  // Bouml preserved body end 00095382
714 
715 } // GOPPRR::CPort CGraph::Ports() const throw(::GOPPRR::Error::CEmpty)
716 
717 
718 
719 
720 ::std::map< ::std::string, GOPPRR::CPort* > CGraph::Ports(GOPPRR::CObject * const pObject, const ::std::string& Type, const bool& bSubString, const bool& bUseException) const throw(::GOPPRR::Error::CEmpty)
721 {
722  // Bouml preserved body begin 0009E102
723  ::std::map< ::std::string, ::GOPPRR::CPort* > Ports;
724  unsigned int x(0);
725  unsigned int y(0);
726 
727 
728 
729  // process all bindings in this graph
730  for (x = 0; x != m_BindingSet.size(); x++)
731  {
732  // process all bindings via the current connection
733  for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size(); y++)
734  {
735  // check current call for object
736  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pObject == pObject)
737  {
738  // check, if port is valid
739  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pPort != 0)
740  {
741  // check, if port type is correct
742  if ((!bSubString && m_BindingSet[x].m_Connection.m_Calls[y].m_pPort->m_Type == Type ) ||
743  (bSubString && m_BindingSet[x].m_Connection.m_Calls[y].m_pPort->m_Type.find(Type) != ::std::string::npos))
744  {
745  // add port of current binding
746  Ports[m_BindingSet[x].m_Connection.m_Calls[y].m_pPort->m_OID] = m_BindingSet[x].m_Connection.m_Calls[y].m_pPort;
747 
748  } // if ((!bSubString && m_BindingSet[x].m_Connection.m_Calls[y].m_pPort->m_Type == Type ) ||
749 
750  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pPort != 0)
751 
752  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pObject == pObject)
753 
754  } // for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size(); y++)
755 
756  } // for (x = 0; x != m_BindingSet.size(); x++)
757 
758 
759  // check, if exception should be used and map is empty
760  if (bUseException && Ports.empty())
761  {
762  // construct and throw exception
763  throw (::GOPPRR::Error::CEmpty("no ports connected to object found"));
764 
765  } // if (bUseException && Relationships.empty())
766 
767  // return map of all connected relationships
768  return (Ports);
769  // Bouml preserved body end 0009E102
770 
771 } // GOPPRR::CPort CGraph::Ports() const throw(::GOPPRR::Error::CEmpty)
772 
773 
774 
775 
776 ::std::map< ::std::string, GOPPRR::CObject* > CGraph::Objects(GOPPRR::CPort * const pPort, GOPPRR::CRole * const pRole, const bool & bUseException) const throw(::GOPPRR::Error::CEmpty)
777 {
778  // Bouml preserved body begin 00095402
779  bool bFoundInCalls(false);
780  ::std::map< ::std::string, ::GOPPRR::CObject* > Objects;
781  unsigned int x(0);
782  unsigned int y(0);
783 
784 
785 
786  // process all bindings in this graph
787  for (x = 0; x != m_BindingSet.size(); x++)
788  {
789  // process all bindings via the current connection
790  for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
791  {
792  // check current call for port and role
793  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pPort == pPort && m_BindingSet[x].m_Connection.m_Calls[y].m_pRole == pRole)
794  {
795  // check, if object is valid
796  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pObject != 0)
797  {
798  // add object of current binding
799  Objects[m_BindingSet[x].m_Connection.m_Calls[y].m_pObject->m_OID] = m_BindingSet[x].m_Connection.m_Calls[y].m_pObject;
800 
801  // set found flag to true
802  bFoundInCalls = true;
803 
804  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pObject != 0)
805 
806  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pPort == pPort && m_BindingSet[x].m_Connection.m_Calls[y].m_pRole == pRole)
807 
808  } // for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
809 
810  // reset found flag
811  bFoundInCalls = false;
812 
813  } // for (x = 0; x != m_BindingSet.size(); x++)
814 
815 
816  // check, if exception should be used and map is empty
817  if (bUseException && Objects.empty())
818  {
819  // construct and throw exception
820  throw (::GOPPRR::Error::CEmpty("no objects connected to port found"));
821 
822  } // if (bUseException && Objects.empty())
823 
824  // return map of all connected relationships
825  return (Objects);
826  // Bouml preserved body end 00095402
827 
828 } // GOPPRR::CObject CGraph::Objects() const throw(::GOPPRR::Error::CEmpty)
829 
830 
831 
832 
833 ::std::map< ::std::string, GOPPRR::CObject* > CGraph::Objects(GOPPRR::CRole * const pRole, const bool& bUseException) const throw(::GOPPRR::Error::CEmpty)
834 {
835  // Bouml preserved body begin 00095482
836  bool bFoundInCalls(false);
837  ::std::map< ::std::string, ::GOPPRR::CObject* > Objects;
838  unsigned int x(0);
839  unsigned int y(0);
840 
841 
842 
843  // process all bindings in this graph
844  for (x = 0; x != m_BindingSet.size(); x++)
845  {
846  // process all bindings via the current connection
847  for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
848  {
849  // check current call for port
850  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole == pRole)
851  {
852  // check, if object is valid
853  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pObject != 0)
854  {
855  // add object of current binding
856  Objects[m_BindingSet[x].m_Connection.m_Calls[y].m_pObject->m_OID] = m_BindingSet[x].m_Connection.m_Calls[y].m_pObject;
857 
858  // set found flag to true
859  bFoundInCalls = true;
860 
861  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pObject != 0)
862 
863  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole == pRole)
864 
865  } // for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
866 
867  // reset found flag
868  bFoundInCalls = false;
869 
870  } // for (x = 0; x != m_BindingSet.size(); x++)
871 
872 
873  // check, if exception should be used and map is empty
874  if (bUseException && Objects.empty())
875  {
876  // construct and throw exception
877  throw (::GOPPRR::Error::CEmpty("no objects connected to role found"));
878 
879  } // if (bUseException && Objects.empty())
880 
881  // return map of all connected relationships
882  return (Objects);
883  // Bouml preserved body end 00095482
884 
885 } // GOPPRR::CObject CGraph::Objects() const throw(::GOPPRR::Error::CEmpty)
886 
887 
888 
889 
890 ::std::map< ::std::string, GOPPRR::CObject* > CGraph::Objects(GOPPRR::CRole * const pRole, const ::std::string& Type, const bool& bSubString, const bool& bUseException) const throw(::GOPPRR::Error::CEmpty)
891 {
892  // Bouml preserved body begin 000A1C02
893  bool bFoundInCalls(false);
894  ::std::map< ::std::string, ::GOPPRR::CObject* > Objects;
895  unsigned int x(0);
896  unsigned int y(0);
897 
898 
899 
900  // process all bindings in this graph
901  for (x = 0; x != m_BindingSet.size(); x++)
902  {
903  // process all bindings via the current connection
904  for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
905  {
906  // check current call for port
907  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole == pRole)
908  {
909  // check, if object is valid
910  if (m_BindingSet[x].m_Connection.m_Calls[y].m_pObject != 0)
911  {
912  // check, if object type is correct
913  if ((!bSubString && m_BindingSet[x].m_Connection.m_Calls[y].m_pObject->m_Type == Type ) ||
914  (bSubString && m_BindingSet[x].m_Connection.m_Calls[y].m_pObject->m_Type.find(Type) != ::std::string::npos))
915  {
916  // add object of current binding
917  Objects[m_BindingSet[x].m_Connection.m_Calls[y].m_pObject->m_OID] = m_BindingSet[x].m_Connection.m_Calls[y].m_pObject;
918 
919  // set found flag to true
920  bFoundInCalls = true;
921 
922  } // if ((!bSubString && m_BindingSet[x].m_Connection.m_Calls[y].m_pObject->m_Type == Type ) ||
923 
924  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pObject != 0)
925 
926  } // if (m_BindingSet[x].m_Connection.m_Calls[y].m_pRole == pRole)
927 
928  } // for (y = 0; y < m_BindingSet[x].m_Connection.m_Calls.size() && !bFoundInCalls; y++)
929 
930  // reset found flag
931  bFoundInCalls = false;
932 
933  } // for (x = 0; x != m_BindingSet.size(); x++)
934 
935 
936  // check, if exception should be used and map is empty
937  if (bUseException && Objects.empty())
938  {
939  // construct and throw exception
940  throw (::GOPPRR::Error::CEmpty("no objects connected to role found"));
941 
942  } // if (bUseException && Objects.empty())
943 
944  // return map of all connected relationships
945  return (Objects);
946  // Bouml preserved body end 000A1C02
947 
948 } // GOPPRR::CObject CGraph::Objects() const throw(::GOPPRR::Error::CEmpty)
949 
950 
951 
952 
953 ::std::map< ::std::string, GOPPRR::CObject* > CGraph::Objects(const ::std::string& Type, const bool& bSubString, const bool& bUseException) const throw(::GOPPRR::Error::CEmpty)
954 {
955  // Bouml preserved body begin 000A8702
956  ::std::map< ::std::string, ::GOPPRR::CObject* > Objects;
957  decltype (::GOPPRR::CGraph::m_ObjectSet.begin()) Object;
958 
959 
960 
961  // process all objects in graph
962  for (Object = this->m_ObjectSet.begin(); Object != this->m_ObjectSet.end(); Object++)
963  {
964  // check, if object type is correct
965  if ((!bSubString && Object->second->m_Type == Type ) || (bSubString && Object->second->m_Type.find(Type) != ::std::string::npos))
966  {
967  // add object of current binding
968  Objects[ Object->second->m_OID ] = Object->second;
969 
970  } // if ((!bSubString && Object->second->m_Type == Type ) || (bSubString && Object->second->m_Type.find(Type) != ::std::string::npos))
971 
972  } // for (Object = this->m_ObjectSet.begin(); Object != this->m_ObjectSet.end(); Object++)
973 
974 
975  // check, if exception should be used and map is empty
976  if (bUseException && Objects.empty())
977  {
978  // construct and throw exception
979  throw (::GOPPRR::Error::CEmpty("no objects found"));
980 
981  } // if (bUseException && Objects.empty())
982 
983  // return map of all connected relationships
984  return (Objects);
985  // Bouml preserved body end 000A8702
986 
987 } // GOPPRR::CObject CGraph::Objects() const throw(::GOPPRR::Error::CEmpty)
988 
989 
990 
991 
992 ::std::map< ::std::string, GOPPRR::CObject* > CGraph::Container(GOPPRR::CObject * const pObject, const bool& bUseException) const throw(::GOPPRR::Error::CEmpty)
993 {
994  // Bouml preserved body begin 00095582
995  bool bFoundInContainer(false);
996  ::std::map< ::std::string, ::GOPPRR::CObject* > Objects;
997  unsigned int x(0);
998  ::std::map< ::std::string, ::GOPPRR::CObject* >::const_iterator y(0);
999 
1000 
1001 
1002  // process all graphical container
1003  for (x = 0; x < m_Containers.size(); x++)
1004  {
1005  // check, if container is searched object
1006  if (m_Containers[x].m_pContainer == pObject)
1007  {
1008  // process all contained object
1009  for (y = m_Containers[x].m_ContainedObjects.begin(); y != m_Containers[x].m_ContainedObjects.end() && !bFoundInContainer; y++)
1010  {
1011  // check, if current contained object is searched one
1012  if (y->second == pObject)
1013  {
1014  // copy container to local map
1015  Objects[y->second->m_OID] = y->second;
1016 
1017  // set container found flag to true;
1018  bFoundInContainer = true;
1019 
1020  } // if (y->second == pObject)
1021 
1022  } // for (y = m_Containers[x].m_ContainedObjects.begin(); y != m_Containers[x].m_ContainedObjects.end() && !bFoundInContainer; y++)
1023 
1024  // reset container found flag
1025  bFoundInContainer = false;
1026 
1027  } // if (m_Containers[x].m_pContainer == pObject)
1028 
1029  } // for (x = 0; x < m_Containers.size(); x++)
1030 
1031 
1032  // check, if exception should be used and map is empty
1033  if (bUseException && Objects.empty())
1034  {
1035  // construct and throw exception
1036  throw (::GOPPRR::Error::CEmpty("no container objects found"));
1037 
1038  } // if (bUseException && Objects.empty())
1039 
1040  // return map of all connected relationships
1041  return (Objects);
1042  // Bouml preserved body end 00095582
1043 
1044 } // GOPPRR::CObject CGraph::Container() const throw(::GOPPRR::Error::CEmpty)
1045 
1046 
1047 
1048 
1049 ::std::map< ::std::string, GOPPRR::CObject* > CGraph::Contained(GOPPRR::CObject * const pObject, const bool& bUseException) const throw(::GOPPRR::Error::CEmpty)
1050 {
1051  // Bouml preserved body begin 00095502
1052  ::std::map< ::std::string, ::GOPPRR::CObject* > Objects;
1053  unsigned int x(0);
1054 
1055 
1056 
1057  // process all graphical container
1058  for (x = 0; x < m_Containers.size(); x++)
1059  {
1060  // check, if container is searched object
1061  if (m_Containers[x].m_pContainer == pObject)
1062  {
1063  // copy all contained objects
1064  Objects.insert(m_Containers[x].m_ContainedObjects.begin(), m_Containers[x].m_ContainedObjects.end());
1065 
1066  } // if (m_Containers[x].m_pContainer == pObject)
1067 
1068  } // for (x = 0; x < m_Containers.size(); x++)
1069 
1070 
1071  // check, if exception should be used and map is empty
1072  if (bUseException && Objects.empty())
1073  {
1074  // construct and throw exception
1075  throw (::GOPPRR::Error::CEmpty("no contained objects found"));
1076 
1077  } // if (bUseException && Objects.empty())
1078 
1079  // return map of all connected relationships
1080  return (Objects);
1081  // Bouml preserved body end 00095502
1082 
1083 } // GOPPRR::CObject CGraph::Contained() const throw(::GOPPRR::Error::CEmpty)
1084 
1085 
1086 
1087 
1089 {
1090  // Bouml preserved body begin 00048D82
1091  // assign member values from source
1092  m_BindingSet = Source.m_BindingSet;
1093  m_ObjectSet = Source.m_ObjectSet;
1094  m_PortSet = Source.m_PortSet;
1095  m_RelationshipSet = Source.m_RelationshipSet;
1096  m_RoleSet = Source.m_RoleSet;
1097  m_Containers = Source.m_Containers;
1098 
1099  // call operator of base class
1100  ::GOPPRR::CNonProperty::operator =(Source);
1101 
1102  // return reference to this instance
1103  return (*this);
1104  // Bouml preserved body end 00048D82
1105 
1106 } // GOPPRR::CGraph CGraph::operator=() throw()
1107 
1108 
1109 
1110 
1111 
1112 
1113 } // namespace GOPPRR

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/.