Back to index

salome-med  6.5.0
Public Types | Public Member Functions | Protected Member Functions | Private Attributes
MED::TCSlice< TValueType > Class Template Reference

This class intends to provide an uniform way to handle multy-dimention data (const version) More...

#include <MED_SliceArray.hxx>

Inheritance diagram for MED::TCSlice< TValueType >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef TValueType value_type

Public Member Functions

 TCSlice (const value_type *theValuePtr, size_t theSourceSize, const std::slice &theSlice)
 Construct the class from bare pointer.
 TCSlice (const TVector< value_type > &theContainer, const std::slice &theSlice)
 Construct the class from corresponding container.
 TCSlice ()
 Default constructor (dangerous)
const value_typeoperator[] (size_t theId) const
 Get element by its number (const version)
const value_typeat (size_t theId) const
size_t size () const
 Get range of the order numbers.

Protected Member Functions

void check_id (size_t theId) const
size_t calculate_id (size_t theId) const
 Calculate internal index to get proper element from the source multy-dimension data.
size_t get_id (size_t theId) const
size_t get_id_at (size_t theId) const

Private Attributes

const TValueType * myCValuePtr
 Reference to source multy-dimension data.
size_t mySourceSize
 Size of the source multy-dimension data.
std::slice mySlice
 Defines algorithm of index calculation.

Detailed Description

template<class TValueType>
class MED::TCSlice< TValueType >

This class intends to provide an uniform way to handle multy-dimention data (const version)

It just contains pointer to real sequence and implement proper calcultion of its indexes. This class deal with constant pointer to the sources data and provide const method to read the them (data).

Definition at line 53 of file MED_SliceArray.hxx.


Member Typedef Documentation

template<class TValueType >
typedef TValueType MED::TCSlice< TValueType >::value_type

Reimplemented in MED::TSlice< TValueType >.

Definition at line 96 of file MED_SliceArray.hxx.


Constructor & Destructor Documentation

template<class TValueType >
MED::TCSlice< TValueType >::TCSlice ( const value_type theValuePtr,
size_t  theSourceSize,
const std::slice &  theSlice 
) [inline]

Construct the class from bare pointer.

Definition at line 99 of file MED_SliceArray.hxx.

                                     : 
      myCValuePtr(theValuePtr),
      mySourceSize(theSourceSize),
      mySlice(theSlice)
    {}
template<class TValueType >
MED::TCSlice< TValueType >::TCSlice ( const TVector< value_type > &  theContainer,
const std::slice &  theSlice 
) [inline]

Construct the class from corresponding container.

Definition at line 108 of file MED_SliceArray.hxx.

                                     : 
      myCValuePtr(&theContainer[0]),
      mySourceSize(theContainer.size()),
      mySlice(theSlice)
    {}
template<class TValueType >
MED::TCSlice< TValueType >::TCSlice ( ) [inline]

Default constructor (dangerous)

Definition at line 116 of file MED_SliceArray.hxx.

             :
      myCValuePtr(NULL)
    {}

Member Function Documentation

template<class TValueType >
const value_type& MED::TCSlice< TValueType >::at ( size_t  theId) const [inline]

Definition at line 128 of file MED_SliceArray.hxx.

    {
      return *(myCValuePtr + get_id_at(theId));
    }

Here is the call graph for this function:

template<class TValueType >
size_t MED::TCSlice< TValueType >::calculate_id ( size_t  theId) const [inline, protected]

Calculate internal index to get proper element from the source multy-dimension data.

Definition at line 74 of file MED_SliceArray.hxx.

    {
      return mySlice.start() + theId*mySlice.stride();
    }

Here is the caller graph for this function:

template<class TValueType >
void MED::TCSlice< TValueType >::check_id ( size_t  theId) const [inline, protected]

Definition at line 61 of file MED_SliceArray.hxx.

    {
      long int anId = -1;
      if(theId < mySlice.size()){
        anId = mySlice.start() + theId*mySlice.stride();
        if(anId < (long int)mySourceSize)
          return;
      }
      throw std::out_of_range("TCSlice::check_id");
    }

Here is the caller graph for this function:

template<class TValueType >
size_t MED::TCSlice< TValueType >::get_id ( size_t  theId) const [inline, protected]

Definition at line 80 of file MED_SliceArray.hxx.

    {
#ifdef MED_TCSLICE_CHECK_RANGE
      check_id(theId);
#endif
      return calculate_id(theId);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TValueType >
size_t MED::TCSlice< TValueType >::get_id_at ( size_t  theId) const [inline, protected]

Definition at line 89 of file MED_SliceArray.hxx.

    {
      check_id(theId);
      return calculate_id(theId);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

template<class TValueType >
const value_type& MED::TCSlice< TValueType >::operator[] ( size_t  theId) const [inline]

Get element by its number (const version)

Definition at line 122 of file MED_SliceArray.hxx.

    {
      return *(myCValuePtr + get_id(theId));
    }

Here is the call graph for this function:

template<class TValueType >
size_t MED::TCSlice< TValueType >::size ( ) const [inline]

Get range of the order numbers.

Definition at line 135 of file MED_SliceArray.hxx.

    {
      return mySlice.size();
    }

Here is the caller graph for this function:


Member Data Documentation

template<class TValueType >
const TValueType* MED::TCSlice< TValueType >::myCValuePtr [private]

Reference to source multy-dimension data.

Definition at line 55 of file MED_SliceArray.hxx.

template<class TValueType >
std::slice MED::TCSlice< TValueType >::mySlice [private]

Defines algorithm of index calculation.

Definition at line 57 of file MED_SliceArray.hxx.

template<class TValueType >
size_t MED::TCSlice< TValueType >::mySourceSize [private]

Size of the source multy-dimension data.

Definition at line 56 of file MED_SliceArray.hxx.


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