GlobalObjects
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"
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 //---------------------------------------------------------------------------
102 {
103 //============== Friends
104 //-----------------------------------------------------------------------
113 friend class PrivateBase;
114 //-----------------------------------------------------------------------
115
116 protected:
117 //============== Attribute
118 //-----------------------------------------------------------------------
128 unsigned int m_uiReferenceCount;
129 //-----------------------------------------------------------------------
143 #if defined (__PTHREADS)
144 EuPCriticalSection m_LocalCriticalSection;
145 #else
147 #endif
148 //-----------------------------------------------------------------------
161 //-----------------------------------------------------------------------
184 //-----------------------------------------------------------------------
185
186 public:
187 //============= ctor
188 //-----------------------------------------------------------------------
199 //-----------------------------------------------------------------------
200
201 protected:
202 //============== dtor
203 //-----------------------------------------------------------------------
220 //-----------------------------------------------------------------------
221
222 public:
223 //============= Copy ctor
224 //-----------------------------------------------------------------------
238 //-----------------------------------------------------------------------
239
240 //============== Methoden
241 //-----------------------------------------------------------------------
251 virtual void removeBase();
252 //-----------------------------------------------------------------------
270 virtual int getClassInfo( ClassInfo *& prClassInfo );
271 //-----------------------------------------------------------------------
285 virtual int getTypeAsString( std::string & rsTypeName ) override;
286 //-----------------------------------------------------------------------
298 virtual std::time_t getCreateDate() const = 0;
299 //-----------------------------------------------------------------------
311 virtual std::time_t getLastChangeDate() const = 0;
312 //-----------------------------------------------------------------------
334 virtual unsigned int remember();
335 //-----------------------------------------------------------------------
359 virtual unsigned int forget();
360 //-----------------------------------------------------------------------
378 virtual void activate();
379 //-----------------------------------------------------------------------
407 virtual int assign( Base & rBase );
408 //-----------------------------------------------------------------------
418 virtual bool isAssigned() const;
419 //-----------------------------------------------------------------------
430 unsigned int getLinkCount() const;
431 //-----------------------------------------------------------------------
441 virtual ObjID getObjID() const;
442 //-----------------------------------------------------------------------
466 int getRecord( Record *& prRecord ) const;
467 //-----------------------------------------------------------------------
481 int getRecord( std::shared_ptr<Record> & rRetVal ) const;
482 //-----------------------------------------------------------------------
500 int getAllPersAttributeNames( std::list<std::string> & rRetValList,
501 const std::vector<unsigned long> * pClassIdVector = 0 ) const;
502 //-----------------------------------------------------------------------
522 int getAllPersAttributeNamesSortByID( std::map< AttributeID, std::string> & rRetValMap,
523 const std::vector<unsigned long> * pClassIdVector = 0 ) const;
524 //-----------------------------------------------------------------------
559 const std::string & sName ) const;
560 //-----------------------------------------------------------------------
581 int getPersAttribute( std::shared_ptr<BaseRecordAttribute> & rRetVal,
582 const std::string & sName ) const;
583 //-----------------------------------------------------------------------
614 const AttributeID & rAttributeID) const;
615 //-----------------------------------------------------------------------
633 int getPersAttribute( std::shared_ptr<BaseRecordAttribute> & rRetVal,
634 const AttributeID & rAttributeID ) const;
635 //-----------------------------------------------------------------------
667 int getAllPersAttributes( std::list< BaseRecordAttribute * > & rRetValList,
668 const std::vector<unsigned long> * pClassIdVector = 0 ) const;
669 //-----------------------------------------------------------------------
689 int getAllPersAttributes( std::list< std::shared_ptr<BaseRecordAttribute> > & rRetValList,
690 const std::vector<unsigned long> * pClassIdVector = 0 ) const;
691 //-----------------------------------------------------------------------
723 int getAllPersAttributesSortByName( std::map< std::string, BaseRecordAttribute *, std::less<std::string> > & rRetValMap,
724 const std::vector<unsigned long> * pClassIdVector = 0 ) const;
725 //-----------------------------------------------------------------------
745 int getAllPersAttributesSortByName( std::map< std::string, std::shared_ptr<BaseRecordAttribute>, std::less<std::string> > & rRetValMap,
746 const std::vector<unsigned long> * pClassIdVector = 0 ) const;
747 //-----------------------------------------------------------------------
781 int getAllPersAttributesSortByID( std::map< AttributeID, BaseRecordAttribute *, std::less<AttributeID> > & rRetValMap,
782 const std::vector<unsigned long> * pClassIdVector = 0) const;
783 //-----------------------------------------------------------------------
805 int getAllPersAttributesSortByID( std::map< AttributeID, std::shared_ptr<BaseRecordAttribute>, std::less<AttributeID> > & rRetValMap,
806 const std::vector<unsigned long> * pClassIdVector = 0 ) const;
807 //-----------------------------------------------------------------------
821 virtual void takeOverRecord( Record * pRecord );
822 //-----------------------------------------------------------------------
832 virtual unsigned long getGloClassID() const =0;
833 //-----------------------------------------------------------------------
853 virtual int store( EnDeepMode eDeepMode = DM_SHALLOW );
854 //-----------------------------------------------------------------------
868 virtual bool isStored();
869 //-----------------------------------------------------------------------
885 virtual int deleteInBase( EnDeepMode eDeepMode = DM_SHALLOW );
886 //-----------------------------------------------------------------------
904 virtual bool isDeletedInBase();
905 //-----------------------------------------------------------------------
923 virtual int refresh();
924 //-----------------------------------------------------------------------
948 virtual int lock( EnLockMode eLockMode = LK_DELETEvWRITE,
949 EnDeepMode eDeepMode = DM_SHALLOW );
950 //-----------------------------------------------------------------------
975 virtual int lock( const LockSpecification & rLockSpecification );
976 //-----------------------------------------------------------------------
1002 virtual int unlock( EnLockMode eLockMode = LK_DELETEvWRITE,
1003 EnDeepMode eDeepMode = DM_SHALLOW);
1004 //-----------------------------------------------------------------------
1031 virtual int unlock( const LockSpecification & rLockSpecification );
1032 //-----------------------------------------------------------------------
1033 //-----------------------------------------------------------------------
1034 // doxygen -> warning: unable to resolve reference to 'GLO_LOCKING_ASK_LOCK' for \ref command
1035 // doxygen -> warning: unable to resolve reference to 'GLO_LOCKING_OBJ' for \ref command
1036 // doxygen -> warning: unable to resolve reference to 'PAGE_GLO_WATCH_NOTIFY' for \ref command
1037 // are references to the GlobalObjects documentation.
1038 //-----------------------------------------------------------------------
1060 virtual int isLocked( EnLockMode eLockMode = LK_DELETEvWRITE,
1061 EnDeepMode eDeepMode = DM_SHALLOW ) const;
1062 //-----------------------------------------------------------------------
1082 virtual int isLocked( const LockSpecification & rLockSpecification ) const;
1083 //-----------------------------------------------------------------------
1107 virtual int isPossible( bool bRead,
1108 bool bWrite,
1109 bool bDelete,
1110 EnDeepMode eDeepMode = DM_SHALLOW ) const;
1111 //-----------------------------------------------------------------------
1131 virtual int isPossible( const LockPossibleSpecification & rLockPossibleSpec,
1132 EnDeepMode eDeepMode = DM_SHALLOW ) const;
1133 //-----------------------------------------------------------------------
1152 EnDeepMode eDeepMode = DM_SHALLOW ) const;
1153 //-----------------------------------------------------------------------
1209 virtual int setWatch( TdWatchNotifyMode ulWatchMode,
1210 EnDeepMode eDeepMode,
1211 CallBack * pCallBack = 0 );
1212 //-----------------------------------------------------------------------
1245 virtual int setWatch( const WatchSpecification & rWatchSpec );
1246 //-----------------------------------------------------------------------
1302 virtual int unsetWatch( TdWatchNotifyMode ulWatchMode,
1303 EnDeepMode eDeepMode,
1304 CallBack * pCallBack = 0 );
1305 //-----------------------------------------------------------------------
1342 virtual int unsetWatch( const WatchSpecification & rWatchSpec );
1343 //-----------------------------------------------------------------------
1344
1345 protected:
1346 //============== Methoden
1347 //-----------------------------------------------------------------------
1359 virtual void insertInObjectSpy() const = 0;
1360 //-----------------------------------------------------------------------
1372 virtual void removeInObjectSpy() const = 0;
1373 //-----------------------------------------------------------------------
1383 virtual void setCreateDate() = 0;
1384 //-----------------------------------------------------------------------
1398 void setSpyaction( bool bSpyaction );
1399 //-----------------------------------------------------------------------
1400
1401 public:
1402 //============== Operatoren
1403 //-----------------------------------------------------------------------
1415 BasePersistent & operator= ( const BasePersistent & rT );
1416 //-----------------------------------------------------------------------
1418
1429 bool operator== ( const BasePersistent & rT ) const;
1430 bool operator!= ( const BasePersistent & rT ) const;
1432 //-----------------------------------------------------------------------
1433 };
1434 //---------------------------------------------------------------------------
1435 #ifdef _MSC_VER
1436 /* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
1437 #pragma warning( default : 4251 )
1438 #endif
1439 //---------------------------------------------------------------------------
1440} // namespace glo
1441#endif
Header for CriticalSection
Header for EuPCriticalSection
Header for CallBack
Header for LockSpecification
For each library, here 'GlobalObjects' there is a type file.
#define __glo_export_dll
Definition GloTypes.h:63
Header for WatchSpecification
Is a mutex which can be queried via its lock mode. See isLocked().
Definition EuPCriticalSection.h:89
Is a mutex which can be queried via its lock mode. See isLocked().
Definition EuCriticalSection.h:94
This class reflects a unique ID of a class information attribute.
Definition GloAttributeID.h:74
This class is the interface to the persistent objects. Here "objects" can be registered,...
Definition GloBase.h:250
Abstract base class for Persistent and the generic GenericPersistent.
Definition GloBasePersistent.h:102
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:146
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
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:183
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 getClassInfo(ClassInfo *&prClassInfo)
virtual bool isStored()
virtual std::time_t getCreateDate() const =0
virtual void activate()
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:128
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:160
int getPersAttribute(BaseRecordAttribute *&prRetVal, const AttributeID &rAttributeID) const
virtual int setWatch(const WatchSpecification &rWatchSpec)
virtual ObjID getObjID() const
virtual int refresh()
Base class for the individual attributes of a Record.
Definition GloBaseRecordAttribute.h:109
Superclass for the classes that are 'connected' to a Base.
Definition GloCallBack.h:74
This class contains all information to store objects of a class in a database, to build objects from ...
Definition GloClassInfo.h:79
To be able to lock objects, the 'lock mode' and the 'lock depth' are required as parameters....
Definition GloLockSpecification.h:58
An object ID consists of the class ID, a database ID and the actual unique object number (all unsigne...
Definition GloObjID.h:77
In this class functions for Base are encapsulated. The Base interface is not affected by any changes ...
Definition GloPrivateBase.h:92
Objects of this class transport the data from the tables into the persistent object and from these ag...
Definition GloRecord.h:101
To be able to watch objects, the 'watching mode', the 'watching depth' and the 'notification object' ...
Definition GloWatchSpecification.h:60
Definition GloAbstractBaseLot.h:42
EnDeepMode
Definition GloTypes.h:247
EnLockMode
Definition GloTypes.h:1070
unsigned long TdWatchNotifyMode
Definition GloTypes.h:543
Permitted actions in the database such as read, write and delete can be queried for an object....
Definition GloTypes.h:1271