openmbvcppinterface 3.1.0 OpenMBV C++ Interface

object.h
1 /*
2 OpenMBV - Open Multi Body Viewer.
3 Copyright (C) 2009 Markus Friedrich
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #ifndef _OPENMBV_OBJECT_H_
21 #define _OPENMBV_OBJECT_H_
22
23 #include <fmatvec/atom.h>
24 #include <string>
25 #include <sstream>
26 #include <hdf5serie/group.h>
27 #include <mbxmlutilshelper/dom.h>
28 #include <utility>
29 #include <vector>
30
31 namespace OpenMBV {
32
33 using Index = int;
34
35 #ifndef SWIG // SWIG can not parse this (swig bug?). However it is not needed for the swig interface -> removed for swig
36 const MBXMLUtils::NamespaceURI OPENMBV("http://www.mbsim-env.de/OpenMBV");
37 #endif
38
39 class Group;
40
42 class Object
43 #ifndef SWIG
44 // with swig we do not need any access to fmatvec::Atom members. To avoid problems with other projects
45 // deriving from fmatvec::Atomm we skip this completely from swig processing.
46 : virtual public fmatvec::Atom
47 #endif
48 {
49 friend class Group;
50 protected:
51 std::string name;
52 std::string enableStr, boundingBoxStr;
53 std::string ID; // Note: the ID is metadata and stored as a processing instruction in XML
54 std::string environmentStr;
55 std::weak_ptr<Group> parent;
56
57 virtual void createHDF5File()=0;
58 virtual void openHDF5File()=0;
59 H5::GroupBase *hdf5Group{nullptr};
60 std::string fullName;
61
62 Object();
63 ~Object() override;
64 public:
66 void setEnable(bool enable) { enableStr=(enable)?"true":"false"; }
67
68 bool getEnable() { return enableStr=="true"?true:false; }
69
71 void setBoundingBox(bool bbox) { boundingBoxStr=(bbox)?"true":"false"; }
72
73 bool getBoundingBox() { return boundingBoxStr=="true"?true:false; }
74
76 void setName(const std::string& name_) { name=name_; }
77
78 std::string getName() { return name; }
79
81 virtual std::string getFullName();
82
85 void setEnvironment(bool env) { environmentStr=(env)?"true":"false"; }
86
88 bool getEnvironment();
89
91 virtual void initializeUsingXML(xercesc::DOMElement *element);
92
93 virtual xercesc::DOMElement *writeXMLFile(xercesc::DOMNode *parent);
94
96 std::shared_ptr<Group> getTopLevelGroup();
97
98 std::weak_ptr<Group> getParent() { return parent; }
99
100 H5::GroupBase *getHDF5Group() { return hdf5Group; };
101
103 std::string getID() const { return ID; }
105 void setID(std::string ID_) { ID=std::move(ID_); }
106
107 };
108
109 }
110
111 #endif
OpenMBV::Object::setName
void setName(const std::string &name_)
Definition: object.h:76
OpenMBV::Object::getEnvironment
bool getEnvironment()
Definition: object.cc:97
OpenMBV::Object::setEnvironment
void setEnvironment(bool env)
Definition: object.h:85
OpenMBV::Object::setBoundingBox
void setBoundingBox(bool bbox)
Definition: object.h:71
OpenMBV::Object::setEnable
void setEnable(bool enable)
Definition: object.h:66
OpenMBV::Object::setID
void setID(std::string ID_)
Definition: object.h:105
MBXMLUtils::NamespaceURI
H5::GroupBase
OpenMBV::Object::getFullName
virtual std::string getFullName()
Definition: object.cc:44
OpenMBV::Object
Definition: object.h:42
OpenMBV::Object::getID
std::string getID() const
Definition: object.h:103
OpenMBV::Object::getTopLevelGroup
std::shared_ptr< Group > getTopLevelGroup()
Definition: object.cc:93
OpenMBV::Object::initializeUsingXML
virtual void initializeUsingXML(xercesc::DOMElement *element)
Definition: object.cc:55
OpenMBV::Group
Definition: group.h:31