BankAndCustomer
Lade ...
Suche ...
Keine Treffer
GloBasePersistent.h
gehe zur Dokumentation dieser Datei
1#ifndef INC_GLOBASEPERSISTENT_H
2#define INC_GLOBASEPERSISTENT_H
3//-----------------------------------------------------------------------------
43//-----------------------------------------------------------------------------
44#include <list>
45#include <vector>
46#include <map>
47#include "GloTypes.h"
48#include "GloCallBack.h"
49#include "GloLockSpecification.h"
50#include "GloWatchSpecification.h"
51#if defined (__PTHREADS)
52 #include <EuPCriticalSection.h>
53#else
54 #include "EuCriticalSection.h"
55#endif
56#include <ctime>
57#include <memory>
58//-----------------------------------------------------------------------------
59namespace glo
60{
61 //---------------------------------------------------------------------------
62 /* Forwards */
63 class Record;
64 class ClassInfo;
65 class AttributeID;
66 class BaseRecordAttribute;
67 //---------------------------------------------------------------------------
68 #ifdef _MSC_VER
69 /* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
70 #pragma warning( disable : 4251 )
71 #endif
72 //---------------------------------------------------------------------------
123 class __glo_export_dll BasePersistent : public CallBack
124 {
125 //============== Friends
126 //-----------------------------------------------------------------------
135 friend class PrivateBase;
136 //-----------------------------------------------------------------------
137
138 protected:
139 //============== Attribute
140 //-----------------------------------------------------------------------
150 Base * m_pBase;
151 //-----------------------------------------------------------------------
161 unsigned int m_uiReferenceCount;
162 //-----------------------------------------------------------------------
176 #if defined (__PTHREADS)
177 EuPCriticalSection m_LocalCriticalSection;
178 #else
179 eut::CriticalSection m_LocalCriticalSection;
180 #endif
181 //-----------------------------------------------------------------------
193 Record * m_pRecord;
194 //-----------------------------------------------------------------------
217 //-----------------------------------------------------------------------
218
219 public:
220 //============= ctor
221 //-----------------------------------------------------------------------
232 //-----------------------------------------------------------------------
233
234 protected:
235 //============== dtor
236 //-----------------------------------------------------------------------
253 //-----------------------------------------------------------------------
254
255 public:
256 //============= Copy ctor
257 //-----------------------------------------------------------------------
272 //-----------------------------------------------------------------------
273
274 //============== Methoden
275 //-----------------------------------------------------------------------
296 virtual int setBase( Base * pBase ) override;
297 //-----------------------------------------------------------------------
312 virtual Base * getBase() const override;
313 //-----------------------------------------------------------------------
323 virtual void removeBase();
324 //-----------------------------------------------------------------------
342 virtual int getClassInfo( ClassInfo *& prClassInfo );
343 //-----------------------------------------------------------------------
357 virtual int getTypeAsString( std::string & rsTypeName ) override;
358 //-----------------------------------------------------------------------
370 virtual std::time_t getCreateDate() const = 0;
371 //-----------------------------------------------------------------------
383 virtual std::time_t getLastChangeDate() const = 0;
384 //-----------------------------------------------------------------------
406 virtual unsigned int remember();
407 //-----------------------------------------------------------------------
431 virtual unsigned int forget();
432 //-----------------------------------------------------------------------
460 virtual int assign( Base & rBase );
461 //-----------------------------------------------------------------------
471 virtual bool isAssigned() const;
472 //-----------------------------------------------------------------------
483 unsigned int getLinkCount() const;
484 //-----------------------------------------------------------------------
494 virtual ObjID getObjID() const;
495 //-----------------------------------------------------------------------
519 int getRecord( Record *& prRecord ) const;
520 //-----------------------------------------------------------------------
534 int getRecord( std::shared_ptr<Record> & rRetVal ) const;
535 //-----------------------------------------------------------------------
553 int getAllPersAttributeNames( std::list<std::string> & rRetValList,
554 const std::vector<unsigned long> * pClassIdVector = nullptr ) const;
555 //-----------------------------------------------------------------------
575 int getAllPersAttributeNamesSortByID( std::map< AttributeID, std::string> & rRetValMap,
576 const std::vector<unsigned long> * pClassIdVector = nullptr ) const;
577 //-----------------------------------------------------------------------
611 int getPersAttribute( BaseRecordAttribute *& prRetVal,
612 const std::string & sName ) const;
613 //-----------------------------------------------------------------------
634 int getPersAttribute( std::shared_ptr<BaseRecordAttribute> & rRetVal,
635 const std::string & sName ) const;
636 //-----------------------------------------------------------------------
666 int getPersAttribute( BaseRecordAttribute *& prRetVal,
667 const AttributeID & rAttributeID) const;
668 //-----------------------------------------------------------------------
686 int getPersAttribute( std::shared_ptr<BaseRecordAttribute> & rRetVal,
687 const AttributeID & rAttributeID ) const;
688 //-----------------------------------------------------------------------
720 int getAllPersAttributes( std::list< BaseRecordAttribute * > & rRetValList,
721 const std::vector<unsigned long> * pClassIdVector = nullptr ) const;
722 //-----------------------------------------------------------------------
742 int getAllPersAttributes( std::list< std::shared_ptr<BaseRecordAttribute> > & rRetValList,
743 const std::vector<unsigned long> * pClassIdVector = nullptr ) const;
744 //-----------------------------------------------------------------------
776 int getAllPersAttributesSortByName( std::map< std::string, BaseRecordAttribute *, std::less<std::string> > & rRetValMap,
777 const std::vector<unsigned long> * pClassIdVector = nullptr ) const;
778 //-----------------------------------------------------------------------
798 int getAllPersAttributesSortByName( std::map< std::string, std::shared_ptr<BaseRecordAttribute>, std::less<std::string> > & rRetValMap,
799 const std::vector<unsigned long> * pClassIdVector = nullptr ) const;
800 //-----------------------------------------------------------------------
834 int getAllPersAttributesSortByID( std::map< AttributeID, BaseRecordAttribute *, std::less<AttributeID> > & rRetValMap,
835 const std::vector<unsigned long> * pClassIdVector = nullptr ) const;
836 //-----------------------------------------------------------------------
858 int getAllPersAttributesSortByID( std::map< AttributeID, std::shared_ptr<BaseRecordAttribute>, std::less<AttributeID> > & rRetValMap,
859 const std::vector<unsigned long> * pClassIdVector = nullptr ) const;
860 //-----------------------------------------------------------------------
874 virtual void takeOverRecord( Record * pRecord );
875 //-----------------------------------------------------------------------
885 virtual unsigned long getGloClassID() const =0;
886 //-----------------------------------------------------------------------
906 virtual int store( EnDeepMode eDeepMode = DM_SHALLOW );
907 //-----------------------------------------------------------------------
921 virtual bool isStored();
922 //-----------------------------------------------------------------------
938 virtual int deleteInBase( EnDeepMode eDeepMode = DM_SHALLOW );
939 //-----------------------------------------------------------------------
957 virtual bool isDeletedInBase();
958 //-----------------------------------------------------------------------
976 virtual int refresh();
977 //-----------------------------------------------------------------------
1001 virtual int lock( EnLockMode eLockMode = LK_DELETEvWRITE,
1002 EnDeepMode eDeepMode = DM_SHALLOW );
1003 //-----------------------------------------------------------------------
1028 virtual int lock( const LockSpecification & rLockSpecification );
1029 //-----------------------------------------------------------------------
1061 virtual int lockAndRefresh( EnLockMode eLockMode = LK_DELETEvWRITE,
1062 EnDeepMode eDeepMode = DM_SHALLOW );
1063 //-----------------------------------------------------------------------
1096 virtual int lockAndRefresh( const LockSpecification & rLockSpecification );
1097 //-----------------------------------------------------------------------
1131 virtual int relock( EnLockMode eLockMode = LK_DELETEvWRITE,
1132 EnDeepMode eDeepMode = DM_SHALLOW );
1133 //-----------------------------------------------------------------------
1169 virtual int relock( const LockSpecification & rLockSpecification );
1170 //-----------------------------------------------------------------------
1212 virtual int relockAndRefresh( EnLockMode eLockMode = LK_DELETEvWRITE,
1213 EnDeepMode eDeepMode = DM_SHALLOW );
1214 //-----------------------------------------------------------------------
1258 virtual int relockAndRefresh( const LockSpecification & rLockSpecification );
1259 //-----------------------------------------------------------------------
1285 virtual int unlock( EnLockMode eLockMode = LK_DELETEvWRITE,
1286 EnDeepMode eDeepMode = DM_SHALLOW);
1287 //-----------------------------------------------------------------------
1314 virtual int unlock( const LockSpecification & rLockSpecification );
1315 //-----------------------------------------------------------------------
1316 //-----------------------------------------------------------------------
1317 // doxygen -> warning: unable to resolve reference to 'GLO_LOCKING_ASK_LOCK' for \ref command
1318 // doxygen -> warning: unable to resolve reference to 'GLO_LOCKING_OBJ' for \ref command
1319 // doxygen -> warning: unable to resolve reference to 'PAGE_GLO_WATCH_NOTIFY' for \ref command
1320 // are references to the GlobalObjects documentation.
1321 //-----------------------------------------------------------------------
1345 virtual int isLocked( EnLockMode eLockMode = LK_DELETEvWRITE,
1346 EnDeepMode eDeepMode = DM_SHALLOW ) const;
1347 //-----------------------------------------------------------------------
1368 virtual int isLocked( const LockSpecification & rLockSpecification ) const;
1369 //-----------------------------------------------------------------------
1393 virtual int isPossible( bool bRead,
1394 bool bWrite,
1395 bool bDelete,
1396 EnDeepMode eDeepMode = DM_SHALLOW ) const;
1397 //-----------------------------------------------------------------------
1417 virtual int isPossible( const LockPossibleSpecification & rLockPossibleSpec,
1418 EnDeepMode eDeepMode = DM_SHALLOW ) const;
1419 //-----------------------------------------------------------------------
1437 virtual int getProcessingPossibilities( LockPossibleSpecification & rLockPossibleSpec,
1438 EnDeepMode eDeepMode = DM_SHALLOW ) const;
1439 //-----------------------------------------------------------------------
1497 virtual int setWatch( TdWatchNotifyMode ulWatchMode,
1498 EnDeepMode eDeepMode,
1499 CallBack * pCallBack = nullptr );
1500 //-----------------------------------------------------------------------
1533 virtual int setWatch( const WatchSpecification & rWatchSpec );
1534 //-----------------------------------------------------------------------
1592 virtual int unsetWatch( TdWatchNotifyMode ulWatchMode,
1593 EnDeepMode eDeepMode,
1594 CallBack * pCallBack = nullptr );
1595 //-----------------------------------------------------------------------
1632 virtual int unsetWatch( const WatchSpecification & rWatchSpec );
1633 //-----------------------------------------------------------------------
1634
1635 protected:
1636 //============== Methoden
1637 //-----------------------------------------------------------------------
1649 virtual void insertInObjectSpy() const = 0;
1650 //-----------------------------------------------------------------------
1662 virtual void removeInObjectSpy() const = 0;
1663 //-----------------------------------------------------------------------
1673 virtual void setCreateDate() = 0;
1674 //-----------------------------------------------------------------------
1688 void setSpyaction( bool bSpyaction );
1689 //-----------------------------------------------------------------------
1690
1691 public:
1692 //============== Operatoren
1693 //-----------------------------------------------------------------------
1705 BasePersistent & operator= ( const BasePersistent & rT );
1706 //-----------------------------------------------------------------------
1708
1719 bool operator== ( const BasePersistent & rT ) const;
1720 bool operator!= ( const BasePersistent & rT ) const;
1722 //-----------------------------------------------------------------------
1723 };
1724 //---------------------------------------------------------------------------
1725 #ifdef _MSC_VER
1726 /* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
1727 #pragma warning( default : 4251 )
1728 #endif
1729 //---------------------------------------------------------------------------
1730} // namespace glo
1731#endif
Header für CallBack
Abstrakte Basisklasse für Persistent und die generische GenericPersistent.
Definition GloBasePersistent.h:124
virtual int isPossible(const LockPossibleSpecification &rLockPossibleSpec, EnDeepMode eDeepMode=DM_SHALLOW) const
virtual int getProcessingPossibilities(LockPossibleSpecification &rLockPossibleSpec, EnDeepMode eDeepMode=DM_SHALLOW) const
virtual int lock(EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW)
virtual int isPossible(bool bRead, bool bWrite, bool bDelete, EnDeepMode eDeepMode=DM_SHALLOW) const
virtual bool isAssigned() const
int getRecord(Record *&prRecord) const
virtual int relockAndRefresh(EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW)
virtual unsigned int forget()
int getAllPersAttributeNames(std::list< std::string > &rRetValList, const std::vector< unsigned long > *pClassIdVector=nullptr) const
BasePersistent(const BasePersistent &rT)
eut::CriticalSection m_LocalCriticalSection
Definition GloBasePersistent.h:179
virtual int assign(Base &rBase)
virtual int unsetWatch(const WatchSpecification &rWatchSpec)
virtual bool isDeletedInBase()
virtual int getTypeAsString(std::string &rsTypeName) override
virtual int unsetWatch(TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack=nullptr)
virtual int isLocked(EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW) const
virtual std::time_t getLastChangeDate() const =0
virtual Base * getBase() const override
int getPersAttribute(std::shared_ptr< BaseRecordAttribute > &rRetVal, const std::string &sName) const
virtual int lockAndRefresh(const LockSpecification &rLockSpecification)
virtual int unlock(EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW)
int getAllPersAttributes(std::list< BaseRecordAttribute * > &rRetValList, const std::vector< unsigned long > *pClassIdVector=nullptr) const
virtual int unlock(const LockSpecification &rLockSpecification)
unsigned int getLinkCount() const
virtual int setBase(Base *pBase) override
Base * m_pBase
Definition GloBasePersistent.h:150
virtual int setWatch(TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack=nullptr)
virtual void setCreateDate()=0
virtual int relock(EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW)
virtual void takeOverRecord(Record *pRecord)
int getAllPersAttributeNamesSortByID(std::map< AttributeID, std::string > &rRetValMap, const std::vector< unsigned long > *pClassIdVector=nullptr) const
int getRecord(std::shared_ptr< Record > &rRetVal) const
virtual int deleteInBase(EnDeepMode eDeepMode=DM_SHALLOW)
int getAllPersAttributesSortByName(std::map< std::string, std::shared_ptr< BaseRecordAttribute >, std::less< std::string > > &rRetValMap, const std::vector< unsigned long > *pClassIdVector=nullptr) const
virtual void insertInObjectSpy() const =0
virtual int relockAndRefresh(const LockSpecification &rLockSpecification)
virtual unsigned int remember()
virtual ~BasePersistent()
bool m_bSpyaction
Definition GloBasePersistent.h:216
virtual int lock(const LockSpecification &rLockSpecification)
int getAllPersAttributesSortByID(std::map< AttributeID, std::shared_ptr< BaseRecordAttribute >, std::less< AttributeID > > &rRetValMap, const std::vector< unsigned long > *pClassIdVector=nullptr) const
void setSpyaction(bool bSpyaction)
virtual int relock(const LockSpecification &rLockSpecification)
virtual int getClassInfo(ClassInfo *&prClassInfo)
int getAllPersAttributesSortByID(std::map< AttributeID, BaseRecordAttribute *, std::less< AttributeID > > &rRetValMap, const std::vector< unsigned long > *pClassIdVector=nullptr) const
virtual bool isStored()
virtual std::time_t getCreateDate() const =0
virtual void removeBase()
int getPersAttribute(std::shared_ptr< BaseRecordAttribute > &rRetVal, const AttributeID &rAttributeID) const
virtual int isLocked(const LockSpecification &rLockSpecification) const
virtual void removeInObjectSpy() const =0
virtual int lockAndRefresh(EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW)
int getPersAttribute(BaseRecordAttribute *&prRetVal, const std::string &sName) const
int getAllPersAttributesSortByName(std::map< std::string, BaseRecordAttribute *, std::less< std::string > > &rRetValMap, const std::vector< unsigned long > *pClassIdVector=nullptr) const
unsigned int m_uiReferenceCount
Definition GloBasePersistent.h:161
virtual unsigned long getGloClassID() const =0
virtual int store(EnDeepMode eDeepMode=DM_SHALLOW)
Record * m_pRecord
Definition GloBasePersistent.h:193
int getPersAttribute(BaseRecordAttribute *&prRetVal, const AttributeID &rAttributeID) const
virtual int setWatch(const WatchSpecification &rWatchSpec)
virtual ObjID getObjID() const
int getAllPersAttributes(std::list< std::shared_ptr< BaseRecordAttribute > > &rRetValList, const std::vector< unsigned long > *pClassIdVector=nullptr) const
virtual int refresh()
Oberklasse für die Klassen, welche mit einer Base 'verbunden' sind.
Definition GloCallBack.h:81
Ein Objekt-ID besteht aus der Klassen-ID, einer Datenbank-ID und der eigentlichen eindeutigen ObjektZ...
Definition GloObjID.h:84
Definition GloBasePersistent.h:60