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

A abstract DC construct, implementing an implicit product structure with ContentPackage components. More...

#include <contentpackage.hh>

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

RVL::DataContainer RVL::Writeable List of all members.

Public Member Functions

 PackageContainer ()
 PackageContainer (PackageContainer< DataType, MetaType > const &)
virtual ~PackageContainer ()
virtual void eval (FunctionObject &f, std::vector< DataContainer const * > &x)
 FO eval method - virtual to allow specialization in subclasses.
virtual void eval (FunctionObjectConstEval &f, vector< DataContainer const * > &x) const
 FOR eval method - virtual to allow specialization in subclasses.

Protected Member Functions

virtual ContentPackage< DataType,
MetaType > & 
get (bool &more)=0
 Sequential access to component CPs.
virtual ContentPackage< DataType,
MetaType > const & 
get (bool &more) const =0
virtual void put () const =0
 store the internal CP buffer - to allow for out-of-order execution (eg.
virtual void reset () const =0
 restore PC to its original state.

Detailed Description

template<typename DataType, typename MetaType>
class RVL::PackageContainer< DataType, MetaType >

A abstract DC construct, implementing an implicit product structure with ContentPackage components.

An explicit product structure could be overlain easily. Also exhibits RepeatableAccess interface and a private version of a server interface, which directly exposes internal data or stores it. This is more appropriate than the RecordServer interface, as a DC such as this one owns its data, and either stores it available for use or accesses windows into it over the internet. A standard RecordServer interface would imply needless copying.

Only reset, get, and put - plus the usual write methods - need be implemented in child classes, as the eval methods of DC are implemented in the base class.

This class poses an interesting aliasing problem. The eval methods define data access patterns as for all DCs. RepeatableAccess models sequential access to a Cartesian product of DCs (as would happen wvia sequential file i/o). In evals with more than one input argument, several of these may be aliased. Reading a component DC from argument i will therefore read the wrong data if another argument, say j, aliases with i.

The fix adopted here is to test each DC input argument for identity (by addresss) with previously accessed args. The CP in which PC::get() places the component data is dynamically allocated if the DC argument doesn't appear earlier on the list. Otherwise the pointer CP is set to the previously used pointer, thus explicitly aliasing the input data by address.

The rationale for this design lies in the unique correspondence between RVL::Vector instances and their DCs. The only case in which Vectors share DCs comes in the Components construction for Vectors in ProductSpaces. Since evaluation happens at the level of components anyway, it is impossible for non-aliased Vector args to yield aliased DC args. In any case it is the DC args which pose the immediate aliasing issue.

Of course, aliasing an input argument with the output argument violates RVL design principles. Since the eval methods are checking addresses in any case, violation of the anti-aliasing rule is also checked and throws an exception.

Because FO evaluation is so central, and can accomodate so many different purposes, in RVL applications, we have left the eval methods virtual - child classes can override them to implement special cases, while delegating to the parent class methods for general evaluations.

Definition at line 459 of file contentpackage.hh.


Constructor & Destructor Documentation

template<typename DataType, typename MetaType>
RVL::PackageContainer< DataType, MetaType >::PackageContainer (  ) 

Definition at line 500 of file contentpackage.hh.

template<typename DataType, typename MetaType>
RVL::PackageContainer< DataType, MetaType >::PackageContainer ( PackageContainer< DataType, MetaType > const &   ) 

Definition at line 501 of file contentpackage.hh.

template<typename DataType, typename MetaType>
virtual RVL::PackageContainer< DataType, MetaType >::~PackageContainer (  )  [virtual]

Definition at line 502 of file contentpackage.hh.


Member Function Documentation

template<typename DataType, typename MetaType>
virtual ContentPackage<DataType,MetaType>& RVL::PackageContainer< DataType, MetaType >::get ( bool &  more  )  [protected, pure virtual]

Sequential access to component CPs.

Should return more=false when there are no more CPs to be returned, else true. Thus a typical use is

bool more = true; while (more) { ContentPackage<...> const & cp = get(more); (do something) }

Implementations should test for more=true and throw an exception if not, as an additional check.

Since access is sequential, revisiting the contents of the PC requires a call to reset().

Child classes must store an internal CP buffer so that they can always return a ref to a CP.

Implemented in RVL::SingleDataContainer< Datatype, Metatype >.

Referenced by RVL::PackageContainer< Datatype, Metatype >::eval().

template<typename DataType, typename MetaType>
virtual ContentPackage<DataType,MetaType> const& RVL::PackageContainer< DataType, MetaType >::get ( bool &  more  )  const [protected, pure virtual]

Implemented in RVL::SingleDataContainer< Datatype, Metatype >.

template<typename DataType, typename MetaType>
virtual void RVL::PackageContainer< DataType, MetaType >::put (  )  const [protected, pure virtual]

store the internal CP buffer - to allow for out-of-order execution (eg.

in parallel), child classes can index into global storage using metadata attributes of their internal CP buffer.

Implemented in RVL::SingleDataContainer< Datatype, Metatype >.

Referenced by RVL::PackageContainer< Datatype, Metatype >::eval().

template<typename DataType, typename MetaType>
virtual void RVL::PackageContainer< DataType, MetaType >::reset (  )  const [protected, pure virtual]

restore PC to its original state.

For out-of-core PCs this should seek the file pointer to BOF.

Implemented in RVL::SingleDataContainer< Datatype, Metatype >.

Referenced by RVL::PackageContainer< Datatype, Metatype >::eval().

template<typename DataType, typename MetaType>
virtual void RVL::PackageContainer< DataType, MetaType >::eval ( FunctionObject f,
std::vector< DataContainer const * > &  x 
) [virtual]

FO eval method - virtual to allow specialization in subclasses.

Definition at line 505 of file contentpackage.hh.

template<typename DataType, typename MetaType>
virtual void RVL::PackageContainer< DataType, MetaType >::eval ( FunctionObjectConstEval f,
vector< DataContainer const * > &  x 
) const [virtual]

FOR eval method - virtual to allow specialization in subclasses.

Implements RVL::DataContainer.

Definition at line 567 of file contentpackage.hh.


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