summaryrefslogtreecommitdiff
path: root/include/connectivity
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-07-08 16:43:16 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-07-08 16:50:20 +0100
commit6f092beb46796b8a6cc94b5f4cbe509bf541fae2 (patch)
tree0b943867ef9d82c62e78502d0e76f7e91bb3990f /include/connectivity
parentd153301d0bb78a37ae03c1b95766cc074b72e0dd (diff)
Revert "use SimpleReferenceObject in connectivity module"
turns out to be a bit tangled wrt copy construction This reverts commit 48cc4f1b8cf06a8e56c12e659a71f72d609568cd.
Diffstat (limited to 'include/connectivity')
-rw-r--r--include/connectivity/CommonTools.hxx30
1 files changed, 25 insertions, 5 deletions
diff --git a/include/connectivity/CommonTools.hxx b/include/connectivity/CommonTools.hxx
index 4199c9c9e788..d09990531aa9 100644
--- a/include/connectivity/CommonTools.hxx
+++ b/include/connectivity/CommonTools.hxx
@@ -37,7 +37,6 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <connectivity/dbtoolsdllapi.hxx>
#include <cppuhelper/supportsservice.hxx>
-#include <salhelper/simplereferenceobject.hxx>
namespace com { namespace sun { namespace star { namespace util {
struct Date;
@@ -64,18 +63,19 @@ namespace connectivity
typedef std::map<OUString,OSQLTable,comphelper::UStringMixLess> OSQLTables;
// class ORefVector allows reference counting on a std::vector
- template< class VectorVal > class ORefVector : public salhelper::SimpleReferenceObject
+ template< class VectorVal > class ORefVector
{
std::vector< VectorVal > m_vector;
+ oslInterlockedCount m_refCount;
protected:
virtual ~ORefVector(){}
public:
typedef std::vector< VectorVal > Vector;
- ORefVector() {}
- ORefVector(size_t _st) : m_vector(_st) {}
- ORefVector(const ORefVector& _rRH) : m_vector(_rRH.m_vector)
+ ORefVector() : m_refCount(0) {}
+ ORefVector(size_t _st) : m_vector(_st) , m_refCount(0) {}
+ ORefVector(const ORefVector& _rRH) : m_vector(_rRH.m_vector),m_refCount(0)
{
}
ORefVector& operator=(const ORefVector& _rRH)
@@ -89,6 +89,26 @@ namespace connectivity
std::vector< VectorVal > & get() { return m_vector; }
std::vector< VectorVal > const & get() const { return m_vector; }
+
+ inline static void * SAL_CALL operator new( size_t nSize )
+ { return ::rtl_allocateMemory( nSize ); }
+ inline static void SAL_CALL operator delete( void * pMem )
+ { ::rtl_freeMemory( pMem ); }
+ inline static void * SAL_CALL operator new( size_t, void * pMem )
+ { return pMem; }
+ inline static void SAL_CALL operator delete( void *, void * )
+ {}
+
+ void acquire()
+ {
+ osl_atomic_increment( &m_refCount );
+ }
+ void release()
+ {
+ if (! osl_atomic_decrement( &m_refCount ))
+ delete this;
+ }
+
};
// class ORowVector incudes refcounting and initialze himself