BankAndCustomer
Loading...
Searching...
No Matches
GloBasePersistent.h
Go to the documentation of this file.
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 = 0 ) const;
555 //-----------------------------------------------------------------------
575 int getAllPersAttributeNamesSortByID( std::map< AttributeID, std::string> & rRetValMap,
576 const std::vector<unsigned long> * pClassIdVector = 0 ) 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 = 0 ) const;
722 //-----------------------------------------------------------------------
742 int getAllPersAttributes( std::list< std::shared_ptr<BaseRecordAttribute> > & rRetValList,
743 const std::vector<unsigned long> * pClassIdVector = 0 ) const;
744 //-----------------------------------------------------------------------
776 int getAllPersAttributesSortByName( std::map< std::string, BaseRecordAttribute *, std::less<std::string> > & rRetValMap,
777 const std::vector<unsigned long> * pClassIdVector = 0 ) 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 = 0 ) const;
800 //-----------------------------------------------------------------------
834 int getAllPersAttributesSortByID( std::map< AttributeID, BaseRecordAttribute *, std::less<AttributeID> > & rRetValMap,
835 const std::vector<unsigned long> * pClassIdVector = 0) const;
836 //-----------------------------------------------------------------------
858 int getAllPersAttributesSortByID( std::map< AttributeID, std::shared_ptr<BaseRecordAttribute>, std::less<AttributeID> > & rRetValMap,
859 const std::vector<unsigned long> * pClassIdVector = 0 ) 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 //-----------------------------------------------------------------------
1063 virtual int relock( EnLockMode eLockMode = LK_DELETEvWRITE,
1064 EnDeepMode eDeepMode = DM_SHALLOW );
1065 //-----------------------------------------------------------------------
1101 virtual int relock( const LockSpecification & rLockSpecification );
1102 //-----------------------------------------------------------------------
1128 virtual int unlock( EnLockMode eLockMode = LK_DELETEvWRITE,
1129 EnDeepMode eDeepMode = DM_SHALLOW);
1130 //-----------------------------------------------------------------------
1157 virtual int unlock( const LockSpecification & rLockSpecification );
1158 //-----------------------------------------------------------------------
1159 //-----------------------------------------------------------------------
1160 // doxygen -> warning: unable to resolve reference to 'GLO_LOCKING_ASK_LOCK' for \ref command
1161 // doxygen -> warning: unable to resolve reference to 'GLO_LOCKING_OBJ' for \ref command
1162 // doxygen -> warning: unable to resolve reference to 'PAGE_GLO_WATCH_NOTIFY' for \ref command
1163 // are references to the GlobalObjects documentation.
1164 //-----------------------------------------------------------------------
1188 virtual int isLocked( EnLockMode eLockMode = LK_DELETEvWRITE,
1189 EnDeepMode eDeepMode = DM_SHALLOW ) const;
1190 //-----------------------------------------------------------------------
1211 virtual int isLocked( const LockSpecification & rLockSpecification ) const;
1212 //-----------------------------------------------------------------------
1236 virtual int isPossible( bool bRead,
1237 bool bWrite,
1238 bool bDelete,
1239 EnDeepMode eDeepMode = DM_SHALLOW ) const;
1240 //-----------------------------------------------------------------------
1260 virtual int isPossible( const LockPossibleSpecification & rLockPossibleSpec,
1261 EnDeepMode eDeepMode = DM_SHALLOW ) const;
1262 //-----------------------------------------------------------------------
1280 virtual int getProcessingPossibilities( LockPossibleSpecification & rLockPossibleSpec,
1281 EnDeepMode eDeepMode = DM_SHALLOW ) const;
1282 //-----------------------------------------------------------------------
1340 virtual int setWatch( TdWatchNotifyMode ulWatchMode,
1341 EnDeepMode eDeepMode,
1342 CallBack * pCallBack = 0 );
1343 //-----------------------------------------------------------------------
1376 virtual int setWatch( const WatchSpecification & rWatchSpec );
1377 //-----------------------------------------------------------------------
1435 virtual int unsetWatch( TdWatchNotifyMode ulWatchMode,
1436 EnDeepMode eDeepMode,
1437 CallBack * pCallBack = 0 );
1438 //-----------------------------------------------------------------------
1475 virtual int unsetWatch( const WatchSpecification & rWatchSpec );
1476 //-----------------------------------------------------------------------
1477
1478 protected:
1479 //============== Methoden
1480 //-----------------------------------------------------------------------
1492 virtual void insertInObjectSpy() const = 0;
1493 //-----------------------------------------------------------------------
1505 virtual void removeInObjectSpy() const = 0;
1506 //-----------------------------------------------------------------------
1516 virtual void setCreateDate() = 0;
1517 //-----------------------------------------------------------------------
1531 void setSpyaction( bool bSpyaction );
1532 //-----------------------------------------------------------------------
1533
1534 public:
1535 //============== Operatoren
1536 //-----------------------------------------------------------------------
1548 BasePersistent & operator= ( const BasePersistent & rT );
1549 //-----------------------------------------------------------------------
1551
1562 bool operator== ( const BasePersistent & rT ) const;
1563 bool operator!= ( const BasePersistent & rT ) const;
1565 //-----------------------------------------------------------------------
1566 };
1567 //---------------------------------------------------------------------------
1568 #ifdef _MSC_VER
1569 /* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
1570 #pragma warning( default : 4251 )
1571 #endif
1572 //---------------------------------------------------------------------------
1573} // namespace glo
1574#endif
Header for CallBack
Abstract base class for Persistent and the generic 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 unsetWatch(TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack=0)
virtual int isPossible(bool bRead, bool bWrite, bool bDelete, EnDeepMode eDeepMode=DM_SHALLOW) const
virtual bool isAssigned() const
int getRecord(Record *&prRecord) const
virtual unsigned int forget()
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 setWatch(TdWatchNotifyMode ulWatchMode, EnDeepMode eDeepMode, CallBack *pCallBack=0)
int getAllPersAttributesSortByName(std::map< std::string, BaseRecordAttribute *, std::less< std::string > > &rRetValMap, const std::vector< unsigned long > *pClassIdVector=0) const
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 getAllPersAttributesSortByName(std::map< std::string, std::shared_ptr< BaseRecordAttribute >, std::less< std::string > > &rRetValMap, const std::vector< unsigned long > *pClassIdVector=0) const
int getPersAttribute(std::shared_ptr< BaseRecordAttribute > &rRetVal, const std::string &sName) const
virtual int unlock(EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW)
virtual int unlock(const LockSpecification &rLockSpecification)
unsigned int getLinkCount() const
virtual int setBase(Base *pBase) override
int getAllPersAttributeNamesSortByID(std::map< AttributeID, std::string > &rRetValMap, const std::vector< unsigned long > *pClassIdVector=0) const
Base * m_pBase
Definition GloBasePersistent.h:150
virtual void setCreateDate()=0
virtual int relock(EnLockMode eLockMode=LK_DELETEvWRITE, EnDeepMode eDeepMode=DM_SHALLOW)
int getAllPersAttributes(std::list< BaseRecordAttribute * > &rRetValList, const std::vector< unsigned long > *pClassIdVector=0) const
virtual void takeOverRecord(Record *pRecord)
int getRecord(std::shared_ptr< Record > &rRetVal) const
virtual int deleteInBase(EnDeepMode eDeepMode=DM_SHALLOW)
virtual void insertInObjectSpy() const =0
int getAllPersAttributesSortByID(std::map< AttributeID, BaseRecordAttribute *, std::less< AttributeID > > &rRetValMap, const std::vector< unsigned long > *pClassIdVector=0) const
virtual unsigned int remember()
virtual ~BasePersistent()
bool m_bSpyaction
Definition GloBasePersistent.h:216
virtual int lock(const LockSpecification &rLockSpecification)
int getAllPersAttributes(std::list< std::shared_ptr< BaseRecordAttribute > > &rRetValList, const std::vector< unsigned long > *pClassIdVector=0) const
void setSpyaction(bool bSpyaction)
virtual int relock(const LockSpecification &rLockSpecification)
virtual int getClassInfo(ClassInfo *&prClassInfo)
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
int getAllPersAttributeNames(std::list< std::string > &rRetValList, const std::vector< unsigned long > *pClassIdVector=0) const
int getPersAttribute(BaseRecordAttribute *&prRetVal, const std::string &sName) const
unsigned int m_uiReferenceCount
Definition GloBasePersistent.h:161
virtual unsigned long getGloClassID() const =0
virtual int store(EnDeepMode eDeepMode=DM_SHALLOW)
int getAllPersAttributesSortByID(std::map< AttributeID, std::shared_ptr< BaseRecordAttribute >, std::less< AttributeID > > &rRetValMap, const std::vector< unsigned long > *pClassIdVector=0) const
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
virtual int refresh()
Superclass for the classes that are 'connected' to a Base.
Definition GloCallBack.h:81
An object ID consists of the class ID, a database ID and the actual unique object number (all unsigne...
Definition GloObjID.h:84
Definition GloBasePersistent.h:60