cartobase  5.0.5
carto::ArrayInterface Class Referenceabstract

ArrayInterface represents any container whose elements can be accessed via an integer index. More...

#include <cartobase/object/object.h>

Inheritance diagram for carto::ArrayInterface:
Collaboration diagram for carto::ArrayInterface:

Public Member Functions

virtual ~ArrayInterface ()
 
virtual bool isArray () const
 Returns false if the stored object doesn't actually implement the ArrayInterface API (needed since all GenericObject inherit this interface whatever they actually contain) More...
 
virtual Object getArrayItem (int index) const =0
 Get the element of index index. More...
 
virtual void setArrayItem (int, Object)=0
 
virtual size_t size () const =0
 Number of sub-elements. More...
 
- Public Member Functions inherited from carto::SizeInterface
virtual ~SizeInterface ()
 
- Public Member Functions inherited from carto::Interface
virtual ~Interface ()
 
- Public Member Functions inherited from carto::IterableInterface
virtual ~IterableInterface ()
 
virtual bool isIterable () const
 Returns false if the stored object doesn't actually implement the IterableInterface API (needed since all GenericObject inherit this interface whatever they actually contain) More...
 
virtual Object objectIterator () const =0
 returns an object implementing the IteratorIntrerface More...
 
virtual bool operator== (const IterableInterface &other) const
 equality test More...
 
virtual bool operator!= (const IterableInterface &other) const
 

Detailed Description

ArrayInterface represents any container whose elements can be accessed via an integer index.

Definition at line 334 of file object.h.

Constructor & Destructor Documentation

◆ ~ArrayInterface()

virtual carto::ArrayInterface::~ArrayInterface ( )
virtual

Member Function Documentation

◆ getArrayItem()

virtual Object carto::ArrayInterface::getArrayItem ( int  index) const
pure virtual

Get the element of index index.

An exception will be thrown if the stored object doesn't actually implement the ArrayInterface. But if it does, access to an element of index greater or equal to size() should not be attempted: depending on the exact storage type and array implementation, it can either throw an exception, or simply crash the program.

Implemented in carto::TypedObject< T >, and carto::TypedObject< SyntaxedInterfaceType< T > >.

Referenced by carto::TypedObject< SyntaxedInterfaceType< T > >::getArrayItem().

◆ isArray()

virtual bool carto::ArrayInterface::isArray ( ) const
virtual

Returns false if the stored object doesn't actually implement the ArrayInterface API (needed since all GenericObject inherit this interface whatever they actually contain)

Reimplemented in carto::TypedObject< T >, and carto::TypedObject< SyntaxedInterfaceType< T > >.

◆ setArrayItem()

virtual void carto::ArrayInterface::setArrayItem ( int  ,
Object   
)
pure virtual

◆ size()

virtual size_t carto::ArrayInterface::size ( ) const
pure virtual

Number of sub-elements.

This method may throw an exception if the stored object has not a size-compatible interface

Implements carto::SizeInterface.

Implemented in carto::TypedObject< T >, carto::TypedObject< SyntaxedInterfaceType< T > >, and carto::GenericObject.


The documentation for this class was generated from the following file: