Gyoto
GyotoFactoryMessenger.h
Go to the documentation of this file.
1 
5 #ifdef GYOTO_USE_XERCES
6 /*
7  Copyright 2011 Thibaut Paumard
8 
9  This file is part of Gyoto.
10 
11  Gyoto is free software: you can redistribute it and/or modify
12  it under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  Gyoto is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with Gyoto. If not, see <http://www.gnu.org/licenses/>.
23  */
24 
25 #ifndef __GyotoFactoryMessenger_H_
26 #define __GyotoFactoryMessenger_H_
27 
29 
33 #ifndef XERCES_INCLUDE_WCHAR_H
34 #define XERCES_INCLUDE_WCHAR_H 0
35 #endif
36 #include <xercesc/dom/DOMElement.hpp>
37 #include <string>
38 #include <GyotoDefs.h>
39 #include <GyotoSmartPointer.h>
40 
41 namespace Gyoto {
42  class Factory;
43  class FactoryMessenger;
44  namespace Metric { class Generic; }
45  namespace Astrobj { class Generic; }
46  namespace Spectrum { class Generic ; }
47  class Screen;
48  class Photon;
49 }
50 
92  private:
95  xercesc::DOMElement *element_;
97  xercesc::DOMNodeList* children_;
99  XMLSize_t nodeCount_;
101  XMLSize_t curNodeIndex_;
103  public:
104  FactoryMessenger(Gyoto::Factory*, xercesc::DOMElement*);
106  FactoryMessenger(const FactoryMessenger& parent, std::string) ;
108 
109  void reset();
111 
113 
123 
133 
143 
153 
168  int getNextParameter(std::string* name,
169  std::string* content,
170  std::string* unit=NULL);
172 
184  std::string getSelfAttribute(std::string attrname) const ;
186 
196  std::string getAttribute(std::string attrname) const ;
198 
212  std::string getFullContent() const ;
214 
233  FactoryMessenger * getChild() const ;
235 
236 
249  std::string fullPath(std::string relpath) ;
251 
252 
254 
282 
288 
294 
295 
306  void setParameter(std::string name);
308 
316  void setParameter(std::string name, double value);
318 
326  void setParameter(std::string name, long int value);
328 
336  void setParameter(std::string name, unsigned int value);
338 
346  void setParameter(std::string name, unsigned long value);
348 
356  void setParameter(std::string name, int value);
358 
365  void setParameter(std::string name, std::string value);
367 
391  void setParameter(std::string name, double val[], size_t n,
392  FactoryMessenger** child= NULL);
394 
395 
407  void setSelfAttribute(std::string attrname, std::string value) ;
409 
413  void setSelfAttribute(std::string attrname, unsigned long value) ;
415 
419  void setSelfAttribute(std::string attrname, unsigned int value) ;
421 
425  void setSelfAttribute(std::string attrname, double value) ;
427 
435  void setFullContent(std::string value) ;
437 
456  FactoryMessenger* makeChild(std::string name);
458 
459 };
460 
461 #endif
462 #endif
std::string getAttribute(std::string attrname) const
Get attribute of a last retrieved parameter.
void reset()
Get back to first parameter.
SmartPointer< Astrobj::Generic > getAstrobj()
Build and get the Astrobj described in this XML file.
int getNextParameter(std::string *name, std::string *content, std::string *unit=NULL)
Get name and value of next parameter.
std::string fullPath(std::string relpath)
Transform path into full path specification.
xercesc::DOMElement * element_
The XML element concerned by this transaction.
Definition: GyotoFactoryMessenger.h:95
Reference-counting pointers.
XMLSize_t nodeCount_
The number of children of the XML element concerned by this transaction.
Definition: GyotoFactoryMessenger.h:99
SmartPointer< Metric::Generic > getMetric()
Build and get the Metric described in this XML file.
Factory / SmartPointee::Subcontractor_t interface.
Definition: GyotoFactoryMessenger.h:91
void setAstrobj(SmartPointer< Astrobj::Generic >)
Set the Astrobj.
void setSelfAttribute(std::string attrname, std::string value)
Set attribute in FactoryMessenger::element_.
std::string getSelfAttribute(std::string attrname) const
Get attribute of FactoryMessenger::element_.
xercesc::DOMNodeList * children_
The children of the XML element concerned by this transaction.
Definition: GyotoFactoryMessenger.h:97
Gyoto ubiquitous macros and typedefs.
SmartPointer< Photon > getPhoton()
Build and get the Photon described in this XML file.
void setScreen(SmartPointer< Screen >)
Set the Screen.
FactoryMessenger * getChild() const
Get another FactoryMessenger instance initialized to current child.
void setMetric(SmartPointer< Metric::Generic >)
Set the Metric.
void setParameter(std::string name)
Output parameter.
SmartPointer< Screen > getScreen()
Build and get the Screen described in this XML file.
XMLSize_t curNodeIndex_
Current child.
Definition: GyotoFactoryMessenger.h:101
XML input/output.
Definition: GyotoFactory.h:112
FactoryMessenger(Gyoto::Factory *, xercesc::DOMElement *)
Constructor called before subcontracting.
Gyoto::Factory * employer_
The Factory that sent this messenger.
Definition: GyotoFactoryMessenger.h:93
void setFullContent(std::string value)
Low level, prefer setParameter()
FactoryMessenger * makeChild(std::string name)
Create child FactoryMessenger.
std::string getFullContent() const
Get full content of element_.