diff options
author | Bernard Normier <bernard@zeroc.com> | 2003-09-16 01:41:46 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2003-09-16 01:41:46 +0000 |
commit | 83cb29a8de333646c9b3e7ac6909accce72e6b5f (patch) | |
tree | cc1037886e0d1770d9c1ad412d79c81a5a1d21ad /cpp/src/Freeze/ConnectionI.h | |
parent | flex fixes (diff) | |
download | ice-83cb29a8de333646c9b3e7ac6909accce72e6b5f.tar.bz2 ice-83cb29a8de333646c9b3e7ac6909accce72e6b5f.tar.xz ice-83cb29a8de333646c9b3e7ac6909accce72e6b5f.zip |
Added Freeze Connection and Transaction
Diffstat (limited to 'cpp/src/Freeze/ConnectionI.h')
-rw-r--r-- | cpp/src/Freeze/ConnectionI.h | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/cpp/src/Freeze/ConnectionI.h b/cpp/src/Freeze/ConnectionI.h new file mode 100644 index 00000000000..fddadd33858 --- /dev/null +++ b/cpp/src/Freeze/ConnectionI.h @@ -0,0 +1,139 @@ +// ********************************************************************** +// +// Copyright (c) 2003 +// ZeroC, Inc. +// Billerica, MA, USA +// +// All Rights Reserved. +// +// Ice is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License version 2 as published by +// the Free Software Foundation. +// +// ********************************************************************** + +#ifndef FREEZE_CONNECTIONI_H +#define FREEZE_CONNECTIONI_H + +#include <Freeze/Connection.h> +#include <Freeze/Initialize.h> +#include <Freeze/TransactionI.h> +#include <Freeze/SharedDbEnv.h> +#include <list> + +namespace Freeze +{ + +class DBMapHelperI; + +class ConnectionI : public Connection +{ +public: + + virtual TransactionPtr + beginTransaction(); + + virtual TransactionPtr + currentTransaction() const; + + virtual void + close(); + + virtual Ice::CommunicatorPtr + getCommunicator() const; + + virtual std::string + getName() const; + + virtual ~ConnectionI(); + + ConnectionI(const Ice::CommunicatorPtr& communicator, + const std::string& envName); + + ConnectionI(const Ice::CommunicatorPtr& communicator, + DbEnv& dbEnv); + + void + closeAllIterators(); + + void + registerMap(DBMapHelperI*); + + void + unregisterMap(DBMapHelperI*); + + void + clearTransaction(); + + DbTxn* + dbTxn() const; + + DbEnv* + dbEnv() const; + + const Ice::CommunicatorPtr& + communicator() const; + + const std::string& + envName() const; + + int + trace() const; + +private: + + Ice::CommunicatorPtr _communicator; + SharedDbEnvPtr _dbEnvHolder; + DbEnv* _dbEnv; + std::string _envName; + TransactionIPtr _transaction; + std::list<DBMapHelperI*> _mapList; + int _trace; +}; + +inline void +ConnectionI::clearTransaction() +{ + _transaction = 0; +} + +inline DbTxn* +ConnectionI::dbTxn() const +{ + if(_transaction == 0) + { + return 0; + } + else + { + return _transaction->dbTxn(); + } +} + +inline DbEnv* +ConnectionI::dbEnv() const +{ + return _dbEnv; +} + +inline const std::string& +ConnectionI::envName() const +{ + return _envName; +} + +inline const Ice::CommunicatorPtr& +ConnectionI::communicator() const +{ + return _communicator; +} + +inline int +ConnectionI::trace() const +{ + return _trace; +} + +} + +#endif |