All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
environment.h
1 /* Copyright (C) 2004-2009 MBSim Development Team
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * Contact: friedrich.at.gc@googlemail.com
18  */
19 
20 #ifndef _MBSIM_ENVIRONMENT_H_
21 #define _MBSIM_ENVIRONMENT_H_
22 
23 #include "fmatvec/fmatvec.h"
24 #include "fmatvec/atom.h"
25 #include <xercesc/dom/DOMElement.hpp>
26 #include <xercesc/dom/DOMNode.hpp>
27 #include <boost/scoped_ptr.hpp>
28 
29 namespace MBSim {
30 
36  class Environment : virtual public fmatvec::Atom {
37  public:
38  /* INTERFACE FOR DERIVED CLASSES */
43  virtual void initializeUsingXML(xercesc::DOMElement *element) {}
44  virtual xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *parent)=0;
45  /***************************************************/
46 
47  protected:
51  Environment() : Atom() {};
52 
56  virtual ~Environment() {};
57  };
58 
64  class MBSimEnvironment : public Environment {
65  public:
66  /* INHERITED INTERFACE */
67  virtual void initializeUsingXML(xercesc::DOMElement *element);
68  virtual xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *parent);
69  /***************************************************/
70 
71  /* GETTER / SETTER */
72  static MBSimEnvironment *getInstance() { return instance.get(); }
73  void setAccelerationOfGravity(const fmatvec::Vec3 &grav_) { grav=grav_; }
74  const fmatvec::Vec3& getAccelerationOfGravity() const { return grav; }
75  /***************************************************/
76 
77  protected:
81  static boost::scoped_ptr<MBSimEnvironment> instance;
82 
87 
91  fmatvec::Vec3 grav;
92  };
93 
94 }
95 
96 #endif /* _MBSIM_ENVIRONMENT_H_ */
97 
static boost::scoped_ptr< MBSimEnvironment > instance
Definition: environment.h:81
basic singleton (see GAMMA et al.) class to capsulate environment variables for XML ...
Definition: environment.h:36
fmatvec::Vec3 grav
acceleration of gravity
Definition: environment.h:91
virtual void initializeUsingXML(xercesc::DOMElement *element)
initializes environment variables by XML element
Definition: environment.h:43
singleton class (see GAMMA et al.) to capsulate environment variables for XML multibody systems ...
Definition: environment.h:64
Environment()
constructor
Definition: environment.h:51
virtual void initializeUsingXML(xercesc::DOMElement *element)
initializes environment variables by XML element
Definition: environment.cc:36
virtual ~Environment()
destructor
Definition: environment.h:56
MBSimEnvironment()
constructor
Definition: environment.h:86

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML