ISIS Core Library 0.7.2 (api 3.0.0)
Data Structures | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends

isis::data::ValueArrayBase Class Reference

#include <valuearray_base.hpp>

Inheritance diagram for isis::data::ValueArrayBase:
isis::util::_internal::GenericValue isis::data::ValueArray< TYPE > isis::data::ValueArray< uint8_t > isis::data::FilePtr

Data Structures

class  DelProxy
 Proxy-Deleter to encapsulate the real deleter/shared_ptr when creating shared_ptr for parts of a shared_ptr. More...

Public Types

typedef
_internal::GenericValueIterator
< true > 
const_value_iterator
typedef const_value_iterator const_value_reference
typedef
_internal::ValueArrayConverterMap::mapped_type::mapped_type 
Converter
typedef
util::_internal::GenericReference
< ValueArrayBase
Reference
typedef
_internal::GenericValueIterator
< false > 
value_iterator
typedef value_iterator value_reference

Public Member Functions

template<typename T >
ValueArray< T > as (scaling_pair scaling=scaling_pair())
 Get this as a ValueArray of a specific type.
virtual value_iterator beginGeneric ()=0
virtual const_value_iterator beginGeneric () const =0
virtual size_t bytesPerElem () const =0
template<typename T >
const ValueArray< T > & castToValueArray () const
 Dynamically cast the ValueBase up to its actual ValueArray<T>.
template<typename T >
ValueArray< T > & castToValueArray ()
 Dynamically cast the ValueBase up to its actual ValueArray<T>.
ValueArrayBase::Reference cloneToNew (size_t length) const
 Create a new ValueArray, of the same type, but differnent size in memory.
size_t compare (size_t start, size_t end, const ValueArrayBase &dst, size_t dst_start) const
 Compare the data of two ValueArray.
ValueArrayBase::Reference convertByID (unsigned short ID, scaling_pair scaling=scaling_pair())
 Get this as a ValueArray of a specific type.
template<typename T >
ValueArray< T > copyAs (scaling_pair scaling=scaling_pair()) const
 Copy this to a new ValueArray<T> using newly allocated memory.
Reference copyByID (unsigned short ID=0, scaling_pair scaling=scaling_pair()) const
 Create new data in memory containg a (converted) copy of this.
template<typename T >
bool copyFromMem (const T *const src, size_t len, scaling_pair scaling=scaling_pair())
 Copies elements from raw memory into this.
void copyRange (size_t start, size_t end, ValueArrayBase &dst, size_t dst_start) const
 Copy a range of elements to another ValueArray of the same type.
bool copyTo (isis::data::ValueArrayBase &dst, scaling_pair scaling=scaling_pair()) const
 Copies elements from this into another ValueArray.
template<typename T >
bool copyToMem (T *dst, size_t len, scaling_pair scaling=scaling_pair()) const
 Copies elements from this into raw memory.
value_iterator endGeneric ()
const_value_iterator endGeneric () const
virtual void endianSwap ()=0
const ConvertergetConverterTo (unsigned short ID) const
size_t getLength () const
virtual std::pair
< util::ValueReference,
util::ValueReference
getMinMax () const =0
 Get minimum/maximum of a ValueArray.
virtual boost::shared_ptr
< const void > 
getRawAddress (size_t offset=0) const =0
 Get the raw address the ValueArray points to.
virtual boost::shared_ptr< void > getRawAddress (size_t offset=0)=0
virtual scaling_pair getScalingTo (unsigned short typeID, const std::pair< util::ValueReference, util::ValueReference > &minmax, autoscaleOption scaleopt=autoscale) const
virtual scaling_pair getScalingTo (unsigned short typeID, autoscaleOption scaleopt=autoscale) const =0
 get the scaling (and offset) which would be used in an conversion
template<typename T >
bool is () const
virtual std::vector< Referencesplice (size_t size) const =0
 Splice up the ValueArray into equal sized blocks.
size_t useCount () const
virtual ~ValueArrayBase ()

Static Public Member Functions

static Reference createByID (unsigned short ID, size_t len)
 Create a ValueArray of given type and length.

Protected Member Functions

virtual ValueArrayBaseclone () const =0
 Create a ValueArray of the same type pointing at the same address.
 ValueArrayBase (size_t len=0)

Protected Attributes

size_t m_len

Friends

class util::_internal::GenericReference< ValueArrayBase >

Detailed Description

Definition at line 125 of file valuearray_base.hpp.


Member Typedef Documentation

typedef _internal::GenericValueIterator<true> isis::data::ValueArrayBase::const_value_iterator

Definition at line 139 of file valuearray_base.hpp.

Definition at line 141 of file valuearray_base.hpp.

typedef _internal::ValueArrayConverterMap::mapped_type::mapped_type isis::data::ValueArrayBase::Converter

Definition at line 174 of file valuearray_base.hpp.

Definition at line 173 of file valuearray_base.hpp.

typedef _internal::GenericValueIterator<false> isis::data::ValueArrayBase::value_iterator

Definition at line 138 of file valuearray_base.hpp.

Definition at line 140 of file valuearray_base.hpp.


Constructor & Destructor Documentation

isis::data::ValueArrayBase::ValueArrayBase ( size_t  len = 0) [protected]

Definition at line 28 of file valuearray_base.cpp.

isis::data::ValueArrayBase::~ValueArrayBase ( ) [virtual]

Definition at line 32 of file valuearray_base.cpp.


Member Function Documentation

template<typename T >
ValueArray<T> isis::data::ValueArrayBase::as ( scaling_pair  scaling = scaling_pair()) [inline]

Get this as a ValueArray of a specific type.

This does an automatic conversion into a new ValueArray if one of following is true:

  • the target type is not the current type
  • scaling.first (the scaling factor) is not 1
  • scaling.first (the scaling offset) is not 0

Otherwise a cheap copy is done.

Parameters:
scalingthe scaling to be used (determined automatically if not given)
Returns:
eigther a cheap copy or a newly created ValueArray

Definition at line 310 of file valuearray_base.hpp.

virtual value_iterator isis::data::ValueArrayBase::beginGeneric ( ) [pure virtual]
virtual const_value_iterator isis::data::ValueArrayBase::beginGeneric ( ) const [pure virtual]
virtual size_t isis::data::ValueArrayBase::bytesPerElem ( ) const [pure virtual]
Returns:
the byte-size of the type of the data this ValueArray points to.

Implemented in isis::data::ValueArray< TYPE >, and isis::data::ValueArray< uint8_t >.

template<typename T >
const ValueArray<T>& isis::data::ValueArrayBase::castToValueArray ( ) const [inline]

Dynamically cast the ValueBase up to its actual ValueArray<T>.

Constant version. Will send an error if T is not the actual type and _ENABLE_CORE_LOG is true.

Returns:
a constant reference of the ValueArray.

Definition at line 185 of file valuearray_base.hpp.

template<typename T >
ValueArray<T>& isis::data::ValueArrayBase::castToValueArray ( ) [inline]

Dynamically cast the ValueBase up to its actual ValueArray<T>.

Referenced version. Will send an error if T is not the actual type and _ENABLE_CORE_LOG is true.

Returns:
a reference of the ValueArray.

Definition at line 194 of file valuearray_base.hpp.

virtual ValueArrayBase* isis::data::ValueArrayBase::clone ( ) const [protected, pure virtual]

Create a ValueArray of the same type pointing at the same address.

Implemented in isis::data::ValueArray< TYPE >, and isis::data::ValueArray< uint8_t >.

ValueArrayBase::Reference isis::data::ValueArrayBase::cloneToNew ( size_t  length) const

Create a new ValueArray, of the same type, but differnent size in memory.

(The actual data are _not_ copied)

Parameters:
lengthlength of the new memory block in elements of the given TYPE

Definition at line 161 of file valuearray_base.cpp.

size_t isis::data::ValueArrayBase::compare ( size_t  start,
size_t  end,
const ValueArrayBase dst,
size_t  dst_start 
) const

Compare the data of two ValueArray.

Counts how many elements in this and the given ValueArray are different within the given range. If the type of this is not equal to the type of the given ValueArray the whole length is assumed to be different. If the given range does not fit into this or the given ValueArray an error is send to the runtime log and the function will probably crash.

Parameters:
startthe first element in this, which schould be compared to the first element in the given TyprPtr
endthe first element in this, which should _not_ be compared anymore to the given TyprPtr
dstthe given ValueArray this should be compared to
dst_startthe first element in the given TyprPtr, which schould be compared to the first element in this
Returns:
the amount of elements which actually differ in both ValueArray or the whole length of the range when the types are not equal.

Definition at line 64 of file valuearray_base.cpp.

ValueArrayBase::Reference isis::data::ValueArrayBase::convertByID ( unsigned short  ID,
scaling_pair  scaling = scaling_pair() 
)

Get this as a ValueArray of a specific type.

This does an automatic conversion into a new ValueArray if one of following is true:

  • the target type is not the current type
  • scaling.first (the scaling factor) is not 1
  • scaling.first (the scaling offset) is not 0

Otherwise a cheap copy is done.

Parameters:
IDthe ID of the requeseted type (use ValueArray::staticID)
scalingthe scaling to be used (determined automatically if not given)
Returns:
a reference of eigther a cheap copy or a newly created ValueArray

Definition at line 148 of file valuearray_base.cpp.

template<typename T >
ValueArray<T> isis::data::ValueArrayBase::copyAs ( scaling_pair  scaling = scaling_pair()) const [inline]

Copy this to a new ValueArray<T> using newly allocated memory.

This will create a new ValueArray of type T and the length of this. The memory will be allocated and the data of this will be copy-converted to T using min/max as value range. If the conversion fails, an error will be send to CoreLog and the data of the newly created ValueArray will be undefined.

Returns:
a the newly created ValueArray

Definition at line 279 of file valuearray_base.hpp.

ValueArrayBase::Reference isis::data::ValueArrayBase::copyByID ( unsigned short  ID = 0,
scaling_pair  scaling = scaling_pair() 
) const

Create new data in memory containg a (converted) copy of this.

Allocates new memory of the requested type and copies the (converted) content of this into that memory.

Parameters:
IDthe ID of the type the new ValueArray (referenced by the Reference returned) should have (if not given, type of the source is used)
scalingthe scaling to be used if a conversion is necessary (computed automatically if not given)

Definition at line 87 of file value_base.cpp.

template<typename T >
bool isis::data::ValueArrayBase::copyFromMem ( const T *const  src,
size_t  len,
scaling_pair  scaling = scaling_pair() 
) [inline]

Copies elements from raw memory into this.

This is allways a deep copy, regardless of the types. If the this and the target are not of the same length:

  • the shorter length will be used
  • a warning about it will be sent to Debug
    Parameters:
    srcpointer to the target memory
    lensize (in elements) of the target memory
    scalingthe scaling to be used if a conversion is necessary (computed automatically if not given)

Definition at line 260 of file valuearray_base.hpp.

void isis::data::ValueArrayBase::copyRange ( size_t  start,
size_t  end,
ValueArrayBase dst,
size_t  dst_start 
) const

Copy a range of elements to another ValueArray of the same type.

Parameters:
startfirst element in this to be copied
endlast element in this to be copied
dsttarget for the copy
dst_startstarting element in dst to be overwritten

Definition at line 167 of file valuearray_base.cpp.

bool isis::data::ValueArrayBase::copyTo ( isis::data::ValueArrayBase dst,
scaling_pair  scaling = scaling_pair() 
) const

Copies elements from this into another ValueArray.

This is allways a deep copy, regardless of the types. If necessary, a conversion will be done. If the this and the target are not of the same length:

  • the shorter length will be used
  • a warning about it will be sent to Debug
    Parameters:
    dstthe ValueArray-object to copy into
    scalingthe scaling to be used if a conversion is necessary (computed automatically if not given)

Definition at line 116 of file valuearray_base.cpp.

template<typename T >
bool isis::data::ValueArrayBase::copyToMem ( T *  dst,
size_t  len,
scaling_pair  scaling = scaling_pair() 
) const [inline]

Copies elements from this into raw memory.

This is allways a deep copy, regardless of the types. If the this and the target are not of the same length:

  • the shorter length will be used
  • a warning about it will be sent to Debug
    Parameters:
    dstpointer to the target memory
    lensize (in elements) of the target memory
    scalingthe scaling to be used if a conversion is necessary (computed automatically if not given)

Definition at line 245 of file valuearray_base.hpp.

ValueArrayBase::Reference isis::data::ValueArrayBase::createByID ( unsigned short  ID,
size_t  len 
) [static]

Create a ValueArray of given type and length.

This allocates memory as needed but does not initialize it.

Returns:
a Reference to a ValueArray pointing to the allocated memory. Or an empty Reference if the creation failed.

Definition at line 65 of file chunk.cpp.

ValueArrayBase::value_iterator isis::data::ValueArrayBase::endGeneric ( )

Definition at line 209 of file valuearray_base.cpp.

ValueArrayBase::const_value_iterator isis::data::ValueArrayBase::endGeneric ( ) const

Definition at line 213 of file valuearray_base.cpp.

virtual void isis::data::ValueArrayBase::endianSwap ( ) [pure virtual]
const ValueArrayBase::Converter & isis::data::ValueArrayBase::getConverterTo ( unsigned short  ID) const

Definition at line 55 of file valuearray_base.cpp.

size_t isis::data::ValueArrayBase::getLength ( ) const
Returns:
the length (in elements) of the data pointed to

Definition at line 30 of file valuearray_base.cpp.

virtual std::pair<util::ValueReference, util::ValueReference> isis::data::ValueArrayBase::getMinMax ( ) const [pure 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:

  • min/max numbers for numbers from a 1-D value space (aka real numbers)
  • complex(lowest real value,lowest imaginary value) / complex(biggest real value,biggest imaginary value) for complex numbers
  • color(lowest red value,lowest green value, lowest blue value)/color(biggest red value,biggest green value, biggest blue value) for color The computed min/max are of the same type as the stored data, but can be compared to other ValueReference without knowing this type via the lt/gt function of ValueBase. The following code checks if the value range of ValueArray-object data1 is a real subset of data2:
     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;
    
    Returns:
    a pair of ValueReferences referring to the found minimum/maximum of the data

Implemented in isis::data::ValueArray< TYPE >, and isis::data::ValueArray< uint8_t >.

virtual boost::shared_ptr<void> isis::data::ValueArrayBase::getRawAddress ( size_t  offset = 0) [pure 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.

Parameters:
offsetammount of bytes to displace the resulting pointer from the actual pointer
Returns:
a shared_ptr with the memory address of the data handled by this ValueArray.

Implemented in isis::data::ValueArray< TYPE >, and isis::data::ValueArray< uint8_t >.

virtual boost::shared_ptr<const void> isis::data::ValueArrayBase::getRawAddress ( size_t  offset = 0) const [pure 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.

Parameters:
offsetammount of bytes to displace the resulting pointer from the actual pointer
Returns:
a shared_ptr with the memory address of the data handled by this ValueArray.

Implemented in isis::data::ValueArray< TYPE >, and isis::data::ValueArray< uint8_t >.

scaling_pair isis::data::ValueArrayBase::getScalingTo ( unsigned short  typeID,
const std::pair< util::ValueReference, util::ValueReference > &  minmax,
autoscaleOption  scaleopt = autoscale 
) const [virtual]

Definition at line 192 of file valuearray_base.cpp.

virtual scaling_pair isis::data::ValueArrayBase::getScalingTo ( unsigned short  typeID,
autoscaleOption  scaleopt = autoscale 
) const [pure virtual]

get the scaling (and offset) which would be used in an conversion

Implemented in isis::data::ValueArray< TYPE >, and isis::data::ValueArray< uint8_t >.

template<typename T >
bool isis::data::ValueArrayBase::is ( ) const

Definition at line 382 of file valuearray.hpp.

virtual std::vector<Reference> isis::data::ValueArrayBase::splice ( size_t  size) const [pure 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.

Parameters:
sizethe maximum size of the spliced parts of the data (the last part can be smaller)
Returns:
a vector of references to ValueArray's which point to the parts of the spliced data

Implemented in isis::data::ValueArray< TYPE >, and isis::data::ValueArray< uint8_t >.

size_t isis::data::ValueArrayBase::useCount ( ) const
Returns:
the number of references using the same memory as this.

Definition at line 205 of file valuearray_base.cpp.


Friends And Related Function Documentation

Definition at line 127 of file valuearray_base.hpp.


Field Documentation

Definition at line 131 of file valuearray_base.hpp.


The documentation for this class was generated from the following files: