All Classes Namespaces Functions Variables Typedefs Enumerations Pages
group.h
1 /*
2  OpenMBV - Open Multi Body Viewer.
3  Copyright (C) 2009 Markus Friedrich
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program 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
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 #ifndef _OPENMBV_GROUP_H_
21 #define _OPENMBV_GROUP_H_
22 
23 #include <openmbvcppinterface/object.h>
24 #include <vector>
25 #include <map>
26 #include <boost/shared_ptr.hpp>
27 #include <boost/enable_shared_from_this.hpp>
28 
29 namespace OpenMBV {
30 
32  class Group : public Object
33 #ifndef SWIG
34  , public boost::enable_shared_from_this<Group>
35 #endif
36  {
37  friend class Body;
38  friend class Object;
39  friend class ObjectFactory;
40  protected:
41  std::vector<boost::shared_ptr<Object> > object;
42  std::string expandStr;
43  std::string fileName; // the file name of the .ombv.xml file of this separateFile Group including the absolute or relatvie path
44  bool separateFile;
45  boost::shared_ptr<H5::File> hdf5File;
46  void createHDF5File();
47  void openHDF5File();
48 
49  Group();
50  virtual ~Group();
51 
55  void writeXML();
56 
60  void readXML();
61 
66  void writeH5();
67 
70  void readH5();
71 
72  public:
74  std::string getClassName() { return "Group"; }
75 
77  void setExpand(bool expand) { expandStr=(expand==true)?"true":"false"; }
78 
79  bool getExpand() { return expandStr=="true"?true:false; }
80 
82  void addObject(boost::shared_ptr<Object> object);
83 
84  std::vector<boost::shared_ptr<Object> >& getObjects() {
85  return object;
86  }
87 
89  void setSeparateFile(bool sepFile) { separateFile=sepFile; }
90 
91  bool getSeparateFile() { return separateFile; }
92  boost::shared_ptr<H5::File>& getHDF5File() { return hdf5File; }
93 
96  std::string getFileName() { return fileName; }
97 
98  std::string getFullName(bool includingFileName=false, bool stopAtSeparateFile=false);
99 
102  void setFileName(const std::string &fn) { fileName=fn; }
103 
107  void write(bool writeXMLFile=true, bool writeH5File=true);
108 
112  void read(bool readXMLFile=true, bool readH5File=true);
113 
117  void terminate();
118 
120  virtual void initializeUsingXML(xercesc::DOMElement *element);
121 
122  xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *parent);
123 
125  boost::shared_ptr<Group> getSeparateGroup() {
126  return separateFile?shared_from_this():parent.lock()->getSeparateGroup();
127  }
128 
130  boost::shared_ptr<Group> getTopLevelGroup() {
131  boost::shared_ptr<Group> p=parent.lock();
132  return !p?shared_from_this():p->getTopLevelGroup();
133  }
134  };
135 
136 }
137 
138 #endif
void terminate()
Definition: group.cc:171
std::string getClassName()
Definition: group.h:74
void writeH5()
Definition: group.cc:162
boost::shared_ptr< Group > getSeparateGroup()
Definition: group.h:125
void readXML()
Definition: group.cc:200
Definition: objectfactory.h:40
virtual void initializeUsingXML(xercesc::DOMElement *element)
Definition: group.cc:179
void setFileName(const std::string &fn)
Definition: group.h:102
boost::shared_ptr< Group > getTopLevelGroup()
Definition: group.h:130
void setExpand(bool expand)
Definition: group.h:77
void write(bool writeXMLFile=true, bool writeH5File=true)
Definition: group.cc:224
void addObject(boost::shared_ptr< Object > object)
Definition: group.cc:52
std::string getFullName(bool includingFileName=false, bool stopAtSeparateFile=false)
Definition: group.cc:61
void read(bool readXMLFile=true, bool readH5File=true)
Definition: group.cc:271
Definition: object.h:48
void writeXML()
Definition: group.cc:150
void readH5()
Definition: group.cc:209
std::string getFileName()
Definition: group.h:96
Definition: group.h:32
void setSeparateFile(bool sepFile)
Definition: group.h:89
Definition: body.h:31

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML