more doxygen documentation, modules added

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@348 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
syntheticpp 2005-11-03 12:43:55 +00:00
parent 76309d2b5c
commit 7b4424b3fd
7 changed files with 311 additions and 193 deletions

View file

@ -28,13 +28,16 @@
//unreachable code if OnUnknownType throws an exception
#endif
/// \defgroup FactoryGroup Factory
namespace Loki
{
////////////////////////////////////////////////////////////////////////////////
// class template DefaultFactoryError
// Manages the "Unknown Type" error in an object factory
/// \class DefaultFactoryError
///
/// \ingroup FactoryGroup
/// Manages the "Unknown Type" error in an object factory
////////////////////////////////////////////////////////////////////////////////
template <typename IdentifierType, class AbstractProduct>
@ -55,48 +58,6 @@ namespace Loki
#define LOKI_ENABLE_NEW_FACTORY_CODE
#ifdef LOKI_ENABLE_NEW_FACTORY_CODE
////////////////////////////////////////////////////////////////////////////////
/*
class template Factory
Implements a generic object factory
cretae functions with up to 15 parameters
template
<
class AbstractProduct,
typename IdentifierType,
typename CreatorParmTList = NullType,
template<typename, class> class FactoryErrorPolicy = ExceptionFactoryError
>
class Factory : public FactoryErrorPolicy<IdentifierType, AbstractProduct>
{
public:
typedef Functor<AbstractProduct*, CreatorParmTList> ProductCreator;
typedef FactoryImpl< AbstractProduct, IdentifierType, CreatorParmTList > Impl;
typedef typename Impl::Parm1Parm1;
// ... up to 15 Parameters
typedef typename IdToProductMap::iterator iterator;
iterator begin();
iterator end();
bool Register(const IdentifierType& id, ProductCreator creator);
bool Unregister(const IdentifierType& id);
template <class PtrObj, typename CreaFn>
bool Register(const IdentifierType& id, const PtrObj& p, CreaFn fn);
AbstractProduct* CreateObject(const IdentifierType& id);
AbstractProduct* CreateObject(const IdentifierType& id, Parm1 p1);
// ... up to 15 Parameters
};
*/
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// class template FunctorImpl
@ -688,9 +649,47 @@ template <typename AP, typename Id, typename P1 >
////////////////////////////////////////////////////////////////////////////////
// class template Factory
/// \class Factory
///
/// \ingroup FactoryGroup
/// Implements a generic object factory.
///
/// Create functions can have up to 15 parameters.
///
/// \code
/// template
/// <
/// class AbstractProduct,
/// typename IdentifierType,
/// typename CreatorParmTList = NullType,
/// template<typename, class> class FactoryErrorPolicy = ExceptionFactoryError
/// >
/// class Factory : public FactoryErrorPolicy<IdentifierType, AbstractProduct>
/// {
///
/// public:
/// typedef Functor<AbstractProduct*, CreatorParmTList> ProductCreator;
/// typedef FactoryImpl< AbstractProduct, IdentifierType, CreatorParmTList > Impl;
///
/// typedef typename Impl::Parm1Parm1;
/// // ... up to 15 Parameters
///
/// typedef typename IdToProductMap::iterator iterator;
/// iterator begin();
/// iterator end();
///
/// bool Register(const IdentifierType& id, ProductCreator creator);
/// bool Unregister(const IdentifierType& id);
///
/// template <class PtrObj, typename CreaFn>
/// bool Register(const IdentifierType& id, const PtrObj& p, CreaFn fn);
///
/// AbstractProduct* CreateObject(const IdentifierType& id);
/// AbstractProduct* CreateObject(const IdentifierType& id, Parm1 p1);
/// // ... up to 15 Parameters
/// };
/// \endcode
////////////////////////////////////////////////////////////////////////////////
template
<
class AbstractProduct,
@ -972,8 +971,10 @@ template <typename AP, typename Id, typename P1 >
#endif //#define ENABLE_NEW_FACTORY_CODE
////////////////////////////////////////////////////////////////////////////////
// class template CloneFactory
// Implements a generic cloning factory
/// \class CloneFactory
///
/// \ingroup FactoryGroup
/// Implements a generic cloning factory
////////////////////////////////////////////////////////////////////////////////
template
@ -1036,6 +1037,9 @@ template <typename AP, typename Id, typename P1 >
#endif // FACTORY_INC_
// $Log$
// Revision 1.10 2005/11/03 12:43:35 syntheticpp
// more doxygen documentation, modules added
//
// Revision 1.9 2005/10/30 14:03:23 syntheticpp
// replace tabs space
//

View file

@ -18,16 +18,19 @@
namespace Loki
{
////////////////////////////////////////////////////////////////////////////////
/// \struct Function
///
/// \ingroup FunctorGroup
/// Allows a boost/TR1 like usage of Functor.
///
/// e.g. Functor<int,LOKI_TYPELIST_2(int,int)> becomes Function<int(int,int)>
////////////////////////////////////////////////////////////////////////////////
template<class R = void()>
struct Function : public Functor<R>
{
};
struct Function : public Functor<R>
{
};
////////////////////////////////////////////////////////////////////////////////
// Function allows a boost/TR1 like usage of Functor.
//
// e.g. Functor<int,LOKI_TYPELIST_2(int,int)> becomes Function<int(int,int)>
////////////////////////////////////////////////////////////////////////////////
template<class R>
struct Function<R()> : public Functor<R>
@ -42,7 +45,7 @@ namespace Loki
FBase::operator=(func);
}
// emptiness
// test on emptiness
template<class R2>
Function(Function<R2()> func) : FBase()
{

View file

@ -26,6 +26,8 @@
#include <typeinfo>
#include <memory>
/// \defgroup FunctorGroup Function objects
namespace Loki
{
////////////////////////////////////////////////////////////////////////////////
@ -1127,8 +1129,10 @@ namespace Loki
#endif
////////////////////////////////////////////////////////////////////////////////
// class template Functor
// A generalized functor implementation with value semantics
/// \class Functor
///
/// \ingroup FunctorGroup
/// A generalized functor implementation with value semantics
////////////////////////////////////////////////////////////////////////////////
template <typename R = void, class TList = NullType,
template<class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL>
@ -1340,8 +1344,10 @@ namespace Loki
}
////////////////////////////////////////////////////////////////////////////////
// class template BinderFirst
// Binds the first parameter of a Functor object to a specific value
/// \class BinderFirst
///
/// \ingroup FunctorGroup
/// Binds the first parameter of a Functor object to a specific value
////////////////////////////////////////////////////////////////////////////////
template <class OriginalFunctor>
@ -1444,8 +1450,8 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// function template BindFirst
// Binds the first parameter of a Functor object to a specific value
/// Binds the first parameter of a Functor object to a specific value
/// \ingroup FunctorGroup
////////////////////////////////////////////////////////////////////////////////
template <class Fctor>
@ -1462,8 +1468,10 @@ namespace Loki
}
////////////////////////////////////////////////////////////////////////////////
// class template Chainer
// Chains two functor calls one after another
/// \class Chainer
///
/// \ingroup FunctorGroup
/// Chains two functor calls one after another
////////////////////////////////////////////////////////////////////////////////
template <typename Fun1, typename Fun2>
@ -1594,8 +1602,8 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// function template Chain
// Chains two functor calls one after another
/// Chains two functor calls one after another
/// \ingroup FunctorGroup
////////////////////////////////////////////////////////////////////////////////

View file

@ -300,7 +300,7 @@ namespace Loki
#endif
////////////////////////////////////////////////////////////////////////////////
/// Copyright (c) 2004 by Curtis Krauskopf - curtis\decompile.com
/// Copyright (c) 2004 by Curtis Krauskopf - curtis@decompile.com
///
/// \struct DeletableSingleton
///
@ -463,25 +463,22 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
/// \struct FollowIntoDeath
/// \class FollowIntoDeath
///
/// \ingroup LifetimeGroup
///
/// Lifetime policyfor the SingletonHolder tempalte.
/// Followers will die after the master dies Followers will not die, if
/// - master never dies (NoDestroy policy)
/// - master never created
/// - master dies not in the function registered with atexit
/// - master dies not by a call of a the atexit registerd function (DeletableSingleton::GreathFullDeath)
/// - master never dies (NoDestroy policy)
/// - master never created
/// - master dies not in the function registered with atexit
/// - master dies not by a call of a the atexit registerd function (DeletableSingleton::GreathFullDeath)
///
/// \par Usage:
///
/// Lifetime of the master singleton, e.g. with a M class:
/// SingletonHolder<M,FollowIntoDeath::With<DefaultLifetime>::AsMasterLifetime> MasterSingleton;
///
/// Lifetime of the follower singleton, e.g. with a F class:
///
/// SingletonHolder<F,CreateUsingNew,FollowIntoDeath::AfterMaster<MasterSingleton>::IsDestroyed>FollowerSingleton
/// Lifetimes of the master and the follower singletons, e.g. with a M and a F class:
/// \code SingletonHolder< M , FollowIntoDeath::With<DefaultLifetime>::AsMasterLifetime > MasterSingleton; \endcode
/// \code SingletonHolder< F , CreateUsingNew, FollowIntoDeath::AfterMaster< MasterSingleton >::IsDestroyed > FollowerSingleton \endcode
////////////////////////////////////////////////////////////////////////////////
class FollowIntoDeath
{

View file

@ -16,13 +16,16 @@
#ifndef LOKI_SMARTPTR_INC_
#define LOKI_SMARTPTR_INC_
////////////////////////////////////////////////////////////////////////////////
// IMPORTANT NOTE
// Due to threading issues, the OwnershipPolicy has been changed as follows:
// Release() returns a boolean saying if that was the last release
// so the pointer can be deleted by the StoragePolicy
// IsUnique() was removed
////////////////////////////////////////////////////////////////////////////////
/// \defgroup SmartPointerGroup Smart pointers
/// Policy based implementation of a smart pointer
/// \defgroup SmartPointerOwnershipGroup Ownership policies
/// \ingroup SmartPointerGroup
/// \defgroup SmartPointerStorageGroup Storage policies
/// \ingroup SmartPointerGroup
/// \defgroup SmartPointerConversionGroup Conversion policies
/// \ingroup SmartPointerGroup
/// \defgroup SmartPointerCheckingGroup Checking policies
/// \ingroup SmartPointerGroup
#include "SmallObj.h"
@ -36,8 +39,10 @@ namespace Loki
{
////////////////////////////////////////////////////////////////////////////////
// class template DefaultSPStorage
// Implementation of the StoragePolicy used by SmartPtr
/// \class DefaultSPStorage
///
/// \ingroup SmartPointerStorageGroup
/// Implementation of the StoragePolicy used by SmartPtr
////////////////////////////////////////////////////////////////////////////////
template <class T>
@ -95,9 +100,11 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// class template RefCounted
// Implementation of the OwnershipPolicy used by SmartPtr
// Provides a classic external reference counting implementation
/// \class RefCounted
///
/// \ingroup SmartPointerOwnershipGroup
/// Implementation of the OwnershipPolicy used by SmartPtr
/// Provides a classic external reference counting implementation
////////////////////////////////////////////////////////////////////////////////
template <class P>
@ -149,10 +156,12 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// class template RefCountedMT
// Implementation of the OwnershipPolicy used by SmartPtr
// Implements external reference counting for multithreaded programs
// Policy Usage: RefCountedMTAdj<ThreadingModel>::RefCountedMT
/// \struct RefCountedMT
///
/// \ingroup SmartPointerOwnershipGroup
/// Implementation of the OwnershipPolicy used by SmartPtr
/// Implements external reference counting for multithreaded programs
/// Policy Usage: RefCountedMTAdj<ThreadingModel>::RefCountedMT
////////////////////////////////////////////////////////////////////////////////
template <template <class> class ThreadingModel>
@ -216,9 +225,11 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// class template COMRefCounted
// Implementation of the OwnershipPolicy used by SmartPtr
// Adapts COM intrusive reference counting to OwnershipPolicy-specific syntax
/// \class COMRefCounted
///
/// \ingroup SmartPointerOwnershipGroup
/// Implementation of the OwnershipPolicy used by SmartPtr
/// Adapts COM intrusive reference counting to OwnershipPolicy-specific syntax
////////////////////////////////////////////////////////////////////////////////
template <class P>
@ -253,10 +264,12 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// class template DeepCopy
// Implementation of the OwnershipPolicy used by SmartPtr
// Implements deep copy semantics, assumes existence of a Clone() member
// function of the pointee type
/// \struct DeepCopy
///
/// \ingroup SmartPointerOwnershipGroup
/// Implementation of the OwnershipPolicy used by SmartPtr
/// Implements deep copy semantics, assumes existence of a Clone() member
/// function of the pointee type
////////////////////////////////////////////////////////////////////////////////
template <class P>
@ -282,9 +295,11 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// class template RefLinked
// Implementation of the OwnershipPolicy used by SmartPtr
// Implements reference linking
/// \class RefLinked
///
/// \ingroup SmartPointerOwnershipGroup
/// Implementation of the OwnershipPolicy used by SmartPtr
/// Implements reference linking
////////////////////////////////////////////////////////////////////////////////
namespace Private
@ -384,9 +399,11 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// class template DestructiveCopy
// Implementation of the OwnershipPolicy used by SmartPtr
// Implements destructive copy semantics (a la std::auto_ptr)
/// \class DestructiveCopy
///
/// \ingroup SmartPointerOwnershipGroup
/// Implementation of the OwnershipPolicy used by SmartPtr
/// Implements destructive copy semantics (a la std::auto_ptr)
////////////////////////////////////////////////////////////////////////////////
template <class P>
@ -418,9 +435,11 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// class template NoCopy
// Implementation of the OwnershipPolicy used by SmartPtr
// Implements a policy that doesn't allow copying objects
/// \class NoCopy
///
/// \ingroup SmartPointerOwnershipGroup
/// Implementation of the OwnershipPolicy used by SmartPtr
/// Implements a policy that doesn't allow copying objects
////////////////////////////////////////////////////////////////////////////////
template <class P>
@ -452,9 +471,11 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// class template AllowConversion
// Implementation of the ConversionPolicy used by SmartPtr
// Allows implicit conversion from SmartPtr to the pointee type
/// \struct AllowConversion
///
/// \ingroup SmartPointerConversionGroup
/// Implementation of the ConversionPolicy used by SmartPtr
/// Allows implicit conversion from SmartPtr to the pointee type
////////////////////////////////////////////////////////////////////////////////
struct AllowConversion
@ -466,10 +487,12 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// class template DisallowConversion
// Implementation of the ConversionPolicy used by SmartPtr
// Does not allow implicit conversion from SmartPtr to the pointee type
// You can initialize a DisallowConversion with an AllowConversion
/// \struct DisallowConversion
///
/// \ingroup SmartPointerConversionGroup
/// Implementation of the ConversionPolicy used by SmartPtr
/// Does not allow implicit conversion from SmartPtr to the pointee type
/// You can initialize a DisallowConversion with an AllowConversion
////////////////////////////////////////////////////////////////////////////////
struct DisallowConversion
@ -487,9 +510,11 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// class template NoCheck
// Implementation of the CheckingPolicy used by SmartPtr
// Well, it's clear what it does :o)
/// \struct NoCheck
///
/// \ingroup SmartPointerCheckingGroup
/// Implementation of the CheckingPolicy used by SmartPtr
/// Well, it's clear what it does :o)
////////////////////////////////////////////////////////////////////////////////
template <class P>
@ -517,9 +542,11 @@ namespace Loki
////////////////////////////////////////////////////////////////////////////////
// class template AssertCheck
// Implementation of the CheckingPolicy used by SmartPtr
// Checks the pointer before dereference
/// \struct AssertCheck
///
/// \ingroup SmartPointerCheckingGroup
/// Implementation of the CheckingPolicy used by SmartPtr
/// Checks the pointer before dereference
////////////////////////////////////////////////////////////////////////////////
template <class P>
@ -550,10 +577,12 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// class template AssertCheckStrict
// Implementation of the CheckingPolicy used by SmartPtr
// Checks the pointer against zero upon initialization and before dereference
// You can initialize an AssertCheckStrict with an AssertCheck
/// \struct AssertCheckStrict
///
/// \ingroup SmartPointerCheckingGroup
/// Implementation of the CheckingPolicy used by SmartPtr
/// Checks the pointer against zero upon initialization and before dereference
/// You can initialize an AssertCheckStrict with an AssertCheck
////////////////////////////////////////////////////////////////////////////////
template <class P>
@ -588,8 +617,10 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// class NullPointerException
// Used by some implementations of the CheckingPolicy used by SmartPtr
/// \struct NullPointerException
///
/// \ingroup SmartPointerGroup
/// Used by some implementations of the CheckingPolicy used by SmartPtr
////////////////////////////////////////////////////////////////////////////////
struct NullPointerException : public std::runtime_error
@ -601,9 +632,11 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// class template RejectNullStatic
// Implementation of the CheckingPolicy used by SmartPtr
// Checks the pointer upon initialization and before dereference
/// \struct RejectNullStatic
///
/// \ingroup SmartPointerCheckingGroup
/// Implementation of the CheckingPolicy used by SmartPtr
/// Checks the pointer upon initialization and before dereference
////////////////////////////////////////////////////////////////////////////////
template <class P>
@ -647,9 +680,11 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// class template RejectNull
// Implementation of the CheckingPolicy used by SmartPtr
// Checks the pointer before dereference
/// \struct RejectNull
///
/// \ingroup SmartPointerCheckingGroup
/// Implementation of the CheckingPolicy used by SmartPtr
/// Checks the pointer before dereference
////////////////////////////////////////////////////////////////////////////////
template <class P>
@ -676,9 +711,11 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// class template RejectNullStrict
// Implementation of the CheckingPolicy used by SmartPtr
// Checks the pointer upon initialization and before dereference
/// \struct RejectNullStrict
///
/// \ingroup SmartPointerCheckingGroup
/// Implementation of the CheckingPolicy used by SmartPtr
/// Checks the pointer upon initialization and before dereference
////////////////////////////////////////////////////////////////////////////////
template <class P>
@ -706,9 +743,11 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// class template ByRef
// Transports a reference as a value
// Serves to implement the Colvin/Gibbons trick for SmartPtr
/// \class ByRef
///
/// \ingroup SmartPointerGroup
/// Transports a reference as a value
/// Serves to implement the Colvin/Gibbons trick for SmartPtr
////////////////////////////////////////////////////////////////////////////////
template <class T>
@ -767,7 +806,21 @@ namespace Loki
};
////////////////////////////////////////////////////////////////////////////////
// class template SmartPtr (definition)
/// \class SmartPtr
///
/// \ingroup SmartPointerGroup
///
/// \param OwnershipPolicy default = RefCounted,
/// \param ConversionPolicy default = DisallowConversion,
/// \param CheckingPolicy default = AssertCheck,
/// \param StoragePolicy default = DefaultSPStorage
///
/// \par IMPORTANT NOTE
/// Due to threading issues, the OwnershipPolicy has been changed as follows:
///
/// - Release() returns a boolean saying if that was the last release
/// so the pointer can be deleted by the StoragePolicy
/// - IsUnique() was removed
////////////////////////////////////////////////////////////////////////////////
template
@ -1022,7 +1075,8 @@ namespace Loki
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// operator== for lhs = SmartPtr, rhs = raw pointer
/// operator== for lhs = SmartPtr, rhs = raw pointer
/// \ingroup SmartPointerGroup
////////////////////////////////////////////////////////////////////////////////
template
@ -1039,7 +1093,8 @@ namespace Loki
{ return GetImpl(lhs) == rhs; }
////////////////////////////////////////////////////////////////////////////////
// operator== for lhs = raw pointer, rhs = SmartPtr
/// operator== for lhs = raw pointer, rhs = SmartPtr
/// \ingroup SmartPointerGroup
////////////////////////////////////////////////////////////////////////////////
template
@ -1056,7 +1111,8 @@ namespace Loki
{ return rhs == lhs; }
////////////////////////////////////////////////////////////////////////////////
// operator!= for lhs = SmartPtr, rhs = raw pointer
/// operator!= for lhs = SmartPtr, rhs = raw pointer
/// \ingroup SmartPointerGroup
////////////////////////////////////////////////////////////////////////////////
template
@ -1073,7 +1129,8 @@ namespace Loki
{ return !(lhs == rhs); }
////////////////////////////////////////////////////////////////////////////////
// operator!= for lhs = raw pointer, rhs = SmartPtr
/// operator!= for lhs = raw pointer, rhs = SmartPtr
/// \ingroup SmartPointerGroup
////////////////////////////////////////////////////////////////////////////////
template
@ -1090,7 +1147,8 @@ namespace Loki
{ return rhs != lhs; }
////////////////////////////////////////////////////////////////////////////////
// operator< for lhs = SmartPtr, rhs = raw pointer -- NOT DEFINED
/// operator< for lhs = SmartPtr, rhs = raw pointer -- NOT DEFINED
/// \ingroup SmartPointerGroup
////////////////////////////////////////////////////////////////////////////////
template
@ -1106,7 +1164,8 @@ namespace Loki
U* rhs);
////////////////////////////////////////////////////////////////////////////////
// operator< for lhs = raw pointer, rhs = SmartPtr -- NOT DEFINED
/// operator< for lhs = raw pointer, rhs = SmartPtr -- NOT DEFINED
/// \ingroup SmartPointerGroup
////////////////////////////////////////////////////////////////////////////////
template
@ -1122,7 +1181,8 @@ namespace Loki
const SmartPtr<T, OP, CP, KP, SP>& rhs);
////////////////////////////////////////////////////////////////////////////////
// operator> for lhs = SmartPtr, rhs = raw pointer -- NOT DEFINED
// operator> for lhs = SmartPtr, rhs = raw pointer -- NOT DEFINED
/// \ingroup SmartPointerGroup
////////////////////////////////////////////////////////////////////////////////
template
@ -1139,7 +1199,8 @@ namespace Loki
{ return rhs < lhs; }
////////////////////////////////////////////////////////////////////////////////
// operator> for lhs = raw pointer, rhs = SmartPtr
/// operator> for lhs = raw pointer, rhs = SmartPtr
/// \ingroup SmartPointerGroup
////////////////////////////////////////////////////////////////////////////////
template
@ -1156,7 +1217,8 @@ namespace Loki
{ return rhs < lhs; }
////////////////////////////////////////////////////////////////////////////////
// operator<= for lhs = SmartPtr, rhs = raw pointer
/// operator<= for lhs = SmartPtr, rhs = raw pointer
/// \ingroup SmartPointerGroup
////////////////////////////////////////////////////////////////////////////////
template
@ -1173,7 +1235,8 @@ namespace Loki
{ return !(rhs < lhs); }
////////////////////////////////////////////////////////////////////////////////
// operator<= for lhs = raw pointer, rhs = SmartPtr
/// operator<= for lhs = raw pointer, rhs = SmartPtr
/// \ingroup SmartPointerGroup
////////////////////////////////////////////////////////////////////////////////
template
@ -1190,7 +1253,8 @@ namespace Loki
{ return !(rhs < lhs); }
////////////////////////////////////////////////////////////////////////////////
// operator>= for lhs = SmartPtr, rhs = raw pointer
/// operator>= for lhs = SmartPtr, rhs = raw pointer
/// \ingroup SmartPointerGroup
////////////////////////////////////////////////////////////////////////////////
template
@ -1207,7 +1271,8 @@ namespace Loki
{ return !(lhs < rhs); }
////////////////////////////////////////////////////////////////////////////////
// operator>= for lhs = raw pointer, rhs = SmartPtr
/// operator>= for lhs = raw pointer, rhs = SmartPtr
/// \ingroup SmartPointerGroup
////////////////////////////////////////////////////////////////////////////////
template
@ -1226,7 +1291,8 @@ namespace Loki
} // namespace Loki
////////////////////////////////////////////////////////////////////////////////
// specialization of std::less for SmartPtr
/// specialization of std::less for SmartPtr
/// \ingroup SmartPointerGroup
////////////////////////////////////////////////////////////////////////////////
namespace std
@ -1261,7 +1327,8 @@ namespace std
// In case that the macro is defined and the conversion policy allow flag is off
// (e.g. DisallowConversion) then the conversion from the "pointer" to the
// SmartPtr must be explicit.
// October 32, 2005: fix void Swap(RefLinkedBase& rhs). Peter Kümmel
// October 21, 2005: fix void Swap(RefLinkedBase& rhs). Peter Kümmel
// November 3, 2005: doxygen like documentation. Peter Kümmel
////////////////////////////////////////////////////////////////////////////////
#endif // SMARTPTR_INC_

View file

@ -2,18 +2,38 @@
#define LOKI_THREADS_H_
////////////////////////////////////////////////////////////////////////////////
// macro LOKI_DEFAULT_THREADING
// Selects the default threading model for certain components of Loki
// If you don't define it, it defaults to single-threaded
// All classes in Loki have configurable threading model; LOKI_DEFAULT_THREADING
// affects only default template arguments
////////////////////////////////////////////////////////////////////////////////
// $Header$
/*!
@defgroup ThreadingGroup Threading
*/
/// @defgroup ThreadingGroup Threading
/// Policies to for the threading model:
///
/// - SingleThreaded
/// - ObjectLevelLockable
/// - ClassLevelLockable
///
/// All classes in Loki have configurable threading model.
///
/// The macro LOKI_DEFAULT_THREADING selects the default
/// threading model for certain components of Loki
/// (it affects only default template arguments)
///
/// \par Usage:
///
/// To use a specific threading model define
///
/// - nothing, single-theading is default
/// - LOKI_OBJECT_LEVEL_THREADING for object-level-threading
/// - LOKI_CLASS_LEVEL_THREADING for class-level-threading
///
/// \par Supported platfroms:
///
/// - Windows (windows.h)
/// - POSIX (pthread.h)
#if defined(LOKI_CLASS_LEVEL_THREADING) || defined(LOKI_OBJECT_LEVEL_THREADING)
@ -42,18 +62,20 @@
namespace Loki
{
/*!
\class SingleThreaded
\ingroup ThreadingGroup
Implementation of the ThreadingModel policy used by various classes
Implements a single-threaded model; no synchronization
*/
////////////////////////////////////////////////////////////////////////////////
/// \class SingleThreaded
///
/// \ingroup ThreadingGroup
/// Implementation of the ThreadingModel policy used by various classes
/// Implements a single-threaded model; no synchronization
////////////////////////////////////////////////////////////////////////////////
template <class Host>
class SingleThreaded
{
public:
/// \struct Lock
/// Dummy Lock class
struct Lock
{
Lock() {}
@ -150,14 +172,13 @@ namespace Loki
#if defined(_WINDOWS_) || defined(_WINDOWS_H) || defined(_PTHREAD_H)
/*!
\class ObjectLevelLockable
\ingroup ThreadingGroup
class template ObjectLevelLockable
Implementation of the ThreadingModel policy used by various classes
Implements a object-level locking scheme
*/
////////////////////////////////////////////////////////////////////////////////
/// \class ObjectLevelLockable
///
/// \ingroup ThreadingGroup
/// Implementation of the ThreadingModel policy used by various classes
/// Implements a object-level locking scheme
////////////////////////////////////////////////////////////////////////////////
template <class Host>
class ObjectLevelLockable
{
@ -182,26 +203,32 @@ namespace Loki
class Lock;
friend class Lock;
/// \struct Lock
/// Lock class to lock on object level
class Lock
{
public:
/// Lock object
explicit Lock(const ObjectLevelLockable& host) : host_(host)
{
LOKI_THREADS_MUTEX_LOCK(&host_.mtx_);
}
/// Lock object
explicit Lock(const ObjectLevelLockable* host) : host_(*host)
{
LOKI_THREADS_MUTEX_LOCK(&host_.mtx_);
}
/// Unlock object
~Lock()
{
LOKI_THREADS_MUTEX_UNLOCK(&host_.mtx_);
}
private:
/// private by design of the object level threading
Lock();
Lock(const Lock&);
Lock& operator=(const Lock&);
@ -221,14 +248,13 @@ namespace Loki
pthread_mutex_t ObjectLevelLockable<Host>::atomic_mutex_(PTHREAD_MUTEX_INITIALIZER);
#endif
/*!
\class ClassLevelLockable
\ingroup ThreadingGroup
Implementation of the ThreadingModel policy used by various classes
Implements a class-level locking scheme
*/
////////////////////////////////////////////////////////////////////////////////
/// \class ClassLevelLockable
///
/// \ingroup ThreadingGroup
/// Implementation of the ThreadingModel policy used by various classes
/// Implements a class-level locking scheme
////////////////////////////////////////////////////////////////////////////////
template <class Host>
class ClassLevelLockable
{
@ -256,28 +282,34 @@ namespace Loki
class Lock;
friend class Lock;
/// \struct Lock
/// Lock class to lock on class level
class Lock
{
public:
/// Lock class
Lock()
{
assert(initializer_.init_);
LOKI_THREADS_MUTEX_LOCK(&initializer_.mtx_);
}
/// Lock class
explicit Lock(const ClassLevelLockable&)
{
assert(initializer_.init_);
LOKI_THREADS_MUTEX_LOCK(&initializer_.mtx_);
}
/// Lock class
explicit Lock(const ClassLevelLockable*)
{
assert(initializer_.init_);
LOKI_THREADS_MUTEX_LOCK(&initializer_.mtx_);
}
/// Unlock class
~Lock()
{
assert(initializer_.init_);
@ -322,6 +354,9 @@ namespace Loki
#endif
// $Log$
// Revision 1.18 2005/11/03 12:43:35 syntheticpp
// more doxygen documentation, modules added
//
// Revision 1.17 2005/11/02 20:01:10 syntheticpp
// more doxygen documentation, modules added
//