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 
25 #include <limits>
26 #include <unordered_map>
27 
35 
36 template class ::IceInternal::Handle<::armarx::Variant>;
37 
38 namespace armarx
39 {
40  template <>
41  Variant::Variant(const std::int8_t& var, void*) : Variant(static_cast<std::int32_t>(var))
42  {
43  }
44 
45  template <>
46  std::int8_t
47  Variant::get<std::int8_t>() const
48  {
49  int i = getInt();
52  return static_cast<std::int8_t>(i);
53  }
54 
55  template <>
56  void
57  Variant::set<std::int8_t>(const std::int8_t& value)
58  {
59  setInt(static_cast<int>(value));
60  }
61 
62  template <>
63  Variant::Variant(const std::int16_t& var, void*) : Variant(static_cast<std::int32_t>(var))
64  {
65  }
66 
67  template <>
68  std::int16_t
69  Variant::get<std::int16_t>() const
70  {
71  int i = getInt();
74  return static_cast<std::int16_t>(i);
75  }
76 
77  template <>
78  void
79  Variant::set<std::int16_t>(const std::int16_t& value)
80  {
81  setInt(static_cast<int>(value));
82  }
83 
84  template <>
85  Variant::Variant(const std::int32_t& var, void*)
86  {
87  data = new IntVariantData(static_cast<int>(var));
88  typeId = VariantType::Int;
89  initialized = true;
90  }
91 
92  template <>
93  std::int32_t
94  Variant::get<std::int32_t>() const
95  {
96  int i = getInt();
99  return static_cast<std::int32_t>(i);
100  }
101 
102  template <>
103  void
104  Variant::set<std::int32_t>(const std::int32_t& value)
105  {
106  setInt(static_cast<int>(value));
107  }
108 
109  template <>
110  Variant::Variant(const std::int64_t& var, void*)
111  {
112  data = new LongVariantData(static_cast<long>(var));
113  typeId = VariantType::Long;
114  initialized = true;
115  }
116 
117  template <>
118  std::int64_t
119  Variant::get<std::int64_t>() const
120  {
121  long i = getLong();
122  return static_cast<std::int64_t>(i);
123  }
124 
125  template <>
126  void
127  Variant::set<std::int64_t>(const std::int64_t& value)
128  {
129  setLong(static_cast<long>(value));
130  }
131 
132  template <>
133  Variant::Variant(const std::uint8_t& var, void*) : Variant(static_cast<std::uint32_t>(var))
134  {
135  }
136 
137  template <>
138  std::uint8_t
139  Variant::get<std::uint8_t>() const
140  {
141  int i = getInt();
144  return static_cast<std::uint8_t>(i);
145  }
146 
147  template <>
148  void
149  Variant::set<std::uint8_t>(const std::uint8_t& value)
150  {
151  setInt(static_cast<int>(value));
152  }
153 
154  template <>
155  Variant::Variant(const std::uint16_t& var, void*) : Variant(static_cast<std::uint32_t>(var))
156  {
157  }
158 
159  template <>
160  std::uint16_t
161  Variant::get<std::uint16_t>() const
162  {
163  int i = getInt();
166  return static_cast<std::uint16_t>(i);
167  }
168 
169  template <>
170  void
171  Variant::set<std::uint16_t>(const std::uint16_t& value)
172  {
173  setInt(static_cast<int>(value));
174  }
175 
176  template <>
177  Variant::Variant(const std::uint32_t& var, void*)
178  {
180  data = new IntVariantData(static_cast<int>(var));
181  typeId = VariantType::Int;
182  initialized = true;
183  }
184 
185  template <>
186  std::uint32_t
187  Variant::get<std::uint32_t>() const
188  {
189  int i = getInt();
191  ARMARX_CHECK_LESS_EQUAL(static_cast<std::uint32_t>(i),
193  return static_cast<std::uint32_t>(i);
194  }
195 
196  template <>
197  void
198  Variant::set<std::uint32_t>(const std::uint32_t& value)
199  {
200  setInt(static_cast<int>(value));
201  }
202 
203  template <>
204  Variant::Variant(const std::uint64_t& var, void*)
205  {
207  data = new LongVariantData(static_cast<long>(var));
208  typeId = VariantType::Long;
209  initialized = true;
210  }
211 
212  template <>
213  std::uint64_t
214  Variant::get<std::uint64_t>() const
215  {
216  long i = getLong();
218  return static_cast<std::uint64_t>(i);
219  }
220 
221  template <>
222  void
223  Variant::set<std::uint64_t>(const std::uint64_t& value)
224  {
226  setLong(static_cast<long>(value));
227  }
228 
229  template <>
230  Variant::Variant(const float& var, void*)
231  {
232  data = new FloatVariantData(var);
233  typeId = VariantType::Float;
234  initialized = true;
235  }
236 
237  template <>
238  Variant::Variant(const double& var, void*)
239  {
240  data = new DoubleVariantData(var);
241  typeId = VariantType::Double;
242  initialized = true;
243  }
244 
245  template <>
246  Variant::Variant(const bool& var, void*)
247  {
248  data = new BoolVariantData(var);
249  typeId = VariantType::Bool;
250  initialized = true;
251  }
252 
253  template <>
254  Variant::Variant(const std::string& var, void*)
255  {
256  data = new StringVariantData(var);
257  typeId = VariantType::String;
258  initialized = true;
259  }
260 
261  template <>
262  bool
263  Variant::get<bool>() const
264  {
265  return getBool();
266  }
267 
268  template <>
269  float
270  Variant::get<float>() const
271  {
272  return getFloat();
273  }
274 
275  template <>
276  double
277  Variant::get<double>() const
278  {
279  return getDouble();
280  }
281 
282  template <>
283  std::string
284  Variant::get<std::string>() const
285  {
286  return getString();
287  }
288 
289  template <>
290  void
291  Variant::set<bool>(const bool& value)
292  {
293  setBool(value);
294  }
295 
296  template <>
297  void
298  Variant::set<float>(const float& value)
299  {
300  setFloat(value);
301  }
302 
303  template <>
304  void
305  Variant::set<double>(const double& value)
306  {
307  setDouble(value);
308  }
309 
310  template <>
311  void
312  Variant::set<std::string>(const std::string& value)
313  {
314  setString(value);
315  }
316 
317  Variant::Variant() : IceUtil::Shared(), VariantBase()
318  {
319  invalidate();
320  }
321 
323  IceUtil::Shared(source), Ice::Object(source), VariantBase(source)
324  {
326 
327  data = VariantDataPtr::dynamicCast(source.data->ice_clone());
328  setType(source.typeId);
329  initialized = source.initialized;
330  }
331 
332  VariantPtr
334  {
335  return new Variant(*this);
336  }
337 
338  // *******************************************************
339  // setter
340  // *******************************************************
341 
342  void
343  Variant::setType(VariantTypeId typeId, const Ice::Current&)
344  {
345  if (getType() != VariantType::Invalid && (getType() != typeId))
346  throw LocalException(
347  "A Variant's type cannot be changed after it was set! Current Variant type: ")
349  << " Requested Type: " << Variant::typeToString(typeId);
350 
351  this->typeId = typeId;
352  }
353 
354  void
355  Variant::setInt(int n, const Ice::Current&)
356  {
358  {
360  }
361 
362  if (!getInitialized())
363  {
364  data = new IntVariantData();
365  }
366 
368  IntVariantDataPtr::dynamicCast(this->data)->n = n;
369  }
370 
371  void
372  Variant::setLong(long n, const Ice::Current&)
373  {
375  {
377  getType(), VariantType::Long, __FUNCTION__);
378  }
379 
380  if (!getInitialized())
381  {
382  data = new LongVariantData();
383  }
384 
386  LongVariantDataPtr::dynamicCast(this->data)->n = n;
387  }
388 
389  void
390  Variant::setFloat(float f, const Ice::Current&)
391  {
393  {
395  getType(), VariantType::Float, __FUNCTION__);
396  }
397 
398  if (!getInitialized())
399  {
400  data = new FloatVariantData();
401  }
402 
404 
405  FloatVariantDataPtr::dynamicCast(this->data)->f = f;
406  }
407 
408  void
409  Variant::setDouble(double d, const Ice::Current&)
410  {
412  {
414  getType(), VariantType::Double, __FUNCTION__);
415  }
416 
417  if (!getInitialized())
418  {
419  data = new DoubleVariantData();
420  }
421 
423 
424  DoubleVariantDataPtr::dynamicCast(this->data)->d = d;
425  }
426 
427  void
428  Variant::setString(const std::string& s, const Ice::Current&)
429  {
431  {
433  getType(), VariantType::String, __FUNCTION__);
434  }
435 
436  if (!getInitialized())
437  {
438  data = new StringVariantData();
439  }
440 
442 
443  StringVariantDataPtr::dynamicCast(this->data)->s = s;
444  }
445 
446  void
447  Variant::setBool(bool b, const Ice::Current&)
448  {
450  {
452  getType(), VariantType::Bool, __FUNCTION__);
453  }
454 
455  if (!getInitialized())
456  {
457  data = new BoolVariantData();
458  }
459 
461 
462  BoolVariantDataPtr::dynamicCast(this->data)->b = b;
463  }
464 
465  void
466  Variant::setClass(const VariantDataClassPtr& variantDataClass)
467  {
468  if (getType() != VariantType::Invalid && (getType() != variantDataClass->getType()))
469  {
471  getType(), variantDataClass->getType(), __FUNCTION__);
472  }
473 
474  data = variantDataClass /*->clone()*/;
475  setType(variantDataClass->getType());
476  }
477 
478  void
479  Variant::setClass(const VariantDataClass& variantDataClass)
480  {
481  if (getType() != VariantType::Invalid && (getType() != variantDataClass.getType()))
482  {
484  getType(), variantDataClass.getType(), __FUNCTION__);
485  }
486 
487  data = variantDataClass.clone();
488  setType(variantDataClass.getType());
489  }
490 
491  // *******************************************************
492  // getter
493  // *******************************************************
494  int
495  Variant::getInt(const Ice::Current&) const
496  {
497  if (getType() != VariantType::Int)
498  {
500  }
501 
502  if (!getInitialized())
503  {
505  }
506 
507  IntVariantData* dataPtr = static_cast<IntVariantData*>(this->data.get());
508 
509  return dataPtr->n;
510  }
511 
512  long
513  Variant::getLong(const Ice::Current&) const
514  {
515  if (getType() != VariantType::Long)
516  {
518  getType(), VariantType::Long, __FUNCTION__);
519  }
520 
521  if (!getInitialized())
522  {
524  }
525 
526  LongVariantData* dataPtr = static_cast<LongVariantData*>(this->data.get());
527 
528  return dataPtr->n;
529  }
530 
531  float
532  Variant::getFloat(const Ice::Current&) const
533  {
534  if (getType() != VariantType::Float)
535  {
537  getType(), VariantType::Float, __FUNCTION__);
538  }
539 
540  if (!getInitialized())
541  {
543  }
544 
545  FloatVariantData* dataPtr = static_cast<FloatVariantData*>(this->data.get());
546 
547  return dataPtr->f;
548  }
549 
550  double
551  Variant::getDouble(const Ice::Current&) const
552  {
553  if (getType() != VariantType::Double)
554  {
556  getType(), VariantType::Double, __FUNCTION__);
557  }
558 
559  if (!getInitialized())
560  {
562  }
563 
564  DoubleVariantData* dataPtr = static_cast<DoubleVariantData*>(this->data.get());
565 
566  return dataPtr->d;
567  }
568 
569  std::string
570  Variant::getString(const Ice::Current&) const
571  {
572  if (getType() != VariantType::String)
573  {
575  getType(), VariantType::String, __FUNCTION__);
576  }
577 
578  if (!getInitialized())
579  {
581  }
582 
583  StringVariantData* dataPtr = static_cast<StringVariantData*>(this->data.get());
584 
585  return dataPtr->s;
586  }
587 
588  bool
589  Variant::getBool(const Ice::Current&) const
590  {
591  if (getType() != VariantType::Bool)
592  {
594  getType(), VariantType::Bool, __FUNCTION__);
595  }
596 
597  if (!getInitialized())
598  {
600  }
601 
602  BoolVariantData* dataPtr = static_cast<BoolVariantData*>(this->data.get());
603 
604  return dataPtr->b;
605  }
606 
607  std::string
609  {
610  VariantTypeId type = getType();
611  std::stringstream stream;
612  stream.precision(std::numeric_limits<double>::digits10);
613 
614  if (!getInitialized())
615  {
616  stream << "Not Initialized";
617  }
618  else if (type == VariantType::Invalid)
619  {
620  stream << "n/a";
621  }
622  else if (type == VariantType::Int)
623  {
624  stream << getInt();
625  }
626  else if (type == VariantType::Long)
627  {
628  stream << getLong();
629  }
630  else if (type == VariantType::Float)
631  {
632  stream << getFloat();
633  }
634  else if (type == VariantType::Double)
635  {
636  stream << getDouble();
637  }
638  else if (type == VariantType::String)
639  {
640  stream << getString();
641  }
642  else if (type == VariantType::Bool)
643  {
644  if (getBool() == true)
645  {
646  stream << "True";
647  }
648  else
649  {
650  stream << "False";
651  }
652  }
653  else
654  {
655 
656  VariantDataClassPtr ptr = VariantDataClassPtr::dynamicCast(this->data);
657 
658  if (!data)
659  {
660  stream << "NULLDATA (" << typeToString(type) << ")";
661  }
662  else if (ptr)
663  {
664  stream << ptr->output();
665  }
666  else
667  {
668  stream << data.get() << "(NULLCAST for" << typeToString(type) << ")";
669  }
670  }
671 
672  return stream.str();
673  }
674 
675  // *******************************************************
676  // properties
677  // *******************************************************
679  Variant::getType(const Ice::Current&) const
680  {
681  return typeId;
682  }
683 
684  std::string
685  Variant::getTypeName(const Ice::Current&) const
686  {
687  try
688  {
689  return typeToString(typeId);
690  }
692  {
693  return "UnknownType";
694  }
695  }
696 
697  bool
698  Variant::getInitialized(const Ice::Current&) const
699  {
700  if (!initialized)
701  {
703  }
704  return initialized;
705  }
706 
707  bool
708  Variant::validate(const Ice::Current&) const
709  {
710  if (!getInitialized())
711  {
712  return false;
713  }
714 
715  if (data->ice_id() == VariantData::ice_staticId())
716  {
718  }
719 
720  VariantDataClassPtr classPtr = VariantDataClassPtr::dynamicCast(data);
721 
722  if (classPtr)
723  {
724  return classPtr->validate();
725  }
726 
727  return true; // basic variant types are always valid
728  }
729 
730  // *******************************************************
731  // operator
732  // *******************************************************
733  Variant&
734  Variant::operator=(const VariantDataClass& prototype)
735  {
736  if (getType() != VariantType::Invalid && (getType() != prototype.getType()))
737  {
739  getType(), prototype.getType(), __FUNCTION__);
740  }
741 
742  data = VariantDataPtr::dynamicCast(prototype.ice_clone());
743  setType(hashTypeName(prototype.ice_id()));
744 
745  return *this;
746  }
747 
748  Variant&
749  Variant::operator=(const VariantDataClassPtr& prototype)
750  {
751  if (getType() != VariantType::Invalid && (getType() != prototype->getType()))
752  {
754  getType(), prototype->getType(), __FUNCTION__);
755  }
756 
757  data = VariantDataPtr::dynamicCast(prototype->ice_clone());
758  setType(hashTypeName(prototype->ice_id()));
759 
760  return *this;
761  }
762 
763  Variant&
764  Variant::operator=(const Variant& prototype)
765  {
766  if (getType() != VariantType::Invalid && (getType() != prototype.getType()))
767  {
769  getType(), prototype.getType(), __FUNCTION__);
770  }
771 
772  data = VariantDataPtr::dynamicCast(prototype.data->ice_clone());
773  setType(prototype.typeId);
774 
775  return *this;
776  }
777 
778  // *******************************************************
779  // private methods
780  // *******************************************************
781  void
782  Variant::output(std::ostream& stream) const
783  {
784  VariantTypeId type = getType();
785 
786  try
787  {
788  stream << "(" << Variant::typeToString(type) << ") ";
789  }
791  {
792  stream << "(UNKNOWNTYPE) ";
793  }
794 
795  if (!getInitialized())
796  {
797  stream << "not Initialized ";
798  return;
799  }
800 
801  stream << getOutputValueOnly();
802  }
803 
804  void
805  Variant::invalidate()
806  {
807  data = new InvalidVariantData();
808  typeId = VariantType::Invalid;
809  initialized = false;
810  }
811 
812  int
813  Variant::hashTypeName(const std::string& typeName)
814  {
815  static std::unordered_map<std::string, VariantTypeId> idMap;
816  auto it = idMap.find(typeName);
817 
818  if (it != idMap.end())
819  {
820  return it->second;
821  }
822 
823  int hash = 0;
824  int index = 0;
825  int ch;
826 
827  while ((ch = typeName[index++]))
828  {
829  /* hash = hash * 33 ^ c */
830  hash = ((hash << 5) + hash) ^ ch;
831  }
832 
833  idMap[typeName] = hash;
834  return hash;
835  }
836 
837  std::map<VariantTypeId, std::string>&
838  Variant::types()
839  {
840  static std::map<VariantTypeId, std::string> types = std::map<VariantTypeId, std::string>();
841  return types;
842  }
843 
844  // *******************************************************
845  // static methods for type handling
846  // *******************************************************
847  std::string
849  {
850  auto& typeMap = types();
851  std::map<VariantTypeId, std::string>::iterator it = typeMap.find(type);
852 
853 
854  if (it == types().end())
855  {
857  }
858 
859  return it->second;
860  }
861 
862  const std::map<VariantTypeId, std::string>&
864  {
865  return types();
866  }
867 
869  Variant::addTypeName(const std::string& typeName)
870  {
871  int hash = hashTypeName(typeName);
872  std::pair<unsigned int, std::string> entry;
873  entry.first = hash;
874  entry.second = typeName;
875  // std::cout << typeName << ": " << hash << std::endl;
876  // if(types().find(hash) != types().end())
877  // throw LocalException("A Type with this string ('" +typeName + "') is already added. It has to be renamed.");
878  std::map<VariantTypeId, std::string>::iterator it = types().find(hash);
879 
880  if (it != types().end() && typeName != it->second)
881  {
882  throw LocalException("A Type with the same hash value is already added. It has to be "
883  "renamed. TypeName: " +
884  typeName);
885  }
886 
887  Variant::types().insert(entry);
888 
889  return hash;
890  }
891 
892  bool
894  {
895  if (id == VariantType::Bool || id == VariantType::Float || id == VariantType::Double ||
897  {
898  return true;
899  }
900  else
901  {
902  return false;
903  }
904  }
905 
906  std::ostream&
907  operator<<(std::ostream& stream, const VariantDataClass& variant)
908  {
909  stream << variant.output();
910  return stream;
911  }
912 
913 } // namespace armarx
armarx::Variant
The Variant class is described here: Variants.
Definition: Variant.h:223
armarx::Variant::setClass
void setClass(const VariantDataClassPtr &variantDataClass)
Sets the Variant's value to variantDataClass.
Definition: Variant.cpp:466
armarx::Variant::getInitialized
bool getInitialized(const Ice::Current &c=Ice::emptyCurrent) const override
Tells if the Variant is properly initialized.
Definition: Variant.cpp:698
armarx::VariantType::Float
const VariantTypeId Float
Definition: Variant.h:919
armarx::Variant::setLong
void setLong(long n, const Ice::Current &c=Ice::emptyCurrent) override
Sets the Variant's value to n.
Definition: Variant.cpp:372
armarx::Variant::getDouble
double getDouble(const Ice::Current &c=Ice::emptyCurrent) const override
Return the Variant's value as double.
Definition: Variant.cpp:551
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:708
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:679
armarx::Variant::clone
virtual VariantPtr clone() const
Returns a copy of the Variant.
Definition: Variant.cpp:333
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:428
armarx::Variant::getTypes
static const std::map< VariantTypeId, std::string > & getTypes()
Returns the mapping of currently registered types.
Definition: Variant.cpp:863
armarx::VariantType::Bool
const VariantTypeId Bool
Definition: Variant.h:916
DataFieldIdentifier.h
armarx::Variant::Variant
Variant()
Definition: Variant.cpp:317
armarx::exceptions::user::InvalidTypeException
Definition: InvalidTypeException.h:35
IceUtil
Definition: Instance.h:21
magic_enum::detail::n
constexpr auto n() noexcept
Definition: magic_enum.hpp:418
armarx::Variant::getTypeName
std::string getTypeName(const Ice::Current &c=Ice::emptyCurrent) const override
Return the Variant's internal type.
Definition: Variant.cpp:685
armarx::Variant::getLong
long getLong(const Ice::Current &c=Ice::emptyCurrent) const override
Return the Variant's value as long.
Definition: Variant.cpp:513
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:355
IceInternal::Handle< Variant >
InvalidTypeException.h
armarx::VariantType::Double
const VariantTypeId Double
Definition: Variant.h:920
armarx::Variant::setDouble
void setDouble(double d, const Ice::Current &c=Ice::emptyCurrent) override
Sets the Variant's value to d.
Definition: Variant.cpp:409
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:855
armarx::Variant::setBool
void setBool(bool b, const Ice::Current &c=Ice::emptyCurrent) override
Sets the Variant's value to b.
Definition: Variant.cpp:447
armarx::Variant::getString
std::string getString(const Ice::Current &c=Ice::emptyCurrent) const override
Return the Variant's value as string.
Definition: Variant.cpp:570
armarx::VariantType::Invalid
const VariantTypeId Invalid
Definition: Variant.h:915
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:495
armarx::Variant::setFloat
void setFloat(float f, const Ice::Current &c=Ice::emptyCurrent) override
Sets the Variant's value to f.
Definition: Variant.cpp:390
armarx::Variant::operator=
Variant & operator=(int n)
Definition: Variant.h:609
armarx::Variant::typeToString
static std::string typeToString(VariantTypeId typeId)
Return the name of the registered type typeId.
Definition: Variant.cpp:848
armarx::VariantType::Long
const VariantTypeId Long
Definition: Variant.h:918
armarx::Variant::getFloat
float getFloat(const Ice::Current &c=Ice::emptyCurrent) const override
Return the Variant's value as float.
Definition: Variant.cpp:532
max
T max(T t1, T t2)
Definition: gdiam.h:51
armarx::Variant::getOutputValueOnly
virtual std::string getOutputValueOnly() const
Returns the formatted content of the Variant as a string.
Definition: Variant.cpp:608
armarx::VariantTypeId
Ice::Int VariantTypeId
Definition: Variant.h:43
boost::source
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
Definition: point_cloud_graph.h:661
armarx::VariantType::IsBasicType
bool IsBasicType(VariantTypeId id)
Definition: Variant.cpp:893
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:63
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:343
armarx::operator<<
std::ostream & operator<<(std::ostream &os, const PythonApplicationManager::Paths &paths)
Definition: PythonApplicationManager.cpp:285
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:917
armarx::Variant::hashTypeName
static int hashTypeName(const std::string &typeName)
Compute and return a hash value for a given type name.
Definition: Variant.cpp:813
armarx::Variant::output
void output(std::ostream &stream) const
Outputs a formatted representation of the Variant to stream.
Definition: Variant.cpp:782
min
T min(T t1, T t2)
Definition: gdiam.h:44
armarx::VariantType::String
const VariantTypeId String
Definition: Variant.h:921
armarx::exceptions::local::IncompleteTypeException
Definition: InvalidDataFieldException.h:59
armarx::Variant::getBool
bool getBool(const Ice::Current &c=Ice::emptyCurrent) const override
Return the Variant's value as bool.
Definition: Variant.cpp:589
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:27
armarx::Variant::addTypeName
static VariantTypeId addTypeName(const std::string &typeName)
Register a new type for the use in a Variant.
Definition: Variant.cpp:869