GlobalObjects
Lade ...
Suche ...
Keine Treffer
GloTPointerList.h
gehe zur Dokumentation dieser Datei
1#ifndef INC_GLOTPOINTERLIST_H
2#define INC_GLOTPOINTERLIST_H
3//-----------------------------------------------------------------------------
36//-----------------------------------------------------------------------------
37#include "GloTypes.h"
38#include "GloPointerList.h"
39#include "GloBasePersistent.h"
40#include "EuStdFunctions.h"
41//-----------------------------------------------------------------------------
42namespace glo
43{
44 //---------------------------------------------------------------------------
83 template < class T > class TPointerList : public PointerList
84 {
85 public:
86 //============== Konstruktoren
87 //-----------------------------------------------------------------------
98 //-----------------------------------------------------------------------
110 TPointerList( Base & rBase );
111 //-----------------------------------------------------------------------
124 virtual ~TPointerList();
125 //-----------------------------------------------------------------------
126
127 private:
128 //============== Konstruktoren
129 //-----------------------------------------------------------------------
140 //-----------------------------------------------------------------------
141 public:
142 //============== Methoden
143 //-----------------------------------------------------------------------
159 virtual int getTypeAsString( std::string & rsTypeName ) override;
160 //-----------------------------------------------------------------------
194 virtual int insert( T * pNewObj );
195 //-----------------------------------------------------------------------
227 virtual int insert( std::shared_ptr<T> spNewObj );
228 //-----------------------------------------------------------------------
262 virtual int insertBefore( T * pNewObj, const T * pObject );
263 //-----------------------------------------------------------------------
295 virtual int insertBefore( std::shared_ptr<T> spNewObj, const std::shared_ptr<T> spObject );
296 //-----------------------------------------------------------------------
328 virtual int append( T * pNewObj );
329 //-----------------------------------------------------------------------
359 virtual int append( std::shared_ptr<T> spNewObj );
360 //-----------------------------------------------------------------------
396 virtual int remove( T * pObject );
397 //-----------------------------------------------------------------------
431 virtual int remove( std::shared_ptr<T> spObject );
432 //-----------------------------------------------------------------------
470 virtual int get( T *& prRetVal, EnSeekMode eMode );
471 //-----------------------------------------------------------------------
505 virtual int get( std::shared_ptr<T> & rRetVal, EnSeekMode eMode );
506 //-----------------------------------------------------------------------
507
508 private:
509 //============== Operatoren
510 //-----------------------------------------------------------------------
521 //-----------------------------------------------------------------------
522 };
523 //---------------------------------------------------------------------------
524 #define SUPER PointerList
525 //---------------------------------------------------------------------------
526 template < class T >
528 : SUPER()
529 {
530 #ifdef _DEBUG
531 m_strDebugInfo = "TPointerList";
532 #endif
533 }
534 //---------------------------------------------------------------------------
535 template < class T >
537 : SUPER( rBase )
538 {
539 #ifdef _DEBUG
540 m_strDebugInfo = "TPointerList";
541 #endif
542 }
543 //---------------------------------------------------------------------------
544 template < class T >
548 //---------------------------------------------------------------------------
549 template < class T >
550 int TPointerList< T >::getTypeAsString( std::string & rsTypeName )
551 {
552 std::size_t t_nCount( 0 );
553
554 rsTypeName = typeid(T).name();
555 rsTypeName.replace( t_nCount, 6, "");
556 return 0;
557 }
558 //---------------------------------------------------------------------------
559 template < class T >
560 int TPointerList< T >::insert( T * pNewObj )
561 {
562 return SUPER::insertPers( pNewObj );
563 }
564 //---------------------------------------------------------------------------
565 template < class T >
566 int TPointerList< T >::insert( std::shared_ptr<T> spNewObj )
567 {
568 return SUPER::insertPers( spNewObj.operator->() );
569 }
570 //---------------------------------------------------------------------------
571 template < class T >
572 int TPointerList< T >::insertBefore( T * pNewObj, const T * pObject )
573 {
574 return SUPER::insertPersBefore( pNewObj, pObject );
575 }
576 //---------------------------------------------------------------------------
577 template < class T >
578 int TPointerList< T >::insertBefore( std::shared_ptr<T> spNewObj,
579 const std::shared_ptr<T> spObject )
580 {
581 return SUPER::insertPersBefore( spNewObj.operator->(), spObject.operator->() );
582 }
583 //---------------------------------------------------------------------------
584 template < class T >
585 int TPointerList< T >::append( T * pNewObj )
586 {
587 return SUPER::appendPers( pNewObj );
588 }
589 //---------------------------------------------------------------------------
590 template < class T >
591 int TPointerList< T >::append( std::shared_ptr<T> spNewObj )
592 {
593 return SUPER::appendPers( spNewObj.operator->() );
594 }
595 //---------------------------------------------------------------------------
596 template < class T >
597 int TPointerList< T >::remove( T * pObject )
598 {
599 return SUPER::removePers( pObject );
600 }
601 //---------------------------------------------------------------------------
602 template < class T >
603 int TPointerList< T >::remove( std::shared_ptr<T> spObject )
604 {
605 return SUPER::removePers( spObject.operator->() );
606 }
607 //---------------------------------------------------------------------------
608 template < class T >
609 int TPointerList< T >::get( T *& prRetVal, EnSeekMode eMode )
610 {
611 return SUPER::getPers( (BasePersistent*&) prRetVal, eMode );
612 }
613 //---------------------------------------------------------------------------
614 template < class T >
615 int TPointerList< T >::get( std::shared_ptr<T> & rRetVal, EnSeekMode eMode )
616 {
617 T * t_pPersObject = 0;
618 int t_iErr = this->get( t_pPersObject, eMode );
619
620 if ( t_pPersObject )
621 {
622 //rRetVal = std::shared_ptr<T>( t_pPersObject, Forgeter<T>() );
623 rRetVal.reset( t_pPersObject, Forgeter<T>() );
624 }
625 return t_iErr;
626 }
627 //---------------------------------------------------------------------------
628 #undef SUPER
629 //---------------------------------------------------------------------------
630} // namespace glo
631#endif
Header für StdStringFunctions
Header für BasePersistent
Header für PointerList
#define SUPER
Definition GloTAllSet.h:1151
Für jede Bibliothek, hier 'GlobalObjects' gibt es eine Typen-Datei.
Diese Klasse ist die Schnittstelle zu den persistenten Objekten. Hier können "Objekte" angemeldet,...
Definition GloBase.h:250
Abstrakte Basisklasse für Persistent und die generische GenericPersistent.
Definition GloBasePersistent.h:102
std::string m_strDebugInfo
Definition GloCallBack.h:115
Speziel für GenericPersistent oder abgeleitete Klassen von Persistent die Forget-Methode für std::sha...
Definition GloTypes.h:1249
Ist die Basisklasse von einer Template-List. Die persistenten Objekte werden in einer std::list verwa...
Definition GloPointerList.h:66
Eine typsichere Liste von Zeigern auf persistente Objekte in der Datenbank (gedacht als Attribut für ...
Definition GloTPointerList.h:84
TPointerList< T > & operator=(const TPointerList &)
virtual int append(T *pNewObj)
Definition GloTPointerList.h:585
TPointerList()
Definition GloTPointerList.h:527
TPointerList(const TPointerList &)
virtual int remove(T *pObject)
Definition GloTPointerList.h:597
virtual int insertBefore(T *pNewObj, const T *pObject)
Definition GloTPointerList.h:572
virtual int get(T *&prRetVal, EnSeekMode eMode)
Definition GloTPointerList.h:609
virtual int insert(T *pNewObj)
Definition GloTPointerList.h:560
virtual ~TPointerList()
Definition GloTPointerList.h:545
virtual int getTypeAsString(std::string &rsTypeName) override
Definition GloTPointerList.h:550
Definition GloAbstractBaseLot.h:42
EnSeekMode
Definition GloTypes.h:166