Ginga  0.13.6
 All Classes Namespaces Functions Variables
NclPresentationControlConverter.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 NclPresentationControlConverter_H
51 #define NclPresentationControlConverter_H
52 
53 #include "ncl/reuse/ReferNode.h"
54 #include "ncl/reuse/ReferredNode.h"
55 using namespace ::br::pucrio::telemidia::ncl::reuse;
56 
57 #include "ncl/descriptor/Descriptor.h"
58 using namespace ::br::pucrio::telemidia::ncl::descriptor;
59 
60 #include "ncl/switches/DescriptorSwitch.h"
61 #include "ncl/switches/SwitchNode.h"
62 #include "ncl/switches/CompositeRule.h"
63 #include "ncl/switches/SimpleRule.h"
64 #include "ncl/switches/Rule.h"
65 #include "ncl/switches/RuleBase.h"
66 using namespace ::br::pucrio::telemidia::ncl::switches;
67 
68 #include "ncl/interfaces/Port.h"
69 using namespace ::br::pucrio::telemidia::ncl::interfaces;
70 
71 #include "ncl/util/Comparator.h"
72 using namespace ::br::pucrio::telemidia::ncl::util;
73 
74 #include "ncl/NclDocument.h"
75 using namespace ::br::pucrio::telemidia::ncl;
76 
77 #include <map>
78 #include <string>
79 #include <vector>
80 using namespace std;
81 
82 #include "../framework/ModuleParser.h"
83 #include "../framework/DocumentParser.h"
84 using namespace ::br::pucrio::telemidia::converter::framework;
85 
86 #include "../framework/ncl/NclPresentationControlParser.h"
87 using namespace ::br::pucrio::telemidia::converter::framework::ncl;
88 
89 #include "NclPresentationSpecConverter.h"
90 #include "NclComponentsConverter.h"
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 NclPresentationControlConverter : public NclPresentationControlParser {
101  // tabelas com componentes e regras de cada switch
102  // para reusar logica
103  // 1 copiar tabelas abaixo e inicializar
104  // 2 copiar os metodos:
105  // addBindRuleGroupToContentControlGroup,
106  // addCompositionContentGroupToContentControlGroup
107  // addMediaContentGroupToContentControlGroup
108  // createBindRuleGroup
109  // addContentControlGroupToContentControlGroup
110  // posCreateContentControlGroup
111  // addDescriptorGroupToDescriptorSwitchGroup
112  // addBindRuleGroupToDescriptorSwitchGroup
113  // 3 adicionar posCreateDescriptorSwitchGroup no createDescriptorSwitchGroup
114  // 3 adicionar posCreateContentControlGroup no createContentControlGroup
115  // 4 copiar adaptando posCompileContentControlGroup
116  // 4 copiar adaptando posCompileDescriptorSwitchGroup
117  private:
118  map<string, map<string, NodeEntity*>*>* switchConstituents;
119 
120  public:
121  NclPresentationControlConverter(DocumentParser *documentParser);
123 
124  vector<Node*> *getSwitchConstituents(SwitchNode *switchNode);
125  void addCompositeRuleToCompositeRule(
126  void *parentObject, void *childObject);
127 
128  void addCompositeRuleToRuleBase(void *parentObject, void *childObject);
129  void addRuleToCompositeRule(void *parentObject, void *childObject);
130  void addRuleToRuleBase(void *parentObject, void *childObject);
131  void addSwitchPortToSwitch(void *parentObject, void *childObject);
132  void *createCompositeRule(
133  DOMElement *parentElement, void *objGrandParent);
134 
135  void *createSwitch(DOMElement *parentElement, void *objGrandParent);
136  void *createRuleBase(DOMElement *parentElement, void *objGrandParent);
137  void *createRule(DOMElement *parentElement, void *objGrandParent);
138  void *createDescriptorSwitch(
139  DOMElement *parentElement, void *objGrandParent);
140 
141  void addDescriptorToDescriptorSwitch(
142  void *parentObject, void *childObject);
143 
144  void addImportBaseToRuleBase(void *parentObject, void *childObject);
145  void addBindRuleToDescriptorSwitch(
146  void *parentObject, void *childObject);
147 
148  void addBindRuleToSwitch(void *parentObject, void *childObject);
149  void addDefaultComponentToSwitch(void *parentObject, void *childObject);
150  void addDefaultDescriptorToDescriptorSwitch(
151  void *parentObject, void *childObject);
152 
153  void addContextToSwitch(void *parentObject, void *childObject);
154  void addMediaToSwitch(void *parentObject, void *childObject);
155  void addSwitchToSwitch(void *parentObject, void *childObject);
156  void addUnmappedNodesToSwitch(void *parentObject);
157 
158  private:
159  void addNodeToSwitch(SwitchNode *switchNode, NodeEntity *node);
160 
161  public:
162  void *createBindRule(DOMElement *parentElement, void *objGrandParent);
163  void *createDefaultComponent(
164  DOMElement *parentElement, void *objGrandParent);
165 
166  void *createDefaultDescriptor(
167  DOMElement *parentElement, void *objGrandParent);
168 
169  void *posCompileSwitch(DOMElement *parentElement, void *parentObject);
170 
171  private:
172  short convertComparator(string comparator);
173  };
174 }
175 }
176 }
177 }
178 }
179 
180 #endif
Definition: NclPresentationControlConverter.h:100