34 #ifndef CARTOBASE_OBJECT_OBJECT_D_H 
   35 #define CARTOBASE_OBJECT_OBJECT_D_H 
   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 >;     \ 
   45     T const &GenericObject::value< T >() const; \ 
   47     T &GenericObject::value< T >(); \ 
   49     bool GenericObject::value( T &dest ) const; \ 
   51     void GenericObject::setValue( T const & x ); \ 
   53     void DictionaryInterface::setProperty( const std::string &key, \ 
   56       this->setProperty( key, Object::value( value ) ); \ 
   59     bool DictionaryInterface::getProperty( const std::string &key, T &value ) const \ 
   62       if( getProperty( key, o ) && o.get() ) \ 
   66           value = o->GenericObject::value< T >(); \ 
  130   throw std::invalid_argument( std::string( 
"cannot convert object from " )
 
  132                                + 
" (dynamic cast failed from "  
  133                                + 
typeid(*this).
name() + 
" to "  
  134                                + 
typeid(u).name() + 
")" );
 
  144   throw std::invalid_argument( std::string( 
"cannot convert object from " ) 
 
  146                                + 
" (dynamic cast failed from "  
  147                                + 
typeid(*this).
name() + 
" to "  
  148                                + 
typeid(u).name() + 
")" );
 
  153 template <
typename T> 
 
  173     throw std::invalid_argument( std::string( 
"cannot write value of type " ) 
 
  175                                  + 
" to object of type " + 
type() );
 
  185 template <
typename T>
 
  193 template <
typename T>
 
  200 template <
typename T>
 
  208 template <
typename T>
 
  224 template <
typename T>
 
  227   return interface_internal::
 
  233 template <
typename T>
 
  234 const void *TypedObject<T>::_getAddressOfValue()
 const 
  240 template <
typename T>
 
  243   throw std::runtime_error( 
"pure virtual function called" );
 
  248 template <
typename T>
 
  251   throw std::runtime_error( 
"pure virtual function called" );
 
  257 template <
typename T>
 
  263 template <
typename T>
 
  264 bool PrintInstantiation<T>::doIt( 
bool *address )
 
  267     std::cerr << 
"!instantiation! " << 
typeid(T).name() << 
" " 
  276 template <
typename T>
 
  277 bool PrintInstantiation<const T>::doIt( 
bool *address)
 
  280     std::cerr << 
"!instantiation! " << 
typeid(T).name() << 
" " 
  282               << 
static_cast<void *
>( address ) << 
" " 
  297 template <
typename T>
 
  300   return interface_internal::
 
  306 template <
typename T>
 
  309   return interface_internal::
 
  315 template <
typename T>
 
  318   return interface_internal::
 
  329 template <
typename T>
 
  332   return interface_internal::
 
  338 template <
typename T>
 
  341   return interface_internal::
 
  347 template <
typename T>
 
  350   return interface_internal::
 
  361 template <
typename T>
 
  364   return interface_internal::
 
  370 template <
typename T>
 
  373   return interface_internal::
 
  378 template <
typename T>
 
  381   return interface_internal::
 
  386 template <
typename T>
 
  389   return interface_internal::
 
  391     getArrayItem( *
this, index );
 
  396 template <
typename T>
 
  401     setArrayItem( *
this, index, value );
 
  411 template <
typename T>
 
  414   return interface_internal::
 
  420 template <
typename T>
 
  425     reserveArray( *
this, size );
 
  430 template <
typename T>
 
  435     resizeArray( *
this, size );
 
  440 template <
typename T>
 
  445     removeArrayItem( *
this, index );
 
  450 template <
typename T>
 
  455     insertArrayItem( *
this, index, value );
 
  466 template <
typename T>
 
  480 template <
typename T>
 
  483   return interface_internal::
 
  485     ::isDictionary( *
this );
 
  490 template <
typename T>
 
  494   return interface_internal::
 
  496     getProperty( *
this, key, result );
 
  501 template <
typename T>
 
  506     setProperty( *
this, key, value );
 
  511 template <
typename T>
 
  514   return interface_internal::
 
  516     removeProperty( *
this,key );
 
  521 template <
typename T>
 
  526     clearProperties( *
this );
 
  531 template <
typename T>
 
  534   return interface_internal::
 
  536     hasProperty( *
this,key );
 
  546 template <
typename T>
 
  549   return interface_internal::
 
  555 template <
typename T>
 
  558   return interface_internal::
 
  560     objectIterator( *
this );
 
  570 template <
typename T>
 
  573   return interface_internal::
 
  579 template <
typename T>
 
  582   return interface_internal::
 
  589 template <
typename T>
 
  592   return interface_internal::
 
  594     currentValue( *
this );
 
  599 template <
typename T>
 
  614 template <
typename T>
 
  617   return interface_internal::
 
  619     ::isKeyIterator( *
this );
 
  624 template <
typename T>
 
  627   return interface_internal::
 
  639 template <
typename T>
 
  642   return interface_internal::
 
  644     ::isDictionaryIterator( *
this );
 
  649 template <
typename T>
 
  652   return interface_internal::
 
  664 template <
typename T>
 
  667   return interface_internal::
 
  669     ::isIntKeyIterator( *
this );
 
  674 template <
typename T>
 
  677   return interface_internal::
 
  689 template <
typename T>
 
  692   return interface_internal::
 
  699 template <
typename T>
 
  705     return interface_internal::
 
  707         ::equals( *
this, other );
 
  709     return interface_internal::
 
  711         ::equals( *
this, other );
 
  713     return interface_internal::
 
  715         ::equals( *
this, other );
 
  717     return interface_internal::
 
  719         ::equals( *
this, other );
 
  729 template <
typename T>
 
  735 template <
typename T>
 
  742 template <
typename T>
 
  749 template <
typename T>
 
  757 template <
typename T>
 
  769 template <
typename T>
 
  776 template <
typename T>
 
  783 template <
typename T>
 
  790 template <
typename T>
 
  802 template <
typename T>
 
  804                           : _pvalue( &x ), _owner( owner )
 
  809 template <
typename T>
 
  812   if ( _owner ) 
delete _pvalue;
 
  817 template <
typename T>
 
  824 template <
typename T>
 
ArrayInterface represents any container whose elements can be accessed via an integer index.
This class is just a hint to convert an actual data type to an identifier string used in input/output...
static std::string name()
Interface for dictionary-like objects.
Specialized IteratorInterface for dictionaries.
A dynamic array has resize and insertion capabilities (like a STL vector)
base abstract generic object class.
const T & value() const
Retrieve value in object, const reference.
void setValue(const T &val)
Store value in object by copying it.
virtual std::string type() const =0
type() returns the DataTypeCode::name() of the underlying object type
Specialized IteratorInterface for dictionaries.
Container objects which can be iterated.
An iterator object is a reference to another object.
Specialized IteratorInterface for key/value storage.
Specialized NoneInterface for empty objects (null, None).
static Object reference(T &value)
factory function: builds an Object by referencing the value from a ReferenceObject storage wrapper.
static Object value()
factory function: builds an Object by using the default constructor
PointerObject(T &x, bool owner)
virtual Object clone() const
cloning copy
virtual Object clone() const
cloning copy
virtual ~ReferenceObject()
All scalar numbers implement the ScalarInterface (all ints, float, double...)
All container objects inherit the SizeInterface.
Objects whose value may be represented as a character string.
storage wrapper, derived but still abstract template class
virtual long intKey() const
Access the key of the current dictionary element.
virtual bool isContiguous() const
Tells if array indices are contiguous (as in a vector), contrarily to an int key dictionary.
virtual Object objectIterator() const
returns an object implementing the IteratorIntrerface
virtual bool isKeyIterator() const
Returns false if the stored object doesn't actually implement the DictionaryIteratorInterface API (ne...
virtual Object keyObject() const
Access the key of the current element.
virtual Object clone() const
cloning copy
virtual bool isDynArray() const
Returns false if the stored object doesn't actually implement the DynArrayInterface API (needed since...
virtual void setValue(Object val)
virtual Object currentValue() const
Access the value of the element pointed to by the iterator.
virtual void insertArrayItem(int, Object)
inserts an element into the array.
virtual void removeArrayItem(int)
removes an element from the array.
virtual void setScalar(double)
The double value will be converted to the actual storage type before it is set in the contained objec...
virtual bool isIterator() const
Returns false if the stored object doesn't actually implement the IteratorInterface API (needed since...
virtual Object getArrayItem(int index) const
Get the element of index index.
virtual std::string key() const
Access the key of the current dictionary element.
virtual bool isIntKeyIterator() const
Returns false if the stored object doesn't actually implement the DictionaryIteratorInterface API (ne...
virtual std::string getString() const
Obtain a string value, possibly after a conversion.
virtual void clearProperties()
clear the dictionary
virtual void reserveArray(size_t)
like the STL vector::reserve(), memory is reserved but no element is stored
virtual bool isDictionaryIterator() const
Returns false if the stored object doesn't actually implement the DictionaryIteratorInterface API (ne...
virtual bool isIterable() const
Returns false if the stored object doesn't actually implement the IterableInterface API (needed since...
virtual void resizeArray(size_t)
resize the array.
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...
virtual bool isArray() const
Returns false if the stored object doesn't actually implement the ArrayInterface API (needed since al...
virtual size_t size() const
Number of sub-elements.
virtual bool removeProperty(const std::string &)
remove an element.
virtual bool operator==(const GenericObject &other) const
virtual bool hasItem(int index) const
Tells if array item index actually exists.
virtual bool hasProperty(const std::string &) const
check if an element exists under the key key
virtual bool isDictionary() const
Returns false if the stored object doesn't actually implement the DictionaryInterface API (needed sin...
virtual bool isString() const
Returns false if the stored object doesn't actually implement the StringInterface API (needed since a...
virtual double getScalar() const
Obtain a scalar value, possibly after a conversion.
virtual bool isValid() const
true if the iterator points to a valid value, false when the end of the iterable container has been r...
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.
virtual std::string type() const
type() returns the DataTypeCode::name() of the underlying object type
virtual bool isScalar() const
Returns false if the stored object doesn't actually implement the ScalarInterface API (needed since a...
virtual bool isNone() const
Returns false if the stored object doesn't actually implement the NoneInterface API (needed since all...
virtual void setArrayItem(int, Object)
virtual Object clone() const
cloning copy
#define SUPERSUBCLASS(T, U)
void object_to(Object o, T &r)
static void check(T *x=NULL)