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//-----------------------------------------------------------------------------
36//-----------------------------------------------------------------------------
37#include <list>
38#include <vector>
39#include <map>
40#include "GloTypes.h"
41#include "GloCallBack.h"
42#include "GloLockSpecification.h"
43#include "GloWatchSpecification.h"
44#if defined (__PTHREADS)
45 #include <EuPCriticalSection.h>
46#else
47 #include "EuCriticalSection.h"
48#endif
49#include <ctime>
50//-----------------------------------------------------------------------------
51namespace glo
52{
53 //---------------------------------------------------------------------------
54 /* Forwards */
55 class Record;
56 class ClassInfo;
57 class AttributeID;
58 class BaseRecordAttribute;
59 //---------------------------------------------------------------------------
60 #ifdef _MSC_VER
61 /* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
62 #pragma warning( disable : 4251 )
63 #endif
64 //---------------------------------------------------------------------------
115 class __glo_export_dll BasePersistent : public CallBack
116 {
117 //============== Friends
118 //-----------------------------------------------------------------------
127 friend class PrivateBase;
128 //-----------------------------------------------------------------------
129
130 protected:
131 //============== Attribute
132 //-----------------------------------------------------------------------
142 unsigned int m_uiReferenceCount;
143 //-----------------------------------------------------------------------
157 #if defined (__PTHREADS)
158 EuPCriticalSection m_LocalCriticalSection;
159 #else
160 eut::CriticalSection m_LocalCriticalSection;
161 #endif
162 //-----------------------------------------------------------------------
174 Record * m_pRecord;
175 //-----------------------------------------------------------------------
198 //-----------------------------------------------------------------------
199
200 public:
201 //============= ctor
202 //-----------------------------------------------------------------------
213 //-----------------------------------------------------------------------
214
215 protected:
216 //============== dtor
217 //-----------------------------------------------------------------------
234 //-----------------------------------------------------------------------
235
236 public:
237 //============= Copy ctor
238 //-----------------------------------------------------------------------
252 //-----------------------------------------------------------------------
253
254 //============== Methoden
255 //-----------------------------------------------------------------------
265 virtual void removeBase();
266 //-----------------------------------------------------------------------
284 virtual int getClassInfo( ClassInfo *& prClassInfo );
285 //-----------------------------------------------------------------------
299 virtual int getTypeAsString( std::string & rsTypeName ) override;
300 //-----------------------------------------------------------------------
312 virtual std::time_t getCreateDate() const = 0;
313 //-----------------------------------------------------------------------
325 virtual std::time_t getLastChangeDate() const = 0;
326 //-----------------------------------------------------------------------
348 virtual unsigned int remember();
349 //-----------------------------------------------------------------------
373 virtual unsigned int forget();
374 //-----------------------------------------------------------------------
402 virtual int assign( Base & rBase );
403 //-----------------------------------------------------------------------
413 virtual bool isAssigned() const;
414 //-----------------------------------------------------------------------
425 unsigned int getLinkCount() const;
426 //-----------------------------------------------------------------------
436 virtual ObjID getObjID() const;
437 //-----------------------------------------------------------------------
461 int getRecord( Record *& prRecord ) const;
462 //-----------------------------------------------------------------------
476 int getRecord( std::shared_ptr<Record> & rRetVal ) const;
477 //-----------------------------------------------------------------------
495 int getAllPersAttributeNames( std::list<std::string> & rRetValList,
496 const std::vector<unsigned long> * pClassIdVector = 0 ) const;
497 //-----------------------------------------------------------------------
517 int getAllPersAttributeNamesSortByID( std::map< AttributeID, std::string> & rRetValMap,
518 const std::vector<unsigned long> * pClassIdVector = 0 ) const;
519 //-----------------------------------------------------------------------
553 int getPersAttribute( BaseRecordAttribute *& prRetVal,
554 const std::string & sName ) const;
555 //-----------------------------------------------------------------------
576 int getPersAttribute( std::shared_ptr<BaseRecordAttribute> & rRetVal,
577 const std::string & sName ) const;
578 //-----------------------------------------------------------------------
608 int getPersAttribute( BaseRecordAttribute *& prRetVal,
609 const AttributeID & rAttributeID) const;
610 //-----------------------------------------------------------------------
628 int getPersAttribute( std::shared_ptr<BaseRecordAttribute> & rRetVal,
629 const AttributeID & rAttributeID ) const;
630 //-----------------------------------------------------------------------
662 int getAllPersAttributes( std::list< BaseRecordAttribute * > & rRetValList,
663 const std::vector<unsigned long> * pClassIdVector = 0 ) const;
664 //-----------------------------------------------------------------------
684 int getAllPersAttributes( std::list< std::shared_ptr<BaseRecordAttribute> > & rRetValList,
685 const std::vector<unsigned long> * pClassIdVector = 0 ) const;
686 //-----------------------------------------------------------------------
718 int getAllPersAttributesSortByName( std::map< std::string, BaseRecordAttribute *, std::less<std::string> > & rRetValMap,
719 const std::vector<unsigned long> * pClassIdVector = 0 ) const;
720 //-----------------------------------------------------------------------
740 int getAllPersAttributesSortByName( std::map< std::string, std::shared_ptr<BaseRecordAttribute>, std::less<std::string> > & rRetValMap,
741 const std::vector<unsigned long> * pClassIdVector = 0 ) const;
742 //-----------------------------------------------------------------------
776 int getAllPersAttributesSortByID( std::map< AttributeID, BaseRecordAttribute *, std::less<AttributeID> > & rRetValMap,
777 const std::vector<unsigned long> * pClassIdVector = 0) const;
778 //-----------------------------------------------------------------------
800 int getAllPersAttributesSortByID( std::map< AttributeID, std::shared_ptr<BaseRecordAttribute>, std::less<AttributeID> > & rRetValMap,
801 const std::vector<unsigned long> * pClassIdVector = 0 ) const;
802 //-----------------------------------------------------------------------
816 virtual void takeOverRecord( Record * pRecord );
817 //-----------------------------------------------------------------------
827 virtual unsigned long getGloClassID() const =0;
828 //-----------------------------------------------------------------------
848 virtual int store( EnDeepMode eDeepMode = DM_SHALLOW );
849 //-----------------------------------------------------------------------
863 virtual bool isStored();
864 //-----------------------------------------------------------------------
880 virtual int deleteInBase( EnDeepMode eDeepMode = DM_SHALLOW );
881 //-----------------------------------------------------------------------
899 virtual bool isDeletedInBase();
900 //-----------------------------------------------------------------------
918 virtual int refresh();
919 //-----------------------------------------------------------------------
943 virtual int lock( EnLockMode eLockMode = LK_DELETEvWRITE,
944 EnDeepMode eDeepMode = DM_SHALLOW );
945 //-----------------------------------------------------------------------
970 virtual int lock( const LockSpecification & rLockSpecification );
971 //-----------------------------------------------------------------------
1005 virtual int relock( EnLockMode eLockMode = LK_DELETEvWRITE,
1006 EnDeepMode eDeepMode = DM_SHALLOW );
1007 //-----------------------------------------------------------------------
1043 virtual int relock( const LockSpecification & rLockSpecification );
1044 //-----------------------------------------------------------------------
1070 virtual int unlock( EnLockMode eLockMode = LK_DELETEvWRITE,
1071 EnDeepMode eDeepMode = DM_SHALLOW);
1072 //-----------------------------------------------------------------------
1099 virtual int unlock( const LockSpecification & rLockSpecification );
1100 //-----------------------------------------------------------------------
1101 //-----------------------------------------------------------------------
1102 // doxygen -> warning: unable to resolve reference to 'GLO_LOCKING_ASK_LOCK' for \ref command
1103 // doxygen -> warning: unable to resolve reference to 'GLO_LOCKING_OBJ' for \ref command
1104 // doxygen -> warning: unable to resolve reference to 'PAGE_GLO_WATCH_NOTIFY' for \ref command
1105 // are references to the GlobalObjects documentation.
1106 //-----------------------------------------------------------------------
1130 virtual int isLocked( EnLockMode eLockMode = LK_DELETEvWRITE,
1131 EnDeepMode eDeepMode = DM_SHALLOW ) const;
1132 //-----------------------------------------------------------------------
1153 virtual int isLocked( const LockSpecification & rLockSpecification ) const;
1154 //-----------------------------------------------------------------------
1178 virtual int isPossible( bool bRead,
1179 bool bWrite,
1180 bool bDelete,
1181 EnDeepMode eDeepMode = DM_SHALLOW ) const;
1182 //-----------------------------------------------------------------------
1202 virtual int isPossible( const LockPossibleSpecification & rLockPossibleSpec,
1203 EnDeepMode eDeepMode = DM_SHALLOW ) const;
1204 //-----------------------------------------------------------------------
1222 virtual int getProcessingPossibilities( LockPossibleSpecification & rLockPossibleSpec,
1223 EnDeepMode eDeepMode = DM_SHALLOW ) const;
1224 //-----------------------------------------------------------------------
1286 virtual int setWatch( TdWatchNotifyMode ulWatchMode,
1287 EnDeepMode eDeepMode,
1288 CallBack * pCallBack = 0 );
1289 //-----------------------------------------------------------------------
1322 virtual int setWatch( const WatchSpecification & rWatchSpec );
1323 //-----------------------------------------------------------------------
1385 virtual int unsetWatch( TdWatchNotifyMode ulWatchMode,
1386 EnDeepMode eDeepMode,
1387 CallBack * pCallBack = 0 );
1388 //-----------------------------------------------------------------------
1425 virtual int unsetWatch( const WatchSpecification & rWatchSpec );
1426 //-----------------------------------------------------------------------
1427
1428 protected:
1429 //============== Methoden
1430 //-----------------------------------------------------------------------
1442 virtual void insertInObjectSpy() const = 0;
1443 //-----------------------------------------------------------------------
1455 virtual void removeInObjectSpy() const = 0;
1456 //-----------------------------------------------------------------------
1466 virtual void setCreateDate() = 0;
1467 //-----------------------------------------------------------------------
1481 void setSpyaction( bool bSpyaction );
1482 //-----------------------------------------------------------------------
1483
1484 public:
1485 //============== Operatoren
1486 //-----------------------------------------------------------------------
1498 BasePersistent & operator= ( const BasePersistent & rT );
1499 //-----------------------------------------------------------------------
1501
1512 bool operator== ( const BasePersistent & rT ) const;
1513 bool operator!= ( const BasePersistent & rT ) const;
1515 //-----------------------------------------------------------------------
1516 };
1517 //---------------------------------------------------------------------------
1518 #ifdef _MSC_VER
1519 /* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
1520 #pragma warning( default : 4251 )
1521 #endif
1522 //---------------------------------------------------------------------------
1523} // namespace glo
1524#endif
Header for CallBack
Abstract base class for Persistent and the generic GenericPersistent.
Definition GloBasePersistent.h:116
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()
eut::CriticalSection m_LocalCriticalSection
Definition GloBasePersistent.h:160
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
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
int getAllPersAttributeNamesSortByID(std::map< AttributeID, std::string > &rRetValMap, const std::vector< unsigned long > *pClassIdVector=0) const
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:197
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)
BasePersistent(const BasePersistent &)
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:142
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:174
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:74
An object ID consists of the class ID, a database ID and the actual unique object number (all unsigne...
Definition GloObjID.h:77
Definition GloBasePersistent.h:52