GlobalObjects
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GloTransactionManager.h
Go to the documentation of this file.
1#ifndef INC_GLOTRANSACTIONMANAGER_H
2#define INC_GLOTRANSACTIONMANAGER_H
3//-----------------------------------------------------------------------------
47//-----------------------------------------------------------------------------
48#include <list>
49#include <map>
50#include <unordered_map>
51#include <memory>
52
53#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)
54 #include <basetsd.h>
55#elif defined(__GNUC__)
56 #define INT_PTR intptr_t
57#endif
58
59#include "GloTypes.h"
60#include "GloObjID.h"
61#include "GloTransactionOwner.h"
62//-----------------------------------------------------------------------------
63namespace glo
64{
65 //---------------------------------------------------------------------------
66 /* Forwards */
67 class Record;
68 class Communicator;
69 //---------------------------------------------------------------------------
70 #ifdef _MSC_VER
71 /* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
72 #pragma warning( disable : 4251 )
73 #endif
74 //---------------------------------------------------------------------------
75 // doxygen -> warning: unable to resolve reference to 'GLO_REF_DEPENDENT' for \ref command
76 // Is a reference to the GlobalObjects documentation.
77 //---------------------------------------------------------------------------
172 {
173 public:
174 //============== Enumeration
175 //-----------------------------------------------------------------------
206 //-----------------------------------------------------------------------
207
208 //-----------------------------------------------------------------------
209 // >>>>>>>>>>>>>>>>>>>>>> TransactionBase >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
210 //-----------------------------------------------------------------------
224 {
225 public:
226 //============= De- und Konstruktoren
227 //---------------------------------------------------------------------
238 //---------------------------------------------------------------------
249 //---------------------------------------------------------------------
250
251 private:
252 //---------------------------------------------------------------------
263 //---------------------------------------------------------------------
264
265 //============== Operatoren
266 //---------------------------------------------------------------------
277 //---------------------------------------------------------------------
278 };
279 //-----------------------------------------------------------------------
280 // <<<<<<<<<<<<<<<<<<<<<<<< TransactionBase <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
281 //-----------------------------------------------------------------------
282
283 //-----------------------------------------------------------------------
284 // >>>>>>>>>>>>>>>>>>>>>>> TransactionPoint >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
285 //-----------------------------------------------------------------------
299 {
300 private:
301 //============== Attribute
302 //---------------------------------------------------------------------
317 //---------------------------------------------------------------------
318
319 public:
320 //============= Konstruktoren
321 //---------------------------------------------------------------------
332 //---------------------------------------------------------------------
344 TransactionPoint( int iCount );
345 //---------------------------------------------------------------------
346
347 private:
348 //============= Konstruktor
349 //---------------------------------------------------------------------
360 //---------------------------------------------------------------------
361
362 public:
363 //============= Destruktor
364 //---------------------------------------------------------------------
375 //---------------------------------------------------------------------
376
377 //============== Methoden
378 //---------------------------------------------------------------------
390 int getCount() const;
391 //---------------------------------------------------------------------
392
393 private:
394 //============== Operatoren
395 //---------------------------------------------------------------------
406 //---------------------------------------------------------------------
407 };
408 //-----------------------------------------------------------------------
409 // <<<<<<<<<<<<<<<<<<<<< TransactionPoint <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
410 //-----------------------------------------------------------------------
411
412 //-----------------------------------------------------------------------
413 // >>>>>>>>>>>>>>>>>>>>> TransactionStep >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
414 //-----------------------------------------------------------------------
428 {
429
430 public:
431 #ifdef _DEBUG
432 //============== Static attributes
433 //-----------------------------------------------------------------------
445 static unsigned int sm_uiInstanceRecordCount;
446 //-----------------------------------------------------------------------
447 #endif // _DEBUG
448
449 private:
450 //============== Attribute
451 //---------------------------------------------------------------------
465 //---------------------------------------------------------------------
476 //---------------------------------------------------------------------
488 //---------------------------------------------------------------------
489
490 protected:
491 //============== Konstruktoren
492 //---------------------------------------------------------------------
503 //---------------------------------------------------------------------
504
505 public:
506 //============== Konstruktoren
507 //---------------------------------------------------------------------
539 Record * pActionRecord,
540 bool bLocalCopy = false );
541 //---------------------------------------------------------------------
542
543 private:
544 //============= Konstruktor
545 //---------------------------------------------------------------------
556 //---------------------------------------------------------------------
557
558 public:
559 //============= Destruktor
560 //---------------------------------------------------------------------
571 //---------------------------------------------------------------------
572
573 //============== Methoden
574 //---------------------------------------------------------------------
591 void getActionRecord( Record *& prRetVal ) const;
592 //---------------------------------------------------------------------
612 const Record * getActionRecord() const;
613 //---------------------------------------------------------------------
627 //---------------------------------------------------------------------
641 //---------------------------------------------------------------------
654 //---------------------------------------------------------------------
678 int takeOverObjIDsFilePos( const Record & rSourceRecord );
679 //---------------------------------------------------------------------
680
681 private:
682 //============== Operatoren
683 //---------------------------------------------------------------------
694 //---------------------------------------------------------------------
695 };
696 //-----------------------------------------------------------------------
697 // <<<<<<<<<<<<<<<<<<<<<<< TransactionStep <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
698 //-----------------------------------------------------------------------
699
700 //-----------------------------------------------------------------------
701 // >>>>>>>>>>>>>>>> CommunicatorTransactionStack >>>>>>>>>>>>>>>>>>>>>>>>>>
702 //-----------------------------------------------------------------------
718 {
719 private:
720 //============== Attribute
721 //---------------------------------------------------------------------
732 //---------------------------------------------------------------------
744 std::list<TransactionBase *> m_TransactionStack;
745 //---------------------------------------------------------------------
756 //---------------------------------------------------------------------
757
758 protected:
759 //============= Konstruktor
760 //---------------------------------------------------------------------
771 //---------------------------------------------------------------------
772
773 public:
774 //============= De- und Konstruktoren
775 //---------------------------------------------------------------------
791 CommunicatorTransactionStack( const TransactionOwner & rCommunicatorWithTreadID );
792 //---------------------------------------------------------------------
804 //---------------------------------------------------------------------
805
806 private:
807 //============== Copy-Konstruktor
808 //---------------------------------------------------------------------
819 //---------------------------------------------------------------------
820
821 public:
822 //============== Methoden
823 //---------------------------------------------------------------------
837 //---------------------------------------------------------------------
850 //---------------------------------------------------------------------
866 //---------------------------------------------------------------------
898 bool abortTransaction( std::list< TransactionBase * > & rAbortedTransactionStepList );
899 //---------------------------------------------------------------------
925 int setTransactionStep( NUM_PTR & nNewTrxStepAddr,
926 EnStoreDelete eAction,
927 Record * pActionRecord );
928 //---------------------------------------------------------------------
940 std::list< TransactionManager::TransactionBase * > & getTransactionStack();
941 //---------------------------------------------------------------------
942
943 private:
944 //============== Operatoren
945 //---------------------------------------------------------------------
956 //---------------------------------------------------------------------
957 };
958 //-----------------------------------------------------------------------
959 // <<<<<<<<<<<<<<<<< CommunicatorTransactionStack <<<<<<<<<<<<<<<<<<<<<<<<<
960 //-----------------------------------------------------------------------
961
962 private:
963 //============== Attribute
964 //-----------------------------------------------------------------------
977 std::map< TransactionOwner, CommunicatorTransactionStack *, std::less<TransactionOwner> > m_TransactionStackMap;
978 //-----------------------------------------------------------------------
988 std::map< TransactionOwner, CommunicatorTransactionStack * >::iterator m_TransactionStackMapIterator;
989 //-----------------------------------------------------------------------
1000 std::unordered_map< ObjID, Record *, glo::ObjID::HashFunction > m_RecursionRecordMap;
1001 //-----------------------------------------------------------------------
1002
1003 public:
1004 //============== De- und Konstruktor
1005 //-----------------------------------------------------------------------
1016 //-----------------------------------------------------------------------
1027 //-----------------------------------------------------------------------
1028
1029 private:
1030 //============== Copy-Konstruktor
1031 //-----------------------------------------------------------------------
1042 //-----------------------------------------------------------------------
1043
1044 public:
1045 //============== Methoden
1046 //-----------------------------------------------------------------------
1064 void beginTransaction( const TransactionOwner & rCommunicatorWithTreadID );
1065 //-----------------------------------------------------------------------
1097 const TransactionOwner & rCommunicatorWithTreadID );
1098 //-----------------------------------------------------------------------
1124 int abortTransaction( std::list< TransactionBase * > & rAbortedTransactionStepList,
1125 const TransactionOwner & rCommunicatorWithTreadID );
1126 //-----------------------------------------------------------------------
1155 int setTransactionStep( NUM_PTR & nNewTrxStepAddr,
1156 const TransactionOwner & rCommunicatorWithTreadID,
1157 EnStoreDelete eAction,
1158 Record * pActionRecord);
1159 //-----------------------------------------------------------------------
1202 int getActionRecord( Record *& prRetVal,
1203 EnStoreDelete & reAction,
1204 const TransactionOwner & rCommunicatorWithTreadID,
1205 const ObjID & rObjID,
1206 const std::string & rsDataPath,
1207 bool bInRecursion = false );
1208 //-----------------------------------------------------------------------
1240 int getActionRecord( std::shared_ptr < Record > & rRetVal,
1241 EnStoreDelete & reAction,
1242 const TransactionOwner & rCommunicatorWithTreadID,
1243 const ObjID & rObjID,
1244 const std::string & rsDataPath,
1245 bool bInRecursion = false );
1246 //-----------------------------------------------------------------------
1261 bool inTransaction( const TransactionOwner & rCommunicatorWithTreadID ) const;
1262 //-----------------------------------------------------------------------
1276 void deleteAllTransactions( Communicator * pCommunicator );
1277 //-----------------------------------------------------------------------
1278
1279 protected:
1280 //============== Methoden
1281 //-----------------------------------------------------------------------
1301 //-----------------------------------------------------------------------
1316 //-----------------------------------------------------------------------
1317
1318 private:
1319 //-----------------------------------------------------------------------
1330 //-----------------------------------------------------------------------
1331
1332 //============== Operatoren
1333 //-----------------------------------------------------------------------
1344 //-----------------------------------------------------------------------
1345 };
1346 //---------------------------------------------------------------------------
1347 #ifdef _MSC_VER
1348 /* 'Bezeichner': Klasse 'Typ' benötigt eine DLL-Schnittstelle, die von... */
1349 #pragma warning( default : 4251 )
1350 #endif
1351 //---------------------------------------------------------------------------
1352} // namespace glo
1353#endif
Header for ObjID
Header for TransactionOwner
For each library, here 'GlobalObjects' there is a type file.
#define __glo_export_dll
Definition GloTypes.h:70
Superclass of LocalThread, ClientThread and ServerThread, because they can act as senders and receive...
Definition GloCommunicator.h:93
An object ID consists of the class ID, a database ID and the actual unique object number (all unsigne...
Definition GloObjID.h:84
Objects of this class transport the data from the tables into the persistent object and from these ag...
Definition GloRecord.h:108
The transaction stack of a client communicator with thread-id for a database.
Definition GloTransactionManager.h:718
CommunicatorTransactionStack(const TransactionOwner &rCommunicatorWithTreadID)
int setTransactionStep(NUM_PTR &nNewTrxStepAddr, EnStoreDelete eAction, Record *pActionRecord)
TransactionOwner m_CommunicatorWithTreadID
Definition GloTransactionManager.h:731
CommunicatorTransactionStack(const CommunicatorTransactionStack &)
std::list< TransactionManager::TransactionBase * > & getTransactionStack()
std::list< TransactionBase * > m_TransactionStack
Definition GloTransactionManager.h:744
bool abortTransaction(std::list< TransactionBase * > &rAbortedTransactionStepList)
int m_iCurrentTransactionPoint
Definition GloTransactionManager.h:755
Base class for TransactionPoint and TransactionStep.
Definition GloTransactionManager.h:224
TransactionBase(const TransactionBase &)
Objects of this class reflect a transaction start.
Definition GloTransactionManager.h:299
TransactionPoint(const TransactionPoint &)
int m_iCount
Definition GloTransactionManager.h:316
Objects of this class reflect a record operation.
Definition GloTransactionManager.h:428
TransactionStep(EnStoreDelete eAction, Record *pActionRecord, bool bLocalCopy=false)
TransactionManager::EnStoreDelete m_eAction
Definition GloTransactionManager.h:487
bool m_bLocalCopyRecord
Definition GloTransactionManager.h:464
TransactionStep(const TransactionStep &)
static unsigned int sm_uiInstanceRecordCount
Definition GloTransactionManager.h:445
TransactionManager::EnStoreDelete getAction() const
int takeOverObjIDsFilePos(const Record &rSourceRecord)
void getActionRecord(Record *&prRetVal) const
Record * m_pActionRecord
Definition GloTransactionManager.h:475
const Record * getActionRecord() const
std::map< TransactionOwner, CommunicatorTransactionStack * >::iterator m_TransactionStackMapIterator
Definition GloTransactionManager.h:988
EnStoreDelete
Definition GloTransactionManager.h:186
@ eTRX_STORE
Definition GloTransactionManager.h:187
@ eTRX_DELETE
Definition GloTransactionManager.h:196
std::map< TransactionOwner, CommunicatorTransactionStack *, std::less< TransactionOwner > > m_TransactionStackMap
Definition GloTransactionManager.h:977
TransactionManager::CommunicatorTransactionStack * getTransactionStack(const TransactionOwner &rCommunicatorWithTreadID)
int getActionRecord(Record *&prRetVal, EnStoreDelete &reAction, const TransactionOwner &rCommunicatorWithTreadID, const ObjID &rObjID, const std::string &rsDataPath, bool bInRecursion=false)
void beginTransaction(const TransactionOwner &rCommunicatorWithTreadID)
int commitTransaction(CommunicatorTransactionStack *&prRetVal, const TransactionOwner &rCommunicatorWithTreadID)
int setTransactionStep(NUM_PTR &nNewTrxStepAddr, const TransactionOwner &rCommunicatorWithTreadID, EnStoreDelete eAction, Record *pActionRecord)
std::unordered_map< ObjID, Record *, glo::ObjID::HashFunction > m_RecursionRecordMap
Definition GloTransactionManager.h:1000
void removeCurrentTransactionStack()
void deleteAllTransactions(Communicator *pCommunicator)
bool inTransaction(const TransactionOwner &rCommunicatorWithTreadID) const
int writeTransactionFile(CommunicatorTransactionStack *pTransactionStack)
int getActionRecord(std::shared_ptr< Record > &rRetVal, EnStoreDelete &reAction, const TransactionOwner &rCommunicatorWithTreadID, const ObjID &rObjID, const std::string &rsDataPath, bool bInRecursion=false)
int abortTransaction(std::list< TransactionBase * > &rAbortedTransactionStepList, const TransactionOwner &rCommunicatorWithTreadID)
TransactionManager(const TransactionManager &)
In order to make transactions available not only to a glo::Communicator, but also to individual threa...
Definition GloTransactionOwner.h:81
Definition GloAbstractBaseLot.h:49