Ginga  0.13.6
 All Classes Namespaces Functions Variables
NclConnectorsConverter.h
1 /******************************************************************************
2 Este arquivo eh parte da implementacao do ambiente declarativo do middleware
3 Ginga (Ginga-NCL).
4 
5 Direitos Autorais Reservados (c) 1989-2007 PUC-Rio/Laboratorio TeleMidia
6 
7 Este programa eh software livre; voce pode redistribui-lo e/ou modificah-lo sob
8 os termos da Licenca Publica Geral GNU versao 2 conforme publicada pela Free
9 Software Foundation.
10 
11 Este programa eh distribuido na expectativa de que seja util, porem, SEM
12 NENHUMA GARANTIA; nem mesmo a garantia implicita de COMERCIABILIDADE OU
13 ADEQUACAO A UMA FINALIDADE ESPECIFICA. Consulte a Licenca Publica Geral do
14 GNU versao 2 para mais detalhes.
15 
16 Voce deve ter recebido uma copia da Licenca Publica Geral do GNU versao 2 junto
17 com este programa; se nao, escreva para a Free Software Foundation, Inc., no
18 endereco 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
19 
20 Para maiores informacoes:
21 ncl @ telemidia.puc-rio.br
22 http://www.ncl.org.br
23 http://www.ginga.org.br
24 http://www.telemidia.puc-rio.br
25 ******************************************************************************
26 This file is part of the declarative environment of middleware Ginga (Ginga-NCL)
27 
28 Copyright: 1989-2007 PUC-RIO/LABORATORIO TELEMIDIA, All Rights Reserved.
29 
30 This program is free software; you can redistribute it and/or modify it under
31 the terms of the GNU General Public License version 2 as published by
32 the Free Software Foundation.
33 
34 This program is distributed in the hope that it will be useful, but WITHOUT ANY
35 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
36 PARTICULAR PURPOSE. See the GNU General Public License version 2 for more
37 details.
38 
39 You should have received a copy of the GNU General Public License version 2
40 along with this program; if not, write to the Free Software
41 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
42 
43 For further information contact:
44 ncl @ telemidia.puc-rio.br
45 http://www.ncl.org.br
46 http://www.ginga.org.br
47 http://www.telemidia.puc-rio.br
48 *******************************************************************************/
49 
50 #ifndef NclConnectorsConverter_H
51 #define NclConnectorsConverter_H
52 
53 #include "ncl/Parameter.h"
54 using namespace ::br::pucrio::telemidia::ncl;
55 
56 #include "ncl/animation/Animation.h"
57 using namespace ::br::pucrio::telemidia::ncl::animation;
58 
59 #include "ncl/connectors/EventUtil.h"
60 #include "ncl/connectors/ValueAssessment.h"
61 #include "ncl/connectors/CompoundAction.h"
62 #include "ncl/connectors/CompoundCondition.h"
63 #include "ncl/connectors/CompoundStatement.h"
64 #include "ncl/connectors/CausalConnector.h"
65 #include "ncl/connectors/AttributeAssessment.h"
66 #include "ncl/connectors/AssessmentStatement.h"
67 #include "ncl/connectors/SimpleAction.h"
68 #include "ncl/connectors/SimpleCondition.h"
69 #include "ncl/connectors/ConnectorBase.h"
70 using namespace ::br::pucrio::telemidia::ncl::connectors;
71 
72 #include "ncl/util/Comparator.h"
73 using namespace ::br::pucrio::telemidia::ncl::util;
74 
75 #include "util/functions.h"
76 using namespace ::br::pucrio::telemidia::util;
77 
78 #include "ncl/NclDocument.h"
79 using namespace ::br::pucrio::telemidia::ncl;
80 
81 #include "../framework/DocumentParser.h"
82 using namespace ::br::pucrio::telemidia::converter::framework;
83 
84 #include "../framework/ncl/NclConnectorsParser.h"
85 using namespace ::br::pucrio::telemidia::converter::framework::ncl;
86 
87 //#include <stdio.h>
88 #include <map>
89 #include <vector>
90 using namespace std;
91 
92 #include <xercesc/dom/DOM.hpp>
93 XERCES_CPP_NAMESPACE_USE;
94 
95 namespace br {
96 namespace pucrio {
97 namespace telemidia {
98 namespace converter {
99 namespace ncl {
100  class NclConnectorsConverter : public NclConnectorsParser {
101  private:
102  Connector *connector;
103 
104  public:
105  NclConnectorsConverter(DocumentParser *documentParser);
106  void addCausalConnectorToConnectorBase(
107  void *parentObject, void *childObject);
108 
109  void addConnectorParamToCausalConnector(
110  void *parentObject, void *childObject);
111 
112  void addImportBaseToConnectorBase(
113  void *parentObject, void *childObject);
114 
115  void *createCausalConnector(
116  DOMElement *parentElement, void *objGrandParent);
117 
118  void *createConnectorBase(
119  DOMElement *parentElement, void *objGrandParent);
120 
121  void *createConnectorParam(
122  DOMElement *parentElement, void *objGrandParent);
123 
124  private:
125  void compileRoleInformation(Role *role, DOMElement *parentElement);
126 
127  public:
128  void *createSimpleCondition(
129  DOMElement *parentElement, void *objGrandParent);
130 
131  void *createCompoundCondition(
132  DOMElement *parentElement, void *objGrandParent);
133 
134  void *createAttributeAssessment(
135  DOMElement *parentElement, void *objGrandParent);
136 
137  void *createValueAssessment(
138  DOMElement *parentElement, void *objGrandParent);
139 
140  void *createAssessmentStatement(
141  DOMElement *parentElement, void *objGrandParent);
142 
143  void *createCompoundStatement(
144  DOMElement *parentElement, void *objGrandParent);
145 
146  void *createSimpleAction(
147  DOMElement *parentElement, void *objGrandParent);
148 
149  void *createCompoundAction(
150  DOMElement *parentElement, void *objGrandParent);
151 
152  private:
153  Parameter *getParameter(string paramName);
154  short convertActionType(string actionType);
155 
156  public:
157  static short convertEventState(string eventState);
158  void addSimpleConditionToCompoundCondition(
159  void *parentObject, void *childObject);
160 
161  void addCompoundConditionToCompoundCondition(
162  void *parentObject, void *childObject);
163 
164  void addAssessmentStatementToCompoundCondition(
165  void *parentObject, void *childObject);
166 
167  void addCompoundStatementToCompoundCondition(
168  void *parentObject, void *childObject);
169 
170  void addAttributeAssessmentToAssessmentStatement(
171  void *parentObject, void *childObject);
172 
173  void addValueAssessmentToAssessmentStatement(
174  void *parentObject, void *childObject);
175 
176  void addAssessmentStatementToCompoundStatement(
177  void *parentObject, void *childObject);
178 
179  void addCompoundStatementToCompoundStatement(
180  void *parentObject, void *childObject);
181 
182  void addSimpleActionToCompoundAction(
183  void *parentObject, void *childObject);
184 
185  void addCompoundActionToCompoundAction(
186  void *parentObject, void *childObject);
187 
188  void addSimpleConditionToCausalConnector(
189  void *parentObject, void *childObject);
190 
191  void addCompoundConditionToCausalConnector(
192  void *parentObject, void *childObject);
193 
194  void addSimpleActionToCausalConnector(
195  void *parentObject, void *childObject);
196 
197  void addCompoundActionToCausalConnector(
198  void *parentObject, void *childObject);
199 
200  void addAssessmentStatementToConstraintConnector(
201  void *parentObject, void *childObject);
202 
203  void addCompoundStatementToConstraintConnector(
204  void *parentObject, void *childObject);
205 
206  void addConstraintConnectorToConnectorBase(
207  void *parentObject, void *childObject);
208 
209  void *createConstraintConnector(
210  DOMElement *parentElement, void *objGrandParent);
211  };
212 }
213 }
214 }
215 }
216 }
217 
218 #endif