Fish - FiberLib for VISH 0.3
Fish - The Fiber Bundle API for the Vish Visualization Shell
Fiber::TypedArray< T > Class Template Referenceabstract

An intermediate class that allows to operate on the pure type information of some memory array. More...

#include <TypedArray.hpp>

Inheritance diagram for Fiber::TypedArray< T >:
Fiber::MemBase MemCore::Cacheable MemCore::Intercube MemCore::ReferenceBase< Cacheable > Fiber::DirectProductMemArray< Eagle::point3 > Fiber::DirectProductMemArray< T, LinearCoordinateAxisArray, MDIMS > Fiber::DirectProductMemArray< Eagle::point3, ExplicitCoordinateAxisArray > Fiber::DirectProductMemArray< point > Fiber::DirectProductMemArray< point_type > Fiber::DirectProductMemArray< T, LinearCoordinateAxisArray, T::SIZE > Fiber::DirectProductMemArray< T, Category, MDIMS > Fiber::ReferencingMemArray< N, T >

Public Types

typedef T value_type
Public Types inherited from Fiber::MemBase
typedef WeakPtrCreativeArrayBase_t Creator_t
Public Types inherited from MemCore::Cacheable
typedef unsigned long cachecounter_t
Public Types inherited from MemCore::ReferenceBase< Cacheable >
typedef Object reference_domain_t
typedef WeakPtr< Object, Object > SelfPtr_t

Public Member Functions

 TypedArray (const MemBase::Creator_t &C)
 TypedArray (const TypedArray< T > &)=delete
void operator= (const TypedArray< T > &)=delete
virtual T first () const =0
 Retrieve the first element.
virtual T last () const =0
 Retrieve the last element.
virtual CreativeIterator< T > * creativeIterator ()=0
virtual const CreativeIterator< T > * creativeIterator () const =0
virtual RefPtr< MemCore::TypedChunk< T > > myChunk () const =0
 Access to a chunk of contiguous data, if such exists.
RefPtr< MemCore::ChunkBasegetChunk () const override
 Implement the virtual getChunk() function.
const type_infogetType () const override
 Return the element type of the certain array.
template<class UnaryOperator>
RefPtr< MemBaseapplyOperator (const UnaryOperator &theOperator, const MemBase::Creator_t &theCreator) const
 Apply an unary operator on the data contained here, and provide a new memory array of the same size and dimensionality.
template<class result_t>
RefPtr< MemBaseapplyFunction (const std::function< result_t(const T &)> &theOperator) const
 Apply a functor, possibly yielding a different type.
RefPtr< MemBaseapplyFunction (const std::function< T(const T &)> &theOperator) const
 Apply a functor yielding the same type.
template<class result_t>
RefPtr< MemBaseapplyFunction (const std::function< result_t(const T &, index_t I)> &theOperator) const
 Apply a functor, possibly yielding a different type.
RefPtr< MemBaseapplyFunction (const std::function< T(const T &, index_t I)> &theOperator) const
 Apply a functor yielding the same type.
template<class result_t, class SecondType>
RefPtr< MemBaseapplyFunction (const TypedArray< SecondType > &R, const std::function< result_t(const T &, const SecondType &ST, index_t I)> &theOperator) const
 Apply a binary functor, possibly yielding a different type.
template<class BinaryOperator>
RefPtr< MemBaseapplyOperator (const BinaryOperator &theOperator, const RefPtr< MemBase > &rightValue, const MemBase::Creator_t &theCreator) const
 Apply a binary operator on the data contained here, and provide a new memory array of the same size and dimensionality.
auto getComponent (int Component) -> decltype(getComponentArrayIterator(*this, Component))
auto operator() (int Component) -> decltype(getComponentArrayIterator(*this, Component))
ranged_for_iterator< T > begin ()
ranged_for_iterator< T > end ()
const_ranged_for_iterator< T > begin () const
const_ranged_for_iterator< T > end () const
RefPtr< MemBasecreate (const RefPtr< FiberTypeBase > &FT, const type_info &layout=typeid(void)) const
 Create a new mem array of the same dimensions but different type.
template<class T>
RefPtr< MemBasecreate (const type_info &layout=typeid(void)) const
 Create a new mem array of the same dimensions but different type.
RefPtr< MemBasecreate (const DynamicSize &DS, const type_info &layout=typeid(void)) const
 Create a new mem array of the same type but different dimensions.
Public Member Functions inherited from Fiber::MemBase
 MemBase (const FiberTypeIndex &theFiberTypeIndex, const Creator_t &theCreator)
 Empty default constructor.
 ~MemBase ()
 Destructor.
 MemBase (const MemBase &)=delete
MemCore::WeakPtr< MemBasemembase () const
virtual void DeferredConstructor () override=0
 Virtual deferred reference pointer construction pointer Don't overload if you don't know exactly what this function is supposed to do.
virtual Fiber::Dims_t rank () const =0
 Return the number of dimensions.
virtual DynamicSize getSize () const =0
 Return the size of this dataset.
virtual index_t nElements () const
 return the number of elements in this array
auto NumberOfElements () const
auto getNumberOfElements () const
virtual HyperslabParametersgetHyperslabParameters ()=0
virtual std::string getElementAsString (size_t index) const =0
MemCore::WeakPtr< FiberTypeBasegetFiberType () const
MemCore::memsize_t element_memsize () const
virtual RefPtr< MemBasemakeMemArray (const MemBase::Creator_t &C) const =0
 Provide a MemArray, even though the actual data is a procedural array.
virtual RefPtr< MemBasegetComponentArray (int member, const MemBase::Creator_t &C)=0
virtual RefPtr< MemBasecreateSubArray (const DynamicSize &Offset, const DynamicSize &CopySize, const MemBase::Creator_t &C) const =0
virtual RefPtr< MemBasecreateEquallySizedMemArray (const RefPtr< MemCore::ChunkBase > &Storage, const MemBase::Creator_t &C) const =0
 Create a memory array of the same dimensions as the current array, but with data as provided by the Storage.
virtual bool copyFrom (const RefPtr< MemCore::ChunkBase > &theChunk)=0
bool copyFrom (const RefPtr< MemBase > &Mb)
 Copy all data values from the given MemBase.
virtual RefPtr< MemBasecopy (const MemBase::Creator_t &C=nullptr) const =0
 Create a copy of the current array, duplicating all data and allocating new memory for it.
RefPtr< MemBasecreate (const RefPtr< FiberTypeBase > &FT, const type_info &layout=typeid(void)) const
 Create a new mem array of the same dimensions but different type.
template<class T>
RefPtr< MemBasecreate (const type_info &layout=typeid(void)) const
 Create a new mem array of the same dimensions but different type.
RefPtr< MemBasecreate (const DynamicSize &DS, const type_info &layout=typeid(void)) const
 Create a new mem array of the same type but different dimensions.
RefPtr< MemBasecreate (const type_info &layout=typeid(void)) const
 Create a new mem array of the same type and dimensions, but default values.
virtual void * getPtr ()=0
 Special Array Storage.
virtual const void * OriginPtr () const =0
 Get pointer to origin of linearly procedural array, if it is linear.
virtual const void * DeltaPtr () const =0
 Get pointer to delta of linearly procedural array, if it is linear.
MemCore::memsize_t memsize () const override
 How much memory is occupied here at all in case it's stored in a chunk?
Public Member Functions inherited from MemCore::Cacheable
 Cacheable (const WeakPtr< Creature > &C)
bool isCached () const
bool isUncached () const
bool markAsUsed ()
WeakPtr< CacheBasemyCache () const
const WeakPtr< Creature > & myCreator () const
int NumberOfListEntries () const
void PreDestructor ()
void push_back (CacheQueue &Q)
void push_front (CacheQueue &Q)
void setCreator (const WeakPtr< Creature > &C)
Public Member Functions inherited from MemCore::ReferenceBase< Cacheable >
auto getObjectCountID () const noexcept
bool isIdentical (const WeakPtr< Object, Object > &PossibleSelf) const noexcept
void mkAutoDestructive ()
refcount_t refcount () const noexcept
 ReferenceBase (Object *that) noexcept
const auto & self () const
refcount_t wrefcount () const noexcept
Public Member Functions inherited from MemCore::Intercube
void addInterface (const RefPtr< InterfaceBase > &I) const
void addInterfaceData (const Data &D)
void addInterfaceData (const Data &D)
void clearInterfaces ()
bool const_iterateInterfaces (const RefPtr< InterfaceIterationParameter > &IIP) const
virtual RefPtr< InterfaceBasecreateInterface (const type_info &) const
RefPtr< InterfaceBasefindInterface (const type_info &t) const
RefPtr< InterfaceBasegetInterface (const type_info &t)
std::string getInterfaceNames (const char delim=';') const
bool gotNewInterfaceData (const Data &D)
bool gotNewInterfaceData (mutex &M, const Data &D)
bool gotNewInterfaceData (mutex &M, const Data &D)
bool gotNewInterfaceData (mutex &M, const Data &D, const Selector &S)
bool gotNewInterfaceData (mutex &M, const Data &D, const Selector *S)
bool hasChangedInterfaceData (const Data &D) const
bool hasChangedInterfaceData (const Data &D) const
bool hasChangedInterfaceData (const Data &D, const Selector &) const
bool hasChangedInterfaceData (const Data &D, const Selector *) const
bool hasInterface (const type_info &t) const
bool iterateInterfaces (const RefPtr< InterfaceIterationParameter > &IIP)
void printInterfaces () const
void registerInterface (const type_info &t)
void removeInterface ()
void removeInterfaceBase (const type_info &InterfaceBaseID)

Static Public Member Functions

static MemCore::WeakPtr< FiberTypeBasegetFiberType ()
static RefPtr< MemBasecreate (const RefPtr< MemBase > &SourceLayout, const type_info &layout=typeid(void))
static RefPtr< MemBasecreate (const RefPtr< FiberTypeBase > &FT, const DynamicSize &DS, const type_info &layout=typeid(void))
 Given a description of a certain data type for each element on array, allocate a multidimensional array of the given type.
Static Public Member Functions inherited from Fiber::MemBase
static RefPtr< MemBasecreate (const RefPtr< FiberTypeBase > &FT, const DynamicSize &DS, const type_info &layout=typeid(void))
 Given a description of a certain data type for each element on array, allocate a multidimensional array of the given type.
static bool registerCreator (const RefPtr< Allocator > &A, const RefPtr< FiberTypeBase > &FT)

Additional Inherited Members

Static Public Attributes inherited from Fiber::MemBase
static int RegisteredTypes = 0
Protected Member Functions inherited from MemCore::Cacheable
void adjustCacheableSize (memsize_t memDiff)
Protected Member Functions inherited from MemCore::ReferenceBase< Cacheable >
virtual void extremeUnction ()
ReferenceBaseoperator= (const ReferenceBase &R)
void suicide ()

Detailed Description

template<class T>
class Fiber::TypedArray< T >

An intermediate class that allows to operate on the pure type information of some memory array.

Type casting into TypedArray<> is allowed. For instance, to check if some MemBase object refers to an array of doubles, just do

if (RefPtr<TypedArray<double> > D = MemBasePtr)
{
....
}
StrongPtr< Object, ObjectBase > RefPtr
Author
Werner Benger
Examples
PolychromeSurface.cpp, TransparentColoredSurface.cpp, and TypedArray.cpp.

Member Function Documentation

◆ applyOperator() [1/2]

template<class T>
template<class BinaryOperator>
RefPtr< MemBase > Fiber::TypedArray< T >::applyOperator ( const BinaryOperator & theOperator,
const RefPtr< MemBase > & rightValue,
const MemBase::Creator_t & theCreator ) const
inline

Apply a binary operator on the data contained here, and provide a new memory array of the same size and dimensionality.

Returns
The result will be a NullPtr() if there are no data available here though the creativeIterator() function.

◆ applyOperator() [2/2]

template<class T>
template<class UnaryOperator>
RefPtr< MemBase > Fiber::TypedArray< T >::applyOperator ( const UnaryOperator & theOperator,
const MemBase::Creator_t & theCreator ) const
inline

Apply an unary operator on the data contained here, and provide a new memory array of the same size and dimensionality.

Parameters
UnaryOperatorThe operator object, must provide a function call operator() that takes values of type T and yields values that can be assigned to T.
Returns
The result will be a NullPtr() if there are no data available here though the creativeIterator() function.

◆ create()

template<class T>
RefPtr< MemBase > Fiber::MemBase::create ( const RefPtr< FiberTypeBase > & FT,
const DynamicSize & DS,
const type_info & layout = typeid(void) )
static

Given a description of a certain data type for each element on array, allocate a multidimensional array of the given type.

The creation will be forwarded to certain Allocators of this specific type, which have been registered through registerCreator();

◆ creativeIterator() [1/2]

◆ creativeIterator() [2/2]

◆ first()

◆ getChunk()

template<class T>
RefPtr< MemCore::ChunkBase > Fiber::TypedArray< T >::getChunk ( ) const
inlineoverridevirtual

Implement the virtual getChunk() function.

Implements Fiber::MemBase.

◆ getType()

template<class T>
const type_info & Fiber::TypedArray< T >::getType ( ) const
inlineoverridevirtual

Return the element type of the certain array.

Implements Fiber::MemBase.

◆ last()

◆ myChunk()