1#ifndef __FIBER_REFERENCINGMEMARRAY_HPP
2#define __FIBER_REFERENCINGMEMARRAY_HPP "Created 3.12.2007"
5#include "MemArrayBase.hpp"
6#include <fiber/vector/MultiArray.hpp>
7#include "TypedArray.hpp"
9#include <memcore/Verbose.hpp>
15inline std::string element_to_string(
const T&element)
21inline std::string element_to_string(
const std::string&element)
23 return "\"" + element +
"\"";
32 if (EdgeList.
size()>0)
35 for(
size_t i = 1; i<EdgeList.
size(); i++)
48 if (EdgeList.
size()>0)
51 for(
size_t i = 1; i<EdgeList.
size(); i++)
64 if (EdgeList.
size()>0)
67 for(
size_t i = 1; i<EdgeList.
size(); i++)
81 if (EdgeList.
size()>0)
84 for(
size_t i = 1; i<EdgeList.
size(); i++)
101template <Dims_t N,
class T>
129 Verbose(0) <<
" Warning: ReferencingMemArray<"<<
typeid(T)<<
"> constructed with NO storage provided, storage=" <<
theStorage;
141 Verbose(0) <<
" Warning: ReferencingMemArray<"<<
typeid(T)<<
">() constructed with NO data provided, data =" << data;
161 Verbose(0) <<
" Warning: ReferencingMemArray<"<<
typeid(T)<<
">() constructed with NO storage data provided, data =" <<
theStorage;
172 , myStorage(
RMA.myStorage)
175 Verbose(0) <<
" Warning: ReferencingMemArray<"<<
typeid(T)<<
"> Copy constructo NO storage provided, storage=" << myStorage;
188 if (!
mine)
return false;
204 return this->StoragePtr();
214 return myStorage->memsize();
216 Verbose(0) <<
"ReferencingMemArray:memsize() NullPtr for Storage!";
226 std::string getElementAsString(
size_t index)
const override
228 if (!this->myStorage)
231 if (index >= this->myStorage->nElements() )
234 const auto&Datum = this->myStorage->get_vector()[index];
236 return Fiber::element_to_string(Datum);
280 return MultiArray_t::first();
285 return MultiArray_t::last();
293 const CreativeIterator<T>* creativeIterator()
const override
298 const RefPtr<MemCore::TypedChunk<T> >&StoragePtr() const
305 const RefPtr<MemCore::TypedChunk<T> >&getStorage() const
311 const RefPtr<MemCore::TypedChunk<T> >&getTypedStorage()
const
319 return MultiArray_t::Size();
valarray< size_t > size() const
basic_string< char > string
constexpr size_type size() const noexcept
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Description of types, which is meta-information like what is the number of elements of some array-lik...
Definition FiberType.hpp:61
A set of integer values which describes how to iterate over a certain set of values.
Definition HyperslabParameters.hpp:34
Implementation of an Iterator to a sequence of elements, which might be contiguous or a projection of...
Definition vector/Iterator.hpp:525
Abstract class for N-dimensional MultiArrays with MemCore memory management.
Definition MemArrayBase.hpp:37
Base class for multidimensional arrays with MemCore memory management.
Definition MemBase.hpp:70
Definition MultiArray.hpp:371
A memory array that may share its data storage with something else.
Definition ReferencingMemArray.hpp:104
ReferencingMemArray(const ReferencingMemArray &RMA)
Copy constructor.
Definition ReferencingMemArray.hpp:167
const void * DeltaPtr() const override
Get pointer to delta of linearly procedural array, if it is linear.
Definition ReferencingMemArray.hpp:273
index_t nElements() const override
return the number of elements in this array
Definition ReferencingMemArray.hpp:221
ReferencingMemArray(const Iterator< T > &data, const MultiIndex< N > &Sz, const RefPtr< MemCore::ChunkBase > &theStorage, const WeakPtr< CreativeArrayBase > &theCreator)
Constructor.
Definition ReferencingMemArray.hpp:119
void DeferredConstructor() override
Virtual deferred reference pointer construction pointer Don't overload if you don't know exactly what...
Definition ReferencingMemArray.hpp:240
void * getPtr() override
Special Array Storage.
Definition ReferencingMemArray.hpp:263
T last() const override
Retrieve the last element.
Definition ReferencingMemArray.hpp:283
T first() const override
Retrieve the first element.
Definition ReferencingMemArray.hpp:278
const type_info & getType() const override
Return the element type of the certain array.
Definition ReferencingMemArray.hpp:246
MemCore::memsize_t memsize() const override
Note: memsize does not return the number of elements here, but the actual memory that is occupied.
Definition ReferencingMemArray.hpp:211
MultiIndex< N > Size() const override
Return the number of dimensions.
Definition ReferencingMemArray.hpp:317
const type_info & getBaseType() const
Return the element type of the certain array.
Definition ReferencingMemArray.hpp:253
RefPtr< MemCore::TypedChunk< T > > myChunk() const override
Return storage type.
Definition ReferencingMemArray.hpp:202
~ReferencingMemArray()
Protected Destructor to avoid static creation.
Definition ReferencingMemArray.hpp:180
const void * OriginPtr() const override
Get pointer to origin of linearly procedural array, if it is linear.
Definition ReferencingMemArray.hpp:268
ReferencingMemArray(const RefPtr< MemCore::ChunkBase > &theStorage, const MultiArray< N, T > &M, const WeakPtr< CreativeArrayBase > &theCreator)
Create referencing mem array from an existing multi array and some memory reference.
Definition ReferencingMemArray.hpp:153
ReferencingMemArray(const RefPtr< Chunk< T > > &data, const MultiIndex< N > &Sz, const WeakPtr< CreativeArrayBase > &theCreator)
Construct from memory chunk and multidimensional index.
Definition ReferencingMemArray.hpp:133
An intermediate class that allows to operate on the pure type information of some memory array.
Definition TypedArray.hpp:58
const WeakPtr< Creature > & myCreator() const
MemSizeConfig< sizeof(void *)>::memsize_t memsize_t
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
string to_string(const Eagle::FixedArray< ElementType, N > &A, const char *OpenBrace="{", const char *CloseBrace="}", const char *Separator=",")