Jpp  16.0.0-rc.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
JTOOLS::JArray< 1, const T > Class Template Reference

One dimensional read-only array of template objects with fixed length. More...

#include <JArray.hh>

Public Types

typedef const Tconst_pointer
 
typedef const Tconst_iterator
 
typedef std::reverse_iterator
< const_iterator
const_reverse_iterator
 
typedef const Tconst_reference
 
typedef unsigned int size_type
 

Public Member Functions

template<unsigned int M>
 JArray (const JArray< M, T > &array)
 Copy constructor. More...
 
template<unsigned int M>
 JArray (const JArray< M, const T > &array)
 Copy constructor. More...
 
const_iterator begin () const
 get iterator to begin of data More...
 
const_iterator end () const
 get iterator to end of data More...
 
const_reverse_iterator rbegin () const
 get reverse iterator to begin of data More...
 
const_reverse_iterator rend () const
 get reverse iterator to end of data More...
 
const_reference operator[] (int index) const
 Get element at given index. More...
 
const_reference at (int index) const
 Get element at given index. More...
 
const_pointer data () const
 Get pointer to data. More...
 

Static Public Member Functions

static size_type size ()
 Get size of data. More...
 

Static Public Attributes

static const unsigned int N = 1
 

Protected Member Functions

 JArray (const T *__p)
 Constructor. More...
 

Protected Attributes

const_pointer p
 

Friends

class JArray< N+1, const T >
 
JWriteroperator<< (JWriter &out, const JArray &buffer)
 Write array to output. More...
 

Detailed Description

template<class T>
class JTOOLS::JArray< 1, const T >

One dimensional read-only array of template objects with fixed length.

The internal data structure consists of a simple C-pointer to the actual data. The user should ensure that the data are persistent.

Definition at line 1141 of file JArray.hh.

Member Typedef Documentation

template<class T >
typedef const T* JTOOLS::JArray< 1, const T >::const_pointer

Definition at line 1148 of file JArray.hh.

template<class T >
typedef const T* JTOOLS::JArray< 1, const T >::const_iterator

Definition at line 1149 of file JArray.hh.

template<class T >
typedef std::reverse_iterator<const_iterator> JTOOLS::JArray< 1, const T >::const_reverse_iterator

Definition at line 1150 of file JArray.hh.

template<class T >
typedef const T& JTOOLS::JArray< 1, const T >::const_reference

Definition at line 1151 of file JArray.hh.

template<class T >
typedef unsigned int JTOOLS::JArray< 1, const T >::size_type

Definition at line 1152 of file JArray.hh.

Constructor & Destructor Documentation

template<class T >
template<unsigned int M>
JTOOLS::JArray< 1, const T >::JArray ( const JArray< M, T > &  array)
inline

Copy constructor.

Parameters
arrayarray

Definition at line 1161 of file JArray.hh.

1161  :
1162  p(array.data())
1163  {
1164  STATIC_CHECK(M >= N);
1165  }
do $JPP JMEstimator M
Definition: JMEstimator.sh:37
static const unsigned int N
Definition: JArray.hh:1144
#define STATIC_CHECK(expr)
Definition: JAssert.hh:31
const_pointer data() const
Get pointer to data.
Definition: JArray.hh:282
template<class T >
template<unsigned int M>
JTOOLS::JArray< 1, const T >::JArray ( const JArray< M, const T > &  array)
inline

Copy constructor.

Parameters
arrayarray

Definition at line 1174 of file JArray.hh.

1174  :
1175  p(array.data())
1176  {
1177  STATIC_CHECK(M >= N);
1178  }
do $JPP JMEstimator M
Definition: JMEstimator.sh:37
static const unsigned int N
Definition: JArray.hh:1144
#define STATIC_CHECK(expr)
Definition: JAssert.hh:31
const_pointer data() const
Get pointer to data.
Definition: JArray.hh:282
template<class T >
JTOOLS::JArray< 1, const T >::JArray ( const T __p)
inlineprotected

Constructor.

Parameters
__ppointer to data

Definition at line 1259 of file JArray.hh.

1259  :
1260  p(__p)
1261  {}

Member Function Documentation

template<class T >
const_iterator JTOOLS::JArray< 1, const T >::begin ( ) const
inline

get iterator to begin of data

Definition at line 1181 of file JArray.hh.

template<class T >
const_iterator JTOOLS::JArray< 1, const T >::end ( ) const
inline

get iterator to end of data

Definition at line 1182 of file JArray.hh.

template<class T >
const_reverse_iterator JTOOLS::JArray< 1, const T >::rbegin ( ) const
inline

get reverse iterator to begin of data

Definition at line 1185 of file JArray.hh.

template<class T >
const_reverse_iterator JTOOLS::JArray< 1, const T >::rend ( ) const
inline

get reverse iterator to end of data

Definition at line 1186 of file JArray.hh.

template<class T >
const_reference JTOOLS::JArray< 1, const T >::operator[] ( int  index) const
inline

Get element at given index.

Parameters
indexindex
Returns
element at index

Definition at line 1195 of file JArray.hh.

1196  {
1197  return p[index];
1198  }
template<class T >
const_reference JTOOLS::JArray< 1, const T >::at ( int  index) const
inline

Get element at given index.

Parameters
indexindex
Returns
element at index

Definition at line 1207 of file JArray.hh.

1208  {
1209  if (index >= 0 && index < N)
1210  return p[index];
1211  else
1212  throw JIndexOutOfRange("JArray<>::at()");
1213  }
static const unsigned int N
Definition: JArray.hh:1144
template<class T >
const_pointer JTOOLS::JArray< 1, const T >::data ( ) const
inline

Get pointer to data.

Returns
pointer to data

Definition at line 1221 of file JArray.hh.

1222  {
1223  return p;
1224  }
template<class T >
static size_type JTOOLS::JArray< 1, const T >::size ( )
inlinestatic

Get size of data.

Returns
size of data

Definition at line 1232 of file JArray.hh.

1233  {
1234  return N;
1235  }
static const unsigned int N
Definition: JArray.hh:1144

Friends And Related Function Documentation

template<class T >
friend class JArray< N+1, const T >
friend

Definition at line 1146 of file JArray.hh.

template<class T >
JWriter& operator<< ( JWriter out,
const JArray< 1, const T > &  buffer 
)
friend

Write array to output.

Parameters
outwriter
bufferarray
Returns
writer

Definition at line 1245 of file JArray.hh.

1246  {
1247  return out << buffer[0];
1248  }

Member Data Documentation

template<class T >
const unsigned int JTOOLS::JArray< 1, const T >::N = 1
static

Definition at line 1144 of file JArray.hh.

template<class T >
const_pointer JTOOLS::JArray< 1, const T >::p
protected

Definition at line 1252 of file JArray.hh.


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