Variant.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * 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, see <http://www.gnu.org/licenses/>.
17  *
18  * @package ArmarXCore::core
19  * @author Kai Welke (welke at kit dot edu)
20  * @date 2011
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 
32 
33 #include <limits>
34 #include <unordered_map>
35 
36 template class ::IceInternal::Handle<::armarx::Variant>;
37 
38 namespace armarx
39 {
40  template <> Variant::Variant(const std::int8_t& var, void*)
41  : Variant(static_cast<std::int32_t>(var))
42  {
43  }
44  template<> std::int8_t Variant::get<std::int8_t>() const
45  {
46  int i = getInt();
49  return static_cast<std::int8_t>(i);
50  }
51  template<> void Variant::set<std::int8_t>(const std::int8_t& value)
52  {
53  setInt(static_cast<int>(value));
54  }
55 
56  template <> Variant::Variant(const std::int16_t& var, void*)
57  : Variant(static_cast<std::int32_t>(var))
58  {
59  }
60  template<> std::int16_t Variant::get<std::int16_t>() const
61  {
62  int i = getInt();
65  return static_cast<std::int16_t>(i);
66  }
67  template<> void Variant::set<std::int16_t>(const std::int16_t& value)
68  {
69  setInt(static_cast<int>(value));
70  }
71 
72  template <> Variant::Variant(const std::int32_t& var, void*)
73  {
74  data = new IntVariantData(static_cast<int>(var));
75  typeId = VariantType::Int;
76  initialized = true;
77  }
78  template<> std::int32_t Variant::get<std::int32_t>() const
79  {
80  int i = getInt();
83  return static_cast<std::int32_t>(i);
84  }
85  template<> void Variant::set<std::int32_t>(const std::int32_t& value)
86  {
87  setInt(static_cast<int>(value));
88  }
89 
90  template <> Variant::Variant(const std::int64_t& var, void*)
91  {
92  data = new LongVariantData(static_cast<long>(var));
93  typeId = VariantType::Long;
94  initialized = true;
95  }
96  template<> std::int64_t Variant::get<std::int64_t>() const
97  {
98  long i = getLong();
99  return static_cast<std::int64_t>(i);
100  }
101  template<> void Variant::set<std::int64_t>(const std::int64_t& value)
102  {
103  setLong(static_cast<long>(value));
104  }
105 
106  template <> Variant::Variant(const std::uint8_t& var, void*)
107  : Variant(static_cast<std::uint32_t>(var))
108  {
109  }
110  template<> std::uint8_t Variant::get<std::uint8_t>() const
111  {
112  int i = getInt();
115  return static_cast<std::uint8_t>(i);
116  }
117  template<> void Variant::set<std::uint8_t>(const std::uint8_t& value)
118  {
119  setInt(static_cast<int>(value));
120  }
121 
122  template <> Variant::Variant(const std::uint16_t& var, void*)
123  : Variant(static_cast<std::uint32_t>(var))
124  {
125  }
126  template<> std::uint16_t Variant::get<std::uint16_t>() const
127  {
128  int i = getInt();
131  return static_cast<std::uint16_t>(i);
132  }
133  template<> void Variant::set<std::uint16_t>(const std::uint16_t& value)
134  {
135  setInt(static_cast<int>(value));
136  }
137 
138  template <> Variant::Variant(const std::uint32_t& var, void*)
139  {
141  data = new IntVariantData(static_cast<int>(var));
142  typeId = VariantType::Int;
143  initialized = true;
144  }
145  template<> std::uint32_t Variant::get<std::uint32_t>() const
146  {
147  int i = getInt();
149  ARMARX_CHECK_LESS_EQUAL(static_cast<std::uint32_t>(i), std::numeric_limits<std::uint32_t>::max());
150  return static_cast<std::uint32_t>(i);
151  }
152  template<> void Variant::set<std::uint32_t>(const std::uint32_t& value)
153  {
154  setInt(static_cast<int>(value));
155  }
156 
157  template <> Variant::Variant(const std::uint64_t& var, void*)
158  {
160  data = new LongVariantData(static_cast<long>(var));
161  typeId = VariantType::Long;
162  initialized = true;
163  }
164  template<> std::uint64_t Variant::get<std::uint64_t>() const
165  {
166  long i = getLong();
168  return static_cast<std::uint64_t>(i);
169  }
170  template<> void Variant::set<std::uint64_t>(const std::uint64_t& value)
171  {
173  setLong(static_cast<long>(value));
174  }
175 
176  template <> Variant::Variant(const float& var, void*)
177  {
178  data = new FloatVariantData(var);
179  typeId = VariantType::Float;
180  initialized = true;
181  }
182  template <> Variant::Variant(const double& var, void*)
183  {
184  data = new DoubleVariantData(var);
185  typeId = VariantType::Double;
186  initialized = true;
187  }
188  template <> Variant::Variant(const bool& var, void*)
189  {
190  data = new BoolVariantData(var);
191  typeId = VariantType::Bool;
192  initialized = true;
193  }
194  template <> Variant::Variant(const std::string& var, void*)
195  {
196  data = new StringVariantData(var);
197  typeId = VariantType::String;
198  initialized = true;
199  }
200 
201  template<> bool Variant::get<bool>() const
202  {
203  return getBool();
204  }
205  template<> float Variant::get<float>() const
206  {
207  return getFloat();
208  }
209  template<> double Variant::get<double>() const
210  {
211  return getDouble();
212  }
213  template<> std::string Variant::get<std::string>() const
214  {
215  return getString();
216  }
217 
218  template<> void Variant::set<bool>(const bool& value)
219  {
220  setBool(value);
221  }
222  template<> void Variant::set<float>(const float& value)
223  {
224  setFloat(value);
225  }
226  template<> void Variant::set<double>(const double& value)
227  {
228  setDouble(value);
229  }
230  template<> void Variant::set<std::string>(const std::string& value)
231  {
232  setString(value);
233  }
234 
236  : IceUtil::Shared(),
237  VariantBase()
238  {
239  invalidate();
240  }
241 
243  IceUtil::Shared(source),
244  Ice::Object(source),
245  VariantBase(source)
246  {
248 
249  data = VariantDataPtr::dynamicCast(source.data->ice_clone());
250  setType(source.typeId);
251  initialized = source.initialized;
252 
253  }
254 
256  {
257  return new Variant(*this);
258  }
259 
260  // *******************************************************
261  // setter
262  // *******************************************************
263 
264  void Variant::setType(VariantTypeId typeId, const Ice::Current&)
265  {
266  if (getType() != VariantType::Invalid && (getType() != typeId))
267  throw LocalException("A Variant's type cannot be changed after it was set! Current Variant type: ")
268  << Variant::typeToString(getType()) << " Requested Type: " << Variant::typeToString(typeId);
269 
270  this->typeId = typeId;
271  }
272 
273 
274  void Variant::setInt(int n, const Ice::Current&)
275  {
277  {
279  }
280 
281  if (!getInitialized())
282  {
283  data = new IntVariantData();
284  }
285 
287  IntVariantDataPtr::dynamicCast(this->data)->n = n;
288  }
289 
290  void Variant::setLong(long n, const Ice::Current&)
291  {
293  {
295  }
296 
297  if (!getInitialized())
298  {
299  data = new LongVariantData();
300  }
301 
303  LongVariantDataPtr::dynamicCast(this->data)->n = n;
304  }
305 
306  void Variant::setFloat(float f, const Ice::Current&)
307  {
309  {
311  }
312 
313  if (!getInitialized())
314  {
315  data = new FloatVariantData();
316  }
317 
319 
320  FloatVariantDataPtr::dynamicCast(this->data)->f = f;
321  }
322 
323  void Variant::setDouble(double d, const Ice::Current&)
324  {
326  {
328  }
329 
330  if (!getInitialized())
331  {
332  data = new DoubleVariantData();
333  }
334 
336 
337  DoubleVariantDataPtr::dynamicCast(this->data)->d = d;
338  }
339 
340  void Variant::setString(const std::string& s, const Ice::Current&)
341  {
343  {
345  }
346 
347  if (!getInitialized())
348  {
349  data = new StringVariantData();
350  }
351 
353 
354  StringVariantDataPtr::dynamicCast(this->data)->s = s;
355  }
356 
357  void Variant::setBool(bool b, const Ice::Current&)
358  {
360  {
362  }
363 
364  if (!getInitialized())
365  {
366  data = new BoolVariantData();
367  }
368 
370 
371  BoolVariantDataPtr::dynamicCast(this->data)->b = b;
372  }
373 
374  void Variant::setClass(const VariantDataClassPtr& variantDataClass)
375  {
376  if (getType() != VariantType::Invalid && (getType() != variantDataClass->getType()))
377  {
378  throw exceptions::user::InvalidTypeException(getType(), variantDataClass->getType(), __FUNCTION__);
379  }
380 
381  data = variantDataClass/*->clone()*/;
382  setType(variantDataClass->getType());
383  }
384 
385  void Variant::setClass(const VariantDataClass& variantDataClass)
386  {
387  if (getType() != VariantType::Invalid && (getType() != variantDataClass.getType()))
388  {
389  throw exceptions::user::InvalidTypeException(getType(), variantDataClass.getType(), __FUNCTION__);
390  }
391 
392  data = variantDataClass.clone();
393  setType(variantDataClass.getType());
394  }
395 
396 
397  // *******************************************************
398  // getter
399  // *******************************************************
400  int Variant::getInt(const Ice::Current&) const
401  {
402  if (getType() != VariantType::Int)
403  {
405  }
406 
407  if (!getInitialized())
408  {
410  }
411 
412  IntVariantData* dataPtr = static_cast<IntVariantData*>(this->data.get());
413 
414  return dataPtr->n;
415  }
416 
417  long Variant::getLong(const Ice::Current&) const
418  {
419  if (getType() != VariantType::Long)
420  {
422  }
423 
424  if (!getInitialized())
425  {
427  }
428 
429  LongVariantData* dataPtr = static_cast<LongVariantData*>(this->data.get());
430 
431  return dataPtr->n;
432  }
433 
434  float Variant::getFloat(const Ice::Current&) const
435  {
436  if (getType() != VariantType::Float)
437  {
439  }
440 
441  if (!getInitialized())
442  {
444  }
445 
446  FloatVariantData* dataPtr = static_cast<FloatVariantData*>(this->data.get());
447 
448  return dataPtr->f;
449  }
450 
451 
452  double Variant::getDouble(const Ice::Current&) const
453  {
454  if (getType() != VariantType::Double)
455  {
457  }
458 
459  if (!getInitialized())
460  {
462  }
463 
464  DoubleVariantData* dataPtr = static_cast<DoubleVariantData*>(this->data.get());
465 
466  return dataPtr->d;
467  }
468 
469 
470  std::string Variant::getString(const Ice::Current&) const
471  {
472  if (getType() != VariantType::String)
473  {
475  }
476 
477  if (!getInitialized())
478  {
480  }
481 
482  StringVariantData* dataPtr = static_cast<StringVariantData*>(this->data.get());
483 
484  return dataPtr->s;
485  }
486 
487  bool Variant::getBool(const Ice::Current&) const
488  {
489  if (getType() != VariantType::Bool)
490  {
492  }
493 
494  if (!getInitialized())
495  {
497  }
498 
499  BoolVariantData* dataPtr = static_cast<BoolVariantData*>(this->data.get());
500 
501  return dataPtr->b;
502  }
503 
504  std::string Variant::getOutputValueOnly() const
505  {
506  VariantTypeId type = getType();
507  std::stringstream stream;
508  stream.precision(std::numeric_limits<double>::digits10);
509 
510  if (!getInitialized())
511  {
512  stream << "Not Initialized";
513  }
514  else if (type == VariantType::Invalid)
515  {
516  stream << "n/a";
517  }
518  else if (type == VariantType::Int)
519  {
520  stream << getInt();
521  }
522  else if (type == VariantType::Long)
523  {
524  stream << getLong();
525  }
526  else if (type == VariantType::Float)
527  {
528  stream << getFloat();
529  }
530  else if (type == VariantType::Double)
531  {
532  stream << getDouble();
533  }
534  else if (type == VariantType::String)
535  {
536  stream << getString();
537  }
538  else if (type == VariantType::Bool)
539  {
540  if (getBool() == true)
541  {
542  stream << "True";
543  }
544  else
545  {
546  stream << "False";
547  }
548  }
549  else
550  {
551 
552  VariantDataClassPtr ptr = VariantDataClassPtr::dynamicCast(this->data);
553 
554  if (!data)
555  {
556  stream << "NULLDATA (" << typeToString(type) << ")";
557  }
558  else if (ptr)
559  {
560  stream << ptr->output();
561  }
562  else
563  {
564  stream << data.get() << "(NULLCAST for" << typeToString(type) << ")";
565  }
566  }
567 
568  return stream.str();
569  }
570 
571  // *******************************************************
572  // properties
573  // *******************************************************
574  VariantTypeId Variant::getType(const Ice::Current&) const
575  {
576  return typeId;
577  }
578 
579  std::string Variant::getTypeName(const Ice::Current&) const
580  {
581  try
582  {
583  return typeToString(typeId);
584  }
586  {
587  return "UnknownType";
588  }
589  }
590 
591  bool Variant::getInitialized(const Ice::Current&) const
592  {
593  if (!initialized)
594  {
596  }
597  return initialized;
598  }
599 
600 
601  bool Variant::validate(const Ice::Current&) const
602  {
603  if (!getInitialized())
604  {
605  return false;
606  }
607 
608  if (data->ice_id() == VariantData::ice_staticId())
609  {
611  }
612 
613  VariantDataClassPtr classPtr = VariantDataClassPtr::dynamicCast(data);
614 
615  if (classPtr)
616  {
617  return classPtr->validate();
618  }
619 
620  return true; // basic variant types are always valid
621  }
622 
623 
624  // *******************************************************
625  // operator
626  // *******************************************************
627  Variant& Variant::operator =(const VariantDataClass& prototype)
628  {
629  if (getType() != VariantType::Invalid && (getType() != prototype.getType()))
630  {
631  throw exceptions::user::InvalidTypeException(getType(), prototype.getType(), __FUNCTION__);
632  }
633 
634  data = VariantDataPtr::dynamicCast(prototype.ice_clone());
635  setType(hashTypeName(prototype.ice_id()));
636 
637  return *this;
638  }
639 
640  Variant& Variant::operator =(const VariantDataClassPtr& prototype)
641  {
642  if (getType() != VariantType::Invalid && (getType() != prototype->getType()))
643  {
644  throw exceptions::user::InvalidTypeException(getType(), prototype->getType(), __FUNCTION__);
645  }
646 
647  data = VariantDataPtr::dynamicCast(prototype->ice_clone());
648  setType(hashTypeName(prototype->ice_id()));
649 
650  return *this;
651  }
652 
654  {
655  if (getType() != VariantType::Invalid && (getType() != prototype.getType()))
656  {
657  throw exceptions::user::InvalidTypeException(getType(), prototype.getType(), __FUNCTION__);
658  }
659 
660  data = VariantDataPtr::dynamicCast(prototype.data->ice_clone());
661  setType(prototype.typeId);
662 
663  return *this;
664  }
665 
666  // *******************************************************
667  // private methods
668  // *******************************************************
669  void Variant::output(std::ostream& stream) const
670  {
671  VariantTypeId type = getType();
672 
673  try
674  {
675  stream << "(" << Variant::typeToString(type) << ") ";
676  }
678  {
679  stream << "(UNKNOWNTYPE) ";
680  }
681 
682  if (!getInitialized())
683  {
684  stream << "not Initialized " ;
685  return;
686  }
687 
688  stream << getOutputValueOnly();
689 
690  }
691 
692  void Variant::invalidate()
693  {
694  data = new InvalidVariantData();
695  typeId = VariantType::Invalid;
696  initialized = false;
697  }
698 
699  int Variant::hashTypeName(const std::string& typeName)
700  {
701  static std::unordered_map<std::string, VariantTypeId> idMap;
702  auto it = idMap.find(typeName);
703 
704  if (it != idMap.end())
705  {
706  return it->second;
707  }
708 
709  int hash = 0;
710  int index = 0;
711  int ch;
712 
713  while ((ch = typeName[index++]))
714  {
715  /* hash = hash * 33 ^ c */
716  hash = ((hash << 5) + hash) ^ ch;
717  }
718 
719  idMap[typeName] = hash;
720  return hash;
721  }
722 
723  std::map<VariantTypeId, std::string>& Variant::types()
724  {
725  static std::map<VariantTypeId, std::string> types = std::map<VariantTypeId, std::string>();
726  return types;
727  }
728 
729  // *******************************************************
730  // static methods for type handling
731  // *******************************************************
733  {
734  auto& typeMap = types();
735  std::map<VariantTypeId, std::string>::iterator it = typeMap.find(type);
736 
737 
738  if (it == types().end())
739  {
741  }
742 
743  return it->second;
744  }
745 
746  const std::map<VariantTypeId, std::string>& Variant::getTypes()
747  {
748  return types();
749  }
750 
751  VariantTypeId Variant::addTypeName(const std::string& typeName)
752  {
753  int hash = hashTypeName(typeName);
754  std::pair<unsigned int, std::string> entry;
755  entry.first = hash;
756  entry.second = typeName;
757  // std::cout << typeName << ": " << hash << std::endl;
758  // if(types().find(hash) != types().end())
759  // throw LocalException("A Type with this string ('" +typeName + "') is already added. It has to be renamed.");
760  std::map<VariantTypeId, std::string>::iterator it = types().find(hash);
761 
762  if (it != types().end() && typeName != it->second)
763  {
764  throw LocalException("A Type with the same hash value is already added. It has to be renamed. TypeName: " + typeName);
765  }
766 
767  Variant::types().insert(entry);
768 
769  return hash;
770  }
771 
773  {
774  if (id == VariantType::Bool
775  || id == VariantType::Float
776  || id == VariantType::Double
777  || id == VariantType::Int
778  || id == VariantType::Long
779  || id == VariantType::String)
780  {
781  return true;
782  }
783  else
784  {
785  return false;
786  }
787  }
788 
789  std::ostream& operator<<(std::ostream& stream, const VariantDataClass& variant)
790  {
791  stream << variant.output();
792  return stream;
793  }
794 
795 }
796 
797 
798 
armarx::Variant
The Variant class is described here: Variants.
Definition: Variant.h:224
armarx::Variant::setClass
void setClass(const VariantDataClassPtr &variantDataClass)
Sets the Variant's value to variantDataClass.
Definition: Variant.cpp:374
armarx::Variant::getInitialized
bool getInitialized(const Ice::Current &c=Ice::emptyCurrent) const override
Tells if the Variant is properly initialized.
Definition: Variant.cpp:591
armarx::VariantType::Float
const VariantTypeId Float
Definition: Variant.h:918
armarx::Variant::setLong
void setLong(long n, const Ice::Current &c=Ice::emptyCurrent) override
Sets the Variant's value to n.
Definition: Variant.cpp:290
armarx::Variant::getDouble
double getDouble(const Ice::Current &c=Ice::emptyCurrent) const override
Return the Variant's value as double.
Definition: Variant.cpp:452
armarx::Variant::validate
bool validate(const Ice::Current &c=Ice::emptyCurrent) const override
Checks if the Variant is initialized and the stored value is valid with respect to the Variant's type...
Definition: Variant.cpp:601
index
uint8_t index
Definition: EtherCATFrame.h:59
armarx::Variant::getType
VariantTypeId getType(const Ice::Current &c=Ice::emptyCurrent) const override
Return the Variant's internal type.
Definition: Variant.cpp:574
armarx::Variant::clone
virtual VariantPtr clone() const
Returns a copy of the Variant.
Definition: Variant.cpp:255
armarx::Variant::setString
void setString(const std::string &s, const Ice::Current &c=Ice::emptyCurrent) override
Sets the Variant's value to s.
Definition: Variant.cpp:340
armarx::Variant::getTypes
static const std::map< VariantTypeId, std::string > & getTypes()
Returns the mapping of currently registered types.
Definition: Variant.cpp:746
armarx::VariantType::Bool
const VariantTypeId Bool
Definition: Variant.h:915
DataFieldIdentifier.h
armarx::Variant::Variant
Variant()
Definition: Variant.cpp:235
armarx::exceptions::user::InvalidTypeException
Definition: InvalidTypeException.h:35
IceUtil
Definition: Instance.h:21
armarx::Variant::getTypeName
std::string getTypeName(const Ice::Current &c=Ice::emptyCurrent) const override
Return the Variant's internal type.
Definition: Variant.cpp:579
armarx::Variant::getLong
long getLong(const Ice::Current &c=Ice::emptyCurrent) const override
Return the Variant's value as long.
Definition: Variant.cpp:417
StringHelpers.h
armarx::Variant::setInt
void setInt(int n, const Ice::Current &c=Ice::emptyCurrent) override
Sets the Variant's value to n.
Definition: Variant.cpp:274
IceInternal::Handle< Variant >
InvalidTypeException.h
armarx::VariantType::Double
const VariantTypeId Double
Definition: Variant.h:919
armarx::Variant::setDouble
void setDouble(double d, const Ice::Current &c=Ice::emptyCurrent) override
Sets the Variant's value to d.
Definition: Variant.cpp:323
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
armarx::Variant::setBool
void setBool(bool b, const Ice::Current &c=Ice::emptyCurrent) override
Sets the Variant's value to b.
Definition: Variant.cpp:357
armarx::Variant::getString
std::string getString(const Ice::Current &c=Ice::emptyCurrent) const override
Return the Variant's value as string.
Definition: Variant.cpp:470
armarx::VariantType::Invalid
const VariantTypeId Invalid
Definition: Variant.h:914
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
UnknownTypeException.h
armarx::exceptions::user::UnknownTypeException
Definition: UnknownTypeException.h:36
armarx::Variant::getInt
int getInt(const Ice::Current &c=Ice::emptyCurrent) const override
Return the Variant's value as int.
Definition: Variant.cpp:400
armarx::Variant::setFloat
void setFloat(float f, const Ice::Current &c=Ice::emptyCurrent) override
Sets the Variant's value to f.
Definition: Variant.cpp:306
armarx::Variant::operator=
Variant & operator=(int n)
Definition: Variant.h:613
armarx::Variant::typeToString
static std::string typeToString(VariantTypeId typeId)
Return the name of the registered type typeId.
Definition: Variant.cpp:732
armarx::VariantType::Long
const VariantTypeId Long
Definition: Variant.h:917
armarx::Variant::getFloat
float getFloat(const Ice::Current &c=Ice::emptyCurrent) const override
Return the Variant's value as float.
Definition: Variant.cpp:434
max
T max(T t1, T t2)
Definition: gdiam.h:48
armarx::Variant::getOutputValueOnly
virtual std::string getOutputValueOnly() const
Returns the formatted content of the Variant as a string.
Definition: Variant.cpp:504
armarx::VariantTypeId
Ice::Int VariantTypeId
Definition: Variant.h:44
boost::source
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:681
armarx::VariantType::IsBasicType
bool IsBasicType(VariantTypeId id)
Definition: Variant.cpp:772
ARMARX_CHECK_GREATER_EQUAL
#define ARMARX_CHECK_GREATER_EQUAL(lhs, rhs)
This macro evaluates whether lhs is greater or equal (>=) rhs and if it turns out to be false it will...
Definition: ExpressionException.h:123
InvalidDataFieldException.h
armarx::exceptions::user::NotInitializedException
Definition: NotInitializedException.h:34
ARMARX_CHECK_LESS_EQUAL
#define ARMARX_CHECK_LESS_EQUAL(lhs, rhs)
This macro evaluates whether lhs is less or equal (<=) rhs and if it turns out to be false it will th...
Definition: ExpressionException.h:109
armarx::Variant::initialized
bool initialized
Definition: Variant.h:726
ExpressionException.h
Ice
Definition: DBTypes.cpp:64
ARMARX_CHECK_EXPRESSION
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
Definition: ExpressionException.h:73
std
Definition: Application.h:66
armarx::Variant::setType
void setType(VariantTypeId typeId, const Ice::Current &c=Ice::emptyCurrent) override
Sets the Variant's type to typeId.
Definition: Variant.cpp:264
armarx::operator<<
std::ostream & operator<<(std::ostream &os, const PythonApplicationManager::Paths &paths)
Definition: PythonApplicationManager.cpp:221
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:916
armarx::Variant::hashTypeName
static int hashTypeName(const std::string &typeName)
Compute and return a hash value for a given type name.
Definition: Variant.cpp:699
armarx::Variant::output
void output(std::ostream &stream) const
Outputs a formatted representation of the Variant to stream.
Definition: Variant.cpp:669
min
T min(T t1, T t2)
Definition: gdiam.h:42
armarx::VariantType::String
const VariantTypeId String
Definition: Variant.h:920
armarx::exceptions::local::IncompleteTypeException
Definition: InvalidDataFieldException.h:56
armarx::Variant::getBool
bool getBool(const Ice::Current &c=Ice::emptyCurrent) const override
Return the Variant's value as bool.
Definition: Variant.cpp:487
Variant.h
armarx::ctrlutil::s
double s(double t, double s0, double v0, double a0, double j)
Definition: CtrlUtil.h:33
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::Variant::addTypeName
static VariantTypeId addTypeName(const std::string &typeName)
Register a new type for the use in a Variant.
Definition: Variant.cpp:751