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 
28 namespace MBSim {
29 
35  class Environment : virtual public fmatvec::Atom {
36  public:
37  /* INTERFACE FOR DERIVED CLASSES */
42  virtual void initializeUsingXML(xercesc::DOMElement *element) {}
43  /***************************************************/
44 
45  protected:
49  Environment() : Atom() {};
50 
54  virtual ~Environment() {};
55  };
56 
62  class MBSimEnvironment : public Environment {
63  public:
64  /* INHERITED INTERFACE */
65  virtual void initializeUsingXML(xercesc::DOMElement *element);
66  /***************************************************/
67 
68  /* GETTER / SETTER */
69  static MBSimEnvironment *getInstance() { return instance.get(); }
70  void setAccelerationOfGravity(const fmatvec::Vec3 &grav_) { grav=grav_; }
71  const fmatvec::Vec3& getAccelerationOfGravity() const { return grav; }
72  /***************************************************/
73 
74  private:
78  static std::unique_ptr<MBSimEnvironment> instance;
79 
80  protected:
85 
89  fmatvec::Vec3 grav;
90  };
91 
92 }
93 
94 #endif /* _MBSIM_ENVIRONMENT_H_ */
95 
static std::unique_ptr< MBSimEnvironment > instance
Definition: environment.h:78
basic singleton (see GAMMA et al.) class to capsulate environment variables for XML ...
Definition: environment.h:35
fmatvec::Vec3 grav
acceleration of gravity
Definition: environment.h:89
virtual void initializeUsingXML(xercesc::DOMElement *element)
initializes environment variables by XML element
Definition: environment.h:42
singleton class (see GAMMA et al.) to capsulate environment variables for XML multibody systems ...
Definition: environment.h:62
Environment()
constructor
Definition: environment.h:49
virtual void initializeUsingXML(xercesc::DOMElement *element)
initializes environment variables by XML element
Definition: environment.cc:36
virtual ~Environment()
destructor
Definition: environment.h:54
MBSimEnvironment()
constructor
Definition: environment.h:84

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML