openrave.org

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
xmlreaders.h
Go to the documentation of this file.
1 // -*- coding: utf-8 -*-
2 // Copyright (C) 2006-2013 Rosen Diankov <rosen.diankov@gmail.com>
3 //
4 // This file is part of OpenRAVE.
5 // OpenRAVE is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published by
7 // the Free Software Foundation, either version 3 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 Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
23 #ifndef OPENRAVE_XMLREADERS_H
24 #define OPENRAVE_XMLREADERS_H
25 
26 #include <openrave/openrave.h>
27 
28 namespace OpenRAVE {
29 
30 namespace xmlreaders {
31 
33 {
34 public:
35  StringXMLReadable(const std::string& xmlid, const std::string& data);
36  virtual void Serialize(BaseXMLWriterPtr writer, int options=0) const;
37  const std::string& GetData() const;
38  std::string _data;
39 };
40 
41 typedef boost::shared_ptr<StringXMLReadable> StringXMLReadablePtr;
42 
45 {
46 public:
47  HierarchicalXMLReadable(const std::string& xmlid, const AttributesList& atts);
49  }
50  virtual void Serialize(BaseXMLWriterPtr writer, int options=0) const;
51  std::string _data;
53  std::list<boost::shared_ptr<HierarchicalXMLReadable> > _listchildren;
54 };
55 
56 typedef boost::shared_ptr<HierarchicalXMLReadable> HierarchicalXMLReadablePtr;
57 
60 {
61 public:
66  virtual ProcessElement startElement(const std::string& name, const AttributesList& atts);
67  virtual bool endElement(const std::string& name);
68  virtual void characters(const std::string& ch);
69 
71  return _ptraj;
72  }
73 
74 protected:
76  std::stringstream _ss;
80  std::vector<dReal> _vdata;
82 };
83 
84 typedef boost::shared_ptr<TrajectoryReader> TrajectoryReaderPtr;
85 
88 {
89 public:
94  virtual ProcessElement startElement(const std::string& name, const AttributesList& atts);
95  virtual bool endElement(const std::string& name);
96  virtual void characters(const std::string& ch);
97 
99  return _pgeom;
100  }
101 
102  inline bool IsOverwriteDiffuse() const {
103  return _bOverwriteDiffuse;
104  }
105  inline bool IsOverwriteAmbient() const {
106  return _bOverwriteAmbient;
107  }
108  inline bool IsOverwriteTransparency() const {
109  return _bOverwriteTransparency;
110  }
111 protected:
113  std::stringstream _ss;
115 
116  bool _bOverwriteDiffuse, _bOverwriteAmbient, _bOverwriteTransparency;
117 };
118 
119 typedef boost::shared_ptr<GeometryInfoReader> GeometryInfoReaderPtr;
120 
123 {
124 public:
125  HierarchicalXMLReader(const std::string& xmlid, const AttributesList& atts);
126  virtual ProcessElement startElement(const std::string& name, const AttributesList& atts);
127  virtual bool endElement(const std::string& name);
128  virtual void characters(const std::string& ch);
129  virtual XMLReadablePtr GetReadable();
130 private:
131  std::string _xmlid;
132  boost::shared_ptr<HierarchicalXMLReader> _pcurreader;
133  HierarchicalXMLReadablePtr _readable;
134 };
135 
136 typedef boost::shared_ptr<HierarchicalXMLReader> HierarchicalXMLReaderPtr;
137 
139 {
140 public:
141  StreamXMLWriter(const std::string& xmltag, const AttributesList& atts=AttributesList());
142  const std::string& GetFormat() const;
143  virtual void SetCharData(const std::string& data);
144  virtual BaseXMLWriterPtr AddChild(const std::string& xmltag, const AttributesList& atts=AttributesList());
145  virtual void Serialize(std::ostream& stream);
146 
147  std::list<boost::shared_ptr<StreamXMLWriter> > _listchildren;
148  std::string _xmltag, _data;
150 };
151 
152 typedef boost::shared_ptr<StreamXMLWriter> StreamXMLWriterPtr;
153 
154 } // xmlreaders
155 } // OpenRAVE
156 
157 #endif