Skip to content

Commit

Permalink
refactor: remove commented-out (and some debug) code of ETL/handle
Browse files Browse the repository at this point in the history
  • Loading branch information
rodolforg committed Oct 11, 2023
1 parent 87c46b0 commit 778db98
Showing 1 changed file with 0 additions and 89 deletions.
89 changes: 0 additions & 89 deletions ETL/ETL/_handle.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ class handle
typedef int size_type;

protected:
#ifdef _DEBUG
public:
#endif
value_type *obj; //!< Pointer to object

public:
Expand All @@ -154,25 +151,6 @@ class handle
//! Handle is released on deletion
~handle() { detach(); }

//! Template Assignment operator
/*! \note This class may not be necessary, and may be removed
** at some point in the future.
*/
/*
template <class U> handle<value_type> &
operator=(const handle<U> &x)
{
if(x.get()==obj)
return *this;
detach();
obj=static_cast<value_type*>(x.get());
if(obj)obj->ref();
return *this;
}
*/

//! Assignment operator
handle<value_type> &
operator=(const handle<value_type> &x)
Expand Down Expand Up @@ -213,9 +191,6 @@ class handle
#endif
}

// This will be reintroduced with a new function
//void release() { detach(); }

void reset() { detach(); }

bool empty()const { return obj==0; }
Expand Down Expand Up @@ -356,19 +331,13 @@ class rhandle : public handle<T>
typedef int count_type;
typedef int size_type;


using handle<value_type>::count;
using handle<value_type>::unique;
using handle<value_type>::operator bool;
using handle<value_type>::get;
using handle<value_type>::operator*;
using handle<value_type>::operator->;

/*
operator const handle<value_type>&()const
{ return *this; }
*/

private:
using handle<value_type>::obj;

Expand All @@ -377,8 +346,6 @@ class rhandle : public handle<T>

void add_to_rlist()
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing

assert(obj);
obj->rref();

Expand All @@ -398,7 +365,6 @@ class rhandle : public handle<T>

void del_from_rlist()
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
assert(obj);
obj->runref();

Expand Down Expand Up @@ -429,54 +395,27 @@ class rhandle : public handle<T>
//! Constructor that constructs from a pointer to new object
rhandle(pointer x):handle<T>(x)
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
if(obj)add_to_rlist();
}

rhandle(const handle<value_type> &x):handle<T>(x)
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
if(obj)add_to_rlist();
}

//! Default copy constructor
rhandle(const rhandle<value_type> &x):handle<T>(x)
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
if(obj)add_to_rlist();
}

//! Handle is released on deletion
~rhandle() { detach(); }

//! Template Assignment operator
/*! \note This class may not be necessary, and may be removed
** at some point in the future.
*/
/*
template <class U> const handle<value_type> &
operator=(const handle<U> &x)
{
if(x.get()==obj)
return *this;
detach();
obj=static_cast<value_type*>(x.get());
if(obj)
{
obj->ref();
add_to_rlist();
}
return *this;
}
*/

//! Assignment operator
rhandle<value_type> &
operator=(const rhandle<value_type> &x)
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
if(x.get()==obj)
return *this;

Expand All @@ -494,7 +433,6 @@ class rhandle : public handle<T>
rhandle<value_type>&
operator=(const handle<value_type> &x)
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
if(x.get()==obj)
return *this;

Expand All @@ -512,7 +450,6 @@ class rhandle : public handle<T>
rhandle<value_type>&
operator=(value_type* x)
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
if(x==obj)
return *this;

Expand All @@ -532,15 +469,11 @@ class rhandle : public handle<T>
void
detach()
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
if(obj)del_from_rlist();
handle<value_type>::detach();
obj = nullptr;
}

// This will be reintroduced with a new function
//void release() { detach(); }

void reset() { detach(); }

//! Creates a new instance of a T object and puts it in the handle.
Expand All @@ -551,22 +484,19 @@ class rhandle : public handle<T>
count_type
rcount()const
{
// value_type*const& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
return obj?obj->rcount():0;
}

//! Returns true if there is only one instance of the object
bool
runique()const
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
assert(obj); return obj->front_==obj->back_;
}

//! \writeme
int replace(const handle<value_type> &x)
{
// value_type*& obj(handle<T>::obj); // Required to keep gcc 3.4.2 from barfing
assert(obj);
assert(x.get()!=obj);

Expand Down Expand Up @@ -602,15 +532,6 @@ class rhandle : public handle<T>
/*! \warning not yet implemented. \writeme */
handle<value_type> &
swap(handle<value_type> &x);
/*
{
assert(0);
pointer ptr=x.obj;
x.obj=obj;
obj=ptr;
return *this;
}
*/
}; // END of template class rhandle


Expand All @@ -634,9 +555,6 @@ class loose_handle
typedef int size_type;

protected:
#ifdef _DEBUG
public:
#endif
value_type *obj; //!< Pointer to object

public:
Expand Down Expand Up @@ -696,8 +614,6 @@ class loose_handle
//! Handle release procedure
void detach() { obj=0; }

// This will be reintroduced with a new function
//void release() { detach(); }

void reset() { detach(); }

Expand All @@ -719,11 +635,6 @@ class loose_handle
operator->()const
{ assert(obj); return obj; }

//! static_cast<> overload
//template <class U>
//operator loose_handle<U>()const
//{ return loose_handle<U>(static_cast<U*>(obj)); }

//! static_cast<> overload (for consts)
operator loose_handle<const value_type>()const
{ return loose_handle<const value_type>(static_cast<const_pointer>(obj)); }
Expand Down

0 comments on commit 778db98

Please sign in to comment.