Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
DynArr< T >::IndexingProvider< D > Class Template Reference

#include <AbsArr.h>

Public Member Functions

 IndexingProvider (DynArr< D > &farr, long fq_deref_ind, long fcurrent_pos)
 
 operator D& () const
 
D & operator= (const D &f)
 
IndexingProvider< D > & operator[] (long n)
 
const IndexingProvider< D > & operator[] (long n) const
 

Public Attributes

DynArr< D > & arr
 
long q_deref_ind
 
long current_pos
 

Detailed Description

template<class T>
template<class D>
class DynArr< T >::IndexingProvider< D >

Definition at line 1905 of file AbsArr.h.

Constructor & Destructor Documentation

◆ IndexingProvider()

template<class T >
template<class D >
DynArr< T >::IndexingProvider< D >::IndexingProvider ( DynArr< D > &  farr,
long  fq_deref_ind,
long  fcurrent_pos 
)
inline

Definition at line 1910 of file AbsArr.h.

1911 : arr(farr), q_deref_ind(fq_deref_ind), current_pos(fcurrent_pos) {}
DynArr< D > & arr
Definition: AbsArr.h:1907

Member Function Documentation

◆ operator D&()

template<class T >
template<class D >
DynArr< T >::IndexingProvider< D >::operator D& ( ) const
inline

Definition at line 1912 of file AbsArr.h.

1912 {
1913 if (q_deref_ind != arr.qel.get_qel()) {
1914 mcerr << "ERROR in IndexingProvider::operator D& (): q_deref_ind != "
1915 "qel.get_qel()\n";
1917 mcerr << "Type of T is (in internal notations) " << typeid(D).name()
1918 << '\n';
1919 spexit(mcerr);
1920 }
1921#ifdef ALR_CHECK_BOUND
1922 return arr.el[current_pos];
1923#else
1924 return arr.el.acu(current_pos);
1925#endif
1926 }
#define spexit(stream)
Definition: FunNameStack.h:536
long get_qel(void) const
Definition: AbsArr.h:420
T & acu(long n)
Definition: AbsArr.h:372
#define mcerr
Definition: prstream.h:135
#define Iprint2n(file, name1, name2)
Definition: prstream.h:236

◆ operator=()

template<class T >
template<class D >
D & DynArr< T >::IndexingProvider< D >::operator= ( const D &  f)
inline

Definition at line 1927 of file AbsArr.h.

1927 {
1928 if (q_deref_ind != arr.get_qel().get_qel()) {
1929 mcerr << "ERROR in T& IndexingProvider::operator=(T& f): q_deref_ind "
1930 "!= arr.get_qel().get_qel()\n";
1932 mcerr << "Type of T is (in internal notations) " << typeid(D).name()
1933 << '\n';
1934 spexit(mcerr);
1935 }
1936#ifdef ALR_CHECK_BOUND
1937 arr.ac_lin(current_pos) = f;
1938#else
1939 arr.acu_lin(current_pos) = f;
1940#endif
1941 //return arr.el[current_pos];
1942 }
T & acu_lin(long n)
Definition: AbsArr.h:2542
T & ac_lin(long n)
Definition: AbsArr.h:2501
const DynLinArr< long > & get_qel(void) const
Definition: AbsArr.h:2548

◆ operator[]() [1/2]

template<class T >
template<class D >
IndexingProvider< D > & DynArr< T >::IndexingProvider< D >::operator[] ( long  n)
inline

Definition at line 1944 of file AbsArr.h.

1944 {
1945 if (q_deref_ind >= arr.get_qel().get_qel()) {
1946 mcerr << "ERROR in DynArr::IndexingProvider& DynArr::operator[](long "
1947 "n): q_deref_ind >= arr.get_qel().get_qel()\n";
1949 mcerr << "Type of T is (in internal notations) " << typeid(D).name()
1950 << '\n';
1951 spexit(mcerr);
1952 }
1953#ifdef ALR_CHECK_EACH_BOUND
1954 if (n >= 0 && n < arr.qel.acu(q_deref_ind)) {
1955#endif
1957 q_deref_ind++;
1958 return *this;
1959#ifdef ALR_CHECK_EACH_BOUND
1960 } else {
1961 mcerr << "Error in IndexingProvider<D>& "
1962 "IndexingProvider::operator[](long n): n < 0 || n >= "
1963 "qel.acu(q_deref_ind)\n";
1964 Iprint2n(mcout, n, arr.qel.acu(q_deref_ind));
1965 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
1966 << '\n';
1967 spexit(mcerr);
1968 }
1969#endif
1970 }
const DynLinArr< long > & get_cum_qel(void) const
Definition: AbsArr.h:2552
#define mcout
Definition: prstream.h:133

◆ operator[]() [2/2]

template<class T >
template<class D >
const IndexingProvider< D > & DynArr< T >::IndexingProvider< D >::operator[] ( long  n) const
inline

Definition at line 1972 of file AbsArr.h.

1972 {
1973 if (q_deref_ind >= arr.get_qel().get_qel()) {
1974 mcerr << "ERROR in DynArr::IndexingProvider& DynArr::operator[](long "
1975 "n): q_deref_ind >= arr.get_qel().get_qel()\n";
1977 mcerr << "Type of T is (in internal notations) " << typeid(D).name()
1978 << '\n';
1979 spexit(mcerr);
1980 }
1981#ifdef ALR_CHECK_EACH_BOUND
1982 if (n >= 0 && n < arr.qel.acu(q_deref_ind)) {
1983#endif
1985 q_deref_ind++;
1986 return *this;
1987#ifdef ALR_CHECK_EACH_BOUND
1988 } else {
1989 mcerr << "Error in IndexingProvider<D>& "
1990 "IndexingProvider::operator[](long n): n < 0 || n >= "
1991 "qel.acu(q_deref_ind)\n";
1992 Iprint2n(mcout, n, arr.qel.acu(q_deref_ind));
1993 mcerr << "Type of T is (in internal notations) " << typeid(T).name()
1994 << '\n';
1995 spexit(mcerr);
1996 }
1997#endif
1998 }

Member Data Documentation

◆ arr

◆ current_pos

template<class T >
template<class D >
long DynArr< T >::IndexingProvider< D >::current_pos
mutable

◆ q_deref_ind

template<class T >
template<class D >
long DynArr< T >::IndexingProvider< D >::q_deref_ind
mutable

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