My Project
Loading...
Searching...
No Matches
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 };
int i
Definition: cfEzgcd.cc:132
STATIC_VAR jList * T
Definition: janet.cc:30

◆ template_1d_array() [3/4]

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

Definition at line 668 of file svd_si.h.

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

◆ ~template_1d_array() [2/2]

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

Definition at line 674 of file svd_si.h.

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

◆ 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 680 of file svd_si.h.

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

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 763 of file svd_si.h.

764 {
765 return m_Vec;
766 };

◆ 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 768 of file svd_si.h.

769 {
770 return m_Vec;
771 };

◆ 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 780 of file svd_si.h.

781 {
782 return m_iHigh;
783 };

◆ 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 774 of file svd_si.h.

775 {
776 return m_iLow;
777 };

◆ 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 };
bool wrongIdx(int i) const
Definition: ap.h:793

◆ getvector() [2/4]

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

Definition at line 785 of file svd_si.h.

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

◆ 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 794 of file svd_si.h.

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

◆ 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 };
static void make_assertion(bool bClause)
Definition: ap.h:49

◆ operator()() [2/4]

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

Definition at line 735 of file svd_si.h.

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

◆ 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 726 of file svd_si.h.

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

◆ 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 700 of file svd_si.h.

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

◆ 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 744 of file svd_si.h.

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

◆ 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 };
void setbounds(int iLow, int iHigh)
Definition: ap.h:735

◆ setcontent() [2/2]

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

Definition at line 755 of file svd_si.h.

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

◆ 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 802 of file svd_si.h.

802{ 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: