Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
JTOOLS::JArray< N, 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...
 
JArray< N-1, const Tpop_front () const
 Make a copy in which the first element is removed. More...
 
JArray< N-1, const Tpop_back () const
 Make a copy in which the last element is removed. More...
 

Static Public Member Functions

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

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<unsigned int N, class T>
class JTOOLS::JArray< N, 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 913 of file JArray.hh.

Member Typedef Documentation

template<unsigned int N, class T >
typedef const T* JTOOLS::JArray< N, const T >::const_pointer

Definition at line 918 of file JArray.hh.

template<unsigned int N, class T >
typedef const T* JTOOLS::JArray< N, const T >::const_iterator

Definition at line 919 of file JArray.hh.

template<unsigned int N, class T >
typedef std::reverse_iterator<const_iterator> JTOOLS::JArray< N, const T >::const_reverse_iterator

Definition at line 920 of file JArray.hh.

template<unsigned int N, class T >
typedef const T& JTOOLS::JArray< N, const T >::const_reference

Definition at line 921 of file JArray.hh.

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

Definition at line 922 of file JArray.hh.

Constructor & Destructor Documentation

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

Copy constructor.

Parameters
arrayarray

Definition at line 931 of file JArray.hh.

931  :
932  p(array.data())
933  {
934  STATIC_CHECK(M >= N);
935  }
do $JPP JMEstimator M
Definition: JMEstimator.sh:37
#define STATIC_CHECK(expr)
Definition: JAssert.hh:29
then usage $script[input file[working directory[option]]] nWhere option can be N
Definition: JMuonPostfit.sh:37
const_pointer data() const
Get pointer to data.
Definition: JArray.hh:276
template<unsigned int N, class T >
template<unsigned int M>
JTOOLS::JArray< N, const T >::JArray ( const JArray< M, const T > &  array)
inline

Copy constructor.

Parameters
arrayarray

Definition at line 944 of file JArray.hh.

944  :
945  p(array.data())
946  {
947  STATIC_CHECK(M >= N);
948  }
do $JPP JMEstimator M
Definition: JMEstimator.sh:37
#define STATIC_CHECK(expr)
Definition: JAssert.hh:29
then usage $script[input file[working directory[option]]] nWhere option can be N
Definition: JMuonPostfit.sh:37
const_pointer data() const
Get pointer to data.
Definition: JArray.hh:276
template<unsigned int N, class T >
JTOOLS::JArray< N, const T >::JArray ( const T __p)
inlineprotected

Constructor.

Parameters
__ppointer to data

Definition at line 1055 of file JArray.hh.

1055  :
1056  p(__p)
1057  {}

Member Function Documentation

template<unsigned int N, class T >
const_iterator JTOOLS::JArray< N, const T >::begin ( ) const
inline

get iterator to begin of data

Definition at line 951 of file JArray.hh.

template<unsigned int N, class T >
const_iterator JTOOLS::JArray< N, const T >::end ( ) const
inline

get iterator to end of data

Definition at line 952 of file JArray.hh.

template<unsigned int N, class T >
const_reverse_iterator JTOOLS::JArray< N, const T >::rbegin ( ) const
inline

get reverse iterator to begin of data

Definition at line 955 of file JArray.hh.

template<unsigned int N, class T >
const_reverse_iterator JTOOLS::JArray< N, const T >::rend ( ) const
inline

get reverse iterator to end of data

Definition at line 956 of file JArray.hh.

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

Get element at given index.

Parameters
indexindex
Returns
element at index

Definition at line 965 of file JArray.hh.

966  {
967  return p[index];
968  }
template<unsigned int N, class T >
const_reference JTOOLS::JArray< N, const T >::at ( int  index) const
inline

Get element at given index.

Parameters
indexindex
Returns
element at index

Definition at line 977 of file JArray.hh.

978  {
979  if (index >= 0 && index < N)
980  return p[index];
981  else
982  throw JIndexOutOfRange("JArray<>::at()");
983  }
then usage $script[input file[working directory[option]]] nWhere option can be N
Definition: JMuonPostfit.sh:37
template<unsigned int N, class T >
const_pointer JTOOLS::JArray< N, const T >::data ( ) const
inline

Get pointer to data.

Returns
pointer to data

Definition at line 991 of file JArray.hh.

992  {
993  return p;
994  }
template<unsigned int N, class T >
static size_type JTOOLS::JArray< N, const T >::size ( )
inlinestatic

Get size of data.

Returns
size of data

Definition at line 1002 of file JArray.hh.

1003  {
1004  return N;
1005  }
then usage $script[input file[working directory[option]]] nWhere option can be N
Definition: JMuonPostfit.sh:37
template<unsigned int N, class T >
JArray<N-1, const T> JTOOLS::JArray< N, const T >::pop_front ( ) const
inline

Make a copy in which the first element is removed.

Returns
array

Definition at line 1013 of file JArray.hh.

1014  {
1015  return JArray<N-1, const T>(p + 1);
1016  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
One dimensional array of template objects with fixed length.
Definition: JArray.hh:35
then usage $script[input file[working directory[option]]] nWhere option can be N
Definition: JMuonPostfit.sh:37
template<unsigned int N, class T >
JArray<N-1, const T> JTOOLS::JArray< N, const T >::pop_back ( ) const
inline

Make a copy in which the last element is removed.

Returns
array

Definition at line 1024 of file JArray.hh.

1025  {
1026  return JArray<N-1, const T>(p);
1027  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
One dimensional array of template objects with fixed length.
Definition: JArray.hh:35
then usage $script[input file[working directory[option]]] nWhere option can be N
Definition: JMuonPostfit.sh:37

Friends And Related Function Documentation

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

Definition at line 916 of file JArray.hh.

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

Write array to output.

Parameters
outwriter
bufferarray
Returns
writer

Definition at line 1037 of file JArray.hh.

1038  {
1039  for (const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
1040  out << *i;
1041  }
1042 
1043  return out;
1044  }
const_iterator begin() const
get iterator to begin of data
Definition: JArray.hh:201
const_iterator end() const
get iterator to end of data
Definition: JArray.hh:202

Member Data Documentation

template<unsigned int N, class T >
const_pointer JTOOLS::JArray< N, const T >::p
protected

Definition at line 1048 of file JArray.hh.


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