Actin®  Version 5.2.0
Software for Robotics Simulation and Control
ecXmlBasicType.h
Go to the documentation of this file.
1 #ifndef ecXmlBasicType_H_
2 #define ecXmlBasicType_H_
3 //------------------------------------------------------------------------------
4 // Copyright (c) 2001-2013 Energid Technologies. All rights reserved.
5 //
13 //
14 //------------------------------------------------------------------------------
15 #include "ecBaseXmlBasicType.h"
16 
17 class EcAngle;
18 class EcNonNegReal;
19 
20 template<class BasicType>
22 {
23 public:
24 
25  typedef BasicType basic_type; // Corresponding non-xml basic type
26 
29  (
30  );
31 
34  (
35  const BasicType& val
36  );
37 
39  virtual ~EcXmlBasicType
40  (
41  );
42 
45  (
46  const EcXmlBasicType<BasicType>& orig
47  );
48 
50  EcXmlBasicType<BasicType>& operator=
51  (
52  const EcXmlBasicType<BasicType>& orig
53  );
54 
56  inline EcXmlBasicType<BasicType>& operator=
57  (
58  const BasicType& val
59  )
60  {
61  m_Value = val;
62  return *this;
63  }
64 
66  EcBoolean operator==
67  (
68  const EcXmlBasicType<BasicType>& orig
69  ) const;
70 
72  inline operator const BasicType&
73  (
74  ) const
75  {
76  return m_Value;
77  }
78 
80  EcBoolean operator<
81  (
82  const EcXmlBasicType<BasicType>& orig
83  ) const;
84 
87  (
88  ) const EC_OVERRIDE;
89 
92  (
93  const EcXmlObject* other
94  ) const EC_OVERRIDE;
95 
98  (
99  ) const EC_OVERRIDE;
100 
105  (
106  EcXmlReader& stream
107  ) EC_OVERRIDE;
108 
111  (
112  EcXmlReader& stream
113  ) EC_OVERRIDE;
114 
119  (
120  EcXmlWriter& stream
121  ) const EC_OVERRIDE;
122 
125  (
126  EcXmlSchema& stream
127  ) const EC_OVERRIDE;
128 
131  (
132  ) const EC_OVERRIDE;
133 
135  inline const BasicType& value
136  (
137  ) const
138  {
139  return m_Value;
140  }
141 
143  inline BasicType& value
144  (
145  )
146  {
147  return m_Value;
148  }
149 
151  inline void setValue
152  (
153  const BasicType& val
154  )
155  {
156  m_Value=val;
157  }
158 
161  (
162  );
163 
165  virtual const EcToken& token
166  (
167  ) const EC_OVERRIDE;
168 
170  virtual void setValueFromString
171  (
172  const EcString& string
173  ) EC_OVERRIDE;
174 
175 protected:
176 
177  BasicType m_Value;
178 };
179 
181 
184 
187 
190 
193 
196 
199 
202 
205 
208 
211 
214 
217 
219 template<class BasicType>
220 std::ostream& operator<<
221  (
222  std::ostream& stream,
223  const EcXmlBasicType<BasicType>& orig
224  )
225 {
226  stream << orig.value();
227 
228  return stream;
229 }
230 
231 // Make sure and specify that this library exports these symbols so that they
232 // are not duplicated elsewhere. Only needed on windows
233 # if defined(WIN32) && defined(EC_BUILD_SHARED_LIBS) && !defined(stableFoundation_xml_EXPORTS)
234 extern template class EC_DECL_IMPORTS EcXmlBasicType<EcReal>;
235 extern template class EC_DECL_IMPORTS EcXmlBasicType<EcU32>;
236 extern template class EC_DECL_IMPORTS EcXmlBasicType<EcInt32>;
237 extern template class EC_DECL_IMPORTS EcXmlBasicType<EcU16>;
238 extern template class EC_DECL_IMPORTS EcXmlBasicType<EcInt16>;
239 extern template class EC_DECL_IMPORTS EcXmlBasicType<EcInt8>;
240 extern template class EC_DECL_IMPORTS EcXmlBasicType<EcU8>;
241 extern template class EC_DECL_IMPORTS EcXmlBasicType<EcString>;
242 extern template class EC_DECL_IMPORTS EcXmlBasicType<EcBoolean>;
243 # endif
244 
245 #endif // ecXmlBasicType_H_
EcXmlBasicType< EcU8 > EcXmlU8
an unsigned 8-bit integer that can read and write to an XML stream.
EcXmlBasicType< EcInt32 > EcXmlInt32
an signed 32-bit integer that can read and write to an XML stream.
EcXmlBasicType< EcInt8 > EcXmlInt8
a signed 8-bit integer that can read and write to an XML stream.
virtual const EcToken & token() const EC_OVERRIDE
token to use when writing out to xml.
EcBoolean writeSchema(EcXmlSchema &stream) const EC_OVERRIDE
write schema
EcXmlBasicType< EcInt16 > EcXmlInt16
an signed 16-bit integer that can read and write to an XML stream.
Holds the parent class for all XML basic types.
#define EC_OVERRIDE
Add wrapper around c++11 override keyword.
Definition: ecMacros.h:36
EcBoolean equality(const EcXmlObject *other) const EC_OVERRIDE
equality - virtual equality to an EcXmlObject pointer
virtual ~EcXmlBasicType()
destructor
EcXmlBasicType< EcU16 > EcXmlU16
an unsigned 16-bit integer that can read and write to an XML stream.
EcXmlBasicType< EcReal > EcXmlReal
This template class is defined for the following:
void setValue(const BasicType &val)
set the value
A class to define an angle, with values in the range [-Pi, Pi].
Definition: ecAngle.h:18
An EcString-like class that holds a tag and a namespace.
Definition: ecToken.h:41
EcBoolean readAttribute(EcXmlReader &stream) EC_OVERRIDE
read
EcXmlBasicType< EcNonNegReal > EcXmlNonNegReal
a nonnegative real value that can read and write to an XML stream.
static EcXmlBasicType< BasicType > nullObject()
get a null value
A base class for xml objects.
Definition: ecXmlObject.h:23
EcXmlBasicType< EcAngle > EcXmlAngle
an angle that can read and write to an XML stream.
EcBoolean write(EcXmlWriter &stream) const EC_OVERRIDE
EcXmlObject * clone() const EC_OVERRIDE
clone
EcBoolean isBasicType() const EC_OVERRIDE
Return true/false for basic type.
virtual void setValueFromString(const EcString &string) EC_OVERRIDE
set the value from a string
EcXmlObject * newObject() const EC_OVERRIDE
virtual new that returns an EcXmlObject
bool EcBoolean
Boolean (0 or 1)
Definition: ecTypes.h:21
EcBoolean read(EcXmlReader &stream) EC_OVERRIDE
BasicType m_Value
Basic value.
EcXmlBasicType< EcString > EcXmlString
a character string that can read and write to an XML stream.
XML file writer.
Definition: ecXmlWriter.h:19
A nonnegative floating-point number.
Definition: ecNonnegReal.h:18
std::basic_string< char > EcString
a character string
Definition: ecTypes.h:116
An XML file reader.
Definition: ecXmlReader.h:17
const BasicType & value() const
get the value - const version
A template class for basic types that can be read and written to XML streams.
EcXmlBasicType()
default constructor
#define EC_DECL_IMPORTS
imports storage-class modifier
Definition: ecConfig.h:89
EcXmlBasicType< EcU32 > EcXmlU32
an unsigned 32-bit integer that can read and write to an XML stream.
Class for generating schemas.
Definition: ecXmlSchema.h:22
EcXmlBasicType< EcBoolean > EcXmlBoolean
a boolean that can read and write to an XML stream.
EcXmlBasicType< EcTime > EcXmlTime
a time value that can read and write to an XML stream.
Created by Energid Technologies www.energid.com
Copyright © 2016 Energid. All trademarks mentioned in this document are property of their respective owners.