summaryrefslogtreecommitdiff
path: root/cppe/include/IceE/Handle.h
diff options
context:
space:
mode:
Diffstat (limited to 'cppe/include/IceE/Handle.h')
-rw-r--r--cppe/include/IceE/Handle.h380
1 files changed, 190 insertions, 190 deletions
diff --git a/cppe/include/IceE/Handle.h b/cppe/include/IceE/Handle.h
index f9947c09974..1f29a6290ab 100644
--- a/cppe/include/IceE/Handle.h
+++ b/cppe/include/IceE/Handle.h
@@ -29,51 +29,51 @@ public:
T* get() const
{
- return _ptr;
+ return _ptr;
}
T* operator->() const
{
- if(!_ptr)
- {
- //
- // We don't throw directly NullHandleException here to
- // keep the code size of this method to a minimun (the
- // assembly code for throwing an exception is much bigger
- // than just a function call). This maximises the chances
- // of inlining by compiler optimization.
- //
- throwNullHandleException(__FILE__, __LINE__);
- }
-
- return _ptr;
+ if(!_ptr)
+ {
+ //
+ // We don't throw directly NullHandleException here to
+ // keep the code size of this method to a minimun (the
+ // assembly code for throwing an exception is much bigger
+ // than just a function call). This maximises the chances
+ // of inlining by compiler optimization.
+ //
+ throwNullHandleException(__FILE__, __LINE__);
+ }
+
+ return _ptr;
}
T& operator*() const
{
- if(!_ptr)
- {
- //
- // We don't throw directly NullHandleException here to
- // keep the code size of this method to a minimun (the
- // assembly code for throwing an exception is much bigger
- // than just a function call). This maximises the chances
- // of inlining by compiler optimization.
- //
- throwNullHandleException(__FILE__, __LINE__);
- }
-
- return *_ptr;
+ if(!_ptr)
+ {
+ //
+ // We don't throw directly NullHandleException here to
+ // keep the code size of this method to a minimun (the
+ // assembly code for throwing an exception is much bigger
+ // than just a function call). This maximises the chances
+ // of inlining by compiler optimization.
+ //
+ throwNullHandleException(__FILE__, __LINE__);
+ }
+
+ return *_ptr;
}
operator bool() const
{
- return _ptr ? true : false;
+ return _ptr ? true : false;
}
void swap(HandleBase& other)
{
- std::swap(_ptr, other._ptr);
+ std::swap(_ptr, other._ptr);
}
T* _ptr;
@@ -96,12 +96,12 @@ inline bool operator==(const HandleBase<T>& lhs, const HandleBase<U>& rhs)
U* r = rhs.get();
if(l && r)
{
- return *l == *r;
+ return *l == *r;
}
else
{
- return !l && !r;
- }
+ return !l && !r;
+ }
}
template<typename T, typename U>
@@ -117,11 +117,11 @@ inline bool operator<(const HandleBase<T>& lhs, const HandleBase<U>& rhs)
U* r = rhs.get();
if(l && r)
{
- return *l < *r;
+ return *l < *r;
}
else
{
- return !l && r;
+ return !l && r;
}
}
@@ -150,114 +150,114 @@ public:
Handle(T* p = 0)
{
- this->_ptr = p;
+ this->_ptr = p;
- if(this->_ptr)
- {
- this->_ptr->__incRef();
- }
+ if(this->_ptr)
+ {
+ this->_ptr->__incRef();
+ }
}
template<typename Y>
Handle(const Handle<Y>& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- this->_ptr->__incRef();
- }
+ if(this->_ptr)
+ {
+ this->_ptr->__incRef();
+ }
}
Handle(const Handle& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- this->_ptr->__incRef();
- }
+ if(this->_ptr)
+ {
+ this->_ptr->__incRef();
+ }
}
~Handle()
{
- if(this->_ptr)
- {
- this->_ptr->__decRef();
- }
+ if(this->_ptr)
+ {
+ this->_ptr->__decRef();
+ }
}
Handle& operator=(T* p)
{
- if(this->_ptr != p)
- {
- if(p)
- {
- p->__incRef();
- }
-
- T* ptr = this->_ptr;
- this->_ptr = p;
-
- if(ptr)
- {
- ptr->__decRef();
- }
- }
- return *this;
+ if(this->_ptr != p)
+ {
+ if(p)
+ {
+ p->__incRef();
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = p;
+
+ if(ptr)
+ {
+ ptr->__decRef();
+ }
+ }
+ return *this;
}
template<typename Y>
Handle& operator=(const Handle<Y>& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- r._ptr->__incRef();
- }
-
- T* ptr = this->_ptr;
- this->_ptr = r._ptr;
-
- if(ptr)
- {
- ptr->__decRef();
- }
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ r._ptr->__incRef();
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = r._ptr;
+
+ if(ptr)
+ {
+ ptr->__decRef();
+ }
+ }
+ return *this;
}
Handle& operator=(const Handle& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- r._ptr->__incRef();
- }
-
- T* ptr = this->_ptr;
- this->_ptr = r._ptr;
-
- if(ptr)
- {
- ptr->__decRef();
- }
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ r._ptr->__incRef();
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = r._ptr;
+
+ if(ptr)
+ {
+ ptr->__decRef();
+ }
+ }
+ return *this;
}
template<class Y>
static Handle dynamicCast(const HandleBase<Y>& r)
{
- return Handle(dynamic_cast<T*>(r._ptr));
+ return Handle(dynamic_cast<T*>(r._ptr));
}
template<class Y>
static Handle dynamicCast(Y* p)
{
- return Handle(dynamic_cast<T*>(p));
+ return Handle(dynamic_cast<T*>(p));
}
};
@@ -284,146 +284,146 @@ public:
Handle(T* p = 0)
{
- this->_ptr = p;
+ this->_ptr = p;
- if(this->_ptr)
- {
- upCast(this->_ptr)->__incRef();
- }
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__incRef();
+ }
}
template<typename Y>
Handle(const Handle<Y>& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- upCast(this->_ptr)->__incRef();
- }
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__incRef();
+ }
}
template<typename Y>
Handle(const ::IceUtil::Handle<Y>& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- upCast(this->_ptr)->__incRef();
- }
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__incRef();
+ }
}
Handle(const Handle& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- upCast(this->_ptr)->__incRef();
- }
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__incRef();
+ }
}
~Handle()
{
- if(this->_ptr)
- {
- upCast(this->_ptr)->__decRef();
- }
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__decRef();
+ }
}
Handle& operator=(T* p)
{
- if(this->_ptr != p)
- {
- if(p)
- {
- upCast(p)->__incRef();
- }
-
- T* ptr = this->_ptr;
- this->_ptr = p;
-
- if(ptr)
- {
- upCast(ptr)->__decRef();
- }
- }
- return *this;
+ if(this->_ptr != p)
+ {
+ if(p)
+ {
+ upCast(p)->__incRef();
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = p;
+
+ if(ptr)
+ {
+ upCast(ptr)->__decRef();
+ }
+ }
+ return *this;
}
template<typename Y>
Handle& operator=(const Handle<Y>& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
upCast(r._ptr)->__incRef();
- }
+ }
- T* ptr = this->_ptr;
- this->_ptr = r._ptr;
+ T* ptr = this->_ptr;
+ this->_ptr = r._ptr;
- if(ptr)
- {
- upCast(ptr)->__decRef();
- }
- }
- return *this;
+ if(ptr)
+ {
+ upCast(ptr)->__decRef();
+ }
+ }
+ return *this;
}
template<typename Y>
Handle& operator=(const ::IceUtil::Handle<Y>& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- upCast(r._ptr)->__incRef();
- }
-
- T* ptr = this->_ptr;
- this->_ptr = r._ptr;
-
- if(ptr)
- {
- upCast(ptr)->__decRef();
- }
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ upCast(r._ptr)->__incRef();
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = r._ptr;
+
+ if(ptr)
+ {
+ upCast(ptr)->__decRef();
+ }
+ }
+ return *this;
}
Handle& operator=(const Handle& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- upCast(r._ptr)->__incRef();
- }
-
- T* ptr = this->_ptr;
- this->_ptr = r._ptr;
-
- if(ptr)
- {
- upCast(ptr)->__decRef();
- }
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ upCast(r._ptr)->__incRef();
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = r._ptr;
+
+ if(ptr)
+ {
+ upCast(ptr)->__decRef();
+ }
+ }
+ return *this;
}
template<class Y>
static Handle dynamicCast(const ::IceUtil::HandleBase<Y>& r)
{
- return Handle(dynamic_cast<T*>(r._ptr));
+ return Handle(dynamic_cast<T*>(r._ptr));
}
template<class Y>
static Handle dynamicCast(Y* p)
{
- return Handle(dynamic_cast<T*>(p));
+ return Handle(dynamic_cast<T*>(p));
}
};