hpp-manipulation-urdf  4.9.0
Implementation of a parser for hpp-manipulation.
sequence.hh
Go to the documentation of this file.
1 // Copyright (c) 2014, LAAS-CNRS
2 // Authors: Joseph Mirabel (joseph.mirabel@laas.fr)
3 //
4 // This file is part of hpp-manipulation-urdf.
5 // hpp-manipulation-urdf is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // hpp-manipulation-urdf is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // hpp-manipulation-urdf. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef HPP_MANIPULATION_PARSER_FACTORIES_SEQUENCE_HH
18 # define HPP_MANIPULATION_PARSER_FACTORIES_SEQUENCE_HH
19 
21 
22 namespace hpp {
23  namespace manipulation {
24  namespace parser {
27  template <typename Container>
28  void readSequence (const std::string& str, Container& out, int size = -1);
29 
35  template <typename ValueType>
36  class SequenceFactory : public ObjectFactory {
37  public:
38  typedef std::vector <ValueType> OutType;
39  SequenceFactory (ObjectFactory* parent, const XMLElement* element, const int nbValue = -1) :
40  ObjectFactory (parent, element), size_ (nbValue)
41  {}
42 
43  virtual void addTextChild (const XMLText* text);
44 
45  const OutType& values () const
46  {
47  return values_;
48  }
49 
50  private:
51  std::vector <ValueType> values_;
52  int size_;
53  };
54 
56  } // namespace parser
57  } // namespace manipulation
58 } // namespace hpp
59 
60 #endif // HPP_MANIPULATION_PARSER_FACTORIES_SEQUENCE_HH
TiXmlElement XMLElement
Definition: parser.hh:31
void readSequence(const std::string &str, Container &out, int size=-1)
std::vector< ValueType > OutType
Definition: sequence.hh:38
virtual void addTextChild(const XMLText *text)
Add Text child.
TiXmlText XMLText
Definition: parser.hh:35
const OutType & values() const
Definition: sequence.hh:45
SequenceFactory(ObjectFactory *parent, const XMLElement *element, const int nbValue=-1)
Definition: sequence.hh:39
Factory parsing sequence of values.
Definition: sequence.hh:36
Class that catch XML Parser events for a specific tag and build the corresponding Object...
Definition: parser.hh:73
FCL_REAL size() const