My Project  UNKNOWN_GIT_VERSION
Public Member Functions | Private Member Functions | Private Attributes
ap::template_1d_array< T > Class Template Reference

#include <ap.h>

Public Member Functions

 template_1d_array ()
 
 ~template_1d_array ()
 
 template_1d_array (const template_1d_array &rhs)
 
const template_1d_arrayoperator= (const template_1d_array &rhs)
 
const Toperator() (int i) const
 
Toperator() (int i)
 
void setbounds (int iLow, int iHigh)
 
void setcontent (int iLow, int iHigh, const T *pContent)
 
Tgetcontent ()
 
const Tgetcontent () const
 
int getlowbound (int iBoundNum=0) const
 
int gethighbound (int iBoundNum=0) const
 
raw_vector< Tgetvector (int iStart, int iEnd)
 
const_raw_vector< Tgetvector (int iStart, int iEnd) const
 
 template_1d_array ()
 
 ~template_1d_array ()
 
 template_1d_array (const template_1d_array &rhs)
 
const template_1d_arrayoperator= (const template_1d_array &rhs)
 
const Toperator() (int i) const
 
Toperator() (int i)
 
void setbounds (int iLow, int iHigh)
 
void setcontent (int iLow, int iHigh, const T *pContent)
 
Tgetcontent ()
 
const Tgetcontent () const
 
int getlowbound (int iBoundNum=0) const
 
int gethighbound (int iBoundNum=0) const
 
raw_vector< Tgetvector (int iStart, int iEnd)
 
const_raw_vector< Tgetvector (int iStart, int iEnd) const
 

Private Member Functions

bool wrongIdx (int i) const
 
bool wrongIdx (int i) const
 

Private Attributes

Tm_Vec
 
long m_iVecSize
 
long m_iLow
 
long m_iHigh
 

Detailed Description

template<class T>
class ap::template_1d_array< T >

Definition at line 656 of file ap.h.

Constructor & Destructor Documentation

◆ template_1d_array() [1/4]

template<class T >
ap::template_1d_array< T >::template_1d_array ( )
inline

Definition at line 659 of file ap.h.

660  {
661  m_Vec=0;
662  m_iVecSize = 0;
663  };

◆ ~template_1d_array() [1/2]

template<class T >
ap::template_1d_array< T >::~template_1d_array ( )
inline

Definition at line 665 of file ap.h.

666  {
667  if(m_Vec)
668  delete[] m_Vec;
669  };

◆ template_1d_array() [2/4]

template<class T >
ap::template_1d_array< T >::template_1d_array ( const template_1d_array< T > &  rhs)
inline

Definition at line 671 of file ap.h.

672  {
673  m_iVecSize = rhs.m_iVecSize;
674  m_iLow = rhs.m_iLow;
675  m_iHigh = rhs.m_iHigh;
676  if(rhs.m_Vec)
677  {
678  m_Vec = new T[m_iVecSize];
679  #ifndef UNSAFE_MEM_COPY
680  for(int i=0; i<m_iVecSize; i++)
681  m_Vec[i] = rhs.m_Vec[i];
682  #else
683  memcpy(m_Vec, rhs.m_Vec, m_iVecSize*sizeof(T));
684  #endif
685  }
686  else
687  m_Vec=0;
688  };

◆ template_1d_array() [3/4]

template<class T >
ap::template_1d_array< T >::template_1d_array ( )
inline

Definition at line 667 of file svd_si.h.

668  {
669  m_Vec=0;
670  m_iVecSize = 0;
671  };

◆ ~template_1d_array() [2/2]

template<class T >
ap::template_1d_array< T >::~template_1d_array ( )
inline

Definition at line 673 of file svd_si.h.

674  {
675  if(m_Vec)
676  delete[] m_Vec;
677  };

◆ template_1d_array() [4/4]

template<class T >
ap::template_1d_array< T >::template_1d_array ( const template_1d_array< T > &  rhs)
inline

Definition at line 679 of file svd_si.h.

680  {
681  m_iVecSize = rhs.m_iVecSize;
682  m_iLow = rhs.m_iLow;
683  m_iHigh = rhs.m_iHigh;
684  if(rhs.m_Vec)
685  {
686  m_Vec = new T[m_iVecSize];
687  #ifndef UNSAFE_MEM_COPY
688  for(int i=0; i<m_iVecSize; i++)
689  m_Vec[i] = rhs.m_Vec[i];
690  #else
691  memcpy(m_Vec, rhs.m_Vec, m_iVecSize*sizeof(T));
692  #endif
693  }
694  else
695  m_Vec=0;
696  };

Member Function Documentation

◆ getcontent() [1/4]

template<class T >
T* ap::template_1d_array< T >::getcontent ( )
inline

Definition at line 754 of file ap.h.

755  {
756  return m_Vec;
757  };

◆ getcontent() [2/4]

template<class T >
T* ap::template_1d_array< T >::getcontent ( )
inline

Definition at line 762 of file svd_si.h.

763  {
764  return m_Vec;
765  };

◆ getcontent() [3/4]

template<class T >
const T* ap::template_1d_array< T >::getcontent ( ) const
inline

Definition at line 759 of file ap.h.

760  {
761  return m_Vec;
762  };

◆ getcontent() [4/4]

template<class T >
const T* ap::template_1d_array< T >::getcontent ( ) const
inline

Definition at line 767 of file svd_si.h.

768  {
769  return m_Vec;
770  };

◆ gethighbound() [1/2]

template<class T >
int ap::template_1d_array< T >::gethighbound ( int  iBoundNum = 0) const
inline

Definition at line 771 of file ap.h.

772  {
773  return m_iHigh;
774  };

◆ gethighbound() [2/2]

template<class T >
int ap::template_1d_array< T >::gethighbound ( int  iBoundNum = 0) const
inline

Definition at line 779 of file svd_si.h.

780  {
781  return m_iHigh;
782  };

◆ getlowbound() [1/2]

template<class T >
int ap::template_1d_array< T >::getlowbound ( int  iBoundNum = 0) const
inline

Definition at line 765 of file ap.h.

766  {
767  return m_iLow;
768  };

◆ getlowbound() [2/2]

template<class T >
int ap::template_1d_array< T >::getlowbound ( int  iBoundNum = 0) const
inline

Definition at line 773 of file svd_si.h.

774  {
775  return m_iLow;
776  };

◆ getvector() [1/4]

template<class T >
raw_vector<T> ap::template_1d_array< T >::getvector ( int  iStart,
int  iEnd 
)
inline

Definition at line 776 of file ap.h.

777  {
778  if( iStart>iEnd || wrongIdx(iStart) || wrongIdx(iEnd) )
779  return raw_vector<T>(0, 0, 1);
780  else
781  return raw_vector<T>(m_Vec+iStart-m_iLow, iEnd-iStart+1, 1);
782  };

◆ getvector() [2/4]

template<class T >
raw_vector<T> ap::template_1d_array< T >::getvector ( int  iStart,
int  iEnd 
)
inline

Definition at line 784 of file svd_si.h.

785  {
786  if( iStart>iEnd || wrongIdx(iStart) || wrongIdx(iEnd) )
787  return raw_vector<T>(0, 0, 1);
788  else
789  return raw_vector<T>(m_Vec+iStart-m_iLow, iEnd-iStart+1, 1);
790  };

◆ getvector() [3/4]

template<class T >
const_raw_vector<T> ap::template_1d_array< T >::getvector ( int  iStart,
int  iEnd 
) const
inline

Definition at line 785 of file ap.h.

786  {
787  if( iStart>iEnd || wrongIdx(iStart) || wrongIdx(iEnd) )
788  return const_raw_vector<T>(0, 0, 1);
789  else
790  return const_raw_vector<T>(m_Vec+iStart-m_iLow, iEnd-iStart+1, 1);
791  };

◆ getvector() [4/4]

template<class T >
const_raw_vector<T> ap::template_1d_array< T >::getvector ( int  iStart,
int  iEnd 
) const
inline

Definition at line 793 of file svd_si.h.

794  {
795  if( iStart>iEnd || wrongIdx(iStart) || wrongIdx(iEnd) )
796  return const_raw_vector<T>(0, 0, 1);
797  else
798  return const_raw_vector<T>(m_Vec+iStart-m_iLow, iEnd-iStart+1, 1);
799  };

◆ operator()() [1/4]

template<class T >
T& ap::template_1d_array< T >::operator() ( int  i)
inline

Definition at line 726 of file ap.h.

727  {
728  #ifndef NO_AP_ASSERT
730  #endif
731  return m_Vec[ i-m_iLow ];
732  };

◆ operator()() [2/4]

template<class T >
T& ap::template_1d_array< T >::operator() ( int  i)
inline

Definition at line 734 of file svd_si.h.

735  {
736  #ifndef NO_AP_ASSERT
738  #endif
739  return m_Vec[ i-m_iLow ];
740  };

◆ operator()() [3/4]

template<class T >
const T& ap::template_1d_array< T >::operator() ( int  i) const
inline

Definition at line 717 of file ap.h.

718  {
719  #ifndef NO_AP_ASSERT
721  #endif
722  return m_Vec[ i-m_iLow ];
723  };

◆ operator()() [4/4]

template<class T >
const T& ap::template_1d_array< T >::operator() ( int  i) const
inline

Definition at line 725 of file svd_si.h.

726  {
727  #ifndef NO_AP_ASSERT
729  #endif
730  return m_Vec[ i-m_iLow ];
731  };

◆ operator=() [1/2]

template<class T >
const template_1d_array& ap::template_1d_array< T >::operator= ( const template_1d_array< T > &  rhs)
inline

Definition at line 691 of file ap.h.

692  {
693  if( this==&rhs )
694  return *this;
695 
696  m_iLow = rhs.m_iLow;
697  m_iHigh = rhs.m_iHigh;
698  m_iVecSize = rhs.m_iVecSize;
699  if(m_Vec)
700  delete[] m_Vec;
701  if(rhs.m_Vec)
702  {
703  m_Vec = new T[m_iVecSize];
704  #ifndef UNSAFE_MEM_COPY
705  for(int i=0; i<m_iVecSize; i++)
706  m_Vec[i] = rhs.m_Vec[i];
707  #else
708  memcpy(m_Vec, rhs.m_Vec, m_iVecSize*sizeof(T));
709  #endif
710  }
711  else
712  m_Vec=0;
713  return *this;
714  };

◆ operator=() [2/2]

template<class T >
const template_1d_array& ap::template_1d_array< T >::operator= ( const template_1d_array< T > &  rhs)
inline

Definition at line 699 of file svd_si.h.

700  {
701  if( this==&rhs )
702  return *this;
703 
704  m_iLow = rhs.m_iLow;
705  m_iHigh = rhs.m_iHigh;
706  m_iVecSize = rhs.m_iVecSize;
707  if(m_Vec)
708  delete[] m_Vec;
709  if(rhs.m_Vec)
710  {
711  m_Vec = new T[m_iVecSize];
712  #ifndef UNSAFE_MEM_COPY
713  for(int i=0; i<m_iVecSize; i++)
714  m_Vec[i] = rhs.m_Vec[i];
715  #else
716  memcpy(m_Vec, rhs.m_Vec, m_iVecSize*sizeof(T));
717  #endif
718  }
719  else
720  m_Vec=0;
721  return *this;
722  };

◆ setbounds() [1/2]

template<class T >
void ap::template_1d_array< T >::setbounds ( int  iLow,
int  iHigh 
)
inline

Definition at line 735 of file ap.h.

736  {
737  if(m_Vec)
738  delete[] m_Vec;
739  m_iLow = iLow;
740  m_iHigh = iHigh;
741  m_iVecSize = iHigh-iLow+1;
742  m_Vec = new T[m_iVecSize];
743  };

◆ setbounds() [2/2]

template<class T >
void ap::template_1d_array< T >::setbounds ( int  iLow,
int  iHigh 
)
inline

Definition at line 743 of file svd_si.h.

744  {
745  if(m_Vec)
746  delete[] m_Vec;
747  m_iLow = iLow;
748  m_iHigh = iHigh;
749  m_iVecSize = iHigh-iLow+1;
750  m_Vec = new T[m_iVecSize];
751  };

◆ setcontent() [1/2]

template<class T >
void ap::template_1d_array< T >::setcontent ( int  iLow,
int  iHigh,
const T pContent 
)
inline

Definition at line 746 of file ap.h.

747  {
748  setbounds(iLow, iHigh);
749  for(int i=iLow; i<=iHigh; i++)
750  (*this)(i) = pContent[i-iLow];
751  };

◆ setcontent() [2/2]

template<class T >
void ap::template_1d_array< T >::setcontent ( int  iLow,
int  iHigh,
const T pContent 
)
inline

Definition at line 754 of file svd_si.h.

755  {
756  setbounds(iLow, iHigh);
757  for(int i=iLow; i<=iHigh; i++)
758  (*this)(i) = pContent[i-iLow];
759  };

◆ wrongIdx() [1/2]

template<class T >
bool ap::template_1d_array< T >::wrongIdx ( int  i) const
inlineprivate

Definition at line 793 of file ap.h.

793 { return i<m_iLow || i>m_iHigh; };

◆ wrongIdx() [2/2]

template<class T >
bool ap::template_1d_array< T >::wrongIdx ( int  i) const
inlineprivate

Definition at line 801 of file svd_si.h.

801 { return i<m_iLow || i>m_iHigh; };

Field Documentation

◆ m_iHigh

template<class T >
long ap::template_1d_array< T >::m_iHigh
private

Definition at line 797 of file ap.h.

◆ m_iLow

template<class T >
long ap::template_1d_array< T >::m_iLow
private

Definition at line 797 of file ap.h.

◆ m_iVecSize

template<class T >
long ap::template_1d_array< T >::m_iVecSize
private

Definition at line 796 of file ap.h.

◆ m_Vec

template<class T >
T * ap::template_1d_array< T >::m_Vec
private

Definition at line 795 of file ap.h.


The documentation for this class was generated from the following files:
ap::template_1d_array::m_iVecSize
long m_iVecSize
Definition: ap.h:796
i
int i
Definition: cfEzgcd.cc:125
T
static jList * T
Definition: janet.cc:31
ap::template_1d_array::m_iHigh
long m_iHigh
Definition: ap.h:797
ap::ap_error::make_assertion
static void make_assertion(bool bClause)
Definition: ap.h:49
ap::template_1d_array::wrongIdx
bool wrongIdx(int i) const
Definition: ap.h:793
ap::template_1d_array::setbounds
void setbounds(int iLow, int iHigh)
Definition: ap.h:735
ap::template_1d_array::m_iLow
long m_iLow
Definition: ap.h:797
ap::template_1d_array::m_Vec
T * m_Vec
Definition: ap.h:793