Update of /cvsroot/cppunit/cppunit2/include/cpptl
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29225/include/cpptl
Modified Files:
intrusiveptr.h
Added Files:
cpptl_autolink.h
Log Message:
* rough sketch of a working OpenTest driver with CppUT adaptor for TestRunner.
--- NEW FILE: cpptl_autolink.h ---
#ifndef CPPTL_AUTOLINK_H_INCLUDED
# define CPPTL_AUTOLINK_H_INCLUDED
# if !defined(CPPTL_NO_AUTOLINK) && !defined(CPPTL_DLL_BUILD)
# define CPPTL_AUTOLINK_NAME "cpptl"
# undef CPPTL_AUTOLINK_DLL
# ifdef CPPTL_DLL
# define CPPTL_AUTOLINK_DLL
# endif
# include "autolink.h"
# endif
#endif // CPPTL_AUTOLINK_H_INCLUDED
Index: intrusiveptr.h
===================================================================
RCS file: /cvsroot/cppunit/cppunit2/include/cpptl/intrusiveptr.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** intrusiveptr.h 13 Nov 2005 11:00:41 -0000 1.3
--- intrusiveptr.h 11 Dec 2005 17:16:08 -0000 1.4
***************
*** 135,138 ****
--- 135,168 ----
}
+ bool operator ==( const ThisType &other ) const
+ {
+ return p_ == other.p_;
+ }
+
+ bool operator !=( const ThisType &other ) const
+ {
+ return !(*this == other );
+ }
+
+ bool operator <( const ThisType &other ) const
+ {
+ return p_ < other.p_;
+ }
+
+ bool operator <=( const ThisType &other ) const
+ {
+ return p_ <= other.p_;
+ }
+
+ bool operator >=( const ThisType &other ) const
+ {
+ return p_ >= other.p_;
+ }
+
+ bool operator >( const ThisType &other ) const
+ {
+ return p_ > other.p_;
+ }
+
private:
PointeeType *p_;
***************
*** 207,210 ****
--- 237,324 ----
+ namespace CppTL {
+
+ template<class DataType>
+ class SharedDataPtr
+ {
+ public:
+ typedef SharedDataPtr<DataType> ThisType;
+ typedef DataType Data;
+
+ SharedDataPtr()
+ {
+ }
+
+ SharedDataPtr( const Data &data )
+ : shared_( new CountedData( data ) )
+ {
+ }
+
+ SharedDataPtr( const ThisType &other )
+ : shared_( other.shared_ )
+ {
+ }
+
+ ~SharedDataPtr()
+ {
+ }
+
+ Data *get() const
+ {
+ CountedData *data = shared_.get();
+ return data ? &(data->data_) : 0;
+ }
+
+ void swap( ThisType &other )
+ {
+ shared_.swap( other.shared_ );
+ }
+
+ ThisType &operator =( const ThisType &other )
+ {
+ ThisType tmp( other );
+ swap( tmp );
+ return *this;
+ }
+
+ DataType &operator *() const
+ {
+ // assert( p_ != 0 )
+ return shared_->data_;
+ }
+
+ DataType *operator ->() const
+ {
+ return &(shared_->data_);
+ }
+
+ operator bool() const
+ {
+ return shared_;
+ }
+
+ bool operator !() const
+ {
+ return !shared_;
+ }
+
+ private:
+ class CountedData : public IntrusiveCount
+ {
+ public:
+ CountedData( const Data &data )
+ : data_( data )
+ {
+ }
+
+ Data data_;
+ };
+
+ IntrusivePtr<CountedData> shared_;
+ };
+
+
+ } // namespace CppTL
+
#endif // CPPTL_INTRUSIVEPTR_H_INCLUDED
|