RVL::ContentPackage< DataType, MetaType > Class Template Reference

A normal pairing of an array of data along with Metadata object. More...

#include <contentpackage.hh>

Inheritance diagram for RVL::ContentPackage< DataType, MetaType >:

RVL::LocalDataContainer< DataType > RVL::DataContainer RVL::Writeable List of all members.

Public Member Functions

 ContentPackage (const ContentPackage< DataType, MetaType > &bin)
 copy constructor - deep copy, assumes const word length for DataType returned by sizeof.
 ContentPackage ()
 main constructor
virtual ~ContentPackage ()
bool initialize (MetaType const &_md, LocalDataContainer< DataType > *p=NULL, size_t start=0)
 post-construction initialization - can only be done once! Optional reference to external storage permits a CP to act as a "view" of another hunk of memory.
bool isInitialized () const
 initialization status query
ContentPackage< DataType,
MetaType > & 
operator= (ContentPackage< DataType, MetaType > const &src)
 assignment
bool operator== (ContentPackage< DataType, MetaType > const &a) const
 comparison
bool operator!= (ContentPackage< DataType, MetaType > const &a) const
bool isCompatible (ContentPackage< DataType, MetaType > const &a) const
MetaType & getMetadata ()
 access metadata, mutable
MetaType const & getMetadata () const
 access metadata, const
size_t getSize () const
 access data array size
DataType * getData ()
 access data, mutable
DataType const * getData () const
 access data, const
ostream & write (ostream &str) const

Detailed Description

template<class DataType, class MetaType>
class RVL::ContentPackage< DataType, MetaType >

A normal pairing of an array of data along with Metadata object.

The only requirement on DataType:

must have static size - and object of type DataType must have a definite size known at compile time - and possess a default constructor which allocates a memory block of constant, definite size - sizeof(DataType) must make sense, and actually give the size in bytes of a word of type DataType. Essentially the only possibilities are an intrinsic type or a struct made out of intrinsic types or a struct made out of such structs or...

The only requirements on MetaType:

a deep copy constructor;

correct behaviour of the getDataSize<MetaType>() helper function, if necessary by template specialization, returning the size of the DataType array specified by a MetaType object.

These assumptions are implicit in the presumption that all information necessary to initialize and define the behaviour of an object of this type is present in the MetaType data member and the DataType type specification..

This class follows the "initialization separate from instantiation" paradigm. The added flexibility is useful eg. in distributed computing - a recipient object can be constructed before the data it is to receive has been transmitted. Since the MetaType data member determines the size of the DataType array, the alternative paradigm would require some kind of auxiliary factory object.

Definition at line 202 of file contentpackage.hh.


Constructor & Destructor Documentation

template<class DataType, class MetaType>
RVL::ContentPackage< DataType, MetaType >::ContentPackage ( const ContentPackage< DataType, MetaType > &  bin  ) 

copy constructor - deep copy, assumes const word length for DataType returned by sizeof.

Definition at line 214 of file contentpackage.hh.

template<class DataType, class MetaType>
RVL::ContentPackage< DataType, MetaType >::ContentPackage (  ) 

main constructor

Definition at line 233 of file contentpackage.hh.

template<class DataType, class MetaType>
virtual RVL::ContentPackage< DataType, MetaType >::~ContentPackage (  )  [virtual]

Definition at line 238 of file contentpackage.hh.


Member Function Documentation

template<class DataType, class MetaType>
bool RVL::ContentPackage< DataType, MetaType >::initialize ( MetaType const &  _md,
LocalDataContainer< DataType > *  p = NULL,
size_t  start = 0 
)

post-construction initialization - can only be done once! Optional reference to external storage permits a CP to act as a "view" of another hunk of memory.

Definition at line 258 of file contentpackage.hh.

Referenced by RVL::SingleDataContainer< Datatype, Metatype >::initialize().

template<class DataType, class MetaType>
bool RVL::ContentPackage< DataType, MetaType >::isInitialized (  )  const

initialization status query

Definition at line 290 of file contentpackage.hh.

Referenced by RVL::SingleDataContainer< Datatype, Metatype >::getMetadata().

template<class DataType, class MetaType>
ContentPackage<DataType,MetaType>& RVL::ContentPackage< DataType, MetaType >::operator= ( ContentPackage< DataType, MetaType > const &  src  ) 

assignment

Definition at line 294 of file contentpackage.hh.

template<class DataType, class MetaType>
bool RVL::ContentPackage< DataType, MetaType >::operator== ( ContentPackage< DataType, MetaType > const &  a  )  const

comparison

Definition at line 309 of file contentpackage.hh.

Referenced by RVL::ContentPackage< Datatype, Metatype >::operator!=().

template<class DataType, class MetaType>
bool RVL::ContentPackage< DataType, MetaType >::operator!= ( ContentPackage< DataType, MetaType > const &  a  )  const

Definition at line 318 of file contentpackage.hh.

template<class DataType, class MetaType>
bool RVL::ContentPackage< DataType, MetaType >::isCompatible ( ContentPackage< DataType, MetaType > const &  a  )  const

Definition at line 322 of file contentpackage.hh.

template<class DataType, class MetaType>
MetaType& RVL::ContentPackage< DataType, MetaType >::getMetadata (  ) 

access metadata, mutable

Definition at line 327 of file contentpackage.hh.

Referenced by RVL::SingleDataContainer< Datatype, Metatype >::getMetadata(), and RVL::ContentPackage< Datatype, Metatype >::isCompatible().

template<class DataType, class MetaType>
MetaType const& RVL::ContentPackage< DataType, MetaType >::getMetadata (  )  const

access metadata, const

Definition at line 338 of file contentpackage.hh.

template<class DataType, class MetaType>
size_t RVL::ContentPackage< DataType, MetaType >::getSize (  )  const [virtual]

access data array size

Implements RVL::LocalDataContainer< DataType >.

Definition at line 349 of file contentpackage.hh.

Referenced by RVL::ContentPackage< Datatype, Metatype >::operator==(), and RVL::ContentPackage< Datatype, Metatype >::write().

template<class DataType, class MetaType>
DataType* RVL::ContentPackage< DataType, MetaType >::getData (  )  [virtual]

access data, mutable

Implements RVL::LocalDataContainer< DataType >.

Definition at line 355 of file contentpackage.hh.

Referenced by RVL::ContentPackage< Datatype, Metatype >::operator==().

template<class DataType, class MetaType>
DataType const* RVL::ContentPackage< DataType, MetaType >::getData (  )  const [virtual]

access data, const

Implements RVL::LocalDataContainer< DataType >.

Definition at line 365 of file contentpackage.hh.

template<class DataType, class MetaType>
ostream& RVL::ContentPackage< DataType, MetaType >::write ( ostream &  str  )  const [virtual]

Implements RVL::Writeable.

Definition at line 375 of file contentpackage.hh.

Referenced by RVL::SingleDataContainer< Datatype, Metatype >::write().


The documentation for this class was generated from the following file:
Generated on 5 Jan 2017 for LocalRVL by  doxygen 1.4.7