cartobase  5.1.2
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 }
150 
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 
179 
180  //------------------//
181  // TypedObject<T> //
182 //------------------//
183 
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 }
213 
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::
228  GenericInterface< T, SUPERSUBCLASS(Interface,T) >::get( *this );
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 
246 
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 {
300  return interface_internal::
301  ScalarImpl< T, SUPERSUBCLASS(ScalarInterface,T) >::isScalar( *this );
302 }
303 
304 
305 //-----------------------------------------------------------------------------
306 template <typename T>
308 {
309  return interface_internal::
310  ScalarImpl< T, SUPERSUBCLASS(ScalarInterface,T) >::getScalar( *this );
311 }
312 
313 
314 //-----------------------------------------------------------------------------
315 template <typename T>
317 {
318  return interface_internal::
319  ScalarImpl< T, SUPERSUBCLASS(ScalarInterface,T) >::setScalar( *this, v );
320 }
321 
322 
323 //-----------------------------------------------------------------------------
324 // StringInterface methods
325 //-----------------------------------------------------------------------------
326 
327 
328 //-----------------------------------------------------------------------------
329 template <typename T>
331 {
332  return interface_internal::
333  StringImpl< T, SUPERSUBCLASS(StringInterface,T) >::isString( *this );
334 }
335 
336 
337 //-----------------------------------------------------------------------------
338 template <typename T>
339 std::string TypedObject<T>::getString() const
340 {
341  return interface_internal::
342  StringImpl< T, SUPERSUBCLASS(StringInterface,T) >::getString( *this );
343 }
344 
345 
346 //-----------------------------------------------------------------------------
347 template <typename T>
348 void TypedObject<T>::setString( const std::string &v )
349 {
350  return interface_internal::
351  StringImpl< T, SUPERSUBCLASS(StringInterface,T) >::setString( *this, v );
352 }
353 
354 
355 //-----------------------------------------------------------------------------
356 // ArrayInterface methods
357 //-----------------------------------------------------------------------------
358 
359 
360 //-----------------------------------------------------------------------------
361 template <typename T>
363 {
364  return interface_internal::
365  ArrayImpl< T, SUPERSUBCLASS(ArrayInterface,T) >::isArray( *this );
366 }
367 
368 
369 //-----------------------------------------------------------------------------
370 template <typename T>
372 {
373  return interface_internal::
374  ArrayImpl< T, SUPERSUBCLASS(ArrayInterface,T) >::isContiguous( *this );
375 }
376 
377 //-----------------------------------------------------------------------------
378 template <typename T>
379 bool TypedObject<T>::hasItem( int index ) const
380 {
381  return interface_internal::
382  ArrayImpl< T, SUPERSUBCLASS(ArrayInterface,T) >::hasItem( *this, index );
383 }
384 
385 //-----------------------------------------------------------------------------
386 template <typename T>
388 {
389  return interface_internal::
390  ArrayImpl< T, SUPERSUBCLASS(ArrayInterface,T) >::
391  getArrayItem( *this, index );
392 }
393 
394 
395 //-----------------------------------------------------------------------------
396 template <typename T>
397 void TypedObject<T>::setArrayItem( int index, Object value )
398 {
399  interface_internal::
400  ArrayImpl< T, SUPERSUBCLASS(ArrayInterface,T) >::
401  setArrayItem( *this, index, value );
402 }
403 
404 
405 //-----------------------------------------------------------------------------
406 // DynArrayInterface methods
407 //-----------------------------------------------------------------------------
408 
409 
410 //-----------------------------------------------------------------------------
411 template <typename T>
413 {
414  return interface_internal::
415  DynArrayImpl< T, SUPERSUBCLASS(DynArrayInterface,T) >::isDynArray( *this );
416 }
417 
418 
419 //-----------------------------------------------------------------------------
420 template <typename T>
421 void TypedObject<T>::reserveArray( size_t size )
422 {
423  interface_internal::
424  DynArrayImpl< T, SUPERSUBCLASS(DynArrayInterface,T) >::
425  reserveArray( *this, size );
426 }
427 
428 
429 //-----------------------------------------------------------------------------
430 template <typename T>
431 void TypedObject<T>::resizeArray( size_t size )
432 {
433  interface_internal::
434  DynArrayImpl< T, SUPERSUBCLASS(DynArrayInterface,T) >::
435  resizeArray( *this, size );
436 }
437 
438 
439 //-----------------------------------------------------------------------------
440 template <typename T>
442 {
443  interface_internal::
444  DynArrayImpl< T, SUPERSUBCLASS(DynArrayInterface,T) >::
445  removeArrayItem( *this, index );
446 }
447 
448 
449 //-----------------------------------------------------------------------------
450 template <typename T>
451 void TypedObject<T>::insertArrayItem( int index, Object value )
452 {
453  interface_internal::
454  DynArrayImpl< T, SUPERSUBCLASS(DynArrayInterface,T) >::
455  insertArrayItem( *this, index, value );
456 }
457 
458 
459 
460 //-----------------------------------------------------------------------------
461 // SizeInterface methods
462 //-----------------------------------------------------------------------------
463 
464 
465 //-----------------------------------------------------------------------------
466 template <typename T>
467 size_t TypedObject<T>::size() const
468 {
470  size( *this );
471 }
472 
473 
474 //-----------------------------------------------------------------------------
475 // DictionaryInterface methods
476 //-----------------------------------------------------------------------------
477 
478 
479 //-----------------------------------------------------------------------------
480 template <typename T>
482 {
483  return interface_internal::
484  DictionaryImpl< T, SUPERSUBCLASS(DictionaryInterface,T) >
485  ::isDictionary( *this );
486 }
487 
488 
489 //-----------------------------------------------------------------------------
490 template <typename T>
491 bool TypedObject<T>::getProperty( const std::string &key,
492  Object & result ) const
493 {
494  return interface_internal::
495  DictionaryImpl< T, SUPERSUBCLASS(DictionaryInterface,T) >::
496  getProperty( *this, key, result );
497 }
498 
499 
500 //-----------------------------------------------------------------------------
501 template <typename T>
502 void TypedObject<T>::setProperty( const std::string &key, Object value )
503 {
504  interface_internal::
505  DictionaryImpl< T, SUPERSUBCLASS(DictionaryInterface,T) >::
506  setProperty( *this, key, value );
507 }
508 
509 
510 //-----------------------------------------------------------------------------
511 template <typename T>
512 bool TypedObject<T>::removeProperty( const std::string &key )
513 {
514  return interface_internal::
515  DictionaryImpl< T, SUPERSUBCLASS(DictionaryInterface,T) >::
516  removeProperty( *this,key );
517 }
518 
519 
520 //-----------------------------------------------------------------------------
521 template <typename T>
523 {
524  interface_internal::
525  DictionaryImpl< T, SUPERSUBCLASS(DictionaryInterface,T) >::
526  clearProperties( *this );
527 }
528 
529 
530 //-----------------------------------------------------------------------------
531 template <typename T>
532 bool TypedObject<T>::hasProperty( const std::string &key ) const
533 {
534  return interface_internal::
535  DictionaryImpl< T, SUPERSUBCLASS(DictionaryInterface,T) >::
536  hasProperty( *this,key );
537 }
538 
539 
540 //-----------------------------------------------------------------------------
541 // IterableInterface methods
542 //-----------------------------------------------------------------------------
543 
544 
545 //-----------------------------------------------------------------------------
546 template <typename T>
548 {
549  return interface_internal::
550  IterableImpl< T, SUPERSUBCLASS(IterableInterface,T) >::isIterable( *this );
551 }
552 
553 
554 //-----------------------------------------------------------------------------
555 template <typename T>
557 {
558  return interface_internal::
559  IterableImpl< T, SUPERSUBCLASS(IterableInterface,T) >::
560  objectIterator( *this );
561 }
562 
563 
564 //-----------------------------------------------------------------------------
565 // IteratorInterface methods
566 //-----------------------------------------------------------------------------
567 
568 
569 //-----------------------------------------------------------------------------
570 template <typename T>
572 {
573  return interface_internal::
574  IteratorImpl< T, SUPERSUBCLASS(IteratorInterface,T) >::isIterator( *this );
575 }
576 
577 
578 //-----------------------------------------------------------------------------
579 template <typename T>
581 {
582  return interface_internal::
583  IteratorImpl< T, SUPERSUBCLASS(IteratorInterface,T) >::
584  isValid( *this );
585 }
586 
587 
588 //-----------------------------------------------------------------------------
589 template <typename T>
591 {
592  return interface_internal::
593  IteratorImpl< T, SUPERSUBCLASS(IteratorInterface,T) >::
594  currentValue( *this );
595 }
596 
597 
598 //-----------------------------------------------------------------------------
599 template <typename T>
601 {
602  interface_internal::
603  IteratorImpl< T, SUPERSUBCLASS(IteratorInterface,T) >::
604  next( *this );
605 }
606 
607 
608 //-----------------------------------------------------------------------------
609 // KeyIteratorInterface methods
610 //-----------------------------------------------------------------------------
611 
612 
613 //-----------------------------------------------------------------------------
614 template <typename T>
616 {
617  return interface_internal::
618  KeyIteratorImpl< T, SUPERSUBCLASS(KeyIteratorInterface,T) >
619  ::isKeyIterator( *this );
620 }
621 
622 
623 //-----------------------------------------------------------------------------
624 template <typename T>
626 {
627  return interface_internal::
628  KeyIteratorImpl< T, SUPERSUBCLASS(KeyIteratorInterface,T) >::
629  keyObject( *this );
630 }
631 
632 
633 //-----------------------------------------------------------------------------
634 // DictionaryIteratorInterface methods
635 //-----------------------------------------------------------------------------
636 
637 
638 //-----------------------------------------------------------------------------
639 template <typename T>
641 {
642  return interface_internal::
643  DictionaryIteratorImpl< T, SUPERSUBCLASS(DictionaryIteratorInterface,T) >
644  ::isDictionaryIterator( *this );
645 }
646 
647 
648 //-----------------------------------------------------------------------------
649 template <typename T>
650 std::string TypedObject<T>::key() const
651 {
652  return interface_internal::
653  DictionaryIteratorImpl< T, SUPERSUBCLASS(DictionaryIteratorInterface,T) >::
654  key( *this );
655 }
656 
657 
658 //-----------------------------------------------------------------------------
659 // IntKeyIteratorInterface methods
660 //-----------------------------------------------------------------------------
661 
662 
663 //-----------------------------------------------------------------------------
664 template <typename T>
666 {
667  return interface_internal::
668  IntDictionaryIteratorImpl< T, SUPERSUBCLASS(IntKeyIteratorInterface,T) >
669  ::isIntKeyIterator( *this );
670 }
671 
672 
673 //-----------------------------------------------------------------------------
674 template <typename T>
676 {
677  return interface_internal::
678  IntDictionaryIteratorImpl< T, SUPERSUBCLASS(IntKeyIteratorInterface,T) >::
679  intKey( *this );
680 }
681 
682 
683 //-----------------------------------------------------------------------------
684 // NoneInterface methods
685 //-----------------------------------------------------------------------------
686 
687 
688 //-----------------------------------------------------------------------------
689 template <typename T>
691 {
692  return interface_internal::
693  NoneImpl< T, SUPERSUBCLASS(NoneInterface,T) >
694  ::isNone( *this );
695 }
696 
697 
698 //-----------------------------------------------------------------------------
699 template <typename T>
700 bool TypedObject<T>::operator == ( const GenericObject & other ) const
701 {
702  if( this == &other )
703  return true;
704  if( isScalar() )
705  return interface_internal::
706  ScalarImpl< T, SUPERSUBCLASS(ScalarInterface,T) >
707  ::equals( *this, other );
708  if( isString() )
709  return interface_internal::
710  StringImpl< T, SUPERSUBCLASS(StringInterface,T) >
711  ::equals( *this, other );
712  if( isDictionary() )
713  return interface_internal::
714  DictionaryImpl< T, SUPERSUBCLASS(DictionaryInterface,T) >
715  ::equals( *this, other );
716  if( isIterable() )
717  return interface_internal::
718  IterableImpl< T, SUPERSUBCLASS(IterableInterface,T) >
719  ::equals( *this, other );
720  return false;
721 }
722 
723 
724  //------------------//
725  // ValueObject<T> //
726 //------------------//
727 
728 //-----------------------------------------------------------------------------
729 template <typename T>
731 {
732 }
733 
734 //-----------------------------------------------------------------------------
735 template <typename T>
737 {
738  _value = x;
739 }
740 
741 //-----------------------------------------------------------------------------
742 template <typename T>
744 {
745 }
746 
747 
748 //-----------------------------------------------------------------------------
749 template <typename T>
751 {
752  return _value;
753 }
754 
755 
756 //-----------------------------------------------------------------------------
757 template <typename T>
759 {
760  return Object::value( _value );
761 }
762 
763 
764  //----------------------//
765  // ReferenceObject<T> //
766 //----------------------//
767 
768 //-----------------------------------------------------------------------------
769 template <typename T>
771  : _value( x )
772 {
773 }
774 
775 //-----------------------------------------------------------------------------
776 template <typename T>
778 {
779 }
780 
781 
782 //-----------------------------------------------------------------------------
783 template <typename T>
785 {
786  return _value;
787 }
788 
789 //-----------------------------------------------------------------------------
790 template <typename T>
792 {
793  return Object::reference( _value );
794 }
795 
796 
797  //--------------------//
798  // PointerObject<T> //
799 //--------------------//
800 
801 //-----------------------------------------------------------------------------
802 template <typename T>
804  : _pvalue( &x ), _owner( owner )
805 {
806 }
807 
808 //-----------------------------------------------------------------------------
809 template <typename T>
811 {
812  if ( _owner ) delete _pvalue;
813 }
814 
815 
816 //-----------------------------------------------------------------------------
817 template <typename T>
819 {
820  return *_pvalue;
821 }
822 
823 //-----------------------------------------------------------------------------
824 template <typename T>
826 {
827  return Object( new PointerObject<T>( *_pvalue, false ) );
828 }
829 
830 
831 } // namespace carto
832 
833 #endif // ifndef CARTOBASE_OBJECT_OBJECT_D_H
ArrayInterface represents any container whose elements can be accessed via an integer index.
Definition: object.h:336
This class is just a hint to convert an actual data type to an identifier string used in input/output...
Definition: types.h:111
static std::string name()
Definition: types.h:243
Interface for dictionary-like objects.
Definition: object.h:414
Specialized IteratorInterface for dictionaries.
Definition: object.h:289
A dynamic array has resize and insertion capabilities (like a STL vector)
Definition: object.h:374
base abstract generic object class.
Definition: object.h:545
const T & value() const
Retrieve value in object, const reference.
Definition: object_d.h:126
void setValue(const T &val)
Store value in object by copying it.
Definition: object_d.h:167
virtual std::string type() const =0
type() returns the DataTypeCode::name() of the underlying object type
Specialized IteratorInterface for dictionaries.
Definition: object.h:313
Container objects which can be iterated.
Definition: object.h:197
An iterator object is a reference to another object.
Definition: object.h:236
Specialized IteratorInterface for key/value storage.
Definition: object.h:265
Specialized NoneInterface for empty objects (null, None).
Definition: object.h:516
static Object reference(T &value)
factory function: builds an Object by referencing the value from a ReferenceObject storage wrapper.
Definition: object.h:1546
static Object value()
factory function: builds an Object by using the default constructor
Definition: object.h:1496
PointerObject(T &x, bool owner)
Definition: object_d.h:803
virtual ~PointerObject()
Definition: object_d.h:810
virtual T & getValue()
Definition: object_d.h:818
virtual Object clone() const
cloning copy
Definition: object_d.h:825
virtual T & getValue()
Definition: object_d.h:784
virtual Object clone() const
cloning copy
Definition: object_d.h:791
virtual ~ReferenceObject()
Definition: object_d.h:777
All scalar numbers implement the ScalarInterface (all ints, float, double...)
Definition: object.h:110
All container objects inherit the SizeInterface.
Definition: object.h:178
Objects whose value may be represented as a character string.
Definition: object.h:144
storage wrapper, derived but still abstract template class
Definition: object.h:671
virtual long intKey() const
Access the key of the current dictionary element.
Definition: object_d.h:675
virtual bool isContiguous() const
Tells if array indices are contiguous (as in a vector), contrarily to an int key dictionary.
Definition: object_d.h:371
virtual Object objectIterator() const
returns an object implementing the IteratorIntrerface
Definition: object_d.h:556
virtual bool isKeyIterator() const
Returns false if the stored object doesn't actually implement the DictionaryIteratorInterface API (ne...
Definition: object_d.h:615
virtual Object keyObject() const
Access the key of the current element.
Definition: object_d.h:625
virtual Object clone() const
cloning copy
Definition: object_d.h:249
virtual bool isDynArray() const
Returns false if the stored object doesn't actually implement the DynArrayInterface API (needed since...
Definition: object_d.h:412
virtual void setValue(Object val)
Definition: object_d.h:209
virtual Object currentValue() const
Access the value of the element pointed to by the iterator.
Definition: object_d.h:590
virtual void insertArrayItem(int, Object)
inserts an element into the array.
Definition: object_d.h:451
virtual void removeArrayItem(int)
removes an element from the array.
Definition: object_d.h:441
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 bool isIterator() const
Returns false if the stored object doesn't actually implement the IteratorInterface API (needed since...
Definition: object_d.h:571
virtual Object getArrayItem(int index) const
Get the element of index index.
Definition: object_d.h:387
virtual std::string key() const
Access the key of the current dictionary element.
Definition: object_d.h:650
virtual bool isIntKeyIterator() const
Returns false if the stored object doesn't actually implement the DictionaryIteratorInterface API (ne...
Definition: object_d.h:665
virtual std::string getString() const
Obtain a string value, possibly after a conversion.
Definition: object_d.h:339
virtual void clearProperties()
clear the dictionary
Definition: object_d.h:522
virtual void reserveArray(size_t)
like the STL vector::reserve(), memory is reserved but no element is stored
Definition: object_d.h:421
virtual bool isDictionaryIterator() const
Returns false if the stored object doesn't actually implement the DictionaryIteratorInterface API (ne...
Definition: object_d.h:640
virtual T & getValue()
Definition: object_d.h:241
virtual bool isIterable() const
Returns false if the stored object doesn't actually implement the IterableInterface API (needed since...
Definition: object_d.h:547
virtual void resizeArray(size_t)
resize the array.
Definition: object_d.h:431
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 bool isArray() const
Returns false if the stored object doesn't actually implement the ArrayInterface API (needed since al...
Definition: object_d.h:362
virtual size_t size() const
Number of sub-elements.
Definition: object_d.h:467
virtual bool removeProperty(const std::string &)
remove an element.
Definition: object_d.h:512
virtual bool operator==(const GenericObject &other) const
Definition: object_d.h:700
virtual ~TypedObject()
Definition: object_d.h:194
virtual bool hasItem(int index) const
Tells if array item index actually exists.
Definition: object_d.h:379
virtual bool hasProperty(const std::string &) const
check if an element exists under the key key
Definition: object_d.h:532
virtual bool isDictionary() const
Returns false if the stored object doesn't actually implement the DictionaryInterface API (needed sin...
Definition: object_d.h:481
virtual bool isString() const
Returns false if the stored object doesn'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 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:580
virtual void setProperty(const std::string &key, Object value)=0
Set (insert or replace) the element of key key with the value object.
virtual bool getProperty(const std::string &key, Object &value) const=0
Access the element ok key key.
virtual void next()
Point to the next element of the iterable container.
Definition: object_d.h:600
virtual std::string type() const
type() returns the DataTypeCode::name() of the underlying object type
Definition: object_d.h:217
virtual bool isScalar() const
Returns false if the stored object doesn't actually implement the ScalarInterface API (needed since a...
Definition: object_d.h:298
virtual bool isNone() const
Returns false if the stored object doesn't actually implement the NoneInterface API (needed since all...
Definition: object_d.h:690
virtual void setArrayItem(int, Object)
Definition: object_d.h:397
virtual ~ValueObject()
Definition: object_d.h:743
virtual T & getValue()
Definition: object_d.h:750
virtual Object clone() const
cloning copy
Definition: object_d.h:758
#define SUPERSUBCLASS(T, U)
Definition: conversion.h:86
void object_to(Object o, T &r)
Definition: object.h:1319
int verbose
static void check(T *x=NULL)
Definition: object.h:769