ISIS Core Library 0.7.2 (api 3.0.0)
|
Generic class for type (and length) - aware pointers. More...
#include <valuearray.hpp>
Data Structures | |
struct | BasicDeleter |
Default delete-functor for c-arrays (uses free()). More... | |
struct | NonDeleter |
delete-functor which does nothing (in case someone else manages the data). More... | |
Public Types | |
typedef _internal::ValueArrayIterator < const TYPE > | const_iterator |
typedef const_iterator::reference | const_reference |
typedef _internal::ValueArrayIterator < TYPE > | iterator |
typedef iterator::reference | reference |
Public Member Functions | |
iterator | begin () |
const_iterator | begin () const |
virtual value_iterator | beginGeneric () |
virtual const_value_iterator | beginGeneric () const |
size_t | bytesPerElem () const |
iterator | end () |
const_iterator | end () const |
void | endianSwap () |
std::pair < util::ValueReference, util::ValueReference > | getMinMax () const |
Get minimum/maximum of a ValueArray. | |
boost::shared_ptr< const void > | getRawAddress (size_t offset=0) const |
Get the raw address the ValueArray points to. | |
boost::shared_ptr< void > | getRawAddress (size_t offset=0) |
scaling_pair | getScalingTo (unsigned short typeID, autoscaleOption scaleopt=autoscale) const |
get the scaling (and offset) which would be used in an conversion | |
unsigned short | getTypeID () const |
std::string | getTypeName () const |
bool | isFloat () const |
bool | isInteger () const |
operator boost::shared_ptr< TYPE > & () | |
Implicit conversion to boost::shared_ptr<TYPE> The returned smart pointer will be part of the reference-counting and will correctly delete the data (using the given deleter) if required. | |
operator const boost::shared_ptr< TYPE > & () const | |
TYPE & | operator[] (size_t idx) |
Reference element at at given index. | |
const TYPE & | operator[] (size_t idx) const |
std::vector< Reference > | splice (size_t size) const |
Splice up the ValueArray into equal sized blocks. | |
virtual std::string | toString (bool labeled=false) const |
ValueArray (const boost::shared_ptr< TYPE > &ptr, size_t length) | |
Creates ValueArray from a boost::shared_ptr of the same type. | |
ValueArray (TYPE *const ptr, size_t length) | |
Creates ValueArray from a pointer of type TYPE. | |
ValueArray (size_t length) | |
Creates a ValueArray pointing to a newly allocated array of elements of the given type. | |
template<typename D > | |
ValueArray (TYPE *const ptr, size_t length, D d) | |
Creates ValueArray from a pointer of type TYPE. | |
virtual | ~ValueArray () |
Static Public Member Functions | |
static std::string | staticName () |
Static Public Attributes | |
static const unsigned short | staticID = util::_internal::TypeID<TYPE>::value << 8 |
Protected Member Functions | |
ValueArrayBase * | clone () const |
Create a ValueArray of the same type pointing at the same address. | |
ValueArray () |
Generic class for type (and length) - aware pointers.
The class is designed for arrays, but you can also "point" to an single element by just use "1" for the length. The pointers are reference counted and will be deleted automatically by a customizable deleter. The copy is cheap, thus the copy of a ValueArray will reference the same data. The usual pointer dereferencing interface ("*", "->" and "[]") is supported.
Definition at line 171 of file valuearray.hpp.
typedef _internal::ValueArrayIterator<const TYPE> isis::data::ValueArray< TYPE >::const_iterator |
Definition at line 187 of file valuearray.hpp.
typedef const_iterator::reference isis::data::ValueArray< TYPE >::const_reference |
Definition at line 189 of file valuearray.hpp.
typedef _internal::ValueArrayIterator<TYPE> isis::data::ValueArray< TYPE >::iterator |
Definition at line 186 of file valuearray.hpp.
typedef iterator::reference isis::data::ValueArray< TYPE >::reference |
Definition at line 188 of file valuearray.hpp.
isis::data::ValueArray< TYPE >::ValueArray | ( | ) | [inline, protected] |
Definition at line 181 of file valuearray.hpp.
isis::data::ValueArray< TYPE >::ValueArray | ( | size_t | length | ) | [inline] |
Creates a ValueArray pointing to a newly allocated array of elements of the given type.
The array is zero-initialized. If the requested length is 0 no memory will be allocated and the pointer be "empty".
length | amount of elements in the new array |
Definition at line 213 of file valuearray.hpp.
isis::data::ValueArray< TYPE >::ValueArray | ( | const boost::shared_ptr< TYPE > & | ptr, |
size_t | length | ||
) | [inline] |
Creates ValueArray from a boost::shared_ptr of the same type.
It will inherit the deleter of the shared_ptr.
ptr | the shared_ptr to share the data with |
length | the length of the used array (ValueArray does NOT check for length, this is just here for child classes which may want to check) |
Definition at line 229 of file valuearray.hpp.
isis::data::ValueArray< TYPE >::ValueArray | ( | TYPE *const | ptr, |
size_t | length | ||
) | [inline] |
Creates ValueArray from a pointer of type TYPE.
The pointers are automatically deleted by an instance of BasicDeleter and should not be used outside once used here.
ptr | the pointer to the used array |
length | the length of the used array (ValueArray does NOT check for length, this is just here for child classes which may want to check) |
Definition at line 238 of file valuearray.hpp.
isis::data::ValueArray< TYPE >::ValueArray | ( | TYPE *const | ptr, |
size_t | length, | ||
D | d | ||
) | [inline] |
Creates ValueArray from a pointer of type TYPE.
The pointers are automatically deleted by an copy of d and should not be used outside once used here (this does not apply, if d does not delete). D must implement operator()(TYPE *p).
ptr | the pointer to the used array |
length | the length of the used array in elements (ValueArray does NOT check for length), |
d | the deleter to be used when the data shall be deleted ( d() is called then ) |
Definition at line 250 of file valuearray.hpp.
virtual isis::data::ValueArray< TYPE >::~ValueArray | ( | ) | [inline, virtual] |
Definition at line 252 of file valuearray.hpp.
iterator isis::data::ValueArray< TYPE >::begin | ( | ) | [inline] |
Definition at line 272 of file valuearray.hpp.
const_iterator isis::data::ValueArray< TYPE >::begin | ( | ) | const [inline] |
Definition at line 274 of file valuearray.hpp.
virtual const_value_iterator isis::data::ValueArray< TYPE >::beginGeneric | ( | ) | const [inline, virtual] |
Implements isis::data::ValueArrayBase.
Definition at line 268 of file valuearray.hpp.
virtual value_iterator isis::data::ValueArray< TYPE >::beginGeneric | ( | ) | [inline, virtual] |
Implements isis::data::ValueArrayBase.
Definition at line 265 of file valuearray.hpp.
size_t isis::data::ValueArray< TYPE >::bytesPerElem | ( | ) | const [inline, virtual] |
Implements isis::data::ValueArrayBase.
Definition at line 323 of file valuearray.hpp.
ValueArrayBase* isis::data::ValueArray< TYPE >::clone | ( | ) | const [inline, protected, virtual] |
Create a ValueArray of the same type pointing at the same address.
Implements isis::data::ValueArrayBase.
Definition at line 182 of file valuearray.hpp.
const_iterator isis::data::ValueArray< TYPE >::end | ( | ) | const [inline] |
Definition at line 275 of file valuearray.hpp.
iterator isis::data::ValueArray< TYPE >::end | ( | ) | [inline] |
Definition at line 273 of file valuearray.hpp.
void isis::data::ValueArray< TYPE >::endianSwap | ( | ) | [inline, virtual] |
Implements isis::data::ValueArrayBase.
Definition at line 373 of file valuearray.hpp.
std::pair<util::ValueReference, util::ValueReference> isis::data::ValueArray< TYPE >::getMinMax | ( | ) | const [inline, virtual] |
Get minimum/maximum of a ValueArray.
This computes the minimum and maximum value of the stored data and stores them in ValueReference-Objects. This actually returns the bounding box of the values in the value space of the type. This means:
std::pair<util::ValueReference,util::ValueReference> minmax1=data1.getMinMax(), minmax2=data2.getMinMax(); if(minmax1.first->gt(minmax2.second) && minmax1.second->lt(minmax2.second) std::cout << minmax1 << " is a subset of " minmax2 << std::endl;
Implements isis::data::ValueArrayBase.
Definition at line 325 of file valuearray.hpp.
boost::shared_ptr<const void> isis::data::ValueArray< TYPE >::getRawAddress | ( | size_t | offset = 0 | ) | const [inline, virtual] |
Get the raw address the ValueArray points to.
An offset can be added to the result. If it is not zero, the resulting shared_ptr will use DelProxy as deleter. Thus, it will increase the reference count of the original pointer by one and decrease it when the deletion of the offset pointer is triggered.
offset | ammount of bytes to displace the resulting pointer from the actual pointer |
Implements isis::data::ValueArrayBase.
Definition at line 254 of file valuearray.hpp.
boost::shared_ptr<void> isis::data::ValueArray< TYPE >::getRawAddress | ( | size_t | offset = 0 | ) | [inline, virtual] |
Get the raw address the ValueArray points to.
An offset can be added to the result. If it is not zero, the resulting shared_ptr will use DelProxy as deleter. Thus, it will increase the reference count of the original pointer by one and decrease it when the deletion of the offset pointer is triggered.
offset | ammount of bytes to displace the resulting pointer from the actual pointer |
Implements isis::data::ValueArrayBase.
Definition at line 262 of file valuearray.hpp.
scaling_pair isis::data::ValueArray< TYPE >::getScalingTo | ( | unsigned short | typeID, |
autoscaleOption | scaleopt = autoscale |
||
) | const [inline, virtual] |
get the scaling (and offset) which would be used in an conversion
Implements isis::data::ValueArrayBase.
Definition at line 362 of file valuearray.hpp.
unsigned short isis::data::ValueArray< TYPE >::getTypeID | ( | ) | const [inline, virtual] |
Implements isis::util::_internal::GenericValue.
Definition at line 294 of file valuearray.hpp.
std::string isis::data::ValueArray< TYPE >::getTypeName | ( | ) | const [inline, virtual] |
Implements isis::util::_internal::GenericValue.
Definition at line 293 of file valuearray.hpp.
bool isis::data::ValueArray< TYPE >::isFloat | ( | ) | const [inline, virtual] |
Implements isis::util::_internal::GenericValue.
Definition at line 295 of file valuearray.hpp.
bool isis::data::ValueArray< TYPE >::isInteger | ( | ) | const [inline, virtual] |
Implements isis::util::_internal::GenericValue.
Definition at line 296 of file valuearray.hpp.
isis::data::ValueArray< TYPE >::operator boost::shared_ptr< TYPE > & | ( | ) | [inline] |
Implicit conversion to boost::shared_ptr<TYPE> The returned smart pointer will be part of the reference-counting and will correctly delete the data (using the given deleter) if required.
Definition at line 320 of file valuearray.hpp.
isis::data::ValueArray< TYPE >::operator const boost::shared_ptr< TYPE > & | ( | ) | const [inline] |
Definition at line 321 of file valuearray.hpp.
const TYPE& isis::data::ValueArray< TYPE >::operator[] | ( | size_t | idx | ) | const [inline] |
Definition at line 311 of file valuearray.hpp.
TYPE& isis::data::ValueArray< TYPE >::operator[] | ( | size_t | idx | ) | [inline] |
Reference element at at given index.
If index is invalid, behaviour is undefined. Probably it will crash.
Definition at line 308 of file valuearray.hpp.
std::vector<Reference> isis::data::ValueArray< TYPE >::splice | ( | size_t | size | ) | const [inline, virtual] |
Splice up the ValueArray into equal sized blocks.
This virtually creates new data blocks of the given size by computing new pointers into the block and creating ValueArray objects for them. This ValueArray objects use the reference counting of the original ValueArray via DelProxy, so the original data are only deleted (as a whole) when all spliced and all "normal" ValueArray for this data are deleted.
size | the maximum size of the spliced parts of the data (the last part can be smaller) |
Implements isis::data::ValueArrayBase.
Definition at line 337 of file valuearray.hpp.
static std::string isis::data::ValueArray< TYPE >::staticName | ( | ) | [inline, static] |
Definition at line 299 of file valuearray.hpp.
virtual std::string isis::data::ValueArray< TYPE >::toString | ( | bool | labeled = false | ) | const [inline, virtual] |
Get the string representation of the Value.
This tries to use the isis type conversion to create a string from the Value. If thats no available, it will fall back to boost::lexical_cast. And it will send a warning to CoreDebug. If the lexical cast fails as well, boost::bad_lexical_cast is thrown.
labeled | if true the typename will be appended to the resulting string in brackets. |
Implements isis::util::_internal::GenericValue.
Definition at line 278 of file valuearray.hpp.
const unsigned short isis::data::ValueArray< TYPE >::staticID = util::_internal::TypeID<TYPE>::value << 8 [static] |
Definition at line 191 of file valuearray.hpp.