1#ifndef __FIBER_MEMBASE_HPP
2#define __FIBER_MEMBASE_HPP
5#include <memcore/RefPtr.hpp>
6#include <memcore/Interface.hpp>
7#include <memcore/Persistencer.hpp>
8#include <memcore/Cacheable.hpp>
9#include <memcore/Cache.hpp>
10#include <memcore/Creator.hpp>
11#include <memcore/Chunk.hpp>
13#include <fiber/vector/MultiArray.hpp>
16#include "FiberType.hpp"
17#include "DynamicSize.hpp"
21class FIELD_API MemBase;
25template <Dims_t N,
class T>
59class FIELD_API CreativeArrayBase;
62 WeakPtrCreativeArrayBase_t;
95 virtual void DeferredConstructor()
override = 0;
107 return getSize().nElements();
110 auto NumberOfElements()
const
115 auto getNumberOfElements()
const
126 virtual std::string getElementAsString(
size_t index)
const = 0;
155 return FiberTypeBase::find( myFiberTypeIndex );
160 return myFiberTypeIndex.mem_size;
190 if (!Mb)
return false;
191 return copyFrom( Mb->getChunk() );
200#ifdef HAVE_OLD_MEMARRAY
213 return newMemArray( getSize(), C);
217#ifdef HAVE_MEMARRAY_INDIRECTION
269 return create(FT, getSize(),
layout);
279 return create(FT, getSize(),
layout);
297static int RegisteredTypes;
305 return MemData->getChunk();
324static bool registerMe()
328 printf(
"MemArrayAllocator<%s>::registerMe()\n",
typeid(T).name() );
330 return MemBase::registerCreator(
A, getFiberType() );
333static bool isRegistered()
335 static bool b = registerMe();
337 printf(b?
"isRegistered is TRUE\n":
"isRegistered is FALSE\n");
346 return getChunk(
Mem );
354inline void DeferredInitializationTrait<Fiber::MemBase>::call(
Fiber::MemBase*ma)
basic_string< char > string
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
A class describing an n-dimensional space at runtime.
Definition field/DynamicSize.hpp:29
static WeakPtr_t getFiberType()
Get the fiber type information for the current type.
Definition FiberType.hpp:126
A set of integer values which describes how to iterate over a certain set of values.
Definition HyperslabParameters.hpp:34
Allocating array types through registry of types.
Definition MemBase.hpp:315
Same as above but using a unsinged int vector.
Definition MemBase.hpp:243
Base class for multidimensional arrays with MemCore memory management.
Definition MemBase.hpp:70
RefPtr< MemBase > create(const type_info &layout=typeid(void)) const
Create a new mem array of the same dimensions but different type.
Definition MemBase.hpp:276
virtual DynamicSize getSize() const =0
Return the size of this dataset.
virtual Fiber::Dims_t rank() const =0
Return the number of dimensions.
RefPtr< MemBase > create(const RefPtr< FiberTypeBase > &FT, const type_info &layout=typeid(void)) const
Create a new mem array of the same dimensions but different type.
Definition MemBase.hpp:266
virtual const void * OriginPtr() const =0
Get pointer to origin of linearly procedural array, if it is linear.
virtual void * getPtr()=0
Special Array Storage.
virtual index_t nElements() const
return the number of elements in this array
Definition MemBase.hpp:105
virtual RefPtr< MemBase > createEquallySizedMemArray(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 S...
virtual RefPtr< MemBase > makeMemArray(const MemBase::Creator_t &C) const =0
Provide a MemArray, even though the actual data is a procedural array.
virtual void DeferredConstructor() override=0
Virtual deferred reference pointer construction pointer Don't overload if you don't know exactly what...
Definition MemBase.cpp:24
virtual const type_info & getType() const =0
Return the element type of the certain array.
virtual const void * DeltaPtr() const =0
Get pointer to delta of linearly procedural array, if it is linear.
virtual RefPtr< MemCore::ChunkBase > getChunk() const =0
Get chunk to underlying data, if this is a contiguous array.
bool copyFrom(const RefPtr< MemBase > &Mb)
Copy all data values from the given MemBase.
Definition MemBase.hpp:188
virtual RefPtr< MemBase > copy(const MemBase::Creator_t &C=nullptr) const =0
Create a copy of the current array, duplicating all data and allocating new memory for it.
MemCore::memsize_t memsize() const override
How much memory is occupied here at all in case it's stored in a chunk?
Definition MemBase.hpp:143
MemSizeConfig< sizeof(void *)>::memsize_t memsize_t
point operator-(const point &P, const vector &v)
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
Definition FiberTypeIndex.hpp:12