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 
91 class Gyoto::FactoryMessenger {
92  private:
93  Gyoto::Factory* employer_;
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 
121  SmartPointer<Metric::Generic> metric () ;
123 
131  SmartPointer<Screen> screen () ;
133 
141  SmartPointer<Photon> getPhoton () ;
143 
151  SmartPointer<Astrobj::Generic> astrobj () ;
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 
280  void metric(SmartPointer<Metric::Generic>);
282 
286  void astrobj(SmartPointer<Astrobj::Generic>);
288 
292  void screen(SmartPointer<Screen>);
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
Reference-counting pointers.
Gyoto ubiquitous macros and typedefs.
Namespace for the Gyoto library.
Definition: GyotoAstrobj.h:42