add additional template parameter for the changed threading classes

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@513 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
syntheticpp 2006-01-22 13:31:45 +00:00
parent 7dc0df52d0
commit e3dc79f363
3 changed files with 80 additions and 63 deletions

View file

@ -38,7 +38,7 @@ namespace Loki
namespace Private namespace Private
{ {
template <typename R, template <class> class ThreadingModel> template <typename R, template <class, class> class ThreadingModel>
struct FunctorImplBase : public SmallObject<ThreadingModel> struct FunctorImplBase : public SmallObject<ThreadingModel>
{ {
typedef R ResultType; typedef R ResultType;
@ -92,7 +92,7 @@ namespace Loki
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <typename R, class TList, template <typename R, class TList,
template <class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL> template <class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL>
class FunctorImpl; class FunctorImpl;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@ -100,7 +100,7 @@ namespace Loki
// Specialization for 0 (zero) parameters // Specialization for 0 (zero) parameters
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <typename R, template <class> class ThreadingModel> template <typename R, template <class, class> class ThreadingModel>
class FunctorImpl<R, NullType, ThreadingModel> class FunctorImpl<R, NullType, ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
{ {
@ -114,7 +114,7 @@ namespace Loki
// Specialization for 1 parameter // Specialization for 1 parameter
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <typename R, typename P1, template <class> class ThreadingModel> template <typename R, typename P1, template <class, class> class ThreadingModel>
class FunctorImpl<R, Seq<P1>, ThreadingModel> class FunctorImpl<R, Seq<P1>, ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
{ {
@ -130,7 +130,7 @@ namespace Loki
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <typename R, typename P1, typename P2, template <typename R, typename P1, typename P2,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, Seq<P1, P2>, ThreadingModel> class FunctorImpl<R, Seq<P1, P2>, ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
{ {
@ -147,7 +147,7 @@ namespace Loki
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <typename R, typename P1, typename P2, typename P3, template <typename R, typename P1, typename P2, typename P3,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, Seq<P1, P2, P3>, ThreadingModel> class FunctorImpl<R, Seq<P1, P2, P3>, ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
{ {
@ -165,7 +165,7 @@ namespace Loki
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, Seq<P1, P2, P3, P4>, ThreadingModel> class FunctorImpl<R, Seq<P1, P2, P3, P4>, ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
{ {
@ -185,7 +185,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P5,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, Seq<P1, P2, P3, P4, P5>, ThreadingModel> class FunctorImpl<R, Seq<P1, P2, P3, P4, P5>, ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
{ {
@ -206,7 +206,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P5, typename P6,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6>, ThreadingModel> class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6>, ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
{ {
@ -228,7 +228,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P5, typename P6, typename P7,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6, P7>, ThreadingModel> class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6, P7>, ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
{ {
@ -252,7 +252,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P8, typename P5, typename P6, typename P7, typename P8,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6, P7, P8>, class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6, P7, P8>,
ThreadingModel> ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
@ -278,7 +278,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P8, typename P9, typename P5, typename P6, typename P7, typename P8, typename P9,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9>, class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9>,
ThreadingModel> ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
@ -306,7 +306,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P8, typename P9, typename P5, typename P6, typename P7, typename P8, typename P9,
typename P10, typename P10,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10>, class FunctorImpl<R, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10>,
ThreadingModel> ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
@ -335,7 +335,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P8, typename P9, typename P5, typename P6, typename P7, typename P8, typename P9,
typename P10, typename P11, typename P10, typename P11,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, class FunctorImpl<R,
Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11>, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11>,
ThreadingModel> ThreadingModel>
@ -366,7 +366,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P8, typename P9, typename P5, typename P6, typename P7, typename P8, typename P9,
typename P10, typename P11, typename P12, typename P10, typename P11, typename P12,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, class FunctorImpl<R,
Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12>, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12>,
ThreadingModel> ThreadingModel>
@ -398,7 +398,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P8, typename P9, typename P5, typename P6, typename P7, typename P8, typename P9,
typename P10, typename P11, typename P12, typename P13, typename P10, typename P11, typename P12, typename P13,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, class FunctorImpl<R,
Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13>, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13>,
ThreadingModel> ThreadingModel>
@ -431,7 +431,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P8, typename P9, typename P5, typename P6, typename P7, typename P8, typename P9,
typename P10, typename P11, typename P12, typename P13, typename P14, typename P10, typename P11, typename P12, typename P13, typename P14,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, class FunctorImpl<R,
Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13,
P14>, P14>,
@ -466,7 +466,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P8, typename P9, typename P5, typename P6, typename P7, typename P8, typename P9,
typename P10, typename P11, typename P12, typename P13, typename P14, typename P10, typename P11, typename P12, typename P13, typename P14,
typename P15, template <class> class ThreadingModel> typename P15, template <class, class> class ThreadingModel>
class FunctorImpl<R, class FunctorImpl<R,
Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, Seq<P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13,
P14, P15>, P14, P15>,
@ -502,7 +502,7 @@ namespace Loki
// Specialization for 1 parameter // Specialization for 1 parameter
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <typename R, typename P1, template <class> class ThreadingModel> template <typename R, typename P1, template <class, class> class ThreadingModel>
class FunctorImpl<R, LOKI_TYPELIST_1(P1), ThreadingModel> class FunctorImpl<R, LOKI_TYPELIST_1(P1), ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
{ {
@ -518,7 +518,7 @@ namespace Loki
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <typename R, typename P1, typename P2, template <typename R, typename P1, typename P2,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, LOKI_TYPELIST_2(P1, P2), ThreadingModel> class FunctorImpl<R, LOKI_TYPELIST_2(P1, P2), ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
{ {
@ -535,7 +535,7 @@ namespace Loki
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <typename R, typename P1, typename P2, typename P3, template <typename R, typename P1, typename P2, typename P3,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, LOKI_TYPELIST_3(P1, P2, P3), ThreadingModel> class FunctorImpl<R, LOKI_TYPELIST_3(P1, P2, P3), ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
{ {
@ -553,7 +553,7 @@ namespace Loki
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, LOKI_TYPELIST_4(P1, P2, P3, P4), ThreadingModel> class FunctorImpl<R, LOKI_TYPELIST_4(P1, P2, P3, P4), ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
{ {
@ -573,7 +573,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P5,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, LOKI_TYPELIST_5(P1, P2, P3, P4, P5), ThreadingModel> class FunctorImpl<R, LOKI_TYPELIST_5(P1, P2, P3, P4, P5), ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
{ {
@ -594,7 +594,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P5, typename P6,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, LOKI_TYPELIST_6(P1, P2, P3, P4, P5, P6), ThreadingModel> class FunctorImpl<R, LOKI_TYPELIST_6(P1, P2, P3, P4, P5, P6), ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
{ {
@ -616,7 +616,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P5, typename P6, typename P7,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, LOKI_TYPELIST_7(P1, P2, P3, P4, P5, P6, P7), ThreadingModel> class FunctorImpl<R, LOKI_TYPELIST_7(P1, P2, P3, P4, P5, P6, P7), ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
{ {
@ -640,7 +640,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P8, typename P5, typename P6, typename P7, typename P8,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, LOKI_TYPELIST_8(P1, P2, P3, P4, P5, P6, P7, P8), class FunctorImpl<R, LOKI_TYPELIST_8(P1, P2, P3, P4, P5, P6, P7, P8),
ThreadingModel> ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
@ -666,7 +666,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P8, typename P9, typename P5, typename P6, typename P7, typename P8, typename P9,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, LOKI_TYPELIST_9(P1, P2, P3, P4, P5, P6, P7, P8, P9), class FunctorImpl<R, LOKI_TYPELIST_9(P1, P2, P3, P4, P5, P6, P7, P8, P9),
ThreadingModel> ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
@ -694,7 +694,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P8, typename P9, typename P5, typename P6, typename P7, typename P8, typename P9,
typename P10, typename P10,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, LOKI_TYPELIST_10(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10), class FunctorImpl<R, LOKI_TYPELIST_10(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10),
ThreadingModel> ThreadingModel>
: public Private::FunctorImplBase<R, ThreadingModel> : public Private::FunctorImplBase<R, ThreadingModel>
@ -723,7 +723,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P8, typename P9, typename P5, typename P6, typename P7, typename P8, typename P9,
typename P10, typename P11, typename P10, typename P11,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, class FunctorImpl<R,
LOKI_TYPELIST_11(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11), LOKI_TYPELIST_11(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11),
ThreadingModel> ThreadingModel>
@ -754,7 +754,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P8, typename P9, typename P5, typename P6, typename P7, typename P8, typename P9,
typename P10, typename P11, typename P12, typename P10, typename P11, typename P12,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, class FunctorImpl<R,
LOKI_TYPELIST_12(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12), LOKI_TYPELIST_12(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12),
ThreadingModel> ThreadingModel>
@ -786,7 +786,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P8, typename P9, typename P5, typename P6, typename P7, typename P8, typename P9,
typename P10, typename P11, typename P12, typename P13, typename P10, typename P11, typename P12, typename P13,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, class FunctorImpl<R,
LOKI_TYPELIST_13(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13), LOKI_TYPELIST_13(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13),
ThreadingModel> ThreadingModel>
@ -819,7 +819,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P8, typename P9, typename P5, typename P6, typename P7, typename P8, typename P9,
typename P10, typename P11, typename P12, typename P13, typename P14, typename P10, typename P11, typename P12, typename P13, typename P14,
template <class> class ThreadingModel> template <class, class> class ThreadingModel>
class FunctorImpl<R, class FunctorImpl<R,
LOKI_TYPELIST_14(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, LOKI_TYPELIST_14(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13,
P14), P14),
@ -854,7 +854,7 @@ namespace Loki
template <typename R, typename P1, typename P2, typename P3, typename P4, template <typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7, typename P8, typename P9, typename P5, typename P6, typename P7, typename P8, typename P9,
typename P10, typename P11, typename P12, typename P13, typename P14, typename P10, typename P11, typename P12, typename P13, typename P14,
typename P15, template <class> class ThreadingModel> typename P15, template <class, class> class ThreadingModel>
class FunctorImpl<R, class FunctorImpl<R,
LOKI_TYPELIST_15(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13, LOKI_TYPELIST_15(P1, P2, P3, P4, P5, P6, P7, P8, P9, P10, P11, P12, P13,
P14, P15), P14, P15),
@ -1137,7 +1137,7 @@ namespace Loki
/// A generalized functor implementation with value semantics /// A generalized functor implementation with value semantics
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <typename R = void, class TList = NullType, template <typename R = void, class TList = NullType,
template<class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL> template<class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL>
class Functor class Functor
{ {
public: public:
@ -1334,7 +1334,7 @@ namespace Loki
{ {
template <class Fctor> struct BinderFirstTraits; template <class Fctor> struct BinderFirstTraits;
template <typename R, class TList, template <class> class ThreadingModel> template <typename R, class TList, template <class, class> class ThreadingModel>
struct BinderFirstTraits< Functor<R, TList, ThreadingModel> > struct BinderFirstTraits< Functor<R, TList, ThreadingModel> >
{ {
typedef Functor<R, TList, ThreadingModel> OriginalFunctor; typedef Functor<R, TList, ThreadingModel> OriginalFunctor;
@ -1361,7 +1361,7 @@ namespace Loki
typedef typename TypeTraits<T>::ParameterType RefOrValue; typedef typename TypeTraits<T>::ParameterType RefOrValue;
}; };
template <typename R, class TList, template <class> class ThreadingModel> template <typename R, class TList, template <class, class> class ThreadingModel>
struct BinderFirstBoundTypeStorage< Functor<R, TList, ThreadingModel> > struct BinderFirstBoundTypeStorage< Functor<R, TList, ThreadingModel> >
{ {
typedef Functor<R, TList, ThreadingModel> OriginalFunctor; typedef Functor<R, TList, ThreadingModel> OriginalFunctor;
@ -1662,6 +1662,9 @@ namespace Loki
#endif // FUNCTOR_INC_ #endif // FUNCTOR_INC_
// $Log$ // $Log$
// Revision 1.15 2006/01/22 13:31:45 syntheticpp
// add additional template parameter for the changed threading classes
//
// Revision 1.14 2006/01/16 19:05:09 rich_sposato // Revision 1.14 2006/01/16 19:05:09 rich_sposato
// Added cvs keywords. // Added cvs keywords.
// //

View file

@ -212,11 +212,12 @@ namespace Loki
*/ */
template template
< <
template <class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL, template <class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL,
std::size_t chunkSize = LOKI_DEFAULT_CHUNK_SIZE, std::size_t chunkSize = LOKI_DEFAULT_CHUNK_SIZE,
std::size_t maxSmallObjectSize = LOKI_MAX_SMALL_OBJECT_SIZE, std::size_t maxSmallObjectSize = LOKI_MAX_SMALL_OBJECT_SIZE,
std::size_t objectAlignSize = LOKI_DEFAULT_OBJECT_ALIGNMENT, std::size_t objectAlignSize = LOKI_DEFAULT_OBJECT_ALIGNMENT,
template <class> class LifetimePolicy = LOKI_DEFAULT_SMALLOBJ_LIFETIME template <class> class LifetimePolicy = LOKI_DEFAULT_SMALLOBJ_LIFETIME,
class MutexPolicy = Mutex
> >
class AllocatorSingleton : public SmallObjAllocator class AllocatorSingleton : public SmallObjAllocator
{ {
@ -227,7 +228,7 @@ namespace Loki
maxSmallObjectSize, objectAlignSize, LifetimePolicy > MyAllocator; maxSmallObjectSize, objectAlignSize, LifetimePolicy > MyAllocator;
/// Defines type for thread-safety locking mechanism. /// Defines type for thread-safety locking mechanism.
typedef ThreadingModel< MyAllocator > MyThreadingModel; typedef ThreadingModel< MyAllocator, MutexPolicy > MyThreadingModel;
/// Defines singleton made from allocator. /// Defines singleton made from allocator.
typedef Loki::SingletonHolder< MyAllocator, Loki::CreateStatic, typedef Loki::SingletonHolder< MyAllocator, Loki::CreateStatic,
@ -276,13 +277,14 @@ namespace Loki
template template
< <
template <class> class TM, template <class, class> class TM,
std::size_t CS, std::size_t CS,
std::size_t MSOS, std::size_t MSOS,
std::size_t OAS, std::size_t OAS,
template <class> class LP template <class> class LP,
class MX
> >
void AllocatorSingleton< TM, CS, MSOS, OAS, LP >::ClearExtraMemory( void ) void AllocatorSingleton< TM, CS, MSOS, OAS, LP, MX >::ClearExtraMemory( void )
{ {
typename MyThreadingModel::Lock lock; typename MyThreadingModel::Lock lock;
(void)lock; // get rid of warning (void)lock; // get rid of warning
@ -291,13 +293,14 @@ namespace Loki
template template
< <
template <class> class TM, template <class, class> class TM,
std::size_t CS, std::size_t CS,
std::size_t MSOS, std::size_t MSOS,
std::size_t OAS, std::size_t OAS,
template <class> class LP template <class> class LP,
class MX
> >
bool AllocatorSingleton< TM, CS, MSOS, OAS, LP >::IsCorrupted( void ) bool AllocatorSingleton< TM, CS, MSOS, OAS, LP, MX >::IsCorrupted( void )
{ {
typename MyThreadingModel::Lock lock; typename MyThreadingModel::Lock lock;
(void)lock; // get rid of warning (void)lock; // get rid of warning
@ -318,14 +321,15 @@ namespace Loki
*/ */
template template
< <
template <class> class TM, template <class, class> class TM,
std::size_t CS, std::size_t CS,
std::size_t MSOS, std::size_t MSOS,
std::size_t OAS, std::size_t OAS,
template <class> class LP template <class> class LP,
class MX
> >
inline unsigned int GetLongevity( inline unsigned int GetLongevity(
AllocatorSingleton< TM, CS, MSOS, OAS, LP > * ) AllocatorSingleton< TM, CS, MSOS, OAS, LP, MX > * )
{ {
// Returns highest possible value. // Returns highest possible value.
return 0xFFFFFFFF; return 0xFFFFFFFF;
@ -411,11 +415,12 @@ namespace Loki
*/ */
template template
< <
template <class> class ThreadingModel, template <class, class> class ThreadingModel,
std::size_t chunkSize, std::size_t chunkSize,
std::size_t maxSmallObjectSize, std::size_t maxSmallObjectSize,
std::size_t objectAlignSize, std::size_t objectAlignSize,
template <class> class LifetimePolicy template <class> class LifetimePolicy,
class MutexPolicy
> >
class SmallObjectBase class SmallObjectBase
{ {
@ -431,7 +436,7 @@ namespace Loki
private: private:
/// Defines type for thread-safety locking mechanism. /// Defines type for thread-safety locking mechanism.
typedef ThreadingModel< ObjAllocatorSingleton > MyThreadingModel; typedef ThreadingModel< ObjAllocatorSingleton, MutexPolicy > MyThreadingModel;
/// Use singleton defined in AllocatorSingleton. /// Use singleton defined in AllocatorSingleton.
typedef typename ObjAllocatorSingleton::MyAllocatorSingleton MyAllocatorSingleton; typedef typename ObjAllocatorSingleton::MyAllocatorSingleton MyAllocatorSingleton;
@ -567,14 +572,15 @@ namespace Loki
*/ */
template template
< <
template <class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL, template <class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL,
std::size_t chunkSize = LOKI_DEFAULT_CHUNK_SIZE, std::size_t chunkSize = LOKI_DEFAULT_CHUNK_SIZE,
std::size_t maxSmallObjectSize = LOKI_MAX_SMALL_OBJECT_SIZE, std::size_t maxSmallObjectSize = LOKI_MAX_SMALL_OBJECT_SIZE,
std::size_t objectAlignSize = LOKI_DEFAULT_OBJECT_ALIGNMENT, std::size_t objectAlignSize = LOKI_DEFAULT_OBJECT_ALIGNMENT,
template <class> class LifetimePolicy = LOKI_DEFAULT_SMALLOBJ_LIFETIME template <class> class LifetimePolicy = LOKI_DEFAULT_SMALLOBJ_LIFETIME,
class MutexPolicy = Mutex
> >
class SmallObject : public SmallObjectBase< ThreadingModel, chunkSize, class SmallObject : public SmallObjectBase< ThreadingModel, chunkSize,
maxSmallObjectSize, objectAlignSize, LifetimePolicy > maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >
{ {
public: public:
@ -602,14 +608,15 @@ namespace Loki
*/ */
template template
< <
template <class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL, template <class, class> class ThreadingModel = LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL,
std::size_t chunkSize = LOKI_DEFAULT_CHUNK_SIZE, std::size_t chunkSize = LOKI_DEFAULT_CHUNK_SIZE,
std::size_t maxSmallObjectSize = LOKI_MAX_SMALL_OBJECT_SIZE, std::size_t maxSmallObjectSize = LOKI_MAX_SMALL_OBJECT_SIZE,
std::size_t objectAlignSize = LOKI_DEFAULT_OBJECT_ALIGNMENT, std::size_t objectAlignSize = LOKI_DEFAULT_OBJECT_ALIGNMENT,
template <class> class LifetimePolicy = LOKI_DEFAULT_SMALLOBJ_LIFETIME template <class> class LifetimePolicy = LOKI_DEFAULT_SMALLOBJ_LIFETIME,
class MutexPolicy = Mutex
> >
class SmallValueObject : public SmallObjectBase< ThreadingModel, chunkSize, class SmallValueObject : public SmallObjectBase< ThreadingModel, chunkSize,
maxSmallObjectSize, objectAlignSize, LifetimePolicy > maxSmallObjectSize, objectAlignSize, LifetimePolicy, MutexPolicy >
{ {
protected: protected:
inline SmallValueObject( void ) {} inline SmallValueObject( void ) {}
@ -626,6 +633,9 @@ namespace Loki
// Nov. 26, 2004: re-implemented by Rich Sposato. // Nov. 26, 2004: re-implemented by Rich Sposato.
// //
// $Log$ // $Log$
// Revision 1.25 2006/01/22 13:31:45 syntheticpp
// add additional template parameter for the changed threading classes
//
// Revision 1.24 2005/12/08 22:09:08 rich_sposato // Revision 1.24 2005/12/08 22:09:08 rich_sposato
// Added functions to check for memory corruption. Also made some minor // Added functions to check for memory corruption. Also made some minor
// coding changes. // coding changes.

View file

@ -166,13 +166,14 @@ namespace Loki
/// Policy Usage: RefCountedMTAdj<ThreadingModel>::RefCountedMT /// Policy Usage: RefCountedMTAdj<ThreadingModel>::RefCountedMT
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
template <template <class> class ThreadingModel> template <template <class, class> class ThreadingModel,
class MX = LOKI_DEFAULT_MUTEX >
struct RefCountedMTAdj struct RefCountedMTAdj
{ {
template <class P> template <class P>
class RefCountedMT : public ThreadingModel< RefCountedMT<P> > class RefCountedMT : public ThreadingModel< RefCountedMT<P>, MX >
{ {
typedef ThreadingModel< RefCountedMT<P> > base_type; typedef ThreadingModel< RefCountedMT<P>, MX > base_type;
typedef typename base_type::IntType CountType; typedef typename base_type::IntType CountType;
typedef volatile CountType *CountPtrType; typedef volatile CountType *CountPtrType;
@ -184,7 +185,7 @@ namespace Loki
sizeof(*pCount_))); sizeof(*pCount_)));
assert(pCount_); assert(pCount_);
//*pCount_ = 1; //*pCount_ = 1;
ThreadingModel<RefCountedMT>::AtomicAssign(*pCount_, 1); ThreadingModel<RefCountedMT, MX>::AtomicAssign(*pCount_, 1);
} }
RefCountedMT(const RefCountedMT& rhs) RefCountedMT(const RefCountedMT& rhs)
@ -199,13 +200,13 @@ namespace Loki
P Clone(const P& val) P Clone(const P& val)
{ {
ThreadingModel<RefCountedMT>::AtomicIncrement(*pCount_); ThreadingModel<RefCountedMT, MX>::AtomicIncrement(*pCount_);
return val; return val;
} }
bool Release(const P&) bool Release(const P&)
{ {
if (!ThreadingModel<RefCountedMT>::AtomicDecrement(*pCount_)) if (!ThreadingModel<RefCountedMT, MX>::AtomicDecrement(*pCount_))
{ {
SmallObject<LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL>::operator delete( SmallObject<LOKI_DEFAULT_THREADING_NO_OBJ_LEVEL>::operator delete(
const_cast<CountType *>(pCount_), const_cast<CountType *>(pCount_),
@ -1336,6 +1337,9 @@ namespace std
#endif // SMARTPTR_INC_ #endif // SMARTPTR_INC_
// $Log$ // $Log$
// Revision 1.11 2006/01/22 13:31:12 syntheticpp
// add additional template parameter for the changed threading classes
//
// Revision 1.10 2006/01/18 17:21:31 lfittl // Revision 1.10 2006/01/18 17:21:31 lfittl
// - Compile library with -Weffc++ and -pedantic (gcc) // - Compile library with -Weffc++ and -pedantic (gcc)
// - Fix most issues raised by using -Weffc++ (initialization lists) // - Fix most issues raised by using -Weffc++ (initialization lists)