GlobalObjects
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GloTPointerList.h
Go to the documentation of this file.
1#ifndef INC_GLOTPOINTERLIST_H
2#define INC_GLOTPOINTERLIST_H
3//-----------------------------------------------------------------------------
43//-----------------------------------------------------------------------------
44#include "GloTypes.h"
45#include "GloPointerList.h"
46#include "GloBasePersistent.h"
47#include "EuStdFunctions.h"
48//-----------------------------------------------------------------------------
49namespace glo
50{
51 //---------------------------------------------------------------------------
90 template < class T > class TPointerList : public PointerList
91 {
92 public:
93 //============== Konstruktoren
94 //-----------------------------------------------------------------------
104 TPointerList();
105 //-----------------------------------------------------------------------
117 TPointerList( Base & rBase );
118 //-----------------------------------------------------------------------
131 virtual ~TPointerList();
132 //-----------------------------------------------------------------------
133
134 private:
135 //============== Konstruktoren
136 //-----------------------------------------------------------------------
147 //-----------------------------------------------------------------------
148
149 public:
150 //============== static methods
151 //-----------------------------------------------------------------------
163 static unsigned long getStaticGloClassID(){ return T::getStaticGloClassID();};
164 //-----------------------------------------------------------------------
165
166 public:
167 //============== Methoden
168 //-----------------------------------------------------------------------
184 virtual int getTypeAsString( std::string & rsTypeName ) override;
185 //-----------------------------------------------------------------------
219 virtual int insert( T * pNewObj );
220 //-----------------------------------------------------------------------
252 virtual int insert( std::shared_ptr<T> spNewObj );
253 //-----------------------------------------------------------------------
287 virtual int insertBefore( T * pNewObj, const T * pObject );
288 //-----------------------------------------------------------------------
320 virtual int insertBefore( std::shared_ptr<T> spNewObj, const std::shared_ptr<T> spObject );
321 //-----------------------------------------------------------------------
353 virtual int append( T * pNewObj );
354 //-----------------------------------------------------------------------
384 virtual int append( std::shared_ptr<T> spNewObj );
385 //-----------------------------------------------------------------------
421 virtual int remove( T * pObject );
422 //-----------------------------------------------------------------------
456 virtual int remove( std::shared_ptr<T> spObject );
457 //-----------------------------------------------------------------------
497 virtual int get( T *& prRetVal, EnSeekMode eMode );
498 //-----------------------------------------------------------------------
532 virtual int get( std::shared_ptr<T> & rRetVal, EnSeekMode eMode );
533 //-----------------------------------------------------------------------
534
535 private:
536 //============== Operatoren
537 //-----------------------------------------------------------------------
548 //-----------------------------------------------------------------------
549 };
550 //---------------------------------------------------------------------------
551 #define SUPER PointerList
552 //---------------------------------------------------------------------------
553 template < class T >
555 : SUPER()
556 {
557 #ifdef _DEBUG
558 m_strDebugInfo = "TPointerList";
559 #endif
560 }
561 //---------------------------------------------------------------------------
562 template < class T >
564 : SUPER( rBase )
565 {
566 #ifdef _DEBUG
567 m_strDebugInfo = "TPointerList";
568 #endif
569 }
570 //---------------------------------------------------------------------------
571 template < class T >
575 //---------------------------------------------------------------------------
576 template < class T >
577 int TPointerList< T >::getTypeAsString( std::string & rsTypeName )
578 {
579 std::size_t t_nCount( 0 );
580
581 rsTypeName = typeid(T).name();
582 rsTypeName.replace( t_nCount, 6, "");
583 return 0;
584 }
585 //---------------------------------------------------------------------------
586 template < class T >
587 int TPointerList< T >::insert( T * pNewObj )
588 {
589 return SUPER::insertPers( pNewObj );
590 }
591 //---------------------------------------------------------------------------
592 template < class T >
593 int TPointerList< T >::insert( std::shared_ptr<T> spNewObj )
594 {
595 return SUPER::insertPers( spNewObj.operator->() );
596 }
597 //---------------------------------------------------------------------------
598 template < class T >
599 int TPointerList< T >::insertBefore( T * pNewObj, const T * pObject )
600 {
601 return SUPER::insertPersBefore( pNewObj, pObject );
602 }
603 //---------------------------------------------------------------------------
604 template < class T >
605 int TPointerList< T >::insertBefore( std::shared_ptr<T> spNewObj,
606 const std::shared_ptr<T> spObject )
607 {
608 return SUPER::insertPersBefore( spNewObj.operator->(), spObject.operator->() );
609 }
610 //---------------------------------------------------------------------------
611 template < class T >
612 int TPointerList< T >::append( T * pNewObj )
613 {
614 return SUPER::appendPers( pNewObj );
615 }
616 //---------------------------------------------------------------------------
617 template < class T >
618 int TPointerList< T >::append( std::shared_ptr<T> spNewObj )
619 {
620 return SUPER::appendPers( spNewObj.operator->() );
621 }
622 //---------------------------------------------------------------------------
623 template < class T >
624 int TPointerList< T >::remove( T * pObject )
625 {
626 return SUPER::removePers( pObject );
627 }
628 //---------------------------------------------------------------------------
629 template < class T >
630 int TPointerList< T >::remove( std::shared_ptr<T> spObject )
631 {
632 return SUPER::removePers( spObject.operator->() );
633 }
634 //---------------------------------------------------------------------------
635 template < class T >
636 int TPointerList< T >::get( T *& prRetVal, EnSeekMode eMode )
637 {
638 return SUPER::getPers( (BasePersistent*&) prRetVal, eMode );
639 }
640 //---------------------------------------------------------------------------
641 template < class T >
642 int TPointerList< T >::get( std::shared_ptr<T> & rRetVal, EnSeekMode eMode )
643 {
644 T * t_pPersObject = nullptr;
645 int t_iErr = this->get( t_pPersObject, eMode );
646
647 if ( t_pPersObject )
648 {
649 //rRetVal = std::shared_ptr<T>( t_pPersObject, Forgetter<T>() );
650 rRetVal.reset( t_pPersObject, Forgetter<T>() );
651 }
652 return t_iErr;
653 }
654 //---------------------------------------------------------------------------
655 #undef SUPER
656 //---------------------------------------------------------------------------
657} // namespace glo
658#endif
Header for StdStringFunctions
Header for BasePersistent
Header for PointerList
#define SUPER
Definition GloTAllSet.h:1300
For each library, here 'GlobalObjects' there is a type file.
Definition GloBase.h:263
Abstract base class for Persistent and the generic GenericPersistent.
Definition GloBasePersistent.h:124
std::string m_strDebugInfo
Definition GloCallBack.h:111
Especially for GenericPersistent or derived classes of Persistent the Forget method for std::shared_p...
Definition GloTypes.h:1253
TPointerList< T > & operator=(const TPointerList &)
virtual int append(T *pNewObj)
Definition GloTPointerList.h:612
TPointerList()
Definition GloTPointerList.h:554
TPointerList(const TPointerList &)
virtual int remove(T *pObject)
Definition GloTPointerList.h:624
virtual int insertBefore(T *pNewObj, const T *pObject)
Definition GloTPointerList.h:599
virtual int get(T *&prRetVal, EnSeekMode eMode)
Definition GloTPointerList.h:636
static unsigned long getStaticGloClassID()
Definition GloTPointerList.h:163
virtual int insert(T *pNewObj)
Definition GloTPointerList.h:587
virtual ~TPointerList()
Definition GloTPointerList.h:572
virtual int getTypeAsString(std::string &rsTypeName) override
Definition GloTPointerList.h:577
Definition GloAbstractBaseLot.h:49
EnSeekMode
Definition GloTypes.h:192