openETCS
case study for the European Train Control System developed for the authors dissertation
GOPPRRTransformer.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 GOPPRR XML to syntax tree transformer
23  */
24 
25 #include "GOPPRRTransformer.h"
26 
27 
28 
29 
30 namespace DSM {
31 
32 
34 {
35  // Bouml preserved body begin 00020F02
36  // empty constructor
37  // Bouml preserved body end 00020F02
38 
39 } // CGOPPRRTransformer::CGOPPRRTransformer() throw()
40 
41 
42 
43 
45 {
46  // Bouml preserved body begin 00020F82
47  // empty destructor
48  // Bouml preserved body end 00020F82
49 
50 } // CGOPPRRTransformer::~CGOPPRRTransformer() throw()
51 
52 
53 
54 
56 {
57  // Bouml preserved body begin 00029582
58  // convert and return pointer to tree
59  return dynamic_cast<DSM::CGOPPRRSyntaxTree*>(m_pTree);
60  // Bouml preserved body end 00029582
61 
62 } // ::DSM::CGOPPRRSyntaxTree CGOPPRRTransformer::GetGOPRRTree() const throw()
63 
64 
65 
66 
67 void CGOPPRRTransformer::CreateSyntaxFromFile(const ::std::string & ModelFileName, GOPPRR::CGraph *& pRootGraph) throw(DSM::Error::CException)
68 {
69  // Bouml preserved body begin 00029482
70  ::std::fstream XMLFile;
71  ::std::string ErrorMessage;
72 
73 
74  // try to open file by name
75  XMLFile.open(ModelFileName.c_str(), ::std::fstream::in);
76 
77  // check, if file could be opened
78  if (!XMLFile.is_open())
79  {
80 
81  // create error message and throw exception
82  ErrorMessage = "File \"";
83  ErrorMessage += ModelFileName;
84  ErrorMessage += "\" could not be opened";
85  throw (DSM::Error::CParameter(ErrorMessage));
86 
87  } // if (!XMLFile.is_open())
88 
89  try
90  {
91  // call method for creating syntax from file stream
92  this->CreateSyntax(XMLFile, pRootGraph);
93 
94  } // try
95  catch (const ::DSM::Error::CException&)
96  {
97  // close file stream
98  XMLFile.close();
99 
100  // re-throw exception
101  throw;
102 
103  } // catch (const ::DSM::Error::CException&)
104 
105  // Bouml preserved body end 00029482
106 
107 } // void CGOPPRRTransformer::CreateSyntaxFromFile() throw(DSM::Error::CException)
108 
109 
110 
111 
112 void CGOPPRRTransformer::CreateSyntax(::std::fstream & ModelFileStream, GOPPRR::CGraph *& pRootGraph) throw(DSM::Error::CException)
113 {
114  // Bouml preserved body begin 00029502
115  ::std::string Model((::std::istreambuf_iterator<char>(ModelFileStream)), ::std::istreambuf_iterator<char>());
116 
117 
118  // call method for creating syntax from string
119  //this->CreateSyntax(Model, pRootGraph);
120  this->CreateSyntaxIterative(Model, pRootGraph);
121 
122  // Bouml preserved body end 00029502
123 
124 } // void CGOPPRRTransformer::CreateSyntax() throw(DSM::Error::CException)
125 
126 
127 
128 
129 void CGOPPRRTransformer::CreateSyntax(const ::std::string & Model, GOPPRR::CGraph *& pRootGraph) throw(DSM::Error::CException)
130 {
131  // Bouml preserved body begin 0002B102
132  bool bRootGraph(false);
133  ::xmlpp::Node::NodeList::iterator x(0);
134  ::xmlpp::Element::AttributeList::iterator y(0);
135  ::xmlpp::Document* pXMLSchema(0);
136  ::xmlpp::Document* pXMLGOPPRRProject(0);
137  ::xmlpp::Element* pProjectNode(0);
138  ::xmlpp::SchemaValidator SchemaValidator;
139  ::xmlpp::Schema* pSchema(0);
140  ::xmlpp::Node::NodeList ProjectElements(0);
141  ::xmlpp::Element::AttributeList ProjectAttributes;
142  ::xmlpp::Element::AttributeList ProjectChildAttributes;
143  ::std::stringstream ErrorMessage;
144  ::std::string CurrentElementsName;
145  ::std::string RootGraphOID;
146  ::std::map< ::std::string, ::std::string> ProjectAttributeMap;
147  ::std::map< ::std::string, ::std::string> ProjectChildAttributeMap;
148  ::xmlpp::Element* pProjectChildXMLElement(0);
149  ::GOPPRR::CProject* pNewProject(0);
150  ::DSM::CGOPPRRSyntaxTree* pSyntaxTree(0);
151 
152 
153 
154  try
155  {
156  // first parse XML Schema from static string
157  m_XMLParser.parse_memory(m_Schema);
158 
159  // get document object for schema
160  pXMLSchema = m_XMLParser.get_document();
161 
162  // create schema object
163  pSchema = new xmlpp::Schema(pXMLSchema);
164 
165  // set schema in validator
166  SchemaValidator.set_schema(pSchema);
167 
168  // parse XML model string
169  m_XMLParser.parse_memory(Model);
170 
171  // get document object for model
172  pXMLGOPPRRProject = m_XMLParser.get_document();
173 
174  // try to validate model
175  SchemaValidator.validate(pXMLGOPPRRProject);
176 
177  // get root node of model
178  pProjectNode = pXMLGOPPRRProject->get_root_node();
179 
180  // get all attributes of root node
181  ProjectAttributes = pProjectNode->get_attributes();
182 
183  // process all attributes of root node
184  for (y = ProjectAttributes.begin(); y != ProjectAttributes.end(); y++)
185  {
186  // store current attribute in map
187  ProjectAttributeMap[ (*y)->get_name() ] = (*y)->get_value();
188 
189  } // for (y = ProjectAttributes.begin(); y != ProjectAttributes.end(); y++)
190 
191  // create GOPPR::CProject here first to use members for element creation
192  pNewProject = new ::GOPPRR::CProject( ProjectAttributeMap["name"] );
193 
194  // get all children of openETCS node
195  ProjectElements = pProjectNode->get_children();
196 
197 
198  // process all elements in project elements,
199  for (x = ProjectElements.begin(); x != ProjectElements.end(); x++)
200  {
201  // try to convert pointer to current graph in concrete type
202  pProjectChildXMLElement = dynamic_cast< ::xmlpp::Element* >(*x);
203 
204 
205  // check, if current node is a element (ignore others)
206  if (pProjectChildXMLElement != 0)
207  {
208  // get name of current element
209  CurrentElementsName = pProjectChildXMLElement->get_name();
210 
211 
212  // check, name of current element for further proceedings
213  if (CurrentElementsName == "graph")
214  {
215  // get all attributes of current XML graph element
216  ProjectChildAttributes = pProjectChildXMLElement->get_attributes();
217 
218  // process all attributes of project child node
219  for (y = ProjectChildAttributes.begin(); y != ProjectChildAttributes.end(); y++)
220  {
221  // store current attribute in map
222  ProjectChildAttributeMap[ (*y)->get_name() ] = (*y)->get_value();
223 
224  } // for (y = ProjectChildAttributes.begin(); y != ProjectChildAttributes.end(); y++)
225 
226  // call internal method to create graph object
227  ::DSM::CGOPPRRTransformer::CreateGraph(pProjectChildXMLElement, pNewProject->m_GraphSet, pNewProject->m_ObjectSet, pNewProject->m_PropertySet, pNewProject->m_PortSet, pNewProject->m_RoleSet, pNewProject->m_RelationshipSet, bRootGraph);
228 
229  // check, if current graph is root graph
230  if (bRootGraph)
231  {
232  // store OID of root graph
233  RootGraphOID = ProjectChildAttributeMap["oid"];
234 
235  // reset root flag
236  bRootGraph = false;
237 
238  } // if (bRootGraph)
239 
240  } // if (CurrentElementsName == "graph")
241  else if (CurrentElementsName == "object")
242  {
243  // call internal method to create graph object
244  ::DSM::CGOPPRRTransformer::CreateObject(pProjectChildXMLElement, pNewProject->m_GraphSet, pNewProject->m_ObjectSet, pNewProject->m_PropertySet, pNewProject->m_PortSet, pNewProject->m_RoleSet, pNewProject->m_RelationshipSet);
245 
246  } // else if (CurrentElementsName == "object")
247  else if (CurrentElementsName == "property")
248  {
249  // call internal method to create property object
250  ::DSM::CGOPPRRTransformer::CreateProperty(pProjectChildXMLElement, pNewProject->m_GraphSet, pNewProject->m_ObjectSet, pNewProject->m_PropertySet, pNewProject->m_PortSet, pNewProject->m_RoleSet, pNewProject->m_RelationshipSet);
251 
252  } // else if (CurrentElementsName == "property")
253  else if (CurrentElementsName == "port")
254  {
255  // call internal method to create port object
256  ::DSM::CGOPPRRTransformer::CreatePort(pProjectChildXMLElement, pNewProject->m_GraphSet, pNewProject->m_ObjectSet, pNewProject->m_PropertySet, pNewProject->m_PortSet, pNewProject->m_RoleSet, pNewProject->m_RelationshipSet);
257 
258  } // else if (CurrentElementsName == "port")
259  else if (CurrentElementsName == "role")
260  {
261  // call internal method to create role object
262  ::DSM::CGOPPRRTransformer::CreateRole(pProjectChildXMLElement, pNewProject->m_GraphSet, pNewProject->m_ObjectSet, pNewProject->m_PropertySet, pNewProject->m_PortSet, pNewProject->m_RoleSet, pNewProject->m_RelationshipSet);
263 
264  } // else if (CurrentElementsName == "role")
265  else if (CurrentElementsName == "relationship")
266  {
267  // call internal method to create role object
268  ::DSM::CGOPPRRTransformer::CreateRelationship(pProjectChildXMLElement, pNewProject->m_GraphSet, pNewProject->m_ObjectSet, pNewProject->m_PropertySet, pNewProject->m_PortSet, pNewProject->m_RoleSet, pNewProject->m_RelationshipSet);
269 
270  } // else if (CurrentElementsName == "relationship")
271  else
272  {
273  // create error message and throw exception
274  ErrorMessage << "unexpected XML element in <gopprr:project> in line ";
275  ErrorMessage << pProjectChildXMLElement->get_line();
276  throw (DSM::Error::CParser(ErrorMessage.str()));
277 
278  } // else
279 
280 
281  } // if (pXMLElement != 0)
282 
283  } // for (x = ProjectElements.begin(); x != ProjectElements.end(); x++)
284 
285 
286  // check, if a root graph OID was set
287  if (pNewProject->m_GraphSet.find(RootGraphOID) != pNewProject->m_GraphSet.end())
288  {
289  // store pointer to root graph in parameter
290  pRootGraph = &pNewProject->m_GraphSet[RootGraphOID];
291 
292  } // if (pNewProject->m_GraphSet.find(RootGraphOID) != pNewProject->m_GraphSet.end())
293 
294  // create syntax tree from Project
295  pSyntaxTree = new ::DSM::CGOPPRRSyntaxTree(pNewProject,pRootGraph);
296 
297  // delete old syntax tree
298  delete m_pTree;
299 
300  // assign new syntax tree to member
301  m_pTree = pSyntaxTree;
302 
303 
304  // deallocate memory for schema
305  delete pSchema;
306 
307  } // try
308  catch (const ::xmlpp::exception& ParserException)
309  {
310  // delete all allocated memory
311  delete pNewProject;
312  delete pSyntaxTree;
313  delete pSchema;
314 
315  // throw own exception type
316  throw(DSM::Error::CParser(ParserException.what()));
317 
318  } // catch (xmlpp::exception)
319  catch (const ::std::bad_alloc& MemoryException)
320  {
321  // delete all allocated memory
322  delete pNewProject;
323  delete pSyntaxTree;
324  delete pSchema;
325 
326  // throw own exception type
327  throw(DSM::Error::CMemory(MemoryException.what()));
328 
329  } // catch (const std::bad_alloc& MemoryException)
330  catch (const ::DSM::Error::CException&)
331  {
332  // delete all allocated memory
333  delete pNewProject;
334  delete pSyntaxTree;
335  delete pSchema;
336 
337  // re-throw exception
338  throw;
339 
340  } // catch (const ::DSM::Error::CException&)
341  // Bouml preserved body end 0002B102
342 
343 } // void CGOPPRRTransformer::CreateSyntax() throw(DSM::Error::CException)
344 
345 
346 
347 
348 void CGOPPRRTransformer::CreateSyntaxIterative(const ::std::string & Model, GOPPRR::CGraph *& pRootGraph) throw(DSM::Error::CException)
349 {
350  // Bouml preserved body begin 0009C282
351  bool bRootGraph(false);
352  ::xmlpp::Node::NodeList::iterator x(0);
353  ::xmlpp::Element::AttributeList::iterator y(0);
354  ::xmlpp::Document* pXMLSchema(0);
355  ::xmlpp::Document* pXMLGOPPRRProject(0);
356  ::xmlpp::Element* pProjectElement(0);
357  ::xmlpp::Element* pPropertyElement(0);
358  ::xmlpp::Element* pObjectElement(0);
359  ::xmlpp::Element* pPortElement(0);
360  ::xmlpp::Element* pRoleElement(0);
361  ::xmlpp::Element* pGraphElement(0);
362  ::xmlpp::Element* pRelationshipElement(0);
363  ::xmlpp::SchemaValidator SchemaValidator;
364  ::xmlpp::Schema* pSchema(0);
365  ::xmlpp::Node::NodeList GraphElements(0);
366  ::xmlpp::Node::NodeList ObjectElements(0);
367  ::xmlpp::Node::NodeList PortElements(0);
368  ::xmlpp::Node::NodeList PropertyElements(0);
369  ::xmlpp::Node::NodeList RoleElements(0);
370  ::xmlpp::Node::NodeList RelationshipElements(0);
371  ::xmlpp::Element::AttributeList ProjectAttributes;
372  ::std::stringstream ErrorMessage;
373  ::std::string RootGraphOID;
374  ::std::string DecompositonOID;
375  ::std::map< ::std::string, ::std::string> ProjectAttributeMap;
376  ::std::map< ::std::string, ::std::string> PropertyAttributeMap;
377  ::GOPPRR::CProject* pNewProject(0);
378  ::DSM::CGOPPRRSyntaxTree* pSyntaxTree(0);
379  decltype (::GOPPRR::CProject::m_PropertySet.begin()) ThisProperty;
380  decltype (::GOPPRR::CProperty::m_NonProperties.begin()) ThisNonProperty;
381  decltype (::GOPPRR::CProject::m_ObjectSet.begin()) ThisObject;
382  decltype (::GOPPRR::CObject::m_Explosions.begin()) ThisExplosion;
383  decltype (::GOPPRR::CProject::m_RoleSet.begin()) ThisRole;
384  decltype (::GOPPRR::CProject::m_RelationshipSet.begin()) ThisRelationship;
385 
386 
387  try
388  {
389  // --------------------------------------------------------------------------------------
390 
391  // first parse XML Schema from static string
392  m_XMLParser.parse_memory(m_Schema);
393 
394  // get document object for schema
395  pXMLSchema = m_XMLParser.get_document();
396 
397  // create schema object
398  pSchema = new xmlpp::Schema(pXMLSchema);
399 
400  // set schema in validator
401  SchemaValidator.set_schema(pSchema);
402 
403  // parse XML model string
404  m_XMLParser.parse_memory(Model);
405 
406  // get document object for model
407  pXMLGOPPRRProject = m_XMLParser.get_document();
408 
409  // try to validate model
410  SchemaValidator.validate(pXMLGOPPRRProject);
411 
412  // get root node of model
413  pProjectElement = pXMLGOPPRRProject->get_root_node();
414 
415  // get all attributes of root node
416  ProjectAttributes = pProjectElement->get_attributes();
417 
418  // process all attributes of root node
419  for (y = ProjectAttributes.begin(); y != ProjectAttributes.end(); y++)
420  {
421  // store current attribute in map
422  ProjectAttributeMap[ (*y)->get_name() ] = (*y)->get_value();
423 
424  } // for (y = ProjectAttributes.begin(); y != ProjectAttributes.end(); y++)
425 
426  // create GOPPR::CProject here first to use members for element creation
427  pNewProject = new ::GOPPRR::CProject( ProjectAttributeMap["name"] );
428 
429  // --------------------------------------------------------------------------------------
430 
431 
432 
433  // first get all property XML elements --------------------------------------------------
434  PropertyElements = pProjectElement->get_children("property");
435 
436  // process all properties
437  for (x = PropertyElements.begin(); x != PropertyElements.end(); x++)
438  {
439  // try to convert current node pointer into element pointer
440  pPropertyElement = dynamic_cast< ::xmlpp::Element* >(*x);
441 
442  // check, if current node is a element (ignore otherwise)
443  if (pPropertyElement != 0)
444  {
445  // call internal method to create property object
447  pNewProject->m_GraphSet,
448  pNewProject->m_ObjectSet,
449  pNewProject->m_PropertySet,
450  pNewProject->m_PortSet,
451  pNewProject->m_RoleSet,
452  pNewProject->m_RelationshipSet);
453 
454  } // if (pPropertyElement != 0)
455 
456  } // for (x = PropertyElements.begin(); x != PropertyElements.end(); x++)
457 
458  // --------------------------------------------------------------------------------------
459 
460 
461 
462  // get all object XML elements ----------------------------------------------------------
463  ObjectElements = pProjectElement->get_children("object");
464 
465  // process all object elements
466  for (x = ObjectElements.begin(); x != ObjectElements.end(); x++)
467  {
468  // try to convert current node pointer into element pointer
469  pObjectElement = dynamic_cast< ::xmlpp::Element* >(*x);
470 
471  // check, if current node is a element (ignore otherwise)
472  if (pObjectElement != 0)
473  {
474  // call internal method to create object object
476  pNewProject->m_GraphSet,
477  pNewProject->m_ObjectSet,
478  pNewProject->m_PropertySet,
479  pNewProject->m_PortSet,
480  pNewProject->m_RoleSet,
481  pNewProject->m_RelationshipSet);
482 
483  } // if (pObjectElement != 0)
484 
485  } // for (x = ObjectElements.begin(); x != ObjectElements.end(); x++)
486 
487  // --------------------------------------------------------------------------------------
488 
489 
490 
491  // get all port XML elements ------------------------------------------------------------
492  PortElements = pProjectElement->get_children("port");
493 
494  // process all port elements
495  for (x = PortElements.begin(); x != PortElements.end(); x++)
496  {
497  // try to convert current node pointer into element pointer
498  pPortElement = dynamic_cast< ::xmlpp::Element* >(*x);
499 
500  // check, if current node is a element (ignore otherwise)
501  if (pPortElement != 0)
502  {
503  // call internal method to create port object
505  pNewProject->m_GraphSet,
506  pNewProject->m_ObjectSet,
507  pNewProject->m_PropertySet,
508  pNewProject->m_PortSet,
509  pNewProject->m_RoleSet,
510  pNewProject->m_RelationshipSet);
511 
512  } // if (pPortElement != 0)
513 
514  } // for (x = PortElements.begin(); x != PortElements.end(); x++)
515 
516  // --------------------------------------------------------------------------------------
517 
518 
519  // get all role XML elements ------------------------------------------------------------
520  RoleElements = pProjectElement->get_children("role");
521 
522  // process all role elements
523  for (x = RoleElements.begin(); x != RoleElements.end(); x++)
524  {
525  // try to convert current node pointer into element pointer
526  pRoleElement = dynamic_cast< ::xmlpp::Element* >(*x);
527 
528  // check, if current node is a element (ignore otherwise)
529  if (pRoleElement != 0)
530  {
531  // call internal method to create role object
533  pNewProject->m_GraphSet,
534  pNewProject->m_ObjectSet,
535  pNewProject->m_PropertySet,
536  pNewProject->m_PortSet,
537  pNewProject->m_RoleSet,
538  pNewProject->m_RelationshipSet);
539 
540  } // if (pRoleElement != 0)
541 
542  } // for (x = PortElements.begin(); x != PortElements.end(); x++)
543 
544  // --------------------------------------------------------------------------------------
545 
546 
547  // get all relationship XML elements ----------------------------------------------------
548  RelationshipElements = pProjectElement->get_children("relationship");
549 
550  // process all relationship elements
551  for (x = RelationshipElements.begin(); x != RelationshipElements.end(); x++)
552  {
553  // try to convert current node pointer into element pointer
554  pRelationshipElement = dynamic_cast< ::xmlpp::Element* >(*x);
555 
556  // check, if current node is a element (ignore otherwise)
557  if (pRelationshipElement != 0)
558  {
559  // call internal method to create relationship object
561  pNewProject->m_GraphSet,
562  pNewProject->m_ObjectSet,
563  pNewProject->m_PropertySet,
564  pNewProject->m_PortSet,
565  pNewProject->m_RoleSet,
566  pNewProject->m_RelationshipSet);
567 
568  } // if (pRelationshipElement != 0)
569 
570  } // for (x = RelationshipElements.begin(); x != RelationshipElements.end(); x++)
571 
572  // --------------------------------------------------------------------------------------
573 
574 
575  // finally get all graph XML elements ---------------------------------------------------
576  GraphElements = pProjectElement->get_children("graph");
577 
578  // process all graph elements
579  for (x = GraphElements.begin(); x != GraphElements.end(); x++)
580  {
581  // try to convert current node pointer into element pointer
582  pGraphElement = dynamic_cast< ::xmlpp::Element* >(*x);
583 
584  // check, if current node is a element (ignore otherwise)
585  if (pGraphElement != 0)
586  {
587  // call internal method to create relationship object
589  pNewProject->m_GraphSet,
590  pNewProject->m_ObjectSet,
591  pNewProject->m_PropertySet,
592  pNewProject->m_PortSet,
593  pNewProject->m_RoleSet,
594  pNewProject->m_RelationshipSet,
595  bRootGraph);
596 
597  // check, if graph was the root graph
598  if (bRootGraph)
599  {
600  // store its OID
601  RootGraphOID = pGraphElement->get_attribute_value("oid");
602 
603  // reset root graph flag
604  bRootGraph = false;
605 
606  } // if (bRootGraph)
607 
608  } // if (pGraphElement != 0)
609 
610  } // for (x = GraphElements.begin(); x != GraphElements.end(); x++)
611 
612  // --------------------------------------------------------------------------------------
613 
614 
615 
616 
617  // --------------------------------------------------------------------------------------
618 
619  // check all properties for not set non-property references
620  for (ThisProperty = pNewProject->m_PropertySet.begin(); ThisProperty != pNewProject->m_PropertySet.end(); ThisProperty++)
621  {
622  // process all non properties of current property
623  for (ThisNonProperty = ThisProperty->second.m_NonProperties.begin(); ThisNonProperty != ThisProperty->second.m_NonProperties.end(); ThisNonProperty++)
624  {
625  // try to find OID in all non-properties
626  if (pNewProject->m_GraphSet.find(ThisNonProperty->first) != pNewProject->m_GraphSet.end())
627  {
628  // set pointer to graph as non-property
629  ThisNonProperty->second = &(pNewProject->m_GraphSet[ThisNonProperty->first]);
630 
631  } // if (pNewProject->m_GraphSet.find(ThisNonProperty->first) != pNewProject->m_GraphSet.end())
632  else if (pNewProject->m_ObjectSet.find(ThisNonProperty->first) != pNewProject->m_ObjectSet.end())
633  {
634  // set pointer to object as non-property
635  ThisNonProperty->second = &(pNewProject->m_ObjectSet[ThisNonProperty->first]);
636 
637  } // else if (pNewProject->m_ObjectSet.find(ThisNonProperty->first) != pNewProject->m_ObjectSet.end())
638  else if (pNewProject->m_PortSet.find(ThisNonProperty->first) != pNewProject->m_PortSet.end())
639  {
640  // set pointer to port as non-property
641  ThisNonProperty->second = &(pNewProject->m_PortSet[ThisNonProperty->first]);
642 
643  } // else if (pNewProject->m_PortSet.find(ThisNonProperty->first) != pNewProject->m_PortSet.end())
644  else if (pNewProject->m_RoleSet.find(ThisNonProperty->first) != pNewProject->m_RoleSet.end())
645  {
646  // set pointer to role as non-property
647  ThisNonProperty->second = &(pNewProject->m_RoleSet[ThisNonProperty->first]);
648 
649  } // else if (pNewProject->m_RoleSet.find(ThisNonProperty->first) != pNewProject->m_RoleSet.end())
650  else if (pNewProject->m_RelationshipSet.find(ThisNonProperty->first) != pNewProject->m_RelationshipSet.end())
651  {
652  // set pointer to relationship as non-property
653  ThisNonProperty->second = &(pNewProject->m_RelationshipSet[ThisNonProperty->first]);
654 
655  } // else if (pNewProject->m_RelationshipSet.find(ThisNonProperty->first) != pNewProject->m_RelationshipSet.end())
656  else
657  {
658  // create error message and throw exception
659  ErrorMessage << "could found corresponding non-property for OID ";
660  ErrorMessage << ThisNonProperty->first;
661  throw (DSM::Error::CParser(ErrorMessage.str()));
662 
663  } // else
664 
665  } // m_NonProperties
666 
667  } // for (ThisProperty = pNewProject->m_PropertySet.begin(); ThisProperty != pNewProject->m_PropertySet.end(); ThisProperty++)
668 
669 
670  // check all objects for temporal decompositions and not set explosion references
671  for (ThisObject = pNewProject->m_ObjectSet.begin(); ThisObject != pNewProject->m_ObjectSet.end(); ThisObject++)
672  {
673  // check decomposition of current object
674  if (ThisObject->second.m_pDecomposition != 0)
675  {
676  // store OID of the temporal decomposition graph
677  DecompositonOID = ThisObject->second.m_pDecomposition->m_OID;
678 
679  // delete temporal object
680  delete ThisObject->second.m_pDecomposition;
681 
682  // try to find graph by OID
683  if (pNewProject->m_GraphSet.find(DecompositonOID) != pNewProject->m_GraphSet.end())
684  {
685  // set pointer to decomposition in object
686  ThisObject->second.m_pDecomposition = &(pNewProject->m_GraphSet[DecompositonOID]);
687 
688  } // if (pNewProject->m_GraphSet.find(DecompositonOID) != pNewProject->m_GraphSet.end())
689  else
690  {
691  // create error message and throw exception
692  ErrorMessage << "could found corresponding decomposition graph for OID ";
693  ErrorMessage << DecompositonOID;
694  throw (DSM::Error::CParser(ErrorMessage.str()));
695 
696  } // else
697 
698  } // if (ThisObject->second.m_pDecomposition != 0)
699 
700  // check current object for existing explosions
701  for (ThisExplosion = ThisObject->second.m_Explosions.begin(); ThisExplosion != ThisObject->second.m_Explosions.end(); ThisExplosion++)
702  {
703  // try to find graph by OID
704  if (pNewProject->m_GraphSet.find(ThisExplosion->first) != pNewProject->m_GraphSet.end())
705  {
706  // set pointer to graph in current explosion
707  ThisExplosion->second = &(pNewProject->m_GraphSet[ThisExplosion->first]);
708 
709  } // if (pNewProject->m_GraphSet.find(ThisExplosion->first) != pNewProject->m_GraphSet.end())
710  else
711  {
712  // create error message and throw exception
713  ErrorMessage << "could found corresponding explosion graph for OID ";
714  ErrorMessage << DecompositonOID;
715  throw (DSM::Error::CParser(ErrorMessage.str()));
716 
717  } // else
718 
719  } // for (ThisExplosion = ThisObject->second.m_Explosions.begin(); ThisExplosion = ThisObject->second.m_Explosions.end(); ThisExplosion++)
720 
721  } // for (ThisObject = pNewProject->m_ObjectSet.begin(); ThisObject != pNewProject->m_ObjectSet.end(); ThisObject++)
722 
723 
724  // check all roles for not set explosions
725  for (ThisRole = pNewProject->m_RoleSet.begin(); ThisRole != pNewProject->m_RoleSet.end(); ThisRole++)
726  {
727  // check current role for existing explosions
728  for (ThisExplosion = ThisRole->second.m_Explosions.begin(); ThisExplosion != ThisRole->second.m_Explosions.end(); ThisExplosion++)
729  {
730  // try to find graph by OID
731  if (pNewProject->m_GraphSet.find(ThisExplosion->first) != pNewProject->m_GraphSet.end())
732  {
733  // set pointer to graph in current explosion
734  ThisExplosion->second = &(pNewProject->m_GraphSet[ThisExplosion->first]);
735 
736  } // if (pNewProject->m_GraphSet.find(ThisExplosion->first) != pNewProject->m_GraphSet.end())
737  else
738  {
739  // create error message and throw exception
740  ErrorMessage << "could found corresponding explosion graph for OID ";
741  ErrorMessage << DecompositonOID;
742  throw (DSM::Error::CParser(ErrorMessage.str()));
743 
744  } // else
745 
746  } // for (ThisExplosion = ThisRole->second.m_Explosions.begin(); ThisExplosion = ThisRole->second.m_Explosions.end(); ThisExplosion++)
747 
748  } // for (ThisRole = pNewProject->m_RoleSet.begin(); ThisRole != pNewProject->m_RoleSet.end(); ThisRole++)
749 
750 
751  // check all relationships for not set explosions
752  for (ThisRelationship = pNewProject->m_RelationshipSet.begin(); ThisRelationship != pNewProject->m_RelationshipSet.end(); ThisRelationship++)
753  {
754  // check current relationsHip for existing explosions
755  for (ThisExplosion = ThisRelationship->second.m_Explosions.begin(); ThisExplosion != ThisRelationship->second.m_Explosions.end(); ThisExplosion++)
756  {
757  // try to find graph by OID
758  if (pNewProject->m_GraphSet.find(ThisExplosion->first) != pNewProject->m_GraphSet.end())
759  {
760  // set pointer to graph in current explosion
761  ThisExplosion->second = &(pNewProject->m_GraphSet[ThisExplosion->first]);
762 
763  } // if (pNewProject->m_GraphSet.find(ThisExplosion->first) != pNewProject->m_GraphSet.end())
764  else
765  {
766  // create error message and throw exception
767  ErrorMessage << "could found corresponding explosion graph for OID ";
768  ErrorMessage << DecompositonOID;
769  throw (DSM::Error::CParser(ErrorMessage.str()));
770 
771  } // else
772 
773  } // for (ThisRelationship = pNewProject->m_RelationshipSet.begin(); ThisRelationship != pNewProject->m_RelationshipSet.end(); ThisRelationship++)
774 
775  } // for (ThisRelationship = pNewProject->m_RoleSet.begin(); ThisRelationship != pNewProject->m_RoleSet.end(); ThisRelationship++)
776 
777 
778  // --------------------------------------------------------------------------------------
779 
780 
781 
782 
783  // check, if a root graph OID was set
784  if (pNewProject->m_GraphSet.find(RootGraphOID) != pNewProject->m_GraphSet.end())
785  {
786  // store pointer to root graph in parameter
787  pRootGraph = &pNewProject->m_GraphSet[RootGraphOID];
788 
789  } // if (pNewProject->m_GraphSet.find(RootGraphOID) != pNewProject->m_GraphSet.end())
790 
791  // create syntax tree from Project
792  pSyntaxTree = new ::DSM::CGOPPRRSyntaxTree(pNewProject,pRootGraph);
793 
794  // delete old syntax tree
795  delete m_pTree;
796 
797  // assign new syntax tree to member
798  m_pTree = pSyntaxTree;
799 
800 
801  // deallocate memory for schema
802  delete pSchema;
803 
804  } // try
805  catch (const ::xmlpp::exception& ParserException)
806  {
807  // delete all allocated memory
808  delete pNewProject;
809  delete pSyntaxTree;
810  delete pSchema;
811 
812  // throw own exception type
813  throw(DSM::Error::CParser(ParserException.what()));
814 
815  } // catch (xmlpp::exception)
816  catch (const ::std::bad_alloc& MemoryException)
817  {
818  // delete all allocated memory
819  delete pNewProject;
820  delete pSyntaxTree;
821  delete pSchema;
822 
823  // throw own exception type
824  throw(DSM::Error::CMemory(MemoryException.what()));
825 
826  } // catch (const std::bad_alloc& MemoryException)
827  catch (const ::DSM::Error::CException&)
828  {
829  // delete all allocated memory
830  delete pNewProject;
831  delete pSyntaxTree;
832  delete pSchema;
833 
834  // re-throw exception
835  throw;
836 
837  } // catch (const ::DSM::Error::CException&)
838  // Bouml preserved body end 0009C282
839 
840 } // void CGOPPRRTransformer::CreateSyntaxIterative() throw(DSM::Error::CException)
841 
842 
843 
844 
845 void CGOPPRRTransformer::CreatePropertyIterative(::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph >& Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort >& Ports, std::map< ::std::string, ::GOPPRR::CRole >& Roles, std::map< ::std::string, ::GOPPRR::CRelationship >& Relationships) throw(DSM::Error::CException)
846 
847 {
848  // Bouml preserved body begin 0009C302
849  ::xmlpp::Node::NodeList::iterator x(0);
850  ::xmlpp::Element::AttributeList::iterator y(0);
851  ::xmlpp::Element* pPropertyXMLChildElement(0);
852  ::xmlpp::TextNode* pPropertyXMLChildTextNode(0);
853  ::xmlpp::Node::NodeList PropertyChildNodes(pXMLElement->get_children());
854  ::xmlpp::Element::AttributeList PropertyAttributes(pXMLElement->get_attributes());
855  ::xmlpp::Element::AttributeList PropertyChildAttributes;
856  ::std::map< ::std::string, ::std::string > PropertyAttributeMap;
857  ::std::map< ::std::string, ::std::string > PropertyChildAttributeMap;
858  ::std::map< ::std::string, ::GOPPRR::CNonProperty* > NonProperties;
859  ::std::string PropertyValue;
860  ::std::string CurrentPropertyChildName;
861  ::std::stringstream ErrorMessage;
862 
863 
864 
865  // process all attributes of property
866  for (y = PropertyAttributes.begin(); y != PropertyAttributes.end(); y++)
867  {
868  // store current property in map
869  PropertyAttributeMap[(*y)->get_name()] = (*y)->get_value();
870 
871  } // for (y = PropertyAttributes.begin(); y != PropertyAttributes.end(); y++)
872 
873 
874 
875  // process all XML child nodes of property
876  for (x = PropertyChildNodes.begin(); x != PropertyChildNodes.end(); x++)
877  {
878  // try to convert current child node in element node
879  pPropertyXMLChildElement = dynamic_cast< ::xmlpp::Element* >(*x);
880 
881  // try to convert current child node in text node
882  pPropertyXMLChildTextNode = dynamic_cast< ::xmlpp::TextNode* >(*x);
883 
884  // evaluate type of node by pointer, distinguish only between text node and element, ignore others
885  if (pPropertyXMLChildElement != 0)
886  {
887  // get all property child XML element
888  PropertyChildAttributes = pPropertyXMLChildElement->get_attributes();
889 
890  // process all attributes of property child XML element
891  for (y = PropertyChildAttributes.begin(); y != PropertyChildAttributes.end(); y++)
892  {
893  // store current property in map
894  PropertyChildAttributeMap[(*y)->get_name()] = (*y)->get_value();
895 
896  } // for (y = PropertyChildAttributes(); y != PropertyChildAttributes(); y++)
897 
898  // get name of current property XML child
899  CurrentPropertyChildName = pPropertyXMLChildElement->get_name();
900 
901  // evaluate name of child node
902  if (CurrentPropertyChildName == "graph-reference")
903  {
904  // store NULL pointer to GOPPRR::CGraph in non properties map
905  NonProperties[ PropertyChildAttributeMap["oid"] ] = nullptr;
906 
907  } // if (CurrentPropertyChildName == "graph-reference")
908  else if (CurrentPropertyChildName == "object-reference")
909  {
910  // store NULL pointer to GOPPRR::CGraph in non properties map
911  NonProperties[ PropertyChildAttributeMap["oid"] ] = nullptr;
912 
913  } // else if (CurrentPropertyChildName == "object-reference")
914  else if (CurrentPropertyChildName == "port-reference")
915  {
916  // store NULL pointer to GOPPRR::CGraph in non properties map
917  NonProperties[ PropertyChildAttributeMap["oid"] ] = nullptr;
918 
919  } // else if (CurrentPropertyChildName == "port-reference")
920  else if (CurrentPropertyChildName == "role-reference")
921  {
922  // store NULL pointer to GOPPRR::CRole in non properties map
923  NonProperties[ PropertyChildAttributeMap["oid"] ] = nullptr;
924 
925  } // else if (CurrentPropertyChildName == "role-reference")
926  else if (CurrentPropertyChildName == "relationship-reference")
927  {
928  // store NULL pointer to GOPPRR::CRole in non properties map
929  NonProperties[ PropertyChildAttributeMap["oid"] ] = nullptr;
930 
931  } // else if (CurrentPropertyChildName == "relationship-reference")
932  else
933  {
934  // create error message and throw exception
935  ErrorMessage << "unexpected XML element in <gopprr:property> in line ";
936  ErrorMessage << pPropertyXMLChildElement->get_line();
937  throw (DSM::Error::CParser(ErrorMessage.str()));
938 
939  } // else
940 
941  } // if (pPropertyXMLChildElement != 0)
942  else if (pPropertyXMLChildTextNode != 0)
943  {
944  // store text as value of property
945  PropertyValue = pPropertyXMLChildTextNode->get_content();
946 
947  } // else if (pPropertyXMLChildTextNode != 0)
948 
949  } // for (x = PropertyChildNodes.begin(); x != PropertyChildNodes.end(); x++)
950 
951 
952  // finally create GOPPRR::CProperty object
953  Properties[ PropertyAttributeMap["oid"] ] = ::GOPPRR::CProperty(PropertyAttributeMap["oid"],
954  PropertyAttributeMap["type"],
955  PropertyValue,
956  NonProperties);
957  // Bouml preserved body end 0009C302
958 
959 } // void CGOPPRRTransformer::CreatePropertyIterative() throw(DSM::Error::CException)
960 
961 
962 
963 
964 
965 void CGOPPRRTransformer::CreateObjectIterative(::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph >& Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort >& Ports, std::map< ::std::string, ::GOPPRR::CRole >& Roles, std::map< ::std::string, ::GOPPRR::CRelationship >& Relationships) throw(DSM::Error::CException)
966 
967 {
968  // Bouml preserved body begin 0009C402
969  ::xmlpp::Element::AttributeList::iterator x(0);
970  ::xmlpp::Node::NodeList::iterator y(0);
971  ::xmlpp::Node::NodeList::iterator z(0);
972  ::xmlpp::Element::AttributeList ObjectAttributes;
973  ::xmlpp::Element::AttributeList ObjectChildAttributes;
974  ::xmlpp::Element::AttributeList DecompositonChildAttributes;
975  ::xmlpp::Node::NodeList ObjectNodes(pXMLElement->get_children());
976  ::xmlpp::Node::NodeList DecompositonNodes;
977  ::xmlpp::Element* pObjectChildXMLElement(0);
978  ::xmlpp::Element* pDecompositionChildXMLElement(0);
979  ::std::map< ::std::string, ::std::string> ObjectAttributeMap;
980  ::std::map< ::std::string, ::std::string> ObjectChildAttributeMap;
981  ::std::map< ::std::string, ::std::string> DecompositionChildAttributeMap;
982  ::std::map< ::std::string, ::GOPPRR::CProperty* > ObjectProperties;
983  ::std::string ChildElementName;
984  ::std::string DecompositionChildElementName;
985  ::std::stringstream ErrorMessage;
986  ::GOPPRR::CGraph* pDecomposition(0);
987  ::std::map< ::std::string, ::GOPPRR::CGraph* > Explosions;
988 
989 
990 
991 
992  // get all XML attributed of current element
993  ObjectAttributes = pXMLElement->get_attributes();
994 
995  // process all attributes
996  for (x = ObjectAttributes.begin(); x != ObjectAttributes.end(); x++)
997  {
998  // store current attribute in map
999  ObjectAttributeMap[(*x)->get_name()] = (*x)->get_value();
1000 
1001  } // for (x = ObjectAttributes.begin(); x != ObjectAttributes.end(); x++)
1002 
1003 
1004 
1005  // process all child nodes of graph element
1006  for (y = ObjectNodes.begin(); y != ObjectNodes.end(); y++)
1007  {
1008  // try to convert xmlpp node into element
1009  pObjectChildXMLElement = dynamic_cast< ::xmlpp::Element* >(*y);
1010 
1011  // check, if node could be converted
1012  if (pObjectChildXMLElement != 0)
1013  {
1014  // get XML name of current element
1015  ChildElementName = pObjectChildXMLElement->get_name();
1016 
1017  // get all attributes of current element
1018  ObjectChildAttributes = pObjectChildXMLElement->get_attributes();
1019 
1020  // process all attributes of current element
1021  for (x = ObjectChildAttributes.begin(); x != ObjectChildAttributes.end(); x++)
1022  {
1023  // store current attribute in map
1024  ObjectChildAttributeMap[(*x)->get_name()] = (*x)->get_value();
1025 
1026  } // for (x = ObjectChildAttributes.begin(); x != ObjectChildAttributes.end(); x++)
1027 
1028 
1029  // evaluate name of current XML element
1030  if (ChildElementName == "property-reference")
1031  {
1032  // store pointer to GOPPRR::CProperty object for this object
1033  ObjectProperties[ ObjectChildAttributeMap["oid"] ] = &(Properties[ ObjectChildAttributeMap["oid"] ]);
1034 
1035  } // if (ChildElementName == "property-reference")
1036  else if (ChildElementName == "decomposition")
1037  {
1038  // get all child nodes of this decomposition
1039  DecompositonNodes = pObjectChildXMLElement->get_children();
1040 
1041  // process all decomposition child nodes
1042  for (z = DecompositonNodes.begin(); z != DecompositonNodes.end(); z++)
1043  {
1044  // try to convert current node in element
1045  pDecompositionChildXMLElement = dynamic_cast< ::xmlpp::Element* >(*z);
1046 
1047  // check, if current node is element (ignore others)
1048  if (pDecompositionChildXMLElement != 0)
1049  {
1050  // get all attributes of current child element
1051  DecompositonChildAttributes = pDecompositionChildXMLElement->get_attributes();
1052 
1053  // process all attributes of current element
1054  for (x = DecompositonChildAttributes.begin(); x != DecompositonChildAttributes.end(); x++)
1055  {
1056  // store current attribute in map
1057  DecompositionChildAttributeMap[(*x)->get_name()] = (*x)->get_value();
1058 
1059  } // for (x = DecompositonChildAttributes.begin(); x != DecompositonChildAttributes.end(); x++)
1060 
1061  // get name of current decomposition child element
1062  DecompositionChildElementName = pDecompositionChildXMLElement->get_name();
1063 
1064  // evaluate name of current decomposition child
1065  if (DecompositionChildElementName == "graph-reference")
1066  {
1067  try
1068  {
1069  // store pointer to temporaily graph object (to be replaced and deleted later)
1070  pDecomposition = new ::GOPPRR::CGraph(DecompositionChildAttributeMap["oid"]);
1071 
1072  } // try
1073  catch (const ::std::bad_alloc& Exception)
1074  {
1075  // create error message and throw exception
1076  ErrorMessage << "error while allocating memory for temporarly graph object: ";
1077  ErrorMessage << Exception.what();
1078  throw (DSM::Error::CParser(ErrorMessage.str()));
1079 
1080  } // catch (const ::std::bad_alloc& Exception)
1081 
1082  } // if (DecompositionChildElementName == "graph-reference")
1083  else
1084  {
1085  // create error message and throw exception
1086  ErrorMessage << "unexpected XML element in <gopprr:decomposition> in line ";
1087  ErrorMessage << pDecompositionChildXMLElement->get_line();
1088  throw (DSM::Error::CParser(ErrorMessage.str()));
1089 
1090  } // else
1091 
1092  } // if (pDecompositionChildXMLElement != 0)
1093 
1094  } // for (z = DecompositonNodes.begin(); z != DecompositonNodes.end(); z++)
1095 
1096  } // else if (ChildElementName == "decomposition")
1097  else if (ChildElementName == "explosions")
1098  {
1099  // call internal helper method for creating explosions
1101  Graphs,
1102  Objects,
1103  Properties,
1104  Ports,
1105  Roles,
1106  Relationships,
1107  Explosions);
1108 
1109  } // else if (ChildElementName == "explosions")
1110  else
1111  {
1112  // create error message and throw exception
1113  ErrorMessage << "unexpected XML element in <gopprr:object> in line ";
1114  ErrorMessage << pXMLElement->get_line();
1115  throw (DSM::Error::CParser(ErrorMessage.str()));
1116 
1117  } // else
1118 
1119  } // if (pObjectChildXMLElement != 0)
1120 
1121  } // for (y = ObjectNodes.begin(); y != ObjectNodes.end(); y++)
1122 
1123 
1124 
1125  // finally create GOPPRR::CObject object here
1126  Objects[ ObjectAttributeMap["oid"] ] = ::GOPPRR::CObject(ObjectAttributeMap["oid"],
1127  ObjectAttributeMap["type"],
1128  ObjectAttributeMap["name"],
1129  ObjectProperties);
1130 
1131  // set decomposition in object
1132  Objects[ ObjectAttributeMap["oid"] ].m_pDecomposition = pDecomposition;
1133 
1134  // set explosions in object
1135  Objects[ ObjectAttributeMap["oid"] ].m_Explosions = Explosions;
1136  // Bouml preserved body end 0009C402
1137 
1138 } // void CGOPPRRTransformer::CreateObjectIterative() throw(DSM::Error::CException)
1139 
1140 
1141 
1142 
1143 
1144 void CGOPPRRTransformer::CreateExplosionIterative(::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph > & Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty > & Properties, std::map< ::std::string, ::GOPPRR::CPort > & Ports, std::map< ::std::string, ::GOPPRR::CRole > & Roles, std::map< ::std::string, ::GOPPRR::CRelationship > & Relationships, std::map< ::std::string, ::GOPPRR::CGraph* >& Explosions) throw(DSM::Error::CException)
1145 
1146 {
1147  // Bouml preserved body begin 0009C482
1148  ::xmlpp::Element::NodeList::iterator x(0);
1149  ::xmlpp::Element::AttributeList::iterator y(0);
1150  ::xmlpp::Element::AttributeList ExplosionChildAttributes;
1151  ::xmlpp::Element::NodeList ExplosionNodes;
1152  ::xmlpp::Element* pExplosionChildXMLElement(0);
1153  ::std::string ExplosionChildElementName;
1154  ::std::stringstream ErrorMessage;
1155  ::std::map< ::std::string, std::string> ExplosionChildAttributeMap;
1156 
1157 
1158 
1159  // get all child nodes of this explosion
1160  ExplosionNodes = pXMLElement->get_children();
1161 
1162  // process all explosion child nodes
1163  for (x = ExplosionNodes.begin(); x != ExplosionNodes.end(); x++)
1164  {
1165  // try to convert current node in element
1166  pExplosionChildXMLElement = dynamic_cast< ::xmlpp::Element* >(*x);
1167 
1168  // check, if current node is element (ignore others)
1169  if (pExplosionChildXMLElement != 0)
1170  {
1171  // get all attributes of current child element
1172  ExplosionChildAttributes = pExplosionChildXMLElement->get_attributes();
1173 
1174  // get name of current explosion child element
1175  ExplosionChildElementName = pExplosionChildXMLElement->get_name();
1176 
1177  // process all attributes of explosion child element
1178  for (y = ExplosionChildAttributes.begin(); y != ExplosionChildAttributes.end(); y++)
1179  {
1180  // store current attribute in map
1181  ExplosionChildAttributeMap[(*y)->get_name()] = (*y)->get_value();
1182 
1183  } // for (y = ExplosionChildAttributes(); x != ExplosionChildAttributes(); y++)
1184 
1185 
1186  // evaluate name of current explosion child
1187  if (ExplosionChildElementName == "graph-reference")
1188  {
1189  // store NULL pointer to graph as explosion
1190  Explosions[ ExplosionChildAttributeMap["oid"] ]= nullptr;
1191 
1192  } // if (ExplosionChildElementName == "graph-reference")
1193  else
1194  {
1195  // create error message and throw exception
1196  ErrorMessage << "unexpected XML element in <gopprr:decomposition> in line ";
1197  ErrorMessage << pExplosionChildXMLElement->get_line();
1198  throw (DSM::Error::CParser(ErrorMessage.str()));
1199 
1200  } // else
1201 
1202  } // if (pExplosionChildXMLElement != 0)
1203 
1204  } // for (x = ExplosionNodes.begin(); x != ExplosionNodes.end(); x++)
1205  // Bouml preserved body end 0009C482
1206 
1207 } // void CGOPPRRTransformer::CreateExplosionIterative() throw(DSM::Error::CException)
1208 
1209 
1210 
1211 
1212 
1213 void CGOPPRRTransformer::CreatePortIterative(::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph >& Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort >& Ports, std::map< ::std::string, ::GOPPRR::CRole >& Roles, std::map< ::std::string, ::GOPPRR::CRelationship >& Relationships) throw(DSM::Error::CException)
1214 
1215 {
1216  // Bouml preserved body begin 0009C582
1217  ::xmlpp::Node::NodeList::iterator x(0);
1218  ::xmlpp::Element::AttributeList::iterator y(0);
1219  ::xmlpp::Element* pPortXMLChildElement(0);
1220  ::xmlpp::Node::NodeList PortChildNodes(pXMLElement->get_children());
1221  ::xmlpp::Element::AttributeList PortAttributes(pXMLElement->get_attributes());
1222  ::xmlpp::Element::AttributeList PortChildAttributes;
1223  ::std::map< ::std::string, ::std::string > PortAttributeMap;
1224  ::std::map< ::std::string, ::std::string > PortChildAttributeMap;
1225  ::std::map< ::std::string, ::GOPPRR::CProperty* > PortProperties;
1226  ::std::string CurrentPropertyChildName;
1227  ::std::stringstream ErrorMessage;
1228 
1229 
1230 
1231  // process all attributes of port
1232  for (y = PortAttributes.begin(); y != PortAttributes.end(); y++)
1233  {
1234  // store current property in map
1235  PortAttributeMap[(*y)->get_name()] = (*y)->get_value();
1236 
1237  } // for (y = PropertyAttributes.begin(); y != PropertyAttributes.end(); y++)
1238 
1239 
1240 
1241  // process all XML child nodes of port
1242  for (x = PortChildNodes.begin(); x != PortChildNodes.end(); x++)
1243  {
1244  // try to convert current child node in element node
1245  pPortXMLChildElement = dynamic_cast< ::xmlpp::Element* >(*x);
1246 
1247  // evaluate type of node by pointer, only use elements, ignore other
1248  if (pPortXMLChildElement != 0)
1249  {
1250  // get all property child XML element
1251  PortChildAttributes = pPortXMLChildElement->get_attributes();
1252 
1253  // process all attributes of property child XML element
1254  for (y = PortChildAttributes.begin(); y != PortChildAttributes.end(); y++)
1255  {
1256  // store current property in map
1257  PortChildAttributeMap[(*y)->get_name()] = (*y)->get_value();
1258 
1259  } // for (y = PropertyChildAttributes(); y != PropertyChildAttributes(); y++)
1260 
1261 
1262  // get name of current property XML child
1263  CurrentPropertyChildName = pPortXMLChildElement->get_name();
1264 
1265  // evaluate name of current port child XML node
1266  if (CurrentPropertyChildName == "property-reference")
1267  {
1268  // store NULL pointer to GOPPRR::Property object for this object
1269  PortProperties[ PortChildAttributeMap["oid"] ] = &(Properties[ PortChildAttributeMap["oid"] ]);
1270 
1271  } // if (CurrentPropertyChildName == "property-reference")
1272  else
1273  {
1274  // create error message and throw exception
1275  ErrorMessage << "unexpected XML element in <gopprr:port> in line ";
1276  ErrorMessage << pPortXMLChildElement->get_line();
1277  throw (DSM::Error::CParser(ErrorMessage.str()));
1278 
1279  } // else
1280 
1281  } // if (pPropertyXMLChildElement != 0)
1282 
1283  } // for (x = PropertyChildNodes.begin(); x != PropertyChildNodes.end(); x++)
1284 
1285 
1286  // finally create GOPPRR::CPort object
1287  Ports[ PortAttributeMap["oid"] ] = ::GOPPRR::CPort(PortAttributeMap["oid"],
1288  PortAttributeMap["type"],
1289  PortAttributeMap["name"],
1290  PortProperties);
1291  // Bouml preserved body end 0009C582
1292 
1293 } // void CGOPPRRTransformer::CreatePortIterative() throw(DSM::Error::CException)
1294 
1295 
1296 
1297 
1298 
1299 void CGOPPRRTransformer::CreateRoleIterative(::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph >& Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort >& Ports, std::map< ::std::string, ::GOPPRR::CRole >& Roles, std::map< ::std::string, ::GOPPRR::CRelationship >& Relationships) throw(DSM::Error::CException)
1300 
1301 {
1302  // Bouml preserved body begin 0009C602
1303  ::xmlpp::Node::NodeList::iterator x(0);
1304  ::xmlpp::Element::AttributeList::iterator y(0);
1305  ::xmlpp::Node::NodeList::iterator z(0);
1306  ::xmlpp::Element* pRoleXMLChildElement(0);
1307  ::xmlpp::Node::NodeList RoleChildNodes(pXMLElement->get_children());
1308  ::xmlpp::Element::AttributeList RoleAttributes(pXMLElement->get_attributes());
1309  ::xmlpp::Element::AttributeList RoleChildAttributes;
1310  ::std::map< ::std::string, ::std::string > RoleAttributeMap;
1311  ::std::map< ::std::string, ::std::string > RoleChildAttributeMap;
1312  ::std::map< ::std::string, ::GOPPRR::CProperty* > RoleProperties;
1313  ::std::string CurrentRoleChildName;
1314  ::std::stringstream ErrorMessage;
1315  ::std::map< ::std::string, ::GOPPRR::CGraph* > Explosions;
1316 
1317 
1318 
1319  // process all attributes of role
1320  for (y = RoleAttributes.begin(); y != RoleAttributes.end(); y++)
1321  {
1322  // store current property in map
1323  RoleAttributeMap[(*y)->get_name()] = (*y)->get_value();
1324 
1325  } // for (y = PropertyAttributes.begin(); y != PropertyAttributes.end(); y++)
1326 
1327 
1328 
1329 
1330  // process all XML child nodes of role
1331  for (x = RoleChildNodes.begin(); x != RoleChildNodes.end(); x++)
1332  {
1333  // try to convert current child node in element node
1334  pRoleXMLChildElement = dynamic_cast< ::xmlpp::Element* >(*x);
1335 
1336  // evaluate type of node by pointer, only use elements, ignore other
1337  if (pRoleXMLChildElement != 0)
1338  {
1339  // get all role child XML element
1340  RoleChildAttributes = pRoleXMLChildElement->get_attributes();
1341 
1342  // process all attributes of role child XML element
1343  for (y = RoleChildAttributes.begin(); y != RoleChildAttributes.end(); y++)
1344  {
1345  // store current property in map
1346  RoleChildAttributeMap[(*y)->get_name()] = (*y)->get_value();
1347 
1348  } // for (y = PropertyChildAttributes(); y != PropertyChildAttributes(); y++)
1349 
1350 
1351  // get name of current role XML child
1352  CurrentRoleChildName = pRoleXMLChildElement->get_name();
1353 
1354  // evaluate name of current port child XML node
1355  if (CurrentRoleChildName == "property-reference")
1356  {
1357  // store NULL pointer to GOPPRR::Property object for this object
1358  RoleProperties[ RoleChildAttributeMap["oid"] ] = &(Properties[ RoleChildAttributeMap["oid"] ]);
1359 
1360  } // if (CurrentRoleChildName == "property-reference")
1361  else if (CurrentRoleChildName == "explosions")
1362  {
1363  // call internal helper method for creating explosions
1365  Graphs,
1366  Objects,
1367  Properties,
1368  Ports,
1369  Roles,
1370  Relationships,
1371  Explosions);
1372 
1373  } // else if (CurrentCurrentRoleChildNamePropertyChildName == "explosions")
1374  else
1375  {
1376  // create error message and throw exception
1377  ErrorMessage << "unexpected XML element in <gopprr:port> in line ";
1378  ErrorMessage << pRoleXMLChildElement->get_line();
1379  throw (DSM::Error::CParser(ErrorMessage.str()));
1380 
1381  } // else
1382 
1383  } // if (pPropertyXMLChildElement != 0)
1384 
1385  } // for (x = PropertyChildNodes.begin(); x != PropertyChildNodes.end(); x++)
1386 
1387 
1388  // finally create GOPPRR::CProperty object
1389  Roles[ RoleAttributeMap["oid"] ] = ::GOPPRR::CRole(RoleAttributeMap["oid"],
1390  RoleAttributeMap["type"],
1391  RoleAttributeMap["name"],
1392  RoleProperties);
1393 
1394  // set role explosions
1395  Roles[ RoleAttributeMap["oid"] ].m_Explosions = Explosions;
1396  // Bouml preserved body end 0009C602
1397 
1398 } // void CGOPPRRTransformer::CreateRoleIterative() throw(DSM::Error::CException)
1399 
1400 
1401 
1402 
1403 
1404 void CGOPPRRTransformer::CreateRelationshipIterative(::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph >& Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort >& Ports, std::map< ::std::string, ::GOPPRR::CRole >& Roles, std::map< ::std::string, ::GOPPRR::CRelationship >& Relationships) throw(DSM::Error::CException)
1405 
1406 {
1407  // Bouml preserved body begin 0009C682
1408  ::xmlpp::Node::NodeList::iterator x(0);
1409  ::xmlpp::Element::AttributeList::iterator y(0);
1410  ::xmlpp::Node::NodeList::iterator z(0);
1411  ::xmlpp::Element* pRelationshipXMLChildElement(0);
1412  ::xmlpp::Node::NodeList RelationshipChildNodes(pXMLElement->get_children());
1413  ::xmlpp::Element::AttributeList RelationshipAttributes(pXMLElement->get_attributes());
1414  ::xmlpp::Element::AttributeList RelationshipChildAttributes;
1415  ::std::map< ::std::string, ::std::string > RelationshipAttributeMap;
1416  ::std::map< ::std::string, ::std::string > RelationshipChildAttributeMap;
1417  ::std::map< ::std::string, ::GOPPRR::CProperty* > RelationshipProperties;
1418  ::std::string CurrentRelationshipChildName;
1419  ::std::stringstream ErrorMessage;
1420  ::std::map< ::std::string, ::GOPPRR::CGraph* > Explosions;
1421 
1422 
1423 
1424  // process all attributes of relationship
1425  for (y = RelationshipAttributes.begin(); y != RelationshipAttributes.end(); y++)
1426  {
1427  // store current property in map
1428  RelationshipAttributeMap[(*y)->get_name()] = (*y)->get_value();
1429 
1430  } // for (y = PropertyAttributes.begin(); y != PropertyAttributes.end(); y++)
1431 
1432 
1433 
1434  // process all XML child nodes of relationship
1435  for (x = RelationshipChildNodes.begin(); x != RelationshipChildNodes.end(); x++)
1436  {
1437  // try to convert current child node in element node
1438  pRelationshipXMLChildElement = dynamic_cast< ::xmlpp::Element* >(*x);
1439 
1440  // evaluate type of node by pointer, only use elements, ignore other
1441  if (pRelationshipXMLChildElement != 0)
1442  {
1443  // get all property child XML element
1444  RelationshipChildAttributes = pRelationshipXMLChildElement->get_attributes();
1445 
1446  // process all attributes of property child XML element
1447  for (y = RelationshipChildAttributes.begin(); y != RelationshipChildAttributes.end(); y++)
1448  {
1449  // store current property in map
1450  RelationshipChildAttributeMap[(*y)->get_name()] = (*y)->get_value();
1451 
1452  } // for (y = PropertyChildAttributes(); y != PropertyChildAttributes(); y++)
1453 
1454 
1455  // get name of current relationship XML child
1456  CurrentRelationshipChildName = pRelationshipXMLChildElement->get_name();
1457 
1458  // evaluate name of current relationship child XML node
1459  if (CurrentRelationshipChildName == "property-reference")
1460  {
1461  // store reference to GOPPRR::Property object for this object
1462  RelationshipProperties[ RelationshipChildAttributeMap["oid"] ] = &(Properties[ RelationshipChildAttributeMap["oid"] ]);
1463 
1464  } // if (CurrentPropertyChildName == "property-reference")
1465  else if (CurrentRelationshipChildName == "explosions")
1466  {
1467  // call internal helper method for creating explosions
1468  ::DSM::CGOPPRRTransformer::CreateExplosionIterative(pRelationshipXMLChildElement,
1469  Graphs,
1470  Objects,
1471  Properties,
1472  Ports,
1473  Roles,
1474  Relationships,
1475  Explosions);
1476 
1477  } // else if (CurrentRelationshipChildName == "explosions")
1478  else
1479  {
1480  // create error message and throw exception
1481  ErrorMessage << "unexpected XML element in <gopprr:port> in line ";
1482  ErrorMessage << pRelationshipXMLChildElement->get_line();
1483  throw (DSM::Error::CParser(ErrorMessage.str()));
1484 
1485  } // else
1486 
1487  } // if (pPropertyXMLChildElement != 0)
1488 
1489  } // for (x = PropertyChildNodes.begin(); x != PropertyChildNodes.end(); x++)
1490 
1491 
1492  // finally create GOPPRR::CProperty object
1493  Relationships[ RelationshipAttributeMap["oid"] ] = ::GOPPRR::CRelationship(RelationshipAttributeMap["oid"],
1494  RelationshipAttributeMap["type"],
1495  RelationshipAttributeMap["name"],
1496  RelationshipProperties);
1497 
1498  // set role explosions
1499  Relationships[ RelationshipAttributeMap["oid"] ].m_Explosions = Explosions;
1500  // Bouml preserved body end 0009C682
1501 
1502 } // void CGOPPRRTransformer::CreateRelationshipIterative() throw(DSM::Error::CException)
1503 
1504 
1505 
1506 
1507 
1508 void CGOPPRRTransformer::CreateGraphIterative(::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph > & Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort > & Ports, std::map< ::std::string, ::GOPPRR::CRole > & Roles, std::map< ::std::string, ::GOPPRR::CRelationship > & Relationships, bool& bRoot) throw(DSM::Error::CException)
1509 
1510 {
1511  // Bouml preserved body begin 0009C702
1512  ::xmlpp::Element::AttributeList::iterator x(0);
1513  ::xmlpp::Node::NodeList::iterator y(0);
1514  ::xmlpp::Node::NodeList::iterator z(0);
1515  ::xmlpp::Node::NodeList::iterator u(0);
1516  ::xmlpp::NodeSet::iterator v(0);
1517  ::xmlpp::Element::AttributeList CurrentAttributes(pXMLElement->get_attributes());
1518  ::xmlpp::Element::AttributeList ContentChildAttributes;
1519  ::xmlpp::Element::AttributeList BindingChildAttributes;
1520  ::xmlpp::Element::AttributeList ConnectionChildAttributes;
1521  ::xmlpp::Node::NodeList GraphNodes(pXMLElement->get_children());
1522  ::xmlpp::Node::NodeList BindingNodes;
1523  ::xmlpp::Node::NodeList ConnectionNodes;
1524  ::xmlpp::Node::NodeList ContentNodes;
1525  ::xmlpp::Element* pConnectionXMLElement(0);
1526  ::xmlpp::Element* pConnectionXMLChildElement(0);
1527  ::xmlpp::Element* pGraphChildXMLElement(0);
1528  ::xmlpp::Element* pContentXMLChildNode(0);
1529  ::xmlpp::Element* pBindingXMLChildNode(0);
1530  ::std::vector< ::GOPPRR::CConnection::CCall > CurrentCalls;
1531  ::std::stringstream ErrorMessage;
1532  ::std::string CurrentElement;
1533  ::std::string CurrentBindingElement;
1534  ::std::string CurrentConnectionElement;
1535  ::std::string CurrentContentElement;
1536  ::std::map< ::std::string, std::string > GraphAttributeMap;
1537  ::std::map< ::std::string, std::string > CurrentElementAttributeMap;
1538  ::std::map< ::std::string, std::string > XPathElementAttributeMap;
1539  ::std::map< ::std::string, std::string > BindingChildAttributeMap;
1540  ::std::map< ::std::string, std::string > ContentChildAttributeMap;
1541  ::std::map< ::std::string, std::string > ConnectionChildAttributeMap;
1542  ::std::map< ::std::string, ::GOPPRR::CObject* > GraphObjects;
1543  ::std::map< ::std::string, ::GOPPRR::CPort* > GraphPorts;
1544  ::std::map< ::std::string, ::GOPPRR::CProperty* > GraphProperties;
1545  ::std::map< ::std::string, ::GOPPRR::CRole* > GraphRoles;
1546  ::std::map< ::std::string, ::GOPPRR::CRelationship* > GraphRelationships;
1547  ::std::vector< ::GOPPRR::CBinding > GraphBindings;
1548  ::std::vector< ::GOPPRR::CGraphicalContainer > Containers;
1549  ::GOPPRR::CRelationship* pCurrentRelationship(0);
1550  ::GOPPRR::CObject* pCurrentContainer(0);
1551  ::std::map< ::std::string, ::GOPPRR::CObject* > CurrentContainedObjects;
1552  ::std::map< ::std::string, ::GOPPRR::CRelationship* > CurrentContainedRelationships;
1553 
1554 
1555 
1556 
1557  // process all attributes of current graph XML element
1558  for (x = CurrentAttributes.begin(); x != CurrentAttributes.end(); x++)
1559  {
1560  // store current attribute in map
1561  GraphAttributeMap[(*x)->get_name()] = (*x)->get_value();
1562 
1563  } // for (x = CurrentAttributes.begin(); x != CurrentAttributes.end(); x++)
1564 
1565 
1566 
1567  // set root graph flag
1568  bRoot = (GraphAttributeMap["root"] == "true");
1569 
1570  // process all child nodes of current graph node
1571  for (y = GraphNodes.begin(); y != GraphNodes.end(); y++)
1572  {
1573  // try to convert current XML node in element
1574  pGraphChildXMLElement = dynamic_cast< ::xmlpp::Element* >(*y);
1575 
1576  // check, if current node is element (ignore non elements)
1577  if (pGraphChildXMLElement != 0)
1578  {
1579  // get name of current XML element
1580  CurrentElement = (*y)->get_name();
1581 
1582  // get all attributes from current XMl element
1583  CurrentAttributes = pGraphChildXMLElement->get_attributes();
1584 
1585  // process all attributes of current graph child XML element
1586  for (x = CurrentAttributes.begin(); x != CurrentAttributes.end(); x++)
1587  {
1588  // store current attribute in map
1589  CurrentElementAttributeMap[(*x)->get_name()] = (*x)->get_value();
1590 
1591  } // for (x = CurrentAttributes.begin(); x != CurrentAttributes.end(); x++)
1592 
1593  // check XML name of current element for further proceedings
1594  if (CurrentElement == "object-reference")
1595  {
1596  // store reference to GOPPRR::CObject object for this graph
1597  GraphObjects[ CurrentElementAttributeMap["oid"] ] = &(Objects[ CurrentElementAttributeMap["oid"] ]);
1598 
1599  } // if (CurrenElement == ":object-reference")
1600  else if (CurrentElement == "port-reference")
1601  {
1602  // store reference to GOPPRR::CPort object for this graph
1603  GraphPorts[ CurrentElementAttributeMap["oid"] ] = &(Ports[ CurrentElementAttributeMap["oid"] ]);
1604 
1605  } // else if (CurrentElement == ":port-reference")
1606  else if (CurrentElement == "property-reference")
1607  {
1608  // store reference to GOPPRR::CProperty object for this graph
1609  GraphProperties[ CurrentElementAttributeMap["oid"] ] = &(Properties[ CurrentElementAttributeMap["oid"] ]);
1610 
1611  } // else if (CurrentElement == ":property-reference")
1612  else if (CurrentElement == "role-reference")
1613  {
1614  // store reference to GOPPRR::CRole object for this graph
1615  GraphRoles[ CurrentElementAttributeMap["oid"] ] = &(Roles[CurrentElementAttributeMap["oid"] ]);
1616 
1617  } // else if (CurrentElement == ":role-reference")
1618  else if (CurrentElement == "relationship-reference")
1619  {
1620  // store reference to GOPPRR::CRelationship object for this graph
1621  GraphRelationships[ CurrentElementAttributeMap["oid"] ] = &(Relationships[ CurrentElementAttributeMap["oid"] ]);
1622 
1623  } // else if (CurrentElement == "relationship-reference")
1624  else if (CurrentElement == "graphical-content")
1625  {
1626  // reset container and container objects
1627  pCurrentContainer = 0;
1628  CurrentContainedObjects.clear();
1629  CurrentContainedRelationships.clear();
1630 
1631  // get all child nodes of content XML element
1632  ContentNodes = pGraphChildXMLElement->get_children();
1633 
1634  // check, if at least two child nodes exist
1635  if (ContentNodes.size() < 2)
1636  {
1637  // create error message and throw exception
1638  ErrorMessage << "not enough child XML elements for <gopprr:relationship-reference> in line ";
1639  ErrorMessage << pGraphChildXMLElement->get_line();
1640  throw (DSM::Error::CParser(ErrorMessage.str()));
1641 
1642  } // if (ContentNodes.size() < 2)
1643 
1644  // process all content child nodes
1645  for (z = ContentNodes.begin(); z != ContentNodes.end(); z++)
1646  {
1647  // try to convert current content child node in XML element
1648  pContentXMLChildNode = dynamic_cast< ::xmlpp::Element* >(*z);
1649 
1650  // check, if child node could be converted
1651  if (pContentXMLChildNode != 0)
1652  {
1653  // get all attributes of content child
1654  ContentChildAttributes = pContentXMLChildNode->get_attributes();
1655 
1656  // process all attributes of graphical content element
1657  for (x = ContentChildAttributes.begin(); x != ContentChildAttributes.end(); x++)
1658  {
1659  // store current attribute in map
1660  ContentChildAttributeMap[(*x)->get_name()] = (*x)->get_value();
1661 
1662  } // for (x = ContentChildAttributes(); x != ContentChildAttributes(); x++)
1663 
1664  // get name of current content child element
1665  CurrentContentElement = pContentXMLChildNode->get_name();
1666 
1667  // check name of current element
1668  if (CurrentContentElement == "object-reference")
1669  {
1670  // check, if container reference was yet set
1671  if (pCurrentContainer == 0)
1672  {
1673  // store pointer of current object as container
1674  pCurrentContainer = &(Objects[ ContentChildAttributeMap["oid"] ]);
1675 
1676  } // if (pCurrentContainer == 0)
1677  else
1678  {
1679  // store pointer to current object as contained object
1680  CurrentContainedObjects[ ContentChildAttributeMap["oid"] ] = &(Objects[ ContentChildAttributeMap["oid"] ]);
1681 
1682  } // else
1683 
1684  } // if (CurrentContentElement == "object-reference")
1685  else if (CurrentContentElement == "relationship-reference")
1686  {
1687  // store pointer to current relationship as contgained relationship
1688  CurrentContainedRelationships[ ContentChildAttributeMap["oid"] ] = &(Relationships[ ContentChildAttributeMap["oid"] ]);
1689 
1690  } // else if (CurrentContentElement == "object-reference")
1691  else
1692  {
1693  // create error message and throw exception
1694  ErrorMessage << "unexpected XML element in <gopprr:graphical-content> in line ";
1695  ErrorMessage << pContentXMLChildNode->get_line();
1696  throw (DSM::Error::CParser(ErrorMessage.str()));
1697 
1698  } // else
1699 
1700  } // if (pContentXMLChildNode != 0)
1701 
1702  } // for (z = ContentNodes.begin(); z != ContentNodes.end(); z++)
1703 
1704  // creation of graphical content object
1705  Containers.push_back(::GOPPRR::CGraphicalContainer(pCurrentContainer, CurrentContainedObjects));
1706 
1707  } // else if (CurrentElement == "graphical-content")
1708  else if (CurrentElement == "binding")
1709  {
1710  // get all children XML elements of current binding XML element
1711  BindingNodes = pGraphChildXMLElement->get_children();
1712 
1713  // process all binding XML children
1714  for (z = BindingNodes.begin(); z != BindingNodes.end(); z++)
1715  {
1716  // try to convert node to XML element
1717  pBindingXMLChildNode = dynamic_cast< ::xmlpp::Element* >(*z);
1718 
1719  // check, if node could be converted
1720  if (pBindingXMLChildNode != 0)
1721  {
1722  // get name of current binding XML child
1723  CurrentBindingElement = pBindingXMLChildNode->get_name();
1724 
1725  // get attributes of current binding child element
1726  BindingChildAttributes =pBindingXMLChildNode->get_attributes();
1727 
1728  // process all attributes
1729  for (x = BindingChildAttributes.begin(); x != BindingChildAttributes.end(); x++)
1730  {
1731  // store current attribute in map
1732  BindingChildAttributeMap[ (*x)->get_name() ] = (*x)->get_value();
1733 
1734  } // for (x = BindingChildAttributes.begin(); x != BindingChuldAttributes.end(); x++)
1735 
1736  // check XML name of current binding child
1737  if (CurrentBindingElement == "connection")
1738  {
1739  // reset connection calls
1740  CurrentCalls.clear();
1741 
1742  // get all children XML elements of current connection XML element
1743  ConnectionNodes = pBindingXMLChildNode->get_children();
1744 
1745  // check, if connection element has at least 4 children
1746  if (ConnectionNodes.size() < 4)
1747  {
1748  // create error message and throw exception
1749  ErrorMessage << "not enough child XML elements for <gopprr:connection> in line ";
1750  ErrorMessage << pBindingXMLChildNode->get_line();
1751  throw (DSM::Error::CParser(ErrorMessage.str()));
1752 
1753  } // if (ConnectionNodes.size() < 4)
1754 
1755  // process all connection XML children
1756  for (u = ConnectionNodes.begin(); u != ConnectionNodes.end(); u ++)
1757  {
1758  // try to convert current connection child node into XML element
1759  pConnectionXMLChildElement = dynamic_cast< ::xmlpp::Element* >(*u);
1760 
1761  // check, if current connection child node is element
1762  if (pConnectionXMLChildElement != 0)
1763  {
1764  // get name of current connection XML child
1765  CurrentConnectionElement = (*u)->get_name();
1766 
1767  // get all attributes of connection child element
1768  ConnectionChildAttributes = pConnectionXMLChildElement->get_attributes();
1769 
1770  // process connection child node attributes
1771  for (x = ConnectionChildAttributes.begin(); x != ConnectionChildAttributes.end(); x++)
1772  {
1773  // store current attribute in map
1774  ConnectionChildAttributeMap[ (*x)->get_name() ] = (*x)->get_value();
1775 
1776  } // for (x = ConnectionChildAttributes.begin(); x != ConnectionChildAttributes.end(); x++)
1777 
1778 
1779  // check XML name of current element for further proceedings
1780  if (CurrentConnectionElement == "object-reference")
1781  {
1782  // create new connection call
1783  CurrentCalls.push_back(::GOPPRR::CConnection::CCall(&Objects[ ConnectionChildAttributeMap["oid"] ], 0, 0));
1784 
1785  } // if (CurrentConnectionElement == ":object-reference")
1786  else if (CurrentConnectionElement == "port-reference")
1787  {
1788  // store pointer to port in current connection call
1789  CurrentCalls[ CurrentCalls.size()-1 ].m_pPort = &(Ports[ ConnectionChildAttributeMap["oid"] ]);
1790 
1791  } // else if (CurrentConnectionElement == ":port-reference")
1792  else if (CurrentConnectionElement == "role-reference")
1793  {
1794  // store pointer to port in current connection call
1795  CurrentCalls[ CurrentCalls.size()-1 ].m_pRole = &(Roles[ ConnectionChildAttributeMap["oid"] ]);
1796 
1797  } // else if (CurrentConnectionElement == ":role-reference")
1798  else
1799  {
1800  // create error message and throw exception
1801  ErrorMessage << "unexpected XML element in <gopprr:connection> in line ";
1802  ErrorMessage << pConnectionXMLElement->get_line();
1803  throw (DSM::Error::CParser(ErrorMessage.str()));
1804 
1805  } // else
1806 
1807  } // if (pConnectionXMLChildElement != 0)
1808 
1809  } // for (u = ConnectionElements.begin(); u != ConnectionElements.end(); u ++)
1810 
1811  } // if (CurrentBindingElement == "connection")
1812  else if (CurrentBindingElement == "relationship-reference")
1813  {
1814  // store pointer to current relationship
1815  pCurrentRelationship = &(Relationships[ BindingChildAttributeMap["oid"] ]);
1816 
1817  } // else if (CurrentBindingElement == "relationship-reference")
1818  else
1819  {
1820  // create error message and throw exception
1821  ErrorMessage << "unexpected XML element in <gopprr:binding> in line ";
1822  ErrorMessage << pBindingXMLChildNode->get_line();
1823  throw (DSM::Error::CParser(ErrorMessage.str()));
1824 
1825  } // else
1826 
1827  } // if (pBindingXMLChildNode != 0)
1828 
1829  } // for (z = BindingElements.begin(); z != BindingElements.end(); z++)
1830 
1831  // create GOPPRR::CBinding object and add it to graph bindings
1832  GraphBindings.push_back(::GOPPRR::CBinding(pCurrentRelationship, ::GOPPRR::CConnection(CurrentCalls)));
1833 
1834  } // else if (CurrentElement == "binding")
1835  else
1836  {
1837  // create error message and throw exception
1838  ErrorMessage << "unexpected XML element in <gopprr:project> in line ";
1839  ErrorMessage << pXMLElement->get_line();
1840  throw (DSM::Error::CParser(ErrorMessage.str()));
1841 
1842  } // else
1843 
1844  } // if (pGraphChildXMLElement != 0)
1845 
1846  } // for (y = GraphElements.begin(); y != GraphElements.end(); y++)
1847 
1848 
1849  // finally create GOPPRR::CGraph object here
1850  Graphs[ GraphAttributeMap["oid"] ] = ::GOPPRR::CGraph(GraphAttributeMap["oid"],
1851  GraphAttributeMap["type"],
1852  GraphAttributeMap["name"],
1853  GraphProperties,
1854  GraphBindings,
1855  Containers,
1856  GraphObjects,
1857  GraphPorts,
1858  GraphRelationships,
1859  GraphRoles);
1860  // Bouml preserved body end 0009C702
1861 
1862 } // void CGOPPRRTransformer::CreateGraphIterative() throw(DSM::Error::CException)
1863 
1864 
1865 
1866 
1867 
1868 void CGOPPRRTransformer::CreateGraph(::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph > & Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort > & Ports, std::map< ::std::string, ::GOPPRR::CRole > & Roles, std::map< ::std::string, ::GOPPRR::CRelationship > & Relationships, bool& bRoot) throw(DSM::Error::CException)
1869 
1870 {
1871  // Bouml preserved body begin 00038282
1872  ::xmlpp::Element::AttributeList::iterator x(0);
1873  ::xmlpp::Node::NodeList::iterator y(0);
1874  ::xmlpp::Node::NodeList::iterator z(0);
1875  ::xmlpp::Node::NodeList::iterator u(0);
1876  ::xmlpp::NodeSet::iterator v(0);
1877  ::xmlpp::Element::AttributeList CurrentAttributes(pXMLElement->get_attributes());
1878  ::xmlpp::Element::AttributeList ContentChildAttributes;
1879  ::xmlpp::Element::AttributeList BindingChildAttributes;
1880  ::xmlpp::Element::AttributeList ConnectionChildAttributes;
1881  ::xmlpp::Node::NodeList GraphNodes(pXMLElement->get_children());
1882  ::xmlpp::Node::NodeList BindingNodes;
1883  ::xmlpp::Node::NodeList ConnectionNodes;
1884  ::xmlpp::Node::NodeList ContentNodes;
1885  ::xmlpp::Element* pConnectionXMLElement(0);
1886  ::xmlpp::Element* pConnectionXMLChildElement(0);
1887  ::xmlpp::Element* pGraphChildXMLElement(0);
1888  ::xmlpp::Element* pContentXMLChildNode(0);
1889  ::xmlpp::Element* pBindingXMLChildNode(0);
1890  ::std::vector< ::GOPPRR::CConnection::CCall > CurrentCalls;
1891  ::std::stringstream ErrorMessage;
1892  ::std::string CurrentElement;
1893  ::std::string CurrentBindingElement;
1894  ::std::string CurrentConnectionElement;
1895  ::std::string CurrentContentElement;
1896  ::std::map< ::std::string, std::string > GraphAttributeMap;
1897  ::std::map< ::std::string, std::string > CurrentElementAttributeMap;
1898  ::std::map< ::std::string, std::string > XPathElementAttributeMap;
1899  ::std::map< ::std::string, std::string > BindingChildAttributeMap;
1900  ::std::map< ::std::string, std::string > ContentChildAttributeMap;
1901  ::std::map< ::std::string, std::string > ConnectionChildAttributeMap;
1902  ::std::map< ::std::string, ::GOPPRR::CObject* > GraphObjects;
1903  ::std::map< ::std::string, ::GOPPRR::CPort* > GraphPorts;
1904  ::std::map< ::std::string, ::GOPPRR::CProperty* > GraphProperties;
1905  ::std::map< ::std::string, ::GOPPRR::CRole* > GraphRoles;
1906  ::std::map< ::std::string, ::GOPPRR::CRelationship* > GraphRelationships;
1907  ::std::vector< ::GOPPRR::CBinding > GraphBindings;
1908  ::std::vector< ::GOPPRR::CGraphicalContainer > Containers;
1909  ::GOPPRR::CRelationship* pCurrentRelationship(0);
1910  ::GOPPRR::CObject* pCurrentContainer(0);
1911  ::std::map< ::std::string, ::GOPPRR::CObject* > CurrentContainedObjects;
1912  ::std::map< ::std::string, ::GOPPRR::CRelationship* > CurrentContainedRelationships;
1913 
1914 
1915 
1916 
1917  // process all attributes of current graph XML element
1918  for (x = CurrentAttributes.begin(); x != CurrentAttributes.end(); x++)
1919  {
1920  // store current attribute in map
1921  GraphAttributeMap[(*x)->get_name()] = (*x)->get_value();
1922 
1923  } // for (x = CurrentAttributes.begin(); x != CurrentAttributes.end(); x++)
1924 
1925  // check, if current graph already exists in project
1926  if (Graphs.find( GraphAttributeMap["oid"] ) == Graphs.end())
1927  {
1928  // create plain graph object with same oid to avoid regeneration by recursion
1929  Graphs[ GraphAttributeMap["oid"] ] = ::GOPPRR::CGraph( GraphAttributeMap["oid"] );
1930 
1931  // set root graph flag
1932  bRoot = (GraphAttributeMap["root"] == "true");
1933 
1934  // process all child nodes of current graph node
1935  for (y = GraphNodes.begin(); y != GraphNodes.end(); y++)
1936  {
1937  // try to convert current XML node in element
1938  pGraphChildXMLElement = dynamic_cast< ::xmlpp::Element* >(*y);
1939 
1940  // check, if current node is element (ignore non elements)
1941  if (pGraphChildXMLElement != 0)
1942  {
1943  // get name of current XML element
1944  CurrentElement = (*y)->get_name();
1945 
1946  // get all attributes from current XMl element
1947  CurrentAttributes = pGraphChildXMLElement->get_attributes();
1948 
1949  // process all attributes of current graph child XML element
1950  for (x = CurrentAttributes.begin(); x != CurrentAttributes.end(); x++)
1951  {
1952  // store current attribute in map
1953  CurrentElementAttributeMap[(*x)->get_name()] = (*x)->get_value();
1954 
1955  } // for (x = CurrentAttributes.begin(); x != CurrentAttributes.end(); x++)
1956 
1957  // check XML name of current element for further proceedings
1958  if (CurrentElement == "object-reference")
1959  {
1960  // call internal helper method for creating objects
1961  ::DSM::CGOPPRRTransformer::CreateObject(CurrentElementAttributeMap["oid"], pGraphChildXMLElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
1962 
1963  // store reference to GOPPRR::CObject object for this graph
1964  GraphObjects[CurrentElementAttributeMap["oid"]] = &(Objects[CurrentElementAttributeMap["oid"]]);
1965 
1966  } // if (CurrenElement == ":object-reference")
1967  else if (CurrentElement == "port-reference")
1968  {
1969  // call internal helper method for creating ports
1970  ::DSM::CGOPPRRTransformer::CreatePort(CurrentElementAttributeMap["oid"], pGraphChildXMLElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
1971 
1972  // store reference to GOPPRR::CPort object for this graph
1973  GraphPorts[CurrentElementAttributeMap["oid"]] = &(Ports[CurrentElementAttributeMap["oid"]]);
1974 
1975  } // else if (CurrentElement == ":port-reference")
1976  else if (CurrentElement == "property-reference")
1977  {
1978  // call internal helper method for creating properties
1979  ::DSM::CGOPPRRTransformer::CreateProperty(CurrentElementAttributeMap["oid"], pGraphChildXMLElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
1980 
1981  // store reference to GOPPRR::CProperty object for this graph
1982  GraphProperties[CurrentElementAttributeMap["oid"]] = &(Properties[CurrentElementAttributeMap["oid"]]);
1983 
1984  } // else if (CurrentElement == ":property-reference")
1985  else if (CurrentElement == "role-reference")
1986  {
1987  // call internal helper method for creating roles
1988  ::DSM::CGOPPRRTransformer::CreateRole(CurrentElementAttributeMap["oid"], pGraphChildXMLElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
1989 
1990  // store reference to GOPPRR::CRole object for this graph
1991  GraphRoles[CurrentElementAttributeMap["oid"]] = &(Roles[CurrentElementAttributeMap["oid"]]);
1992 
1993  } // else if (CurrentElement == ":role-reference")
1994  else if (CurrentElement == "relationship-reference")
1995  {
1996  // call internal helper method for creating relationships
1997  ::DSM::CGOPPRRTransformer::CreateRelationship(CurrentElementAttributeMap["oid"], pGraphChildXMLElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
1998 
1999  // store reference to GOPPRR::CRelationship object for this graph
2000  GraphRelationships[CurrentElementAttributeMap["oid"]] = &(Relationships[CurrentElementAttributeMap["oid"]]);
2001 
2002  } // else if (CurrentElement == "relationship-reference")
2003  else if (CurrentElement == "graphical-content")
2004  {
2005  // reset container and container objects
2006  pCurrentContainer = 0;
2007  CurrentContainedObjects.clear();
2008  CurrentContainedRelationships.clear();
2009 
2010  // get all child nodes of content XML element
2011  ContentNodes = pGraphChildXMLElement->get_children();
2012 
2013  // check, if at least two child nodes exist
2014  if (ContentNodes.size() < 2)
2015  {
2016  // create error message and throw exception
2017  ErrorMessage << "not enough child XML elements for <gopprr:relationship-reference> in line ";
2018  ErrorMessage << pGraphChildXMLElement->get_line();
2019  throw (DSM::Error::CParser(ErrorMessage.str()));
2020 
2021  } // if (ContentNodes.size() < 2)
2022 
2023  // process all content child nodes
2024  for (z = ContentNodes.begin(); z != ContentNodes.end(); z++)
2025  {
2026  // try to convert current content child node in XML element
2027  pContentXMLChildNode = dynamic_cast< ::xmlpp::Element* >(*z);
2028 
2029  // check, if child node could be converted
2030  if (pContentXMLChildNode != 0)
2031  {
2032  // get all attributes of content child
2033  ContentChildAttributes = pContentXMLChildNode->get_attributes();
2034 
2035  // process all attributes of graphical content element
2036  for (x = ContentChildAttributes.begin(); x != ContentChildAttributes.end(); x++)
2037  {
2038  // store current attribute in map
2039  ContentChildAttributeMap[(*x)->get_name()] = (*x)->get_value();
2040 
2041  } // for (x = ContentChildAttributes(); x != ContentChildAttributes(); x++)
2042 
2043  // get name of current content child element
2044  CurrentContentElement = pContentXMLChildNode->get_name();
2045 
2046  // check name of current element
2047  if (CurrentContentElement == "object-reference")
2048  {
2049  // call internal helper method for creating objects
2050  ::DSM::CGOPPRRTransformer::CreateObject(ContentChildAttributeMap["oid"], pContentXMLChildNode, Graphs, Objects, Properties, Ports, Roles, Relationships);
2051 
2052  // check, if container reference was yet set
2053  if (pCurrentContainer == 0)
2054  {
2055  // store pointer of current object as container
2056  pCurrentContainer = &(Objects[ ContentChildAttributeMap["oid"] ]);
2057 
2058  } // if (pCurrentContainer == 0)
2059  else
2060  {
2061  // store pointer to current object as contained object
2062  CurrentContainedObjects[ ContentChildAttributeMap["oid"] ] = &(Objects[ ContentChildAttributeMap["oid"] ]);
2063 
2064  } // else
2065 
2066  } // if (CurrentContentElement == "object-reference")
2067  else if (CurrentContentElement == "relationship-reference")
2068  {
2069  // call internal helper method for creating relationships
2070  ::DSM::CGOPPRRTransformer::CreateRelationship(ContentChildAttributeMap["oid"], pContentXMLChildNode, Graphs, Objects, Properties, Ports, Roles, Relationships);
2071 
2072  // store pointer to current relationship as contgained relationship
2073  CurrentContainedRelationships[ ContentChildAttributeMap["oid"] ] = &(Relationships[ ContentChildAttributeMap["oid"] ]);
2074 
2075  } // else if (CurrentContentElement == "object-reference")
2076  else
2077  {
2078  // create error message and throw exception
2079  ErrorMessage << "unexpected XML element in <gopprr:graphical-content> in line ";
2080  ErrorMessage << pContentXMLChildNode->get_line();
2081  throw (DSM::Error::CParser(ErrorMessage.str()));
2082 
2083  } // else
2084 
2085  } // if (pContentXMLChildNode != 0)
2086 
2087  } // for (z = ContentNodes.begin(); z != ContentNodes.end(); z++)
2088 
2089  // creation of graphical content object
2090  Containers.push_back(::GOPPRR::CGraphicalContainer(pCurrentContainer, CurrentContainedObjects));
2091 
2092  } // else if (CurrentElement == "graphical-content")
2093  else if (CurrentElement == "binding")
2094  {
2095  // get all children XML elements of current binding XML element
2096  BindingNodes = pGraphChildXMLElement->get_children();
2097 
2098  // process all binding XML children
2099  for (z = BindingNodes.begin(); z != BindingNodes.end(); z++)
2100  {
2101  // try to convert node to XML element
2102  pBindingXMLChildNode = dynamic_cast< ::xmlpp::Element* >(*z);
2103 
2104  // check, if node could be converted
2105  if (pBindingXMLChildNode != 0)
2106  {
2107  // get name of current binding XML child
2108  CurrentBindingElement = pBindingXMLChildNode->get_name();
2109 
2110  // get attributes of current binding child element
2111  BindingChildAttributes =pBindingXMLChildNode->get_attributes();
2112 
2113  // process all attributes
2114  for (x = BindingChildAttributes.begin(); x != BindingChildAttributes.end(); x++)
2115  {
2116  // store current attribute in map
2117  BindingChildAttributeMap[ (*x)->get_name() ] = (*x)->get_value();
2118 
2119  } // for (x = BindingChildAttributes.begin(); x != BindingChuldAttributes.end(); x++)
2120 
2121  // check XML name of current binding child
2122  if (CurrentBindingElement == "connection")
2123  {
2124  // reset connection calls
2125  CurrentCalls.clear();
2126 
2127  // get all children XML elements of current connection XML element
2128  ConnectionNodes = pBindingXMLChildNode->get_children();
2129 
2130  // check, if connection element has at least 4 children
2131  if (ConnectionNodes.size() < 4)
2132  {
2133  // create error message and throw exception
2134  ErrorMessage << "not enough child XML elements for <gopprr:connection> in line ";
2135  ErrorMessage << pBindingXMLChildNode->get_line();
2136  throw (DSM::Error::CParser(ErrorMessage.str()));
2137 
2138  } // if (ConnectionNodes.size() < 4)
2139 
2140  // process all connection XML children
2141  for (u = ConnectionNodes.begin(); u != ConnectionNodes.end(); u ++)
2142  {
2143  // try to convert current connection child node into XML element
2144  pConnectionXMLChildElement = dynamic_cast< ::xmlpp::Element* >(*u);
2145 
2146  // check, if current connection child node is element
2147  if (pConnectionXMLChildElement != 0)
2148  {
2149  // get name of current connection XML child
2150  CurrentConnectionElement = (*u)->get_name();
2151 
2152  // get all attributes of connection child element
2153  ConnectionChildAttributes = pConnectionXMLChildElement->get_attributes();
2154 
2155  // process connection child node attributes
2156  for (x = ConnectionChildAttributes.begin(); x != ConnectionChildAttributes.end(); x++)
2157  {
2158  // store current attribute in map
2159  ConnectionChildAttributeMap[ (*x)->get_name() ] = (*x)->get_value();
2160 
2161  } // for (x = ConnectionChildAttributes.begin(); x != ConnectionChildAttributes.end(); x++)
2162 
2163 
2164  // check XML name of current element for further proceedings
2165  if (CurrentConnectionElement == "object-reference")
2166  {
2167  // call internal helper method for creating objects
2168  ::DSM::CGOPPRRTransformer::CreateObject(ConnectionChildAttributeMap["oid"], pConnectionXMLChildElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
2169 
2170  // create new connection call
2171  CurrentCalls.push_back(::GOPPRR::CConnection::CCall(&Objects[ ConnectionChildAttributeMap["oid"] ], 0, 0));
2172 
2173  } // if (CurrentConnectionElement == ":object-reference")
2174  else if (CurrentConnectionElement == "port-reference")
2175  {
2176  // call internal helper method for creating ports
2177  ::DSM::CGOPPRRTransformer::CreatePort(ConnectionChildAttributeMap["oid"], pConnectionXMLChildElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
2178 
2179  // store pointer to port in current connection call
2180  CurrentCalls[ CurrentCalls.size()-1 ].m_pPort = &(Ports[ ConnectionChildAttributeMap["oid"] ]);
2181 
2182  } // else if (CurrentConnectionElement == ":port-reference")
2183  else if (CurrentConnectionElement == "role-reference")
2184  {
2185  // call internal helper method for creating roles
2186  ::DSM::CGOPPRRTransformer::CreateRole(ConnectionChildAttributeMap["oid"], pConnectionXMLChildElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
2187 
2188  // store pointer to port in current connection call
2189  CurrentCalls[ CurrentCalls.size()-1 ].m_pRole = &(Roles[ ConnectionChildAttributeMap["oid"] ]);
2190 
2191  } // else if (CurrentConnectionElement == ":role-reference")
2192  else
2193  {
2194  // create error message and throw exception
2195  ErrorMessage << "unexpected XML element in <gopprr:connection> in line ";
2196  ErrorMessage << pConnectionXMLElement->get_line();
2197  throw (DSM::Error::CParser(ErrorMessage.str()));
2198 
2199  } // else
2200 
2201  } // if (pConnectionXMLChildElement != 0)
2202 
2203  } // for (u = ConnectionElements.begin(); u != ConnectionElements.end(); u ++)
2204 
2205  } // if (CurrentBindingElement == "connection")
2206  else if (CurrentBindingElement == "relationship-reference")
2207  {
2208  // call internal helper method for creating relationships
2209  ::DSM::CGOPPRRTransformer::CreateRelationship(BindingChildAttributeMap["oid"], pBindingXMLChildNode, Graphs, Objects, Properties, Ports, Roles, Relationships);
2210 
2211  // store pointer to current relationship
2212  pCurrentRelationship = &(Relationships[ BindingChildAttributeMap["oid"] ]);
2213 
2214  } // else if (CurrentBindingElement == "relationship-reference")
2215  else
2216  {
2217  // create error message and throw exception
2218  ErrorMessage << "unexpected XML element in <gopprr:binding> in line ";
2219  ErrorMessage << pBindingXMLChildNode->get_line();
2220  throw (DSM::Error::CParser(ErrorMessage.str()));
2221 
2222  } // else
2223 
2224  } // if (pBindingXMLChildNode != 0)
2225 
2226  } // for (z = BindingElements.begin(); z != BindingElements.end(); z++)
2227 
2228  // create GOPPRR::CBinding object and add it to graph bindings
2229  GraphBindings.push_back(::GOPPRR::CBinding(pCurrentRelationship, ::GOPPRR::CConnection(CurrentCalls)));
2230 
2231  } // else if (CurrentElement == "binding")
2232  else
2233  {
2234  // create error message and throw exception
2235  ErrorMessage << "unexpected XML element in <gopprr:project> in line ";
2236  ErrorMessage << pXMLElement->get_line();
2237  throw (DSM::Error::CParser(ErrorMessage.str()));
2238 
2239  } // else
2240 
2241  } // if (pGraphChildXMLElement != 0)
2242 
2243  } // for (y = GraphElements.begin(); y != GraphElements.end(); y++)
2244 
2245 
2246  // finally create GOPPRR::CGraph object here
2247  Graphs[ GraphAttributeMap["oid"] ] = ::GOPPRR::CGraph(GraphAttributeMap["oid"], GraphAttributeMap["type"], GraphAttributeMap["name"], GraphProperties, GraphBindings, Containers, GraphObjects, GraphPorts, GraphRelationships, GraphRoles);
2248 
2249  } // if (Graphs.find( GraphAttributeMap["oid"] ) == Graphs.end())
2250  // Bouml preserved body end 00038282
2251 
2252 } // void CGOPPRRTransformer::CreateGraph() throw(DSM::Error::CException)
2253 
2254 
2255 
2256 
2257 
2258 void CGOPPRRTransformer::CreateGraph(const ::std::string& OID, ::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph >& Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort >& Ports, std::map< ::std::string, ::GOPPRR::CRole >& Roles, std::map< ::std::string, ::GOPPRR::CRelationship >& Relationships, bool& bRoot) throw(DSM::Error::CException)
2259 
2260 {
2261  // Bouml preserved body begin 00042102
2262  ::xmlpp::Element* pXPathXMLElement(0);
2263  ::std::stringstream ErrorMessage;
2264 
2265 
2266  // check, if current graph does not yet exist as C++ object
2267  if (Graphs.find(OID) == Graphs.end())
2268  {
2269  // try to find object element by XPath and OID
2270  pXPathXMLElement = ::DSM::CGOPPRRTransformer::FindElementByXPath(pXMLElement, "/gopprr:project/gopprr:graph", OID);
2271 
2272  // check, if XML element was found
2273  if (pXPathXMLElement != 0)
2274  {
2275  // call internal helper method for creating graphs
2276  ::DSM::CGOPPRRTransformer::CreateGraph(pXPathXMLElement, Graphs, Objects, Properties, Ports, Roles, Relationships, bRoot);
2277 
2278  } // if (pXPathXMLElement != 0)
2279  else
2280  {
2281  // create error message and throw exception
2282  ErrorMessage << "no <gopprr:graph> element found for <gopprr::graph-reference> in XML line ";
2283  ErrorMessage << pXMLElement->get_line();
2284  throw (DSM::Error::CParser(ErrorMessage.str()));
2285 
2286  } // else
2287 
2288  } // if (Graphs.find(OID) == Graphs.end())
2289  // Bouml preserved body end 00042102
2290 
2291 } // void CGOPPRRTransformer::CreateGraph() throw(DSM::Error::CException)
2292 
2293 
2294 
2295 
2296 
2297 void CGOPPRRTransformer::CreateObject(::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph >& Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort >& Ports, std::map< ::std::string, ::GOPPRR::CRole >& Roles, std::map< ::std::string, ::GOPPRR::CRelationship >& Relationships) throw(DSM::Error::CException)
2298 
2299 {
2300  // Bouml preserved body begin 00039C02
2301  bool bRootGraph(false);
2302  ::xmlpp::Element::AttributeList::iterator x(0);
2303  ::xmlpp::Node::NodeList::iterator y(0);
2304  ::xmlpp::Node::NodeList::iterator z(0);
2305  ::xmlpp::Element::AttributeList ObjectAttributes;
2306  ::xmlpp::Element::AttributeList ObjectChildAttributes;
2307  ::xmlpp::Element::AttributeList DecompositonChildAttributes;
2308  ::xmlpp::Node::NodeList ObjectNodes(pXMLElement->get_children());
2309  ::xmlpp::Node::NodeList DecompositonNodes;
2310  ::xmlpp::Element* pObjectChildXMLElement(0);
2311  ::xmlpp::Element* pDecompositionChildXMLElement(0);
2312  ::std::map< ::std::string, ::std::string> ObjectAttributeMap;
2313  ::std::map< ::std::string, ::std::string> ObjectChildAttributeMap;
2314  ::std::map< ::std::string, ::std::string> DecompositionChildAttributeMap;
2315  ::std::map< ::std::string, ::GOPPRR::CProperty* > ObjectProperties;
2316  ::std::string ChildElementName;
2317  ::std::string DecompositionChildElementName;
2318  ::std::stringstream ErrorMessage;
2319  ::GOPPRR::CGraph* pDecomposition(0);
2320  ::std::map< ::std::string, ::GOPPRR::CGraph* > Explosions;
2321 
2322 
2323 
2324 
2325  // get all XML attributed of current element
2326  ObjectAttributes = pXMLElement->get_attributes();
2327 
2328  // process all attributes
2329  for (x = ObjectAttributes.begin(); x != ObjectAttributes.end(); x++)
2330  {
2331  // store current attribute in map
2332  ObjectAttributeMap[(*x)->get_name()] = (*x)->get_value();
2333 
2334  } // for (x = ObjectAttributes.begin(); x != ObjectAttributes.end(); x++)
2335 
2336  // check, if current object already exists
2337  if (Objects.find( ObjectAttributeMap["oid"] ) == Objects.end())
2338  {
2339  // create plain object object with same oid to avoid regeneration by recursion
2340  Objects[ ObjectAttributeMap["oid"] ] = ::GOPPRR::CObject( ObjectAttributeMap["oid"] );
2341 
2342  // process all child nodes of graph element
2343  for (y = ObjectNodes.begin(); y != ObjectNodes.end(); y++)
2344  {
2345  // try to convert xmlpp node into element
2346  pObjectChildXMLElement = dynamic_cast< ::xmlpp::Element* >(*y);
2347 
2348  // check, if node could be converted
2349  if (pObjectChildXMLElement != 0)
2350  {
2351  // get XML name of current element
2352  ChildElementName = pObjectChildXMLElement->get_name();
2353 
2354  // get all attributes of current element
2355  ObjectChildAttributes = pObjectChildXMLElement->get_attributes();
2356 
2357  // process all attributes of current element
2358  for (x = ObjectChildAttributes.begin(); x != ObjectChildAttributes.end(); x++)
2359  {
2360  // store current attribute in map
2361  ObjectChildAttributeMap[(*x)->get_name()] = (*x)->get_value();
2362 
2363  } // for (x = ObjectChildAttributes.begin(); x != ObjectChildAttributes.end(); x++)
2364 
2365 
2366  // evaluate name of current XML element
2367  if (ChildElementName == "property-reference")
2368  {
2369  // call internal helper method for creating properties
2370  ::DSM::CGOPPRRTransformer::CreateProperty(ObjectChildAttributeMap["oid"], pObjectChildXMLElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
2371 
2372  // store reference to GOPPRR::Property object for this object
2373  ObjectProperties[ObjectChildAttributeMap["oid"]] = &(Properties[ObjectChildAttributeMap["oid"]]);
2374 
2375  } // if (ChildElementName == "property-reference")
2376  else if (ChildElementName == "decomposition")
2377  {
2378  // get all child nodes of this decomposition
2379  DecompositonNodes = pObjectChildXMLElement->get_children();
2380 
2381  // process all decomposition child nodes
2382  for (z = DecompositonNodes.begin(); z != DecompositonNodes.end(); z++)
2383  {
2384  // try to convert current node in element
2385  pDecompositionChildXMLElement = dynamic_cast< ::xmlpp::Element* >(*z);
2386 
2387  // check, if current node is element (ignore others)
2388  if (pDecompositionChildXMLElement != 0)
2389  {
2390  // get all attributes of current child element
2391  DecompositonChildAttributes = pDecompositionChildXMLElement->get_attributes();
2392 
2393  // process all attributes of current element
2394  for (x = DecompositonChildAttributes.begin(); x != DecompositonChildAttributes.end(); x++)
2395  {
2396  // store current attribute in map
2397  DecompositionChildAttributeMap[(*x)->get_name()] = (*x)->get_value();
2398 
2399  } // for (x = DecompositonChildAttributes.begin(); x != DecompositonChildAttributes.end(); x++)
2400 
2401  // get name of current decomposition child element
2402  DecompositionChildElementName = pDecompositionChildXMLElement->get_name();
2403 
2404  // evaluate name of current decomposition child
2405  if (DecompositionChildElementName == "graph-reference")
2406  {
2407  // call internal helper method for creating graphs
2408  ::DSM::CGOPPRRTransformer::CreateGraph(DecompositionChildAttributeMap["oid"], pDecompositionChildXMLElement, Graphs, Objects, Properties, Ports, Roles, Relationships, bRootGraph);
2409 
2410  // store pointer to graph as decomposition
2411  pDecomposition = &(Graphs[DecompositionChildAttributeMap["oid"]]);
2412 
2413  } // if (DecompositionChildElementName == "graph-reference")
2414  else
2415  {
2416  // create error message and throw exception
2417  ErrorMessage << "unexpected XML element in <gopprr:decomposition> in line ";
2418  ErrorMessage << pDecompositionChildXMLElement->get_line();
2419  throw (DSM::Error::CParser(ErrorMessage.str()));
2420 
2421  } // else
2422 
2423  } // if (pDecompositionChildXMLElement != 0)
2424 
2425  } // for (z = DecompositonNodes.begin(); z != DecompositonNodes.end(); z++)
2426 
2427  } // else if (ChildElementName == "decomposition")
2428  else if (ChildElementName == "explosions")
2429  {
2430  // call internal helper method for creating explosions
2431  ::DSM::CGOPPRRTransformer::CreateExplosion(pObjectChildXMLElement, Graphs, Objects, Properties, Ports, Roles, Relationships, Explosions);
2432 
2433  } // else if (ChildElementName == "explosions")
2434  else
2435  {
2436  // create error message and throw exception
2437  ErrorMessage << "unexpected XML element in <gopprr:object> in line ";
2438  ErrorMessage << pXMLElement->get_line();
2439  throw (DSM::Error::CParser(ErrorMessage.str()));
2440 
2441  } // else
2442 
2443  } // if (pObjectChildXMLElement != 0)
2444 
2445  } // for (y = ObjectNodes.begin(); y != ObjectNodes.end(); y++)
2446 
2447 
2448 
2449  // finally create GOPPRR::CObject object here
2450  Objects[ObjectAttributeMap["oid"]] = ::GOPPRR::CObject(ObjectAttributeMap["oid"], ObjectAttributeMap["type"], ObjectAttributeMap["name"], ObjectProperties);
2451 
2452  // set decomposition in object
2453  Objects[ObjectAttributeMap["oid"]].m_pDecomposition = pDecomposition;
2454 
2455  // set explosions in object
2456  Objects[ObjectAttributeMap["oid"]].m_Explosions = Explosions;
2457 
2458  } // if (Objects.find( ObjectAttributeMap["oid"] ) == Objects.end())
2459  // Bouml preserved body end 00039C02
2460 
2461 } // void CGOPPRRTransformer::CreateObject() throw(DSM::Error::CException)
2462 
2463 
2464 
2465 
2466 
2467 void CGOPPRRTransformer::CreateObject(const ::std::string& OID, ::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph >& Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort >& Ports, std::map< ::std::string, ::GOPPRR::CRole >& Roles, std::map< ::std::string, ::GOPPRR::CRelationship >& Relationships) throw(DSM::Error::CException)
2468 
2469 {
2470  // Bouml preserved body begin 00040582
2471  ::xmlpp::Element* pXPathXMLElement(0);
2472  ::std::stringstream ErrorMessage;
2473 
2474 
2475  // check, if current object does not yet exist as C++ object
2476  if (Objects.find(OID) == Objects.end())
2477  {
2478 
2479  // try to find object element by XPath and OID
2480  pXPathXMLElement = ::DSM::CGOPPRRTransformer::FindElementByXPath(pXMLElement, "/gopprr:project/gopprr:object", OID);
2481 
2482  // check, if XML element was found
2483  if (pXPathXMLElement != 0)
2484  {
2485  // call internal helper method for creating objects
2486  ::DSM::CGOPPRRTransformer::CreateObject(pXPathXMLElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
2487 
2488  } // if (pXPathXMLElement != 0)
2489  else
2490  {
2491  // create error message and throw exception
2492  ErrorMessage << "no <gopprr:object> element found for <gopprr:object-reference> in XML line ";
2493  ErrorMessage << pXMLElement->get_line();
2494  throw (DSM::Error::CParser(ErrorMessage.str()));
2495 
2496  } // else
2497 
2498  } // if (Objects.find(OID) == Objects.end())
2499  // Bouml preserved body end 00040582
2500 
2501 } // void CGOPPRRTransformer::CreateObject() throw(DSM::Error::CException)
2502 
2503 
2504 
2505 
2506 
2507 void CGOPPRRTransformer::CreatePort(::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph >& Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort >& Ports, std::map< ::std::string, ::GOPPRR::CRole >& Roles, std::map< ::std::string, ::GOPPRR::CRelationship >& Relationships) throw(DSM::Error::CException)
2508 
2509 {
2510  // Bouml preserved body begin 0003CF82
2511  ::xmlpp::Node::NodeList::iterator x(0);
2512  ::xmlpp::Element::AttributeList::iterator y(0);
2513  ::xmlpp::Element* pPortXMLChildElement(0);
2514  ::xmlpp::Node::NodeList PortChildNodes(pXMLElement->get_children());
2515  ::xmlpp::Element::AttributeList PortAttributes(pXMLElement->get_attributes());
2516  ::xmlpp::Element::AttributeList PortChildAttributes;
2517  ::std::map< ::std::string, ::std::string > PortAttributeMap;
2518  ::std::map< ::std::string, ::std::string > PortChildAttributeMap;
2519  ::std::map< ::std::string, ::GOPPRR::CProperty* > PortProperties;
2520  ::std::string CurrentPropertyChildName;
2521  ::std::stringstream ErrorMessage;
2522 
2523 
2524 
2525  // process all attributes of port
2526  for (y = PortAttributes.begin(); y != PortAttributes.end(); y++)
2527  {
2528  // store current property in map
2529  PortAttributeMap[(*y)->get_name()] = (*y)->get_value();
2530 
2531  } // for (y = PropertyAttributes.begin(); y != PropertyAttributes.end(); y++)
2532 
2533  // check, if current port exists already
2534  if (Ports.find( PortAttributeMap["oid"] ) == Ports.end())
2535  {
2536  // create plain port object with same oid to avoid regeneration by recursion
2537  Ports[ PortAttributeMap["oid"] ] = ::GOPPRR::CPort( PortAttributeMap["oid"] );
2538 
2539  // process all XML child nodes of port
2540  for (x = PortChildNodes.begin(); x != PortChildNodes.end(); x++)
2541  {
2542  // try to convert current child node in element node
2543  pPortXMLChildElement = dynamic_cast< ::xmlpp::Element* >(*x);
2544 
2545  // evaluate type of node by pointer, only use elements, ignore other
2546  if (pPortXMLChildElement != 0)
2547  {
2548  // get all property child XML element
2549  PortChildAttributes = pPortXMLChildElement->get_attributes();
2550 
2551  // process all attributes of property child XML element
2552  for (y = PortChildAttributes.begin(); y != PortChildAttributes.end(); y++)
2553  {
2554  // store current property in map
2555  PortChildAttributeMap[(*y)->get_name()] = (*y)->get_value();
2556 
2557  } // for (y = PropertyChildAttributes(); y != PropertyChildAttributes(); y++)
2558 
2559 
2560  // get name of current property XML child
2561  CurrentPropertyChildName = pPortXMLChildElement->get_name();
2562 
2563  // evaluate name of current port child XML node
2564  if (CurrentPropertyChildName == "property-reference")
2565  {
2566  // call internal helper method for creating properties
2567  ::DSM::CGOPPRRTransformer::CreateProperty(PortChildAttributeMap["oid"], pPortXMLChildElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
2568 
2569  // store reference to GOPPRR::Property object for this object
2570  PortProperties[PortChildAttributeMap["oid"]] = &(Properties[PortChildAttributeMap["oid"]]);
2571 
2572  } // if (CurrentPropertyChildName == "property-reference")
2573  else
2574  {
2575  // create error message and throw exception
2576  ErrorMessage << "unexpected XML element in <gopprr:port> in line ";
2577  ErrorMessage << pPortXMLChildElement->get_line();
2578  throw (DSM::Error::CParser(ErrorMessage.str()));
2579 
2580  } // else
2581 
2582  } // if (pPropertyXMLChildElement != 0)
2583 
2584  } // for (x = PropertyChildNodes.begin(); x != PropertyChildNodes.end(); x++)
2585 
2586 
2587  // finally create GOPPRR::CPort object
2588  Ports[ PortAttributeMap["oid"] ] = ::GOPPRR::CPort(PortAttributeMap["oid"], PortAttributeMap["type"], PortAttributeMap["name"], PortProperties);
2589 
2590  } // if (Ports.find( PortAttributeMap["oid"] ) == Ports.end())
2591  // Bouml preserved body end 0003CF82
2592 
2593 } // void CGOPPRRTransformer::CreatePort() throw(DSM::Error::CException)
2594 
2595 
2596 
2597 
2598 
2599 void CGOPPRRTransformer::CreatePort(const ::std::string& OID, ::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph >& Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort >& Ports, std::map< ::std::string, ::GOPPRR::CRole >& Roles, std::map< ::std::string, ::GOPPRR::CRelationship >& Relationships) throw(DSM::Error::CException)
2600 
2601 {
2602  // Bouml preserved body begin 00041F82
2603  ::xmlpp::Element* pXPathXMLElement(0);
2604  ::std::stringstream ErrorMessage;
2605 
2606 
2607  // check, if current port does not yet exist as C++ object
2608  if (Ports.find(OID) == Ports.end())
2609  {
2610  // try to find port element by XPath and OID
2611  pXPathXMLElement = ::DSM::CGOPPRRTransformer::FindElementByXPath(pXMLElement, "/gopprr:project/gopprr:port", OID);
2612 
2613  // check, if XML element was found
2614  if (pXPathXMLElement != 0)
2615  {
2616  // call internal helper method for creating ports
2617  ::DSM::CGOPPRRTransformer::CreatePort(pXPathXMLElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
2618 
2619  } // if (pXPathXMLElement != 0)
2620  else
2621  {
2622  // create error message and throw exception
2623  ErrorMessage << "no <gopprr:port> element found for <gopprr::port-reference> in XML line ";
2624  ErrorMessage << pXMLElement->get_line();
2625  throw (DSM::Error::CParser(ErrorMessage.str()));
2626 
2627  } // else
2628 
2629  } // if (Ports.find(OID) == Ports.end())
2630  // Bouml preserved body end 00041F82
2631 
2632 } // void CGOPPRRTransformer::CreatePort() throw(DSM::Error::CException)
2633 
2634 
2635 
2636 
2637 
2638 void CGOPPRRTransformer::CreateProperty(::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph >& Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort >& Ports, std::map< ::std::string, ::GOPPRR::CRole >& Roles, std::map< ::std::string, ::GOPPRR::CRelationship >& Relationships) throw(DSM::Error::CException)
2639 
2640 {
2641  // Bouml preserved body begin 0003B602
2642  bool bRootGraph(false);
2643  ::xmlpp::Node::NodeList::iterator x(0);
2644  ::xmlpp::Element::AttributeList::iterator y(0);
2645  ::xmlpp::Element* pPropertyXMLChildElement(0);
2646  ::xmlpp::TextNode* pPropertyXMLChildTextNode(0);
2647  ::xmlpp::Node::NodeList PropertyChildNodes(pXMLElement->get_children());
2648  ::xmlpp::Element::AttributeList PropertyAttributes(pXMLElement->get_attributes());
2649  ::xmlpp::Element::AttributeList PropertyChildAttributes;
2650  ::std::map< ::std::string, ::std::string > PropertyAttributeMap;
2651  ::std::map< ::std::string, ::std::string > PropertyChildAttributeMap;
2652  ::std::map< ::std::string, ::GOPPRR::CNonProperty* > NonProperties;
2653  ::std::string PropertyValue;
2654  ::std::string CurrentPropertyChildName;
2655  ::std::stringstream ErrorMessage;
2656 
2657 
2658 
2659  // process all attributes of property
2660  for (y = PropertyAttributes.begin(); y != PropertyAttributes.end(); y++)
2661  {
2662  // store current property in map
2663  PropertyAttributeMap[(*y)->get_name()] = (*y)->get_value();
2664 
2665  } // for (y = PropertyAttributes.begin(); y != PropertyAttributes.end(); y++)
2666 
2667  // check, if current property already exists
2668  if (Properties.find( PropertyAttributeMap["oid"] ) == Properties.end())
2669  {
2670  // create plain property object with same oid to avoid regeneration by recursion
2671  Properties[ PropertyAttributeMap["oid"] ] = ::GOPPRR::CProperty( PropertyAttributeMap["oid"] );
2672 
2673  // process all XML child nodes of property
2674  for (x = PropertyChildNodes.begin(); x != PropertyChildNodes.end(); x++)
2675  {
2676  // try to convert current child node in element node
2677  pPropertyXMLChildElement = dynamic_cast< ::xmlpp::Element* >(*x);
2678 
2679  // try to convert current child node in text node
2680  pPropertyXMLChildTextNode = dynamic_cast< ::xmlpp::TextNode* >(*x);
2681 
2682  // evaluate type of node by pointer, distinguish only between text node and element, ignore others
2683  if (pPropertyXMLChildElement != 0)
2684  {
2685  // get all property child XML element
2686  PropertyChildAttributes = pPropertyXMLChildElement->get_attributes();
2687 
2688  // process all attributes of property child XML element
2689  for (y = PropertyChildAttributes.begin(); y != PropertyChildAttributes.end(); y++)
2690  {
2691  // store current property in map
2692  PropertyChildAttributeMap[(*y)->get_name()] = (*y)->get_value();
2693 
2694  } // for (y = PropertyChildAttributes(); y != PropertyChildAttributes(); y++)
2695 
2696  // get name of current property XML child
2697  CurrentPropertyChildName = pPropertyXMLChildElement->get_name();
2698 
2699  // evaluate name of child node
2700  if (CurrentPropertyChildName == "graph-reference")
2701  {
2702  // call internal helper method for creating graphs (ignore root graph flag)
2703  ::DSM::CGOPPRRTransformer::CreateGraph(PropertyChildAttributeMap["oid"], pPropertyXMLChildElement, Graphs, Objects, Properties, Ports, Roles, Relationships, bRootGraph);
2704 
2705  // store pointer to GOPPRR::CGraph in non properties map
2706  NonProperties[PropertyChildAttributeMap["oid"]] = &(Graphs[PropertyChildAttributeMap["oid"]]);
2707 
2708  } // if (CurrentPropertyChildName == "graph-reference")
2709  else if (CurrentPropertyChildName == "object-reference")
2710  {
2711  // call internal helper method for creating objects
2712  ::DSM::CGOPPRRTransformer::CreateObject(PropertyChildAttributeMap["oid"], pPropertyXMLChildElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
2713 
2714  // store pointer to GOPPRR::CGraph in non properties map
2715  NonProperties[PropertyChildAttributeMap["oid"]] = &(Objects[PropertyChildAttributeMap["oid"]]);
2716 
2717  } // else if (CurrentPropertyChildName == "object-reference")
2718  else if (CurrentPropertyChildName == "port-reference")
2719  {
2720  // call internal helper method for creating ports
2721  ::DSM::CGOPPRRTransformer::CreatePort(PropertyChildAttributeMap["oid"], pPropertyXMLChildElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
2722 
2723  // store pointer to GOPPRR::CGraph in non properties map
2724  NonProperties[PropertyChildAttributeMap["oid"]] = &(Ports[PropertyChildAttributeMap["oid"]]);
2725 
2726  } // else if (CurrentPropertyChildName == "port-reference")
2727  else if (CurrentPropertyChildName == "role-reference")
2728  {
2729  // call internal helper method for creating roles
2730  ::DSM::CGOPPRRTransformer::CreateRole(PropertyChildAttributeMap["oid"], pPropertyXMLChildElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
2731 
2732  // store pointer to GOPPRR::CRole in non properties map
2733  NonProperties[PropertyChildAttributeMap["oid"]] = &(Roles[PropertyChildAttributeMap["oid"]]);;
2734 
2735  } // else if (CurrentPropertyChildName == "role-reference")
2736  else if (CurrentPropertyChildName == "relationship-reference")
2737  {
2738  // call internal helper method for creating relationship
2739  ::DSM::CGOPPRRTransformer::CreateRelationship(PropertyChildAttributeMap["oid"], pPropertyXMLChildElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
2740 
2741  // store pointer to GOPPRR::CRole in non properties map
2742  NonProperties[PropertyChildAttributeMap["oid"]] = &(Relationships[PropertyChildAttributeMap["oid"]]);;
2743 
2744  } // else if (CurrentPropertyChildName == "relationship-reference")
2745  else
2746  {
2747  // create error message and throw exception
2748  ErrorMessage << "unexpected XML element in <gopprr:property> in line ";
2749  ErrorMessage << pPropertyXMLChildElement->get_line();
2750  throw (DSM::Error::CParser(ErrorMessage.str()));
2751 
2752  } // else
2753 
2754  } // if (pPropertyXMLChildElement != 0)
2755  else if (pPropertyXMLChildTextNode != 0)
2756  {
2757  // store text as value of property
2758  PropertyValue = pPropertyXMLChildTextNode->get_content();
2759 
2760  } // else if (pPropertyXMLChildTextNode != 0)
2761 
2762  } // for (x = PropertyChildNodes.begin(); x != PropertyChildNodes.end(); x++)
2763 
2764 
2765  // finally create GOPPRR::CProperty object
2766  Properties[ PropertyAttributeMap["oid"] ] = ::GOPPRR::CProperty(PropertyAttributeMap["oid"], PropertyAttributeMap["type"], PropertyValue, NonProperties);
2767 
2768  } // if (Properties.find( PropertyAttributeMap["oid"] ) == Properties.end())
2769  // Bouml preserved body end 0003B602
2770 
2771 } // void CGOPPRRTransformer::CreateProperty() throw(DSM::Error::CException)
2772 
2773 
2774 
2775 
2776 
2777 void CGOPPRRTransformer::CreateProperty(const ::std::string& OID, ::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph >& Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort >& Ports, std::map< ::std::string, ::GOPPRR::CRole >& Roles, std::map< ::std::string, ::GOPPRR::CRelationship >& Relationships) throw(DSM::Error::CException)
2778 
2779 {
2780  // Bouml preserved body begin 00041F02
2781  ::xmlpp::Element* pXPathXMLElement(0);
2782  ::std::stringstream ErrorMessage;
2783 
2784 
2785  // check, if current property does not yet exist as C++ object
2786  if (Properties.find(OID) == Properties.end())
2787  {
2788  // try to find property element by XPath and OID
2789  pXPathXMLElement = ::DSM::CGOPPRRTransformer::FindElementByXPath(pXMLElement, "/gopprr:project/gopprr:property", OID);
2790 
2791  // check, if XML element was found
2792  if (pXPathXMLElement != 0)
2793  {
2794  // call internal helper method for creating properties
2795  ::DSM::CGOPPRRTransformer::CreateProperty(pXPathXMLElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
2796 
2797  } // if (pXPathXMLElement != 0)
2798  else
2799  {
2800  // create error message and throw exception
2801  ErrorMessage << "no <gopprr:property> element found for <gopprr::property-reference> in XML line ";
2802  ErrorMessage << pXMLElement->get_line();
2803  throw (DSM::Error::CParser(ErrorMessage.str()));
2804 
2805  } // else
2806 
2807  } // if (Properties.find(OID) == Properties.end())
2808  // Bouml preserved body end 00041F02
2809 
2810 } // void CGOPPRRTransformer::CreateProperty() throw(DSM::Error::CException)
2811 
2812 
2813 
2814 
2815 
2816 void CGOPPRRTransformer::CreateRole(::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph >& Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort >& Ports, std::map< ::std::string, ::GOPPRR::CRole >& Roles, std::map< ::std::string, ::GOPPRR::CRelationship >& Relationships) throw(DSM::Error::CException)
2817 
2818 {
2819  // Bouml preserved body begin 0003E902
2820  ::xmlpp::Node::NodeList::iterator x(0);
2821  ::xmlpp::Element::AttributeList::iterator y(0);
2822  ::xmlpp::Node::NodeList::iterator z(0);
2823  ::xmlpp::Element* pRoleXMLChildElement(0);
2824  ::xmlpp::Node::NodeList RoleChildNodes(pXMLElement->get_children());
2825  ::xmlpp::Element::AttributeList RoleAttributes(pXMLElement->get_attributes());
2826  ::xmlpp::Element::AttributeList RoleChildAttributes;
2827  ::std::map< ::std::string, ::std::string > RoleAttributeMap;
2828  ::std::map< ::std::string, ::std::string > RoleChildAttributeMap;
2829  ::std::map< ::std::string, ::GOPPRR::CProperty* > RoleProperties;
2830  ::std::string CurrentRoleChildName;
2831  ::std::stringstream ErrorMessage;
2832  ::std::map< ::std::string, ::GOPPRR::CGraph* > Explosions;
2833 
2834 
2835 
2836  // process all attributes of role
2837  for (y = RoleAttributes.begin(); y != RoleAttributes.end(); y++)
2838  {
2839  // store current property in map
2840  RoleAttributeMap[(*y)->get_name()] = (*y)->get_value();
2841 
2842  } // for (y = PropertyAttributes.begin(); y != PropertyAttributes.end(); y++)
2843 
2844  // check, if current role already exitsts
2845  if (Roles.find( RoleAttributeMap["oid"]) == Roles.end())
2846  {
2847  // create plain role object with same oid to avoid regeneration by recursion
2848  Roles[ RoleAttributeMap["oid"] ] = ::GOPPRR::CRole( RoleAttributeMap["oid"] );
2849 
2850  // process all XML child nodes of role
2851  for (x = RoleChildNodes.begin(); x != RoleChildNodes.end(); x++)
2852  {
2853  // try to convert current child node in element node
2854  pRoleXMLChildElement = dynamic_cast< ::xmlpp::Element* >(*x);
2855 
2856  // evaluate type of node by pointer, only use elements, ignore other
2857  if (pRoleXMLChildElement != 0)
2858  {
2859  // get all role child XML element
2860  RoleChildAttributes = pRoleXMLChildElement->get_attributes();
2861 
2862  // process all attributes of role child XML element
2863  for (y = RoleChildAttributes.begin(); y != RoleChildAttributes.end(); y++)
2864  {
2865  // store current property in map
2866  RoleChildAttributeMap[(*y)->get_name()] = (*y)->get_value();
2867 
2868  } // for (y = PropertyChildAttributes(); y != PropertyChildAttributes(); y++)
2869 
2870 
2871  // get name of current role XML child
2872  CurrentRoleChildName = pRoleXMLChildElement->get_name();
2873 
2874  // evaluate name of current port child XML node
2875  if (CurrentRoleChildName == "property-reference")
2876  {
2877  // call internal helper method for creating property
2878  ::DSM::CGOPPRRTransformer::CreateProperty(RoleChildAttributeMap["oid"], pRoleXMLChildElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
2879 
2880  // store reference to GOPPRR::Property object for this object
2881  RoleProperties[RoleChildAttributeMap["oid"]] = &(Properties[RoleChildAttributeMap["oid"]]);
2882 
2883  } // if (CurrentRoleChildName == "property-reference")
2884  else if (CurrentRoleChildName == "explosions")
2885  {
2886  // call internal helper method for creating explosions
2887  ::DSM::CGOPPRRTransformer::CreateExplosion(pRoleXMLChildElement, Graphs, Objects, Properties, Ports, Roles, Relationships, Explosions);
2888 
2889 
2890  } // else if (CurrentCurrentRoleChildNamePropertyChildName == "explosions")
2891  else
2892  {
2893  // create error message and throw exception
2894  ErrorMessage << "unexpected XML element in <gopprr:port> in line ";
2895  ErrorMessage << pRoleXMLChildElement->get_line();
2896  throw (DSM::Error::CParser(ErrorMessage.str()));
2897 
2898  } // else
2899 
2900  } // if (pPropertyXMLChildElement != 0)
2901 
2902  } // for (x = PropertyChildNodes.begin(); x != PropertyChildNodes.end(); x++)
2903 
2904 
2905  // finally create GOPPRR::CProperty object
2906  Roles[ RoleAttributeMap["oid"] ] = ::GOPPRR::CRole(RoleAttributeMap["oid"], RoleAttributeMap["type"], RoleAttributeMap["name"], RoleProperties);
2907 
2908  // set role explosions
2909  Roles[ RoleAttributeMap["oid"] ].m_Explosions = Explosions;
2910 
2911  } // if (Roles.find( RoleAttributeMap["oid"]) == Roles.end())
2912  // Bouml preserved body end 0003E902
2913 
2914 } // void CGOPPRRTransformer::CreateRole() throw(DSM::Error::CException)
2915 
2916 
2917 
2918 
2919 
2920 void CGOPPRRTransformer::CreateRole(const ::std::string& OID, ::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph >& Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort >& Ports, std::map< ::std::string, ::GOPPRR::CRole >& Roles, std::map< ::std::string, ::GOPPRR::CRelationship >& Relationships) throw(DSM::Error::CException)
2921 
2922 {
2923  // Bouml preserved body begin 00042002
2924  ::xmlpp::Element* pXPathXMLElement(0);
2925  ::std::stringstream ErrorMessage;
2926 
2927 
2928  // check, if current role does not yet exist as C++ object
2929  if (Roles.find(OID) == Roles.end())
2930  {
2931  // try to find role element by XPath and OID
2932  pXPathXMLElement = ::DSM::CGOPPRRTransformer::FindElementByXPath(pXMLElement, "/gopprr:project/gopprr:role", OID);
2933 
2934  // check, if XML element was found
2935  if (pXPathXMLElement != 0)
2936  {
2937  // call internal helper method for creating roles
2938  ::DSM::CGOPPRRTransformer::CreateRole(pXPathXMLElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
2939 
2940  } // if (pXPathXMLElement != 0)
2941  else
2942  {
2943  // create error message and throw exception
2944  ErrorMessage << "no <gopprr:role> element found for <gopprr::role-reference> in XML line ";
2945  ErrorMessage << pXMLElement->get_line();
2946  throw (DSM::Error::CParser(ErrorMessage.str()));
2947 
2948  } // else
2949 
2950  } // if (Roles.find(OID) == Roles.end())
2951  // Bouml preserved body end 00042002
2952 
2953 } // void CGOPPRRTransformer::CreateRole() throw(DSM::Error::CException)
2954 
2955 
2956 
2957 
2958 
2959 void CGOPPRRTransformer::CreateRelationship(::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph >& Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort >& Ports, std::map< ::std::string, ::GOPPRR::CRole >& Roles, std::map< ::std::string, ::GOPPRR::CRelationship >& Relationships) throw(DSM::Error::CException)
2960 
2961 {
2962  // Bouml preserved body begin 0003EA02
2963  ::xmlpp::Node::NodeList::iterator x(0);
2964  ::xmlpp::Element::AttributeList::iterator y(0);
2965  ::xmlpp::Node::NodeList::iterator z(0);
2966  ::xmlpp::Element* pRelationshipXMLChildElement(0);
2967  ::xmlpp::Node::NodeList RelationshipChildNodes(pXMLElement->get_children());
2968  ::xmlpp::Element::AttributeList RelationshipAttributes(pXMLElement->get_attributes());
2969  ::xmlpp::Element::AttributeList RelationshipChildAttributes;
2970  ::std::map< ::std::string, ::std::string > RelationshipAttributeMap;
2971  ::std::map< ::std::string, ::std::string > RelationshipChildAttributeMap;
2972  ::std::map< ::std::string, ::GOPPRR::CProperty* > RelationshipProperties;
2973  ::std::string CurrentRelationshipChildName;
2974  ::std::stringstream ErrorMessage;
2975  ::std::map< ::std::string, ::GOPPRR::CGraph* > Explosions;
2976 
2977 
2978 
2979  // process all attributes of relationship
2980  for (y = RelationshipAttributes.begin(); y != RelationshipAttributes.end(); y++)
2981  {
2982  // store current property in map
2983  RelationshipAttributeMap[(*y)->get_name()] = (*y)->get_value();
2984 
2985  } // for (y = PropertyAttributes.begin(); y != PropertyAttributes.end(); y++)
2986 
2987  // check, if relationship already exists
2988  if (Relationships.find( RelationshipAttributeMap["oid"] ) == Relationships.end())
2989  {
2990  // create plain relationship object with same oid to avoid regeneration by recursion
2991  Relationships[ RelationshipAttributeMap["oid"] ] = ::GOPPRR::CRelationship( RelationshipAttributeMap["oid"] );
2992 
2993  // process all XML child nodes of relationship
2994  for (x = RelationshipChildNodes.begin(); x != RelationshipChildNodes.end(); x++)
2995  {
2996  // try to convert current child node in element node
2997  pRelationshipXMLChildElement = dynamic_cast< ::xmlpp::Element* >(*x);
2998 
2999  // evaluate type of node by pointer, only use elements, ignore other
3000  if (pRelationshipXMLChildElement != 0)
3001  {
3002  // get all property child XML element
3003  RelationshipChildAttributes = pRelationshipXMLChildElement->get_attributes();
3004 
3005  // process all attributes of property child XML element
3006  for (y = RelationshipChildAttributes.begin(); y != RelationshipChildAttributes.end(); y++)
3007  {
3008  // store current property in map
3009  RelationshipChildAttributeMap[(*y)->get_name()] = (*y)->get_value();
3010 
3011  } // for (y = PropertyChildAttributes(); y != PropertyChildAttributes(); y++)
3012 
3013 
3014  // get name of current relationship XML child
3015  CurrentRelationshipChildName = pRelationshipXMLChildElement->get_name();
3016 
3017  // evaluate name of current relationship child XML node
3018  if (CurrentRelationshipChildName == "property-reference")
3019  {
3020  // call internal helper method for creating property
3021  ::DSM::CGOPPRRTransformer::CreateProperty(RelationshipChildAttributeMap["oid"], pRelationshipXMLChildElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
3022 
3023  // store reference to GOPPRR::Property object for this object
3024  RelationshipProperties[RelationshipChildAttributeMap["oid"]] = &(Properties[RelationshipChildAttributeMap["oid"]]);
3025 
3026  } // if (CurrentPropertyChildName == "property-reference")
3027  else if (CurrentRelationshipChildName == "explosions")
3028  {
3029  // call internal helper method for creating explosions
3030  ::DSM::CGOPPRRTransformer::CreateExplosion(pRelationshipXMLChildElement, Graphs, Objects, Properties, Ports, Roles, Relationships, Explosions);
3031 
3032  } // else if (CurrentRelationshipChildName == "explosions")
3033  else
3034  {
3035  // create error message and throw exception
3036  ErrorMessage << "unexpected XML element in <gopprr:port> in line ";
3037  ErrorMessage << pRelationshipXMLChildElement->get_line();
3038  throw (DSM::Error::CParser(ErrorMessage.str()));
3039 
3040  } // else
3041 
3042  } // if (pPropertyXMLChildElement != 0)
3043 
3044  } // for (x = PropertyChildNodes.begin(); x != PropertyChildNodes.end(); x++)
3045 
3046 
3047  // finally create GOPPRR::CProperty object
3048  Relationships[ RelationshipAttributeMap["oid"] ] = ::GOPPRR::CRelationship(RelationshipAttributeMap["oid"], RelationshipAttributeMap["type"], RelationshipAttributeMap["name"], RelationshipProperties);
3049 
3050  // set role explosions
3051  Relationships[ RelationshipAttributeMap["oid"] ].m_Explosions = Explosions;
3052 
3053  } // if (Relationships.find( RelationshipAttributeMap["oid"] ) == Relationships.end())
3054  // Bouml preserved body end 0003EA02
3055 
3056 } // void CGOPPRRTransformer::CreateRelationship() throw(DSM::Error::CException)
3057 
3058 
3059 
3060 
3061 
3062 void CGOPPRRTransformer::CreateRelationship(const ::std::string& OID, ::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph >& Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty >& Properties, std::map< ::std::string, ::GOPPRR::CPort >& Ports, std::map< ::std::string, ::GOPPRR::CRole >& Roles, std::map< ::std::string, ::GOPPRR::CRelationship >& Relationships) throw(DSM::Error::CException)
3063 
3064 {
3065  // Bouml preserved body begin 00042082
3066  ::xmlpp::Element* pXPathXMLElement(0);
3067  ::std::stringstream ErrorMessage;
3068 
3069 
3070  // check, if current relationship does not yet exist as C++ object
3071  if (Relationships.find(OID) == Relationships.end())
3072  {
3073  // try to find relationship element by XPath and OID
3074  pXPathXMLElement = ::DSM::CGOPPRRTransformer::FindElementByXPath(pXMLElement, "/gopprr:project/gopprr:relationship", OID);
3075 
3076  // check, if XML element was found
3077  if (pXPathXMLElement != 0)
3078  {
3079  // call internal helper method for creating relationships
3080  ::DSM::CGOPPRRTransformer::CreateRelationship(pXPathXMLElement, Graphs, Objects, Properties, Ports, Roles, Relationships);
3081 
3082  } // if (pXPathXMLElement != 0)
3083  else
3084  {
3085  // create error message and throw exception
3086  ErrorMessage << "no <gopprr:relationship> element found for <gopprr::relationship-refrenece> in XML line ";
3087  ErrorMessage << pXMLElement->get_line();
3088  throw (DSM::Error::CParser(ErrorMessage.str()));
3089 
3090  } // else
3091 
3092  } // if (Relationships.find(OID) == Relationships.end())
3093  // Bouml preserved body end 00042082
3094 
3095 } // void CGOPPRRTransformer::CreateRelationship() throw(DSM::Error::CException)
3096 
3097 
3098 
3099 
3100 
3101 void CGOPPRRTransformer::CreateExplosion(::xmlpp::Element * pXMLElement, std::map< ::std::string, ::GOPPRR::CGraph > & Graphs, std::map< ::std::string, ::GOPPRR::CObject > & Objects, std::map< ::std::string, ::GOPPRR::CProperty > & Properties, std::map< ::std::string, ::GOPPRR::CPort > & Ports, std::map< ::std::string, ::GOPPRR::CRole > & Roles, std::map< ::std::string, ::GOPPRR::CRelationship > & Relationships, std::map< ::std::string, ::GOPPRR::CGraph* >& Explosions) throw(DSM::Error::CException)
3102 
3103 {
3104  // Bouml preserved body begin 0003E982
3105  bool bRootGraph(false);
3106  ::xmlpp::Element::NodeList::iterator x(0);
3107  ::xmlpp::Element::AttributeList::iterator y(0);
3108  ::xmlpp::Element::AttributeList ExplosionChildAttributes;
3109  ::xmlpp::Element::NodeList ExplosionNodes;
3110  ::xmlpp::Element* pExplosionChildXMLElement(0);
3111  ::std::string ExplosionChildElementName;
3112  ::std::stringstream ErrorMessage;
3113  ::std::map< ::std::string, std::string> ExplosionChildAttributeMap;
3114 
3115 
3116 
3117  // get all child nodes of this explosion
3118  ExplosionNodes = pXMLElement->get_children();
3119 
3120  // process all explosion child nodes
3121  for (x = ExplosionNodes.begin(); x != ExplosionNodes.end(); x++)
3122  {
3123  // try to convert current node in element
3124  pExplosionChildXMLElement = dynamic_cast< ::xmlpp::Element* >(*x);
3125 
3126  // check, if current node is element (ignore others)
3127  if (pExplosionChildXMLElement != 0)
3128  {
3129  // get all attributes of current child element
3130  ExplosionChildAttributes = pExplosionChildXMLElement->get_attributes();
3131 
3132  // get name of current explosion child element
3133  ExplosionChildElementName = pExplosionChildXMLElement->get_name();
3134 
3135  // process all attributes of explosion child element
3136  for (y = ExplosionChildAttributes.begin(); y != ExplosionChildAttributes.end(); y++)
3137  {
3138  // store current attribute in map
3139  ExplosionChildAttributeMap[(*y)->get_name()] = (*y)->get_value();
3140 
3141  } // for (y = ExplosionChildAttributes(); x != ExplosionChildAttributes(); y++)
3142 
3143 
3144  // evaluate name of current explosion child
3145  if (ExplosionChildElementName == "graph-reference")
3146  {
3147  // call internal helper method for creating graphs
3148  ::DSM::CGOPPRRTransformer::CreateGraph(ExplosionChildAttributeMap["oid"], pExplosionChildXMLElement, Graphs, Objects, Properties, Ports, Roles, Relationships, bRootGraph);
3149 
3150  // store pointer to graph as explosion
3151  Explosions[ExplosionChildAttributeMap["oid"]]= &(Graphs[ExplosionChildAttributeMap["oid"]]);
3152 
3153  } // if (ExplosionChildElementName == "graph-reference")
3154  else
3155  {
3156  // create error message and throw exception
3157  ErrorMessage << "unexpected XML element in <gopprr:decomposition> in line ";
3158  ErrorMessage << pExplosionChildXMLElement->get_line();
3159  throw (DSM::Error::CParser(ErrorMessage.str()));
3160 
3161  } // else
3162 
3163  } // if (pExplosionChildXMLElement != 0)
3164 
3165  } // for (x = ExplosionNodes.begin(); x != ExplosionNodes.end(); x++)
3166 
3167  // Bouml preserved body end 0003E982
3168 
3169 } // void CGOPPRRTransformer::CreateExplosion() throw(DSM::Error::CException)
3170 
3171 
3172 
3173 
3174 
3175 ::xmlpp::Element* CGOPPRRTransformer::FindElementByXPath(const ::xmlpp::Element * pXMLElement, const ::std::string & XPath, const ::std::string & OID) throw()
3176 
3177 {
3178  // Bouml preserved body begin 0003B582
3179  bool bNodeFound(false);
3180  ::xmlpp::Element::AttributeList::iterator x(0);
3181  ::xmlpp::NodeSet::iterator v(0);
3182  ::xmlpp::NodeSet NodesFromXPath;
3183  ::xmlpp::Element* pCurrentXPathXMLElement(0);
3184  ::xmlpp::Element* pXPathXMLElement(0);
3185  ::xmlpp::Element::AttributeList CurrentAttributes;
3186  ::xmlpp::Node::PrefixNsMap PrefixMap;
3187  ::std::map< ::std::string, ::std::string > XPathElementAttributeMap;
3188 
3189 
3190  // create prefix map
3191  PrefixMap["gopprr"] = "http://www.GOPPRR.org";
3192 
3193  // get all possible XML object nodes from xpath
3194  NodesFromXPath = pXMLElement->find(XPath, PrefixMap);
3195 
3196  // process all nodes in xpath
3197  for (v = NodesFromXPath.begin(); v != NodesFromXPath.end() && !bNodeFound; v++)
3198  {
3199  // try to convert current node from xpath to element
3200  pCurrentXPathXMLElement = dynamic_cast< ::xmlpp::Element* >(*v);
3201 
3202  // check, if XML node is also element (ignore others)
3203  if (pCurrentXPathXMLElement != 0)
3204  {
3205  // get all attributes of current XML element
3206  CurrentAttributes = pCurrentXPathXMLElement->get_attributes();
3207 
3208  // process all attributes of current XMl element
3209  for (x = CurrentAttributes.begin(); x != CurrentAttributes.end(); x++)
3210  {
3211  // store current attribute in map
3212  XPathElementAttributeMap[(*x)->get_name()] = (*x)->get_value();
3213 
3214  } // for (x = CurrentAttributes.begin(); x != CurrentAttributes.end(); x++)
3215 
3216  // check, if current XML element is searched one (by oid)
3217  if (XPathElementAttributeMap["oid"] == OID)
3218  {
3219  // set found flag to true
3220  bNodeFound = true;
3221 
3222  // store pointer to current XML element in pointer for return value
3223  pXPathXMLElement = pCurrentXPathXMLElement;
3224 
3225  } // if (XPathElementAttributeMap["oid"] == OID)
3226 
3227  } // if (pXPathXMLElement != 0)
3228 
3229  } // for (v = NodesFromXPath.begin(); v != NodesFromXPath.end() && !bNodeFound; v++)
3230 
3231 
3232  // return pointer to XML element
3233  return pXPathXMLElement;
3234 
3235  // Bouml preserved body end 0003B582
3236 
3237 } // ::xmlpp::Element* CGOPPRRTransformer::FindElementByXPath() throw()
3238 
3239 
3240 
3241 
3242 
3243 // include XML Schema by preprocessor inline
3244 #ifndef __XML_GOPPRR_SCHEMA__
3245 #define __XML_GOPPRR_SCHEMA__
3246 #include "../GOPPRR/XML/GOPPRR_Schema.inl"
3247 #endif
3248 
3249 /*!
3250  * \brief XML schema for validation of GOPPRR model files
3251  */
3252 ::std::string CGOPPRRTransformer::m_Schema = reinterpret_cast< const char* const >(pGOPPRRXMLSchema);
3253 
3254 
3255 
3256 
3257 
3258 } // namespace DSM

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