Ginga  0.13.6
 All Classes Namespaces Functions Variables
PrivateBaseContext.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 PrivateBaseContext_H_
51 #define PrivateBaseContext_H_
52 
53 #include "ncl/components/PrivateBase.h"
54 #include "ncl/components/ContextNode.h"
55 #include "ncl/components/Node.h"
56 #include "ncl/components/ReferenceContent.h"
57 using namespace ::br::pucrio::telemidia::ncl::components;
58 
59 #include "ncl/switches/Rule.h"
60 #include "ncl/switches/SwitchNode.h"
61 #include "ncl/switches/RuleBase.h"
62 using namespace ::br::pucrio::telemidia::ncl::switches;
63 
64 #include "ncl/interfaces/SwitchPort.h"
65 #include "ncl/interfaces/Anchor.h"
66 #include "ncl/interfaces/InterfacePoint.h"
67 #include "ncl/interfaces/Port.h"
68 using namespace ::br::pucrio::telemidia::ncl::interfaces;
69 
70 #include "ncl/connectors/Connector.h"
71 #include "ncl/connectors/ConnectorBase.h"
72 using namespace ::br::pucrio::telemidia::ncl::connectors;
73 
74 #include "ncl/layout/IDeviceLayout.h"
75 #include "ncl/layout/LayoutRegion.h"
76 #include "ncl/layout/RegionBase.h"
77 using namespace ::br::pucrio::telemidia::ncl::layout;
78 
79 #include "ncl/descriptor/GenericDescriptor.h"
80 #include "ncl/descriptor/DescriptorBase.h"
81 using namespace ::br::pucrio::telemidia::ncl::descriptor;
82 
83 #include "ncl/link/Link.h"
84 using namespace ::br::pucrio::telemidia::ncl::link;
85 
86 #include "ncl/transition/Transition.h"
87 #include "ncl/transition/TransitionBase.h"
88 using namespace ::br::pucrio::telemidia::ncl::transition;
89 
90 #include "ncl/Base.h"
91 #include "ncl/NclDocument.h"
92 #include "ncl/IPrivateBaseContext.h"
93 #include "ncl/IllegalBaseTypeException.h"
94 using namespace ::br::pucrio::telemidia::ncl;
95 
96 #include <map>
97 #include <vector>
98 #include <string>
99 using namespace std;
100 
101 typedef struct {
102  string embeddedNclNodeId;
103  string embeddedNclNodeLocation;
104  NclDocument* embeddedDocument;
106 
107 namespace br {
108 namespace pucrio {
109 namespace telemidia {
110 namespace ginga {
111 namespace ncl {
112  class PrivateBaseContext : public IPrivateBaseContext {
113  private:
114  map<string, NclDocument*> baseDocuments;
115  map<string, NclDocument*> visibleDocuments;
116  map<string, EmbeddedNclData*> embeddedDocuments;
117  map<NclDocument*, IDeviceLayout*> layouts;
118  set<IDeviceLayout*> layoutsGB; //layouts garbage collector
119  PrivateBase* privateBase;
120 
121  public:
123  virtual ~PrivateBaseContext();
124 
125  void createPrivateBase(string id);
126 
127  private:
128  NclDocument* compileDocument(
129  string location, IDeviceLayout* deviceLayout);
130 
131  public:
132  NclDocument* addDocument(
133  string location, IDeviceLayout* deviceLayout);
134 
135  NclDocument* embedDocument(
136  string docId,
137  string nodeId,
138  string location,
139  IDeviceLayout* deviceLayout);
140 
141  void* addVisibleDocument(string location, IDeviceLayout* deviceLayout);
142  NclDocument* getVisibleDocument(string docId);
143 
144  private:
145  bool eraseVisibleDocument(string docLocation);
146 
147  public:
148  string getDocumentLocation(string docId);
149  string getEmbeddedDocumentLocation(string parentDocId, string nodeId);
150  NclDocument* getDocument(string id);
151  NclDocument* getEmbeddedDocument(string parendDocId, string nodeId);
152  vector<NclDocument*>* getDocuments();
153 
154  private:
155  void removeDocumentBase(NclDocument* document, Base* base);
156  void removeDocumentBases(NclDocument* document);
157 
158  public:
159  NclDocument* removeDocument(string id);
160  NclDocument* removeEmbeddedDocument(string parentDocId, string nodeId);
161 
162  private:
163  NclDocument* getBaseDocument(string documentId);
164  void* compileEntity(
165  string location,
166  NclDocument* document,
167  void* parentObject);
168 
169  public:
170  LayoutRegion* addRegion(
171  string documentId,
172  string regionBaseId,
173  string regionId,
174  string xmlRegion);
175 
176  LayoutRegion* removeRegion(
177  string documentId,
178  string regionBaseId,
179  string regionId);
180 
181  RegionBase* addRegionBase(string documentId, string xmlRegionBase);
182 
183  RegionBase* removeRegionBase(
184  string documentId, string regionBaseId);
185 
186  Rule* addRule(string documentId, string xmlRule);
187  Rule* removeRule(string documentId, string ruleId);
188  RuleBase* addRuleBase(string documentId, string xmlRuleBase);
189  RuleBase* removeRuleBase(string documentId, string ruleBaseId);
190  Transition* addTransition(string documentId, string xmlTransition);
191  Transition* removeTransition(string documentId, string transitionId);
192  TransitionBase* addTransitionBase(
193  string documentId, string xmlTransitionBase);
194 
195  TransitionBase* removeTransitionBase(
196  string documentId, string transitionBaseId);
197 
198  Connector* addConnector(string documentId, string xmlConnector);
199  Connector* removeConnector(string documentId, string connectorId);
200  ConnectorBase* addConnectorBase(
201  string documentId, string xmlConnectorBase);
202 
203  ConnectorBase* removeConnectorBase(
204  string documentId, string connectorBaseId);
205 
206  GenericDescriptor* addDescriptor(
207  string documentId, string xmlDescriptor);
208 
209  GenericDescriptor* removeDescriptor(
210  string documentId, string descriptorId);
211 
212  DescriptorBase* addDescriptorBase(
213  string documentId, string xmlDescriptorBase);
214 
215  DescriptorBase* removeDescriptorBase(
216  string documentId, string descriptorBaseId);
217 
218  private:
219  Base* getBase(NclDocument* document, string baseId);
220 
221  public:
222  Base* addImportBase(
223  string documentId, string docBaseId, string xmlImportBase);
224 
225  Base* removeImportBase(
226  string documentId, string docBaseId, string documentURI);
227 
228  NclDocument* addImportedDocumentBase(
229  string documentId, string xmlImportedDocumentBase);
230 
231  NclDocument* removeImportedDocumentBase(
232  string documentId, string importedDocumentBaseId);
233 
234  NclDocument* addImportNCL(string documentId, string xmlImportNCL);
235  NclDocument* removeImportNCL(string documentId, string documentURI);
236  Node* addNode(string documentId, string compositeId, string xmlNode);
237  InterfacePoint* addInterface(
238  string documentId, string nodeId, string xmlInterface);
239 
240  Link* addLink(string documentId, string compositeId, string xmlLink);
241  PrivateBase* getPrivateBase();
242  };
243 }
244 }
245 }
246 }
247 }
248 
249 #endif /*PrivateBaseContext_H_*/
Definition: PrivateBaseContext.h:101
Definition: PrivateBaseContext.h:112