From 05593f6e0be07fb583683a8141e8f822e94f1595 Mon Sep 17 00:00:00 2001 From: enk Date: Thu, 7 Jul 2005 12:39:16 +0000 Subject: [PATCH] Update comments --- src/SUIT/SUIT_DataOwner.cxx | 14 ++++---- src/SUIT/SUIT_DataOwner.h | 34 +++++++++++------- src/SUIT/SUIT_SmartPtr.h | 70 ++++++++++++++++++++----------------- src/SUIT/SUIT_Tools.h | 4 ++- 4 files changed, 70 insertions(+), 52 deletions(-) diff --git a/src/SUIT/SUIT_DataOwner.cxx b/src/SUIT/SUIT_DataOwner.cxx index 2726fefb9..767dd5220 100755 --- a/src/SUIT/SUIT_DataOwner.cxx +++ b/src/SUIT/SUIT_DataOwner.cxx @@ -13,21 +13,21 @@ //******************************************************************** //==================================================================== -// Constructor +//! Constructor //==================================================================== SUIT_DataOwner::SUIT_DataOwner() { } //==================================================================== -// Destructor +//! Destructor //==================================================================== SUIT_DataOwner::~SUIT_DataOwner() { } //==================================================================== -// operator== : compares two owners +//! operator== : compares two owners //==================================================================== bool operator==( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) { @@ -42,7 +42,7 @@ bool operator==( const SUIT_DataOwnerPtr& p1, const SUIT_DataOwnerPtr& p2 ) //******************************************************************** //==================================================================== -// Constructor (default) +//! Constructor (default) //==================================================================== SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList() : QValueList() @@ -50,7 +50,7 @@ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList() } //==================================================================== -// Constructor (copy) +//! Constructor (copy) //==================================================================== SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l ) : QValueList( l ) @@ -59,7 +59,7 @@ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l ) #ifndef QT_NO_STL //==================================================================== -// Constructor (from stl) +//! Constructor (from stl) //==================================================================== SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list& l ) : QValueList( l ) @@ -68,7 +68,7 @@ SUIT_DataOwnerPtrList::SUIT_DataOwnerPtrList( const std::list #endif //==================================================================== -// Appends an item to the list +//! Appends an item to the list //==================================================================== SUIT_DataOwnerPtrList::iterator SUIT_DataOwnerPtrList::append( const SUIT_DataOwnerPtr& x ) { diff --git a/src/SUIT/SUIT_DataOwner.h b/src/SUIT/SUIT_DataOwner.h index d951a37cc..b17520d4d 100755 --- a/src/SUIT/SUIT_DataOwner.h +++ b/src/SUIT/SUIT_DataOwner.h @@ -12,33 +12,43 @@ class SUIT_EXPORT SUIT_DataOwner : public RefCount { public: - SUIT_DataOwner(); - virtual ~SUIT_DataOwner(); - - virtual bool isEqual( const SUIT_DataOwner& ) const = 0; + SUIT_DataOwner();//!< constructor + virtual ~SUIT_DataOwner();//!< destructor + //! compare function + virtual bool isEqual( const SUIT_DataOwner& ) const = 0; }; +/*! \typedef SUIT_DataOwnerPtr + * Define smart pointer for SUIT_DataOwner object + */ typedef SMART(SUIT_DataOwner) SUIT_DataOwnerPtr; +/*! Comparing two SUIT_DataOwnerPtr objects.*/ bool operator==( const SUIT_DataOwnerPtr&, const SUIT_DataOwnerPtr& ); +/*! \class QValueList + * \brief For more documentation see QT documentation. + */ +/*! \class SUIT_DataOwnerPtrList + * \brief Manage list of SUIT_DataOwnerPtr. + */ class SUIT_EXPORT SUIT_DataOwnerPtrList : public QValueList { public: - SUIT_DataOwnerPtrList(); - SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l ); + SUIT_DataOwnerPtrList();//!< constructor + SUIT_DataOwnerPtrList( const SUIT_DataOwnerPtrList& l );//!< copy constructor #ifndef QT_NO_STL - SUIT_DataOwnerPtrList( const std::list& l ); + SUIT_DataOwnerPtrList( const std::list& l );//!< copy constructor for STL list #endif - iterator append ( const SUIT_DataOwnerPtr& x ); + iterator append ( const SUIT_DataOwnerPtr& x );//!< append function private: // hide this methods: only append() should be used to add items to the list - iterator prepend( const SUIT_DataOwnerPtr& x ); - iterator insert ( iterator it, const SUIT_DataOwnerPtr& x ); - void push_front ( const SUIT_DataOwnerPtr& x ); - void push_back ( const SUIT_DataOwnerPtr& x ); + iterator prepend( const SUIT_DataOwnerPtr& x );//!< hide method + iterator insert ( iterator it, const SUIT_DataOwnerPtr& x );//!< hide method + void push_front ( const SUIT_DataOwnerPtr& x );//!< hide method + void push_back ( const SUIT_DataOwnerPtr& x );//!< hide method }; #ifdef WIN32 diff --git a/src/SUIT/SUIT_SmartPtr.h b/src/SUIT/SUIT_SmartPtr.h index 38258ba05..17be2473a 100755 --- a/src/SUIT/SUIT_SmartPtr.h +++ b/src/SUIT/SUIT_SmartPtr.h @@ -3,72 +3,75 @@ #include "SUIT.h" +/*! \brief Base counter class what children using in SmartPtr class how template */ class SUIT_EXPORT RefCount { public: - // constructor + //! constructor RefCount() : crefs( 0 ) {} - // copy constructor + //! copy constructor RefCount( const RefCount& ) : crefs( 0 ) {} - // destructor + //! destructor virtual ~RefCount() {} - // operator= (does not change counter) + //! operator= (does not change counter) RefCount& operator=( const RefCount& ) { return *this; } - // increments reference counter + //! increments reference counter void upcount() { ++crefs; } - // decrements reference counter + //! decrements reference counter void downcount() { if ( crefs > 0 && --crefs == 0 ) delete this; } - // get reference counter value + //! get reference counter value int refcount() const { return crefs; } private: - unsigned long crefs; // reference counter + unsigned long crefs; //!< reference counter }; +/*! \brief Template class that provides automatic casting for hold RefCount based objects.*/ template class SmartPtr { public: - // default constructor + //! default constructor SmartPtr() : p( 0 ) {} - // constructor from any RefCount-based class + //! constructor from any RefCount-based class template SmartPtr( Y* y_ ) { p = dynamic_cast( y_ ); if ( p ) p->upcount(); } - // copy constructor from any RefCount-based class + //! copy constructor from any RefCount-based class template SmartPtr( const SmartPtr& y_ ) { p = dynamic_cast( y_.get() ); if ( p ) p->upcount(); } - // copy constructor + //! copy constructor SmartPtr( const SmartPtr& t_ ) : p( t_.p ) { if ( p ) p->upcount(); } - // destructor + //! destructor virtual ~SmartPtr(void) { if ( p ) p->downcount(); } - // getting access - //operator RefCount*() { return (RefCount*)p; } - T& operator*() const { return *p; } - T* operator->() const { return p; } - operator T*() const { return p; } - T* get() const { return p; } + // getting access + T& operator*() const { return *p; }//!< return *pointer + T* operator->() const { return p; }//!< return pointer + operator T*() const { return p; }//!< return pointer + T* get() const { return p; }//!< return pointer - // assignment + //! assignment template SmartPtr& operator=( const SmartPtr& y_ ) { if ( this == &y_) return *this; return operator=( y_.get() ); } - SmartPtr& operator=( const SmartPtr& t_ ) + //! assignment + SmartPtr& operator=( const SmartPtr& t_ ) { if ( this == &t_) return *this; return operator=( t_.get() ); } - SmartPtr& operator=( T* p_ ) + //!< assignment + SmartPtr& operator=( T* p_ ) { if ( p ) p->downcount(); @@ -79,24 +82,27 @@ public: } // comparing - int operator==( const SmartPtr& t_ ) { return p == t_.p; } - int operator==( const T* p_ ) { return p == p_; } - friend int operator==( const T* p_, const SmartPtr& t_ ) { return t_ == p_; } - int operator!=( SmartPtr& t_ ) { return p != t_.p; } - int operator!=( T* p_ ) { return p != p_; } - friend int operator!=( T* p_, SmartPtr& t_ ) { return p_ != t_.p; } + int operator==( const SmartPtr& t_ ) { return p == t_.p; }//!< comparing + int operator==( const T* p_ ) { return p == p_; }//!< comparing + friend int operator==( const T* p_, const SmartPtr& t_ ) { return t_ == p_; }//!< comparing + int operator!=( SmartPtr& t_ ) { return p != t_.p; }//!< comparing + int operator!=( T* p_ ) { return p != p_; }//!< comparing + friend int operator!=( T* p_, SmartPtr& t_ ) { return p_ != t_.p; }//!< comparing - // nullify + //! nullify void nullify() { if ( p ) p->downcount(); p = 0; } - // check for null + //! check for null bool isNull() const { return p == 0; } private: - T* p; // stored pointer + T* p;//!< stored pointer }; +/*! \def SMART( C ) + * Define macros SMART( C ) - same as SmartPtr(C), where \a C - class object. + */ #define SMART( C ) SmartPtr - +//! casting class T2 to class T1 template SMART(T1) downcast( SMART(T2)& t ) { return SMART(T1)(t.get()); diff --git a/src/SUIT/SUIT_Tools.h b/src/SUIT/SUIT_Tools.h index 0a4eb6556..cdd4287ce 100755 --- a/src/SUIT/SUIT_Tools.h +++ b/src/SUIT/SUIT_Tools.h @@ -9,7 +9,9 @@ #include #include #include - +/*! \class Qtx + * \brief For more documentation see QT documentation. + */ class SUIT_EXPORT SUIT_Tools : public Qtx { public: -- 2.39.2