GlobalObjects
Lade ...
Suche ...
Keine Treffer
GloTPointerSet.h
gehe zur Dokumentation dieser Datei
1#ifndef INC_GLOTPOINTERSET_H
2#define INC_GLOTPOINTERSET_H
3//-----------------------------------------------------------------------------
43//-----------------------------------------------------------------------------
44#include "GloTypes.h"
45#include "GloPointerSet.h"
46#include "GloBasePersistent.h"
47//-----------------------------------------------------------------------------
48namespace glo
49{
50 //---------------------------------------------------------------------------
87 template < class T > class TPointerSet : public PointerSet
88 {
89 public:
90 //============== Konstruktoren
91 //-----------------------------------------------------------------------
101 TPointerSet();
102 //-----------------------------------------------------------------------
114 TPointerSet( Base & rBase );
115 //-----------------------------------------------------------------------
128 virtual ~TPointerSet();
129 //-----------------------------------------------------------------------
130
131 private:
132 //============== Konstruktoren
133 //-----------------------------------------------------------------------
144 //-----------------------------------------------------------------------
145 public:
146 //============== Methoden
147 //-----------------------------------------------------------------------
163 virtual int getTypeAsString( std::string & rsTypeName ) override;
164 //-----------------------------------------------------------------------
196 virtual int insert( T * pNewObj );
197 //-----------------------------------------------------------------------
227 virtual int insert( std::shared_ptr<T> spNewObj );
228 //-----------------------------------------------------------------------
264 virtual int remove( T * pObject );
265 //-----------------------------------------------------------------------
299 virtual int remove( std::shared_ptr<T> spObject );
300 //-----------------------------------------------------------------------
340 virtual int get( T *& prRetVal, EnSeekMode eMode );
341 //-----------------------------------------------------------------------
375 virtual int get( std::shared_ptr<T> & rRetVal, EnSeekMode eMode );
376 //-----------------------------------------------------------------------
377
378 private:
379 //============== Operatoren
380 //-----------------------------------------------------------------------
391 //-----------------------------------------------------------------------
392 };
393 //---------------------------------------------------------------------------
394 #define SUPER PointerSet
395 //---------------------------------------------------------------------------
396 template < class T >
398 : SUPER()
399 {
400 #ifdef _DEBUG
401 m_strDebugInfo = "TPointerSet";
402 #endif
403 }
404 //---------------------------------------------------------------------------
405 template < class T >
407 : SUPER( rBase )
408 {
409 #ifdef _DEBUG
410 m_strDebugInfo = "TPointerSet";
411 #endif
412 }
413 //---------------------------------------------------------------------------
414 template < class T >
418 //---------------------------------------------------------------------------
419 template < class T >
420 int TPointerSet< T >::getTypeAsString( std::string & rsTypeName )
421 {
422 std::size_t t_nCount( 0 );
423
424 rsTypeName = typeid(T).name();
425 rsTypeName.replace( t_nCount, 6, "");
426 return 0;
427 }
428 //---------------------------------------------------------------------------
429 template < class T >
430 int TPointerSet< T >::insert( T * pNewObj )
431 {
432 return SUPER::insertPers( pNewObj );
433 }
434 //---------------------------------------------------------------------------
435 template < class T >
436 int TPointerSet< T >::insert( std::shared_ptr<T> spNewObj )
437 {
438 return SUPER::insertPers( spNewObj.operator->() );
439 }
440 //---------------------------------------------------------------------------
441 template < class T >
442 int TPointerSet< T >::remove( T * pObject )
443 {
444 return SUPER::removePers( pObject );
445 }
446 //---------------------------------------------------------------------------
447 template < class T >
448 int TPointerSet< T >::remove( std::shared_ptr<T> spObject )
449 {
450 return SUPER::removePers( spObject.operator->() );
451 }
452 //---------------------------------------------------------------------------
453 template < class T >
454 int TPointerSet< T >::get( T *& prRetVal, EnSeekMode eMode )
455 {
456 return SUPER::getPers( (BasePersistent*&) prRetVal, eMode );
457 }
458 //---------------------------------------------------------------------------
459 template < class T >
460 int TPointerSet< T >::get( std::shared_ptr<T> & rRetVal, EnSeekMode eMode )
461 {
462 T * t_pPersObject = 0;
463 int t_iErr = this->get( t_pPersObject, eMode );
464
465 if ( t_pPersObject )
466 {
467 //rRetVal = std::shared_ptr<T>( t_pPersObject, Forgetter<T>() );
468 rRetVal.reset( t_pPersObject, Forgetter<T>() );
469 }
470 return t_iErr;
471 }
472 //---------------------------------------------------------------------------
473 #undef SUPER
474 //---------------------------------------------------------------------------
475} // namespace glo
476#endif
Header für BasePersistent
Header für PointerSet
#define SUPER
Definition GloTAllSet.h:1204
Für jede Bibliothek, hier 'GlobalObjects' gibt es eine Typen-Datei.
Definition GloBase.h:263
Abstrakte Basisklasse für Persistent und die generische GenericPersistent.
Definition GloBasePersistent.h:124
std::string m_strDebugInfo
Definition GloCallBack.h:111
Speziel für GenericPersistent oder abgeleitete Klassen von Persistent die Forget-Methode für std::sha...
Definition GloTypes.h:1234
Ist die Basisklasse von einer Template-Set. Die persistenten Objekte werden in einer std::set verwalt...
Definition GloPointerSet.h:73
Ein typsicherer Set von Zeigern auf persistente Objekte in der Datenbank (gedacht als Attribut für pe...
Definition GloTPointerSet.h:88
virtual int insert(T *pNewObj)
Definition GloTPointerSet.h:430
TPointerSet(const TPointerSet &)
virtual int getTypeAsString(std::string &rsTypeName) override
Definition GloTPointerSet.h:420
TPointerSet< T > & operator=(const TPointerSet &)
virtual int remove(T *pObject)
Definition GloTPointerSet.h:442
virtual int get(T *&prRetVal, EnSeekMode eMode)
Definition GloTPointerSet.h:454
TPointerSet()
Definition GloTPointerSet.h:397
virtual ~TPointerSet()
Definition GloTPointerSet.h:415
Definition GloAbstractBaseLot.h:49
EnSeekMode
Definition GloTypes.h:173