cartobase  4.7.0
object_d.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 #ifndef CARTOBASE_OBJECT_OBJECT_D_H
35 #define CARTOBASE_OBJECT_OBJECT_D_H
36 
38 
39 #define INSTANTIATE_GENERIC_OBJECT_TYPE( T ) \
40  template class carto::TypedObject< T >; \
41  template class carto::ValueObject< T >; \
42  template class carto::ReferenceObject< T >; \
43  template class carto::PointerObject< T >; \
44  template \
45  T const &GenericObject::value< T >() const; \
46  template \
47  T &GenericObject::value< T >(); \
48  template \
49  bool GenericObject::value( T &dest ) const; \
50  template \
51  void GenericObject::setValue( T const & x ); \
52  template <> \
53  void DictionaryInterface::setProperty( const std::string &key, \
54  T const &value ) \
55  { \
56  this->setProperty( key, Object::value( value ) ); \
57  } \
58  template <> \
59  bool DictionaryInterface::getProperty( const std::string &key, T &value ) const \
60  { \
61  Object o; \
62  if( getProperty( key, o ) && o.get() ) \
63  { \
64  try \
65  { \
66  value = o->GenericObject::value< T >(); \
67  return true; \
68  } \
69  catch( ... ) \
70  { \
71  } \
72  } \
73  return false; \
74  } \
75 
76 
77 namespace carto
78 {
79 
80 // For lisibility, it has been decided to put a part of object
81 // implementation in a separate header.
83 
84 
85  //------------------------//
86  // DictionaryInterface //
87 //------------------------//
88 /*
89 
90 //---------------------------------------------------------------------------
91 template <typename T>
92 void DictionaryInterface::setProperty( const std::string &key,
93  const T &value )
94 {
95  this->setProperty( key, Object::value( value ) );
96 }
97 
98 
99 //---------------------------------------------------------------------------
100 template <typename T>
101 bool DictionaryInterface::getProperty( const std::string &key, T &value ) const
102 {
103  Object o;
104  if( getProperty( key, o ) && o.get() )
105  {
106  try
107  {
108  value = o->GenericObject::value<T>();
109  return true;
110  }
111  catch( ... )
112  {
113  }
114  }
115  return false;
116 }
117 */
118 
119 
120  //-----------------//
121  // GenericObject //
122 //-----------------//
123 
124 //-----------------------------------------------------------------------------
125 template<typename T>
126 const T &GenericObject::value() const
127 {
128  const TypedObject<T> *u = dynamic_cast<const TypedObject<T> *>( this );
129  if( u ) return( u->getValue() );
130  throw std::invalid_argument( std::string( "cannot convert object from " )
131  + type() + " to " + DataTypeCode<T>::name()
132  + " (dynamic cast failed from "
133  + typeid(*this).name() + " to "
134  + typeid(u).name() + ")" );
135 }
136 
137 
138 //-----------------------------------------------------------------------------
139 template<typename T>
141 {
142  TypedObject<T> *u = dynamic_cast<TypedObject<T> *>( this );
143  if( u ) return( u->getValue() );
144  throw std::invalid_argument( std::string( "cannot convert object from " )
145  + type() + " to " + DataTypeCode<T>::name()
146  + " (dynamic cast failed from "
147  + typeid(*this).name() + " to "
148  + typeid(u).name() + ")" );
149 }
151 
152 //-----------------------------------------------------------------------------
153 template <typename T>
154 bool GenericObject::value( T &dest ) const
155 {
156  const TypedObject<T> *u = dynamic_cast<const TypedObject<T> *>( this );
157  if( u ) {
158  dest = u->getValue();
159  return true;
160  }
161  return false;
162 }
163 
164 
165 //-----------------------------------------------------------------------------
166 template<typename T>
167 void GenericObject::setValue( const T & x )
168 {
169  TypedObject<T> *u = dynamic_cast<TypedObject<T> *>( this );
170  if( u ) {
171  u->getValue() = x;
172  } else {
173  throw std::invalid_argument( std::string( "cannot write value of type " )
175  + " to object of type " + type() );
176  }
177 }
178 
180  //------------------//
181  // TypedObject<T> //
182 //------------------//
184 //-----------------------------------------------------------------------------
185 template <typename T>
187 {
189 }
190 
191 
192 //-----------------------------------------------------------------------------
193 template <typename T>
195 {
196 }
197 
198 
199 //-----------------------------------------------------------------------------
200 template <typename T>
201 const T &TypedObject<T>::getValue() const
202 {
203  return const_cast< TypedObject<T> & >( *this ).getValue();
204 }
205 
206 
207 //-----------------------------------------------------------------------------
208 template <typename T>
210 {
211  object_to( o, getValue() );
212 }
214 
215 //-----------------------------------------------------------------------------
216 template<typename T>
217 std::string TypedObject<T>::type() const
218 {
219  return DataTypeCode<T>::name();
220 }
221 
222 
223 //-----------------------------------------------------------------------------
224 template <typename T>
226 {
227  return interface_internal::
229 }
230 
231 
232 //-----------------------------------------------------------------------------
233 template <typename T>
234 const void *TypedObject<T>::_getAddressOfValue() const
235 {
236  return &getValue();
237 }
238 
239 //-----------------------------------------------------------------------------
240 template <typename T>
242 {
243  throw std::runtime_error( "pure virtual function called" );
244 }
245 
247 //-----------------------------------------------------------------------------
248 template <typename T>
250 {
251  throw std::runtime_error( "pure virtual function called" );
252 }
253 
254 
255 #ifdef CARTO_DEBUG
256 //-----------------------------------------------------------------------------
257 template <typename T>
259  PrintInstantiation<T>::doIt( &TypedObject<T>::_debugInstantiation );
260 
261 
262 //-----------------------------------------------------------------------------
263 template <typename T>
264 bool PrintInstantiation<T>::doIt( bool *address )
265 {
266  if ( verbose ) {
267  std::cerr << "!instantiation! " << typeid(T).name() << " "
268  << "mutable "
269  << address << " "
270  << DataTypeCode<T>::name() << std::endl;
271  }
272  return true;
273 }
274 
275 //-----------------------------------------------------------------------------
276 template <typename T>
277 bool PrintInstantiation<const T>::doIt( bool *address)
278 {
279  if ( verbose ) {
280  std::cerr << "!instantiation! " << typeid(T).name() << " "
281  << "const "
282  << static_cast<void *>( address ) << " "
283  << DataTypeCode<T>::name() << std::endl;
284  }
285  return true;
286 }
287 
288 #endif // ifdef CARTO_DEBUG
289 
290 
291 //-----------------------------------------------------------------------------
292 // ScalarInterface methods
293 //-----------------------------------------------------------------------------
294 
295 
296 //-----------------------------------------------------------------------------
297 template <typename T>
299 {
302 }
303 
304 
305 //-----------------------------------------------------------------------------
306 template <typename T>
308 {
309  return interface_internal::
311 }
313 
314 //-----------------------------------------------------------------------------
315 template <typename T>
317 {
318  return interface_internal::
320 }
321 
322 
323 //-----------------------------------------------------------------------------
324 // StringInterface methods
325 //-----------------------------------------------------------------------------
326 
327 
328 //-----------------------------------------------------------------------------
329 template <typename T>
331 {
332  return interface_internal::
334 }
335 
336 
337 //-----------------------------------------------------------------------------
338 template <typename T>
339 std::string TypedObject<T>::getString() const
340 {
341  return interface_internal::
343 }
344 
345 
346 //-----------------------------------------------------------------------------
347 template <typename T>
348 void TypedObject<T>::setString( const std::string &v )
349 {
350  return interface_internal::
352 }
354 
355 //-----------------------------------------------------------------------------
356 // ArrayInterface methods
357 //-----------------------------------------------------------------------------
358 
359 
360 //-----------------------------------------------------------------------------
361 template <typename T>
363 {
364  return interface_internal::
366 }
368 
369 //-----------------------------------------------------------------------------
370 template <typename T>
372 {
373  return interface_internal::
374  ArrayImpl< T, SUPERSUBCLASS(ArrayInterface,T) >::
375  getArrayItem( *this, index );
376 }
377 
378 
379 //-----------------------------------------------------------------------------
380 template <typename T>
382 {
383  interface_internal::
384  ArrayImpl< T, SUPERSUBCLASS(ArrayInterface,T) >::
385  setArrayItem( *this, index, value );
386 }
388 
389 //-----------------------------------------------------------------------------
390 // DynArrayInterface methods
391 //-----------------------------------------------------------------------------
393 
394 //-----------------------------------------------------------------------------
395 template <typename T>
397 {
398  return interface_internal::
400 }
402 
403 //-----------------------------------------------------------------------------
404 template <typename T>
406 {
407  interface_internal::
408  DynArrayImpl< T, SUPERSUBCLASS(DynArrayInterface,T) >::
409  reserveArray( *this, size );
410 }
411 
412 
413 //-----------------------------------------------------------------------------
414 template <typename T>
416 {
417  interface_internal::
418  DynArrayImpl< T, SUPERSUBCLASS(DynArrayInterface,T) >::
419  resizeArray( *this, size );
420 }
421 
422 
423 //-----------------------------------------------------------------------------
424 template <typename T>
426 {
427  interface_internal::
428  DynArrayImpl< T, SUPERSUBCLASS(DynArrayInterface,T) >::
429  removeArrayItem( *this, index );
430 }
431 
433 //-----------------------------------------------------------------------------
434 template <typename T>
436 {
437  interface_internal::
438  DynArrayImpl< T, SUPERSUBCLASS(DynArrayInterface,T) >::
439  insertArrayItem( *this, index, value );
440 }
441 
442 
444 //-----------------------------------------------------------------------------
445 // SizeInterface methods
446 //-----------------------------------------------------------------------------
448 
449 //-----------------------------------------------------------------------------
450 template <typename T>
451 size_t TypedObject<T>::size() const
452 {
454  size( *this );
455 }
456 
457 
458 //-----------------------------------------------------------------------------
459 // DictionaryInterface methods
460 //-----------------------------------------------------------------------------
461 
462 
463 //-----------------------------------------------------------------------------
464 template <typename T>
466 {
467  return interface_internal::
468  DictionaryImpl< T, SUPERSUBCLASS(DictionaryInterface,T) >
469  ::isDictionary( *this );
470 }
472 
473 //-----------------------------------------------------------------------------
474 template <typename T>
475 bool TypedObject<T>::getProperty( const std::string &key,
476  Object & result ) const
477 {
478  return interface_internal::
479  DictionaryImpl< T, SUPERSUBCLASS(DictionaryInterface,T) >::
480  getProperty( *this, key, result );
481 }
483 
484 //-----------------------------------------------------------------------------
485 template <typename T>
486 void TypedObject<T>::setProperty( const std::string &key, Object value )
487 {
488  interface_internal::
489  DictionaryImpl< T, SUPERSUBCLASS(DictionaryInterface,T) >::
490  setProperty( *this, key, value );
491 }
492 
493 
494 //-----------------------------------------------------------------------------
495 template <typename T>
496 bool TypedObject<T>::removeProperty( const std::string &key )
497 {
498  return interface_internal::
499  DictionaryImpl< T, SUPERSUBCLASS(DictionaryInterface,T) >::
500  removeProperty( *this,key );
501 }
502 
503 
504 //-----------------------------------------------------------------------------
505 template <typename T>
507 {
508  interface_internal::
509  DictionaryImpl< T, SUPERSUBCLASS(DictionaryInterface,T) >::
510  clearProperties( *this );
511 }
512 
513 
514 //-----------------------------------------------------------------------------
515 template <typename T>
516 bool TypedObject<T>::hasProperty( const std::string &key ) const
517 {
518  return interface_internal::
519  DictionaryImpl< T, SUPERSUBCLASS(DictionaryInterface,T) >::
520  hasProperty( *this,key );
521 }
522 
523 
524 //-----------------------------------------------------------------------------
525 // IterableInterface methods
526 //-----------------------------------------------------------------------------
527 
528 
529 //-----------------------------------------------------------------------------
530 template <typename T>
532 {
533  return interface_internal::
535 }
536 
537 
538 //-----------------------------------------------------------------------------
539 template <typename T>
541 {
542  return interface_internal::
543  IterableImpl< T, SUPERSUBCLASS(IterableInterface,T) >::
545 }
546 
547 
548 //-----------------------------------------------------------------------------
549 // IteratorInterface methods
550 //-----------------------------------------------------------------------------
551 
552 
553 //-----------------------------------------------------------------------------
554 template <typename T>
556 {
557  return interface_internal::
559 }
560 
561 
562 //-----------------------------------------------------------------------------
563 template <typename T>
565 {
566  return interface_internal::
567  IteratorImpl< T, SUPERSUBCLASS(IteratorInterface,T) >::
568  isValid( *this );
569 }
570 
571 
572 //-----------------------------------------------------------------------------
573 template <typename T>
575 {
576  return interface_internal::
577  IteratorImpl< T, SUPERSUBCLASS(IteratorInterface,T) >::
578  currentValue( *this );
579 }
580 
581 
582 //-----------------------------------------------------------------------------
583 template <typename T>
585 {
586  interface_internal::
587  IteratorImpl< T, SUPERSUBCLASS(IteratorInterface,T) >::
588  next( *this );
589 }
591 
592 //-----------------------------------------------------------------------------
593 // KeyIteratorInterface methods
594 //-----------------------------------------------------------------------------
596 
597 //-----------------------------------------------------------------------------
598 template <typename T>
600 {
601  return interface_internal::
602  KeyIteratorImpl< T, SUPERSUBCLASS(KeyIteratorInterface,T) >
603  ::isKeyIterator( *this );
604 }
605 
606 
607 //-----------------------------------------------------------------------------
608 template <typename T>
610 {
611  return interface_internal::
612  KeyIteratorImpl< T, SUPERSUBCLASS(KeyIteratorInterface,T) >::
613  keyObject( *this );
614 }
615 
616 
617 //-----------------------------------------------------------------------------
618 // DictionaryIteratorInterface methods
619 //-----------------------------------------------------------------------------
620 
622 //-----------------------------------------------------------------------------
623 template <typename T>
625 {
626  return interface_internal::
627  DictionaryIteratorImpl< T, SUPERSUBCLASS(DictionaryIteratorInterface,T) >
628  ::isDictionaryIterator( *this );
629 }
631 
632 //-----------------------------------------------------------------------------
633 template <typename T>
634 std::string TypedObject<T>::key() const
635 {
636  return interface_internal::
637  DictionaryIteratorImpl< T, SUPERSUBCLASS(DictionaryIteratorInterface,T) >::
638  key( *this );
639 }
641 
642 //-----------------------------------------------------------------------------
643 // IntKeyIteratorInterface methods
644 //-----------------------------------------------------------------------------
645 
646 
647 //-----------------------------------------------------------------------------
648 template <typename T>
650 {
651  return interface_internal::
652  IntDictionaryIteratorImpl< T, SUPERSUBCLASS(IntKeyIteratorInterface,T) >
653  ::isIntKeyIterator( *this );
654 }
656 
657 //-----------------------------------------------------------------------------
658 template <typename T>
660 {
661  return interface_internal::
662  IntDictionaryIteratorImpl< T, SUPERSUBCLASS(IntKeyIteratorInterface,T) >::
663  intKey( *this );
664 }
665 
666 
667 //-----------------------------------------------------------------------------
668 // NoneInterface methods
669 //-----------------------------------------------------------------------------
671 
672 //-----------------------------------------------------------------------------
673 template <typename T>
675 {
676  return interface_internal::
677  NoneImpl< T, SUPERSUBCLASS(NoneInterface,T) >
678  ::isNone( *this );
679 }
680 
681 
682 //-----------------------------------------------------------------------------
683 template <typename T>
684 bool TypedObject<T>::operator == ( const GenericObject & other ) const
685 {
686  if( this == &other )
687  return true;
688  if( isScalar() )
689  return interface_internal::
690  ScalarImpl< T, SUPERSUBCLASS(ScalarInterface,T) >
691  ::equals( *this, other );
692  if( isString() )
693  return interface_internal::
694  StringImpl< T, SUPERSUBCLASS(StringInterface,T) >
695  ::equals( *this, other );
696  if( isDictionary() )
697  return interface_internal::
698  DictionaryImpl< T, SUPERSUBCLASS(DictionaryInterface,T) >
699  ::equals( *this, other );
700  if( isIterable() )
701  return interface_internal::
702  IterableImpl< T, SUPERSUBCLASS(IterableInterface,T) >
703  ::equals( *this, other );
704  return false;
705 }
706 
707 
708  //------------------//
709  // ValueObject<T> //
710 //------------------//
711 
712 //-----------------------------------------------------------------------------
713 template <typename T>
715 {
716 }
717 
718 //-----------------------------------------------------------------------------
719 template <typename T>
721 {
722  _value = x;
723 }
724 
725 //-----------------------------------------------------------------------------
726 template <typename T>
728 {
729 }
730 
731 
732 //-----------------------------------------------------------------------------
733 template <typename T>
735 {
736  return _value;
737 }
739 
740 //-----------------------------------------------------------------------------
741 template <typename T>
743 {
744  return Object::value( _value );
745 }
746 
747 
748  //----------------------//
749  // ReferenceObject<T> //
750 //----------------------//
751 
752 //-----------------------------------------------------------------------------
753 template <typename T>
755  : _value( x )
756 {
757 }
758 
759 //-----------------------------------------------------------------------------
760 template <typename T>
762 {
763 }
764 
765 
766 //-----------------------------------------------------------------------------
767 template <typename T>
769 {
770  return _value;
771 }
772 
773 //-----------------------------------------------------------------------------
774 template <typename T>
776 {
777  return Object::reference( _value );
778 }
779 
780 
781  //--------------------//
782  // PointerObject<T> //
783 //--------------------//
784 
785 //-----------------------------------------------------------------------------
786 template <typename T>
788  : _pvalue( &x ), _owner( owner )
789 {
790 }
791 
792 //-----------------------------------------------------------------------------
793 template <typename T>
795 {
796  if ( _owner ) delete _pvalue;
797 }
799 
800 //-----------------------------------------------------------------------------
801 template <typename T>
803 {
804  return *_pvalue;
805 }
806 
807 //-----------------------------------------------------------------------------
808 template <typename T>
810 {
811  return Object( new PointerObject<T>( *_pvalue, false ) );
812 }
813 
814 
815 } // namespace carto
816 
817 #endif // ifndef CARTOBASE_OBJECT_OBJECT_D_H
virtual ~ValueObject()
Definition: object_d.h:727
virtual bool isScalar() const
Returns false if the stored object doesn&#39;t actually implement the ScalarInterface API (needed since a...
virtual bool isKeyIterator() const
Returns false if the stored object doesn&#39;t actually implement the DictionaryIteratorInterface API (ne...
virtual void setArrayItem(int, Object)=0
virtual Object currentValue() const
Access the value of the element pointed to by the iterator.
Definition: object_d.h:574
virtual bool isDynArray() const
Returns false if the stored object doesn&#39;t actually implement the DynArrayInterface API (needed since...
Definition: object_d.h:396
virtual bool getProperty(const std::string &key, Object &value) const =0
Access the element ok key key.
virtual bool getProperty(const std::string &, Object &) const
Access the element ok key key.
Definition: object_d.h:475
base abstract generic object class.
Definition: object.h:524
static void setString(TypedObject< T > &, const std::string &)
Definition: object_d.h:162
virtual Object getArrayItem(int index) const =0
Get the element of index index.
virtual bool isIntKeyIterator() const
Returns false if the stored object doesn&#39;t actually implement the DictionaryIteratorInterface API (ne...
Definition: object_d.h:649
static bool isDynArray(const TypedObject< T > &)
Definition: object_d.h:300
virtual bool isNone() const =0
Returns false if the stored object doesn&#39;t actually implement the NoneInterface API (needed since all...
virtual long intKey() const
Access the key of the current dictionary element.
Definition: object_d.h:659
virtual bool isString() const
Returns false if the stored object doesn&#39;t actually implement the StringInterface API (needed since a...
Definition: object_d.h:330
virtual double getScalar() const
Obtain a scalar value, possibly after a conversion.
Definition: object_d.h:307
virtual void reserveArray(size_t)
like the STL vector::reserve(), memory is reserved but no element is stored
Definition: object_d.h:405
virtual void insertArrayItem(int, Object)=0
inserts an element into the array.
virtual Object clone() const
cloning copy
Definition: object_d.h:742
virtual T & getValue()
Definition: object_d.h:734
virtual void reserveArray(size_t)=0
like the STL vector::reserve(), memory is reserved but no element is stored
This class is just a hint to convert an actual data type to an identifier string used in input/output...
Definition: types.h:110
virtual T & getValue()
Definition: object_d.h:241
virtual bool isDictionary() const
Returns false if the stored object doesn&#39;t actually implement the DictionaryInterface API (needed sin...
virtual void next()
Point to the next element of the iterable container.
Definition: object_d.h:584
virtual ~PointerObject()
Definition: object_d.h:794
virtual void clearProperties()
clear the dictionary
virtual bool isDictionaryIterator() const
Returns false if the stored object doesn&#39;t actually implement the DictionaryIteratorInterface API (ne...
virtual bool isIntKeyIterator() const
Returns false if the stored object doesn&#39;t actually implement the DictionaryIteratorInterface API (ne...
virtual bool hasProperty(const std::string &key) const =0
check if an element exists under the key key
static void check(T *x=NULL)
Definition: object.h:758
static Object reference(T &value)
factory function: builds an Object by referencing the value from a ReferenceObject storage wrapper...
Definition: object.h:1532
virtual Object keyObject() const =0
Access the key of the current element.
virtual long intKey() const =0
Access the key of the current dictionary element.
virtual bool isValid() const
true if the iterator points to a valid value, false when the end of the iterable container has been r...
Definition: object_d.h:564
static void setScalar(TypedObject< T > &, double)
Definition: object_d.h:96
virtual bool removeProperty(const std::string &)
remove an element.
Definition: object_d.h:496
virtual void insertArrayItem(int, Object)
inserts an element into the array.
Definition: object_d.h:435
static bool isIterable(const TypedObject< T > &)
Definition: object_d.h:521
virtual Object objectIterator() const
returns an object implementing the IteratorIntrerface
Definition: object_d.h:540
virtual bool isScalar() const
Returns false if the stored object doesn&#39;t actually implement the ScalarInterface API (needed since a...
Definition: object_d.h:298
virtual ~TypedObject()
Definition: object_d.h:194
static bool isIterator(const TypedObject< T > &)
Definition: object_d.h:590
int verbose
static bool isString(const TypedObject< T > &)
Definition: object_d.h:150
storage wrapper, derived but still abstract template class
Definition: object.h:88
virtual void resizeArray(size_t)
resize the array.
Definition: object_d.h:415
virtual bool isNone() const
Returns false if the stored object doesn&#39;t actually implement the NoneInterface API (needed since all...
Definition: object_d.h:674
virtual bool isString() const
Returns false if the stored object doesn&#39;t actually implement the StringInterface API (needed since a...
virtual bool isIterator() const
Returns false if the stored object doesn&#39;t actually implement the IteratorInterface API (needed since...
Definition: object_d.h:555
virtual bool isKeyIterator() const
Returns false if the stored object doesn&#39;t actually implement the DictionaryIteratorInterface API (ne...
Definition: object_d.h:599
friend class Object
Definition: object.h:594
virtual void setScalar(double)
The double value will be converted to the actual storage type before it is set in the contained objec...
Definition: object_d.h:316
virtual std::string getString() const
Obtain a string value, possibly after a conversion.
Definition: object_d.h:339
void object_to(Object o, T &r)
Definition: object.h:1305
virtual void resizeArray(size_t)=0
resize the array.
virtual Object clone() const
cloning copy
Definition: object_d.h:775
virtual size_t size() const
Number of sub-elements.
Definition: object_d.h:451
virtual void clearProperties()
clear the dictionary
Definition: object_d.h:506
static std::string name()
Definition: types.h:243
virtual bool operator==(const GenericObject &other) const
Definition: object_d.h:684
virtual void removeArrayItem(int)=0
removes an element from the array.
void setValue(const T &val)
Store value in object by copying it.
Definition: object_d.h:167
virtual Object objectIterator() const =0
returns an object implementing the IteratorIntrerface
virtual Object clone() const
cloning copy
Definition: object_d.h:249
static bool isScalar(const TypedObject< T > &)
Definition: object_d.h:83
virtual std::string type() const =0
type() returns the DataTypeCode::name() of the underlying object type
virtual void next()=0
Point to the next element of the iterable container.
virtual bool isArray() const
Returns false if the stored object doesn&#39;t actually implement the ArrayInterface API (needed since al...
Definition: object_d.h:362
virtual Object getArrayItem(int index) const
Get the element of index index.
Definition: object_d.h:371
virtual void setProperty(const std::string &key, Object value)=0
Set (insert or replace) the element of key key with the value object.
static std::string getString(const TypedObject< T > &)
Definition: object_d.h:155
virtual T & getValue()
Definition: object_d.h:802
static Object value()
factory function: builds an Object by using the default constructor
Definition: object.h:1482
virtual ~ReferenceObject()
Definition: object_d.h:761
virtual bool isIterable() const
Returns false if the stored object doesn&#39;t actually implement the IterableInterface API (needed since...
virtual std::string key() const
Access the key of the current dictionary element.
Definition: object_d.h:634
const T & value() const
Retreive value in object, const reference.
Definition: object_d.h:126
virtual std::string type() const
type() returns the DataTypeCode::name() of the underlying object type
Definition: object_d.h:217
virtual Object currentValue() const =0
Access the value of the element pointed to by the iterator.
virtual void setValue(Object val)
Definition: object_d.h:209
static bool isArray(const TypedObject< T > &)
Definition: object_d.h:246
virtual void setProperty(const std::string &, Object)
Set (insert or replace) the element of key key with the value object.
Definition: object_d.h:486
virtual bool isDictionary() const
Returns false if the stored object doesn&#39;t actually implement the DictionaryInterface API (needed sin...
Definition: object_d.h:465
virtual bool removeProperty(const std::string &)=0
remove an element.
virtual bool isIterable() const
Returns false if the stored object doesn&#39;t actually implement the IterableInterface API (needed since...
Definition: object_d.h:531
virtual size_t size() const =0
Number of sub-elements.
virtual bool hasProperty(const std::string &) const
check if an element exists under the key key
Definition: object_d.h:516
static Interface * get(TypedObject< T > &)
virtual Object clone() const
cloning copy
Definition: object_d.h:809
virtual void removeArrayItem(int)
removes an element from the array.
Definition: object_d.h:425
virtual T & getValue()
Definition: object_d.h:768
static double getScalar(const TypedObject< T > &)
Definition: object_d.h:88
PointerObject(T &x, bool owner)
Definition: object_d.h:787
virtual bool isValid() const =0
true if the iterator points to a valid value, false when the end of the iterable container has been r...
virtual std::string key() const =0
Access the key of the current dictionary element.
virtual bool isDictionaryIterator() const
Returns false if the stored object doesn&#39;t actually implement the DictionaryIteratorInterface API (ne...
Definition: object_d.h:624
virtual void setString(const std::string &)
The string value may be converted to the actual storage type before it is set in the contained object...
Definition: object_d.h:348
virtual Object keyObject() const
Access the key of the current element.
Definition: object_d.h:609
virtual void setArrayItem(int, Object)
Definition: object_d.h:381