Loki header files now all have consistent include statement style.
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@1069 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
ae4fbd418d
commit
6bc2851497
16 changed files with 773 additions and 773 deletions
|
@ -2,14 +2,14 @@
|
|||
// The Loki Library
|
||||
// Copyright (c) 2001 by Andrei Alexandrescu
|
||||
// This code accompanies the book:
|
||||
// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
|
||||
// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
|
||||
// Patterns Applied". Copyright (c) 2001. Addison-Wesley.
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// permission notice appear in supporting documentation.
|
||||
// The author or Addison-Wesley Longman make no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// The author or Addison-Wesley Longman make no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// without express or implied warranty.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef LOKI_ABSTRACTFACTORY_INC_
|
||||
|
@ -18,10 +18,10 @@
|
|||
// $Id$
|
||||
|
||||
|
||||
#include "Typelist.h"
|
||||
#include "Sequence.h"
|
||||
#include "TypeManip.h"
|
||||
#include "HierarchyGenerators.h"
|
||||
#include <loki/Typelist.h>
|
||||
#include <loki/Sequence.h>
|
||||
#include <loki/TypeManip.h>
|
||||
#include <loki/HierarchyGenerators.h>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
|||
* \ingroup FactoriesGroup
|
||||
* \brief Implements an abstract object factory.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \class AbstractFactory
|
||||
* \ingroup AbstractFactoryGroup
|
||||
|
@ -68,14 +68,14 @@ namespace Loki
|
|||
{
|
||||
public:
|
||||
typedef TList ProductList;
|
||||
|
||||
|
||||
template <class T> T* Create()
|
||||
{
|
||||
Unit<T>& unit = *this;
|
||||
return unit.DoCreate(Type2Type<T>());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class template OpNewFactoryUnit
|
||||
// Creates an object by invoking the new operator
|
||||
|
@ -85,10 +85,10 @@ namespace Loki
|
|||
class OpNewFactoryUnit : public Base
|
||||
{
|
||||
typedef typename Base::ProductList BaseProductList;
|
||||
|
||||
|
||||
protected:
|
||||
typedef typename BaseProductList::Tail ProductList;
|
||||
|
||||
|
||||
public:
|
||||
typedef typename BaseProductList::Head AbstractProduct;
|
||||
ConcreteProduct* DoCreate(Type2Type<AbstractProduct>)
|
||||
|
@ -101,7 +101,7 @@ namespace Loki
|
|||
// class template PrototypeFactoryUnit
|
||||
// Creates an object by cloning a prototype
|
||||
// There is a difference between the implementation herein and the one described
|
||||
// in the book: GetPrototype and SetPrototype use the helper friend
|
||||
// in the book: GetPrototype and SetPrototype use the helper friend
|
||||
// functions DoGetPrototype and DoSetPrototype. The friend functions avoid
|
||||
// name hiding issues. Plus, GetPrototype takes a reference to pointer
|
||||
// instead of returning the pointer by value.
|
||||
|
@ -111,7 +111,7 @@ namespace Loki
|
|||
class PrototypeFactoryUnit : public Base
|
||||
{
|
||||
typedef typename Base::ProductList BaseProductList;
|
||||
|
||||
|
||||
protected:
|
||||
typedef typename BaseProductList::Tail ProductList;
|
||||
|
||||
|
@ -133,17 +133,17 @@ namespace Loki
|
|||
template <class U>
|
||||
void GetPrototype(U*& p)
|
||||
{ return DoGetPrototype(*this, p); }
|
||||
|
||||
|
||||
template <class U>
|
||||
void SetPrototype(U* pObj)
|
||||
{ DoSetPrototype(*this, pObj); }
|
||||
|
||||
|
||||
AbstractProduct* DoCreate(Type2Type<AbstractProduct>)
|
||||
{
|
||||
assert(pPrototype_);
|
||||
return pPrototype_->Clone();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
AbstractProduct* pPrototype_;
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// The Loki Library
|
||||
// Data Generator by Shannon Barber
|
||||
// This code DOES NOT accompany the book:
|
||||
// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
|
||||
// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
|
||||
// Patterns Applied". Copyright (c) 2001. Addison-Wesley.
|
||||
//
|
||||
// Code covered by the MIT License
|
||||
|
@ -15,7 +15,7 @@
|
|||
// $Id$
|
||||
|
||||
|
||||
#include "Typelist.h"
|
||||
#include <loki/Typelist.h>
|
||||
|
||||
//Reference version
|
||||
|
||||
|
@ -64,7 +64,7 @@ namespace Loki
|
|||
};
|
||||
template <class TList, template <class> class GenFunc>
|
||||
struct IterateTypes;
|
||||
|
||||
|
||||
template <class T1, class T2, template <class> class GenFunc>
|
||||
struct IterateTypes<Typelist<T1, T2>, GenFunc>
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ namespace Loki
|
|||
tail.operator()(ii);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class AtomicType, template <class> class GenFunc>
|
||||
struct IterateTypes
|
||||
{
|
||||
|
@ -91,7 +91,7 @@ namespace Loki
|
|||
++ii; //Is this even needed?
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <template <class> class GenFunc>
|
||||
struct IterateTypes<NullType, GenFunc>
|
||||
{
|
||||
|
@ -99,7 +99,7 @@ namespace Loki
|
|||
void operator()(II ii)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
template<typename Types, template <class> class UnitFunc, typename II>
|
||||
void iterate_types(II ii)
|
||||
{
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
// $Id$
|
||||
|
||||
|
||||
#include "LokiTypeInfo.h"
|
||||
#include "Functor.h"
|
||||
#include "AssocVector.h"
|
||||
#include "SmallObj.h"
|
||||
#include "Sequence.h"
|
||||
#include <loki/LokiTypeInfo.h>
|
||||
#include <loki/Functor.h>
|
||||
#include <loki/AssocVector.h>
|
||||
#include <loki/SmallObj.h>
|
||||
#include <loki/Sequence.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
|
@ -33,7 +33,7 @@
|
|||
* \defgroup FactoryGroup Factory
|
||||
* \ingroup FactoriesGroup
|
||||
* \brief Implements a generic object factory.
|
||||
*
|
||||
*
|
||||
* <i>The Factory Method pattern is an object-oriented design pattern.
|
||||
* Like other creational patterns, it deals with the problem of creating objects
|
||||
* (products) without specifying the exact class of object that will be created.
|
||||
|
@ -46,7 +46,7 @@
|
|||
* whose main purpose is creation of objects.</i>
|
||||
* <div ALIGN="RIGHT"><a href="http://en.wikipedia.org/wiki/Factory_method_pattern">
|
||||
* Wikipedia</a></div>
|
||||
*
|
||||
*
|
||||
* Loki proposes a generic version of the Factory. Here is a typical use.<br>
|
||||
* <code><br>
|
||||
* 1. Factory< AbstractProduct, int > aFactory;<br>
|
||||
|
@ -62,7 +62,7 @@
|
|||
* ProductCreator by registering them into the Factory.<br>
|
||||
* A ProductCreator is a just a function that will return the right object. ie <br>
|
||||
* <code>
|
||||
* Product* createProductNull()<br>
|
||||
* Product* createProductNull()<br>
|
||||
* {<br>
|
||||
* return new Product<br>
|
||||
* }<br>
|
||||
|
@ -80,11 +80,11 @@ namespace Loki
|
|||
* \defgroup FactoryErrorPoliciesGroup Factory Error Policies
|
||||
* \ingroup FactoryGroup
|
||||
* \brief Manages the "Unknown Type" error in an object factory
|
||||
*
|
||||
*
|
||||
* \class DefaultFactoryError
|
||||
* \ingroup FactoryErrorPoliciesGroup
|
||||
* \brief Default policy that throws an exception
|
||||
*
|
||||
* \brief Default policy that throws an exception
|
||||
*
|
||||
*/
|
||||
|
||||
template <typename IdentifierType, class AbstractProduct>
|
||||
|
@ -1065,9 +1065,9 @@ template <typename AP, typename Id, typename P1 >
|
|||
return NULL;
|
||||
}
|
||||
|
||||
typename IdToProductMap::iterator i =
|
||||
typename IdToProductMap::iterator i =
|
||||
associations_.find(typeid(*model));
|
||||
|
||||
|
||||
if (i != associations_.end())
|
||||
{
|
||||
return (i->second)(model);
|
||||
|
@ -1079,7 +1079,7 @@ template <typename AP, typename Id, typename P1 >
|
|||
typedef AssocVector<TypeInfo, ProductCreator> IdToProductMap;
|
||||
IdToProductMap associations_;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Loki
|
||||
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
// $Id$
|
||||
|
||||
|
||||
#include "Typelist.h"
|
||||
#include "Sequence.h"
|
||||
#include "EmptyType.h"
|
||||
#include "SmallObj.h"
|
||||
#include "TypeTraits.h"
|
||||
#include <loki/Typelist.h>
|
||||
#include <loki/Sequence.h>
|
||||
#include <loki/EmptyType.h>
|
||||
#include <loki/SmallObj.h>
|
||||
#include <loki/TypeTraits.h>
|
||||
#include <typeinfo>
|
||||
#include <memory>
|
||||
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
// The Loki Library
|
||||
// Copyright (c) 2001 by Andrei Alexandrescu
|
||||
// This code accompanies the book:
|
||||
// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
|
||||
// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
|
||||
// Patterns Applied". Copyright (c) 2001. Addison-Wesley.
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// permission notice appear in supporting documentation.
|
||||
// The author or Addison-Wesley Longman make no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// The author or Addison-Wesley Longman make no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// without express or implied warranty.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef LOKI_HIERARCHYGENERATORS_INC_
|
||||
|
@ -18,14 +18,14 @@
|
|||
// $Id$
|
||||
|
||||
|
||||
#include "Typelist.h"
|
||||
#include "TypeTraits.h"
|
||||
#include "EmptyType.h"
|
||||
#include <loki/Typelist.h>
|
||||
#include <loki/TypeTraits.h>
|
||||
#include <loki/EmptyType.h>
|
||||
|
||||
namespace Loki
|
||||
{
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1300
|
||||
#pragma warning( push )
|
||||
#pragma warning( push )
|
||||
// 'class1' : base-class 'class2' is already a base-class of 'class3'
|
||||
#pragma warning( disable : 4584 )
|
||||
#endif // _MSC_VER
|
||||
|
@ -35,27 +35,27 @@ namespace Loki
|
|||
// Generates a scattered hierarchy starting from a typelist and a template
|
||||
// Invocation (TList is a typelist, Unit is a template of one arg):
|
||||
// GenScatterHierarchy<TList, Unit>
|
||||
// The generated class inherits all classes generated by instantiating the
|
||||
// template 'Unit' with the types contained in TList
|
||||
// The generated class inherits all classes generated by instantiating the
|
||||
// template 'Unit' with the types contained in TList
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace Private
|
||||
{
|
||||
// The following type helps to overcome subtle flaw in the original
|
||||
// implementation of GenScatterHierarchy.
|
||||
// The flaw is revealed when the input type list of GenScatterHierarchy
|
||||
// contains more then one element of the same type (e.g. LOKI_TYPELIST_2(int, int)).
|
||||
// In this case GenScatterHierarchy will contain multiple bases of the same
|
||||
// The following type helps to overcome subtle flaw in the original
|
||||
// implementation of GenScatterHierarchy.
|
||||
// The flaw is revealed when the input type list of GenScatterHierarchy
|
||||
// contains more then one element of the same type (e.g. LOKI_TYPELIST_2(int, int)).
|
||||
// In this case GenScatterHierarchy will contain multiple bases of the same
|
||||
// type and some of them will not be reachable (per 10.3).
|
||||
// For example before the fix the first element of Tuple<LOKI_TYPELIST_2(int, int)>
|
||||
// is not reachable in any way!
|
||||
template<class, class>
|
||||
template<class, class>
|
||||
struct ScatterHierarchyTag;
|
||||
}
|
||||
|
||||
template <class TList, template <class> class Unit>
|
||||
class GenScatterHierarchy;
|
||||
|
||||
|
||||
template <class T1, class T2, template <class> class Unit>
|
||||
class GenScatterHierarchy<Typelist<T1, T2>, Unit>
|
||||
: public GenScatterHierarchy<Private::ScatterHierarchyTag<T1, T2>, Unit>
|
||||
|
@ -71,10 +71,10 @@ namespace Loki
|
|||
typedef Unit<T> Result;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// In the middle *unique* class that resolve possible ambiguity
|
||||
template <class T1, class T2, template <class> class Unit>
|
||||
class GenScatterHierarchy<Private::ScatterHierarchyTag<T1, T2>, Unit>
|
||||
class GenScatterHierarchy<Private::ScatterHierarchyTag<T1, T2>, Unit>
|
||||
: public GenScatterHierarchy<T1, Unit>
|
||||
{
|
||||
};
|
||||
|
@ -88,7 +88,7 @@ namespace Loki
|
|||
typedef Unit<T> Result;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template <template <class> class Unit>
|
||||
class GenScatterHierarchy<NullType, Unit>
|
||||
{
|
||||
|
@ -97,14 +97,14 @@ namespace Loki
|
|||
typedef Unit<T> Result;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// function template Field
|
||||
// Accesses a field in an object of a type generated with GenScatterHierarchy
|
||||
// Invocation (obj is an object of a type H generated with GenScatterHierarchy,
|
||||
// T is a type in the typelist used to generate H):
|
||||
// Field<T>(obj)
|
||||
// returns a reference to Unit<T>, where Unit is the template used to generate H
|
||||
// returns a reference to Unit<T>, where Unit is the template used to generate H
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <class T, class H>
|
||||
|
@ -112,16 +112,16 @@ namespace Loki
|
|||
{
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
template <class T, class H>
|
||||
const typename H::template Rebind<T>::Result& Field(const H& obj)
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// function template TupleUnit
|
||||
// The building block of tuples
|
||||
// The building block of tuples
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <class T>
|
||||
|
@ -134,8 +134,8 @@ namespace Loki
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class template Tuple
|
||||
// Implements a tuple class that holds a number of values and provides field
|
||||
// access to them via the Field function (below)
|
||||
// Implements a tuple class that holds a number of values and provides field
|
||||
// access to them via the Field function (below)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <class TList>
|
||||
|
@ -149,13 +149,13 @@ namespace Loki
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <class H, unsigned int i> struct FieldHelper;
|
||||
|
||||
|
||||
template <class H>
|
||||
struct FieldHelper<H, 0>
|
||||
{
|
||||
typedef typename H::TList::Head ElementType;
|
||||
typedef typename H::template Rebind<ElementType>::Result UnitType;
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
isTuple = Conversion<UnitType, TupleUnit<ElementType> >::sameType,
|
||||
|
@ -163,16 +163,16 @@ namespace Loki
|
|||
};
|
||||
|
||||
typedef const typename H::LeftBase ConstLeftBase;
|
||||
|
||||
typedef typename Select<isConst, ConstLeftBase,
|
||||
|
||||
typedef typename Select<isConst, ConstLeftBase,
|
||||
typename H::LeftBase>::Result LeftBase;
|
||||
|
||||
typedef typename Select<isTuple, ElementType,
|
||||
|
||||
typedef typename Select<isTuple, ElementType,
|
||||
UnitType>::Result UnqualifiedResultType;
|
||||
|
||||
typedef typename Select<isConst, const UnqualifiedResultType,
|
||||
UnqualifiedResultType>::Result ResultType;
|
||||
|
||||
|
||||
static ResultType& Do(H& obj)
|
||||
{
|
||||
LeftBase& leftBase = obj;
|
||||
|
@ -185,7 +185,7 @@ namespace Loki
|
|||
{
|
||||
typedef typename TL::TypeAt<typename H::TList, i>::Result ElementType;
|
||||
typedef typename H::template Rebind<ElementType>::Result UnitType;
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
isTuple = Conversion<UnitType, TupleUnit<ElementType> >::sameType,
|
||||
|
@ -193,16 +193,16 @@ namespace Loki
|
|||
};
|
||||
|
||||
typedef const typename H::RightBase ConstRightBase;
|
||||
|
||||
typedef typename Select<isConst, ConstRightBase,
|
||||
|
||||
typedef typename Select<isConst, ConstRightBase,
|
||||
typename H::RightBase>::Result RightBase;
|
||||
|
||||
typedef typename Select<isTuple, ElementType,
|
||||
typedef typename Select<isTuple, ElementType,
|
||||
UnitType>::Result UnqualifiedResultType;
|
||||
|
||||
typedef typename Select<isConst, const UnqualifiedResultType,
|
||||
UnqualifiedResultType>::Result ResultType;
|
||||
|
||||
|
||||
static ResultType& Do(H& obj)
|
||||
{
|
||||
RightBase& rightBase = obj;
|
||||
|
@ -217,7 +217,7 @@ namespace Loki
|
|||
// i is the index of a type in the typelist used to generate H):
|
||||
// Field<i>(obj)
|
||||
// returns a reference to Unit<T>, where Unit is the template used to generate H
|
||||
// and T is the i-th type in the typelist
|
||||
// and T is the i-th type in the typelist
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <int i, class H>
|
||||
|
@ -226,14 +226,14 @@ namespace Loki
|
|||
{
|
||||
return FieldHelper<H, i>::Do(obj);
|
||||
}
|
||||
|
||||
|
||||
// template <int i, class H>
|
||||
// const typename FieldHelper<H, i>::ResultType&
|
||||
// Field(const H& obj)
|
||||
// {
|
||||
// return FieldHelper<H, i>::Do(obj);
|
||||
// }
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class template GenLinearHierarchy
|
||||
// Generates a linear hierarchy starting from a typelist and a template
|
||||
|
@ -248,7 +248,7 @@ namespace Loki
|
|||
class Root = EmptyType
|
||||
>
|
||||
class GenLinearHierarchy;
|
||||
|
||||
|
||||
template
|
||||
<
|
||||
class T1,
|
||||
|
@ -283,7 +283,7 @@ namespace Loki
|
|||
};
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1300
|
||||
#pragma warning( pop )
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
} // namespace Loki
|
||||
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
// The Loki Library
|
||||
// Copyright (c) 2001 by Andrei Alexandrescu
|
||||
// This code accompanies the book:
|
||||
// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
|
||||
// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
|
||||
// Patterns Applied". Copyright (c) 2001. Addison-Wesley.
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// permission notice appear in supporting documentation.
|
||||
// The author or Addison-Wesley Longman make no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// The author or Addison-Wesley Longman make no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// without express or implied warranty.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef LOKI_LOKITYPEINFO_INC_
|
||||
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include <typeinfo>
|
||||
#include <cassert>
|
||||
#include "Typelist.h"
|
||||
#include <loki/Typelist.h>
|
||||
|
||||
namespace Loki
|
||||
{
|
||||
|
@ -45,24 +45,24 @@ namespace Loki
|
|||
private:
|
||||
const std::type_info* pInfo_;
|
||||
};
|
||||
|
||||
|
||||
// Implementation
|
||||
|
||||
|
||||
inline TypeInfo::TypeInfo()
|
||||
{
|
||||
class Nil {};
|
||||
pInfo_ = &typeid(Nil);
|
||||
assert(pInfo_);
|
||||
}
|
||||
|
||||
|
||||
inline TypeInfo::TypeInfo(const std::type_info& ti)
|
||||
: pInfo_(&ti)
|
||||
{ assert(pInfo_); }
|
||||
|
||||
|
||||
inline bool TypeInfo::before(const TypeInfo& rhs) const
|
||||
{
|
||||
assert(pInfo_);
|
||||
// type_info::before return type is int in some VC libraries
|
||||
// type_info::before return type is int in some VC libraries
|
||||
return pInfo_->before(*rhs.pInfo_) != 0;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ namespace Loki
|
|||
assert(pInfo_);
|
||||
return *pInfo_;
|
||||
}
|
||||
|
||||
|
||||
inline const char* TypeInfo::name() const
|
||||
{
|
||||
assert(pInfo_);
|
||||
|
@ -79,7 +79,7 @@ namespace Loki
|
|||
}
|
||||
|
||||
// Comparison operators
|
||||
|
||||
|
||||
inline bool operator==(const TypeInfo& lhs, const TypeInfo& rhs)
|
||||
// type_info::operator== return type is int in some VC libraries
|
||||
{ return (lhs.Get() == rhs.Get()) != 0; }
|
||||
|
@ -88,14 +88,14 @@ namespace Loki
|
|||
{ return lhs.before(rhs); }
|
||||
|
||||
inline bool operator!=(const TypeInfo& lhs, const TypeInfo& rhs)
|
||||
{ return !(lhs == rhs); }
|
||||
|
||||
{ return !(lhs == rhs); }
|
||||
|
||||
inline bool operator>(const TypeInfo& lhs, const TypeInfo& rhs)
|
||||
{ return rhs < lhs; }
|
||||
|
||||
|
||||
inline bool operator<=(const TypeInfo& lhs, const TypeInfo& rhs)
|
||||
{ return !(lhs > rhs); }
|
||||
|
||||
|
||||
inline bool operator>=(const TypeInfo& lhs, const TypeInfo& rhs)
|
||||
{ return !(lhs < rhs); }
|
||||
}
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
// $Id$
|
||||
|
||||
|
||||
#include "Typelist.h"
|
||||
#include "LokiTypeInfo.h"
|
||||
#include "Functor.h"
|
||||
#include "AssocVector.h"
|
||||
#include <loki/Typelist.h>
|
||||
#include <loki/LokiTypeInfo.h>
|
||||
#include <loki/Functor.h>
|
||||
#include <loki/AssocVector.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// IMPORTANT NOTE:
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// The Loki Library
|
||||
// Copyright (c) 2005 Peter Kümmel
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// permission notice appear in supporting documentation.
|
||||
// The author makes no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// The author makes no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// without express or implied warranty.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef LOKI_ORDEREDSTATIC_INC_
|
||||
|
@ -18,10 +18,10 @@
|
|||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
#include "LokiExport.h"
|
||||
#include "Singleton.h"
|
||||
#include "Typelist.h"
|
||||
#include "Sequence.h"
|
||||
#include <loki/LokiExport.h>
|
||||
#include <loki/Singleton.h>
|
||||
#include <loki/Typelist.h>
|
||||
#include <loki/Sequence.h>
|
||||
|
||||
// usage: see test/OrderedStatic
|
||||
|
||||
|
@ -37,17 +37,17 @@ namespace Loki
|
|||
{
|
||||
public:
|
||||
virtual void createObject() = 0;
|
||||
|
||||
|
||||
protected:
|
||||
OrderedStaticCreatorFunc();
|
||||
virtual ~OrderedStaticCreatorFunc();
|
||||
|
||||
|
||||
private:
|
||||
OrderedStaticCreatorFunc(const OrderedStaticCreatorFunc&);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// template base clase for OrderedStatic template,
|
||||
// template base clase for OrderedStatic template,
|
||||
// common for all specializations
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
template<class T>
|
||||
|
@ -69,11 +69,11 @@ namespace Loki
|
|||
OrderedStaticBase(unsigned int longevity) : val_(0), longevity_(longevity)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
virtual ~OrderedStaticBase()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void SetLongevity(T* ptr)
|
||||
{
|
||||
val_=ptr;
|
||||
|
@ -86,11 +86,11 @@ namespace Loki
|
|||
OrderedStaticBase& operator=(const OrderedStaticBase&);
|
||||
T* val_;
|
||||
unsigned int longevity_;
|
||||
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// OrderedStaticManagerClass implements details
|
||||
// OrderedStaticManagerClass implements details
|
||||
// OrderedStaticManager is then defined as a Singleton
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
class LOKI_EXPORT OrderedStaticManagerClass
|
||||
|
@ -107,7 +107,7 @@ namespace Loki
|
|||
private:
|
||||
OrderedStaticManagerClass(const OrderedStaticManagerClass&);
|
||||
OrderedStaticManagerClass& operator=(const OrderedStaticManagerClass&);
|
||||
|
||||
|
||||
struct Data
|
||||
{
|
||||
Data(unsigned int,OrderedStaticCreatorFunc*, Creator);
|
||||
|
@ -129,7 +129,7 @@ namespace Loki
|
|||
|
||||
typedef Loki::SingletonHolder
|
||||
<
|
||||
Loki::Private::OrderedStaticManagerClass,
|
||||
Loki::Private::OrderedStaticManagerClass,
|
||||
Loki::CreateUsingNew,
|
||||
Loki::NoDestroy,
|
||||
Loki::SingleThreaded
|
||||
|
@ -137,7 +137,7 @@ namespace Loki
|
|||
OrderedStaticManager;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// template OrderedStatic template:
|
||||
// template OrderedStatic template:
|
||||
// L : longevity
|
||||
// T : object type
|
||||
// TList : creator parameters
|
||||
|
@ -154,7 +154,7 @@ namespace Loki
|
|||
template<unsigned int L, class T>
|
||||
class OrderedStatic<L, T, Loki::NullType> : public Private::OrderedStaticBase<T>
|
||||
{
|
||||
public:
|
||||
public:
|
||||
OrderedStatic() : Private::OrderedStaticBase<T>(L)
|
||||
{
|
||||
OrderedStaticManager::Instance().registerObject
|
||||
|
@ -180,7 +180,7 @@ namespace Loki
|
|||
OrderedStaticManager::Instance().registerObject
|
||||
(L,this,&Private::OrderedStaticCreatorFunc::createObject);
|
||||
}
|
||||
|
||||
|
||||
void createObject()
|
||||
{
|
||||
Private::OrderedStaticBase<T>::SetLongevity(new T(para_));
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// The Loki Library
|
||||
// Copyright (c) 2006 Peter Kümmel
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// permission notice appear in supporting documentation.
|
||||
// The author makes no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// The author makes no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// without express or implied warranty.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef LOKI_REGISTER_INC_
|
||||
|
@ -15,12 +15,12 @@
|
|||
// $Id$
|
||||
|
||||
|
||||
#include "TypeManip.h"
|
||||
#include "HierarchyGenerators.h"
|
||||
#include "ForEachType.h"
|
||||
#include <loki/TypeManip.h>
|
||||
#include <loki/HierarchyGenerators.h>
|
||||
#include <loki/ForEachType.h>
|
||||
|
||||
|
||||
/// \defgroup RegisterGroup Register
|
||||
/// \defgroup RegisterGroup Register
|
||||
|
||||
namespace Loki
|
||||
{
|
||||
|
@ -35,14 +35,14 @@ namespace Loki
|
|||
/// \ingroup RegisterGroup
|
||||
/// Must be specialized be the user
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
template<class T>
|
||||
template<class T>
|
||||
bool RegisterFunction();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// \ingroup RegisterGroup
|
||||
/// Must be specialized be the user
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
template<class T>
|
||||
template<class T>
|
||||
bool UnRegisterFunction();
|
||||
|
||||
namespace Private
|
||||
|
@ -52,7 +52,7 @@ namespace Loki
|
|||
template< int Index, typename T >
|
||||
void operator()()
|
||||
{
|
||||
RegisterFunction<T>();
|
||||
RegisterFunction<T>();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -118,8 +118,8 @@ namespace Loki
|
|||
/// see test/Register
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#define LOKI_CONCATE(a,b,c,d) a ## b ## c ## d
|
||||
|
||||
#define LOKI_CONCATE(a,b,c,d) a ## b ## c ## d
|
||||
#define LOKI_CONCAT(a,b,c,d) LOKI_CONCATE(a,b,c,d)
|
||||
|
||||
#define LOKI_CHECK_CLASS_IN_LIST( CLASS , LIST ) \
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// $Id$
|
||||
|
||||
|
||||
#include "Typelist.h"
|
||||
#include <loki/Typelist.h>
|
||||
|
||||
namespace Loki
|
||||
{
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
// $Id$
|
||||
|
||||
|
||||
#include "LokiExport.h"
|
||||
#include "Threads.h"
|
||||
#include <loki/LokiExport.h>
|
||||
#include <loki/Threads.h>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
#include <cassert>
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
// $Id$
|
||||
|
||||
|
||||
#include "LokiExport.h"
|
||||
#include "Threads.h"
|
||||
#include "Singleton.h"
|
||||
#include <loki/LokiExport.h>
|
||||
#include <loki/Threads.h>
|
||||
#include <loki/Singleton.h>
|
||||
#include <cstddef>
|
||||
#include <new> // needed for std::nothrow_t parameter.
|
||||
|
||||
|
|
|
@ -29,12 +29,12 @@
|
|||
/// \defgroup SmartPointerCheckingGroup Checking policies
|
||||
/// \ingroup SmartPointerGroup
|
||||
|
||||
#include "LokiExport.h"
|
||||
#include "SmallObj.h"
|
||||
#include "TypeManip.h"
|
||||
#include "static_check.h"
|
||||
#include "RefToValue.h"
|
||||
#include "ConstPolicy.h"
|
||||
#include <loki/LokiExport.h>
|
||||
#include <loki/SmallObj.h>
|
||||
#include <loki/TypeManip.h>
|
||||
#include <loki/static_check.h>
|
||||
#include <loki/RefToValue.h>
|
||||
#include <loki/ConstPolicy.h>
|
||||
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -18,9 +18,9 @@
|
|||
// $Id$
|
||||
|
||||
|
||||
#include "NullType.h"
|
||||
#include "TypeManip.h"
|
||||
#include "TypelistMacros.h"
|
||||
#include <loki/NullType.h>
|
||||
#include <loki/TypeManip.h>
|
||||
#include <loki/TypelistMacros.h>
|
||||
|
||||
|
||||
namespace Loki
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
// The Loki Library
|
||||
// Copyright (c) 2001 by Andrei Alexandrescu
|
||||
// This code accompanies the book:
|
||||
// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
|
||||
// Alexandrescu, Andrei. "Modern C++ Design: Generic Programming and Design
|
||||
// Patterns Applied". Copyright (c) 2001. Addison-Wesley.
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// Permission to use, copy, modify, distribute and sell this software for any
|
||||
// purpose is hereby granted without fee, provided that the above copyright
|
||||
// notice appear in all copies and that both that copyright notice and this
|
||||
// permission notice appear in supporting documentation.
|
||||
// The author or Addison-Wesley Longman make no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// The author or Addison-Wesley Longman make no representations about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// without express or implied warranty.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef LOKI_VISITOR_INC_
|
||||
|
@ -20,15 +20,15 @@
|
|||
|
||||
/// \defgroup VisitorGroup Visitor
|
||||
|
||||
#include "Typelist.h"
|
||||
#include "HierarchyGenerators.h"
|
||||
#include <loki/Typelist.h>
|
||||
#include <loki/HierarchyGenerators.h>
|
||||
|
||||
namespace Loki
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// \class BaseVisitor
|
||||
///
|
||||
///
|
||||
/// \ingroup VisitorGroup
|
||||
/// The base class of any Acyclic Visitor
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -38,7 +38,7 @@ namespace Loki
|
|||
public:
|
||||
virtual ~BaseVisitor() {}
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// \class Visitor
|
||||
///
|
||||
|
@ -48,7 +48,7 @@ namespace Loki
|
|||
/// \par Usage
|
||||
///
|
||||
/// Defining the visitable class:
|
||||
///
|
||||
///
|
||||
/// \code
|
||||
/// class RasterBitmap : public BaseVisitable<>
|
||||
/// {
|
||||
|
@ -59,7 +59,7 @@ namespace Loki
|
|||
///
|
||||
/// Way 1 to define a visitor:
|
||||
/// \code
|
||||
/// class SomeVisitor :
|
||||
/// class SomeVisitor :
|
||||
/// public BaseVisitor // required
|
||||
/// public Visitor<RasterBitmap>,
|
||||
/// public Visitor<Paragraph>
|
||||
|
@ -72,7 +72,7 @@ namespace Loki
|
|||
///
|
||||
/// Way 2 to define the visitor:
|
||||
/// \code
|
||||
/// class SomeVisitor :
|
||||
/// class SomeVisitor :
|
||||
/// public BaseVisitor // required
|
||||
/// public Visitor<LOKI_TYPELIST_2(RasterBitmap, Paragraph)>
|
||||
/// {
|
||||
|
@ -84,7 +84,7 @@ namespace Loki
|
|||
///
|
||||
/// Way 3 to define the visitor:
|
||||
/// \code
|
||||
/// class SomeVisitor :
|
||||
/// class SomeVisitor :
|
||||
/// public BaseVisitor // required
|
||||
/// public Visitor<Seq<RasterBitmap, Paragraph>::Type>
|
||||
/// {
|
||||
|
@ -97,7 +97,7 @@ namespace Loki
|
|||
/// \par Using const visit functions:
|
||||
///
|
||||
/// Defining the visitable class (true for const):
|
||||
///
|
||||
///
|
||||
/// \code
|
||||
/// class RasterBitmap : public BaseVisitable<void, DefaultCatchAll, true>
|
||||
/// {
|
||||
|
@ -108,7 +108,7 @@ namespace Loki
|
|||
///
|
||||
/// Defining the visitor which only calls const member functions:
|
||||
/// \code
|
||||
/// class SomeVisitor :
|
||||
/// class SomeVisitor :
|
||||
/// public BaseVisitor // required
|
||||
/// public Visitor<RasterBitmap, void, true>,
|
||||
/// {
|
||||
|
@ -119,7 +119,7 @@ namespace Loki
|
|||
///
|
||||
/// \par Example:
|
||||
///
|
||||
/// test/Visitor/main.cpp
|
||||
/// test/Visitor/main.cpp
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <class T, typename R = void, bool ConstVisit = false>
|
||||
|
@ -150,7 +150,7 @@ namespace Loki
|
|||
// This specialization is not present in the book. It makes it easier to define
|
||||
// Visitors for multiple types in a shot by using a typelist. Example:
|
||||
//
|
||||
// class SomeVisitor :
|
||||
// class SomeVisitor :
|
||||
// public BaseVisitor // required
|
||||
// public Visitor<LOKI_TYPELIST_2(RasterBitmap, Paragraph)>
|
||||
// {
|
||||
|
@ -169,7 +169,7 @@ namespace Loki
|
|||
// using Visitor<Head, R>::Visit;
|
||||
// using Visitor<Tail, R>::Visit;
|
||||
};
|
||||
|
||||
|
||||
template <class Head, typename R>
|
||||
class Visitor<Typelist<Head, NullType>, R, false> : public Visitor<Head, R, false>
|
||||
{
|
||||
|
@ -187,7 +187,7 @@ namespace Loki
|
|||
// using Visitor<Head, R>::Visit;
|
||||
// using Visitor<Tail, R>::Visit;
|
||||
};
|
||||
|
||||
|
||||
template <class Head, typename R>
|
||||
class Visitor<Typelist<Head, NullType>, R, true> : public Visitor<Head, R, true>
|
||||
{
|
||||
|
@ -216,7 +216,7 @@ namespace Loki
|
|||
virtual R Visit(Head&)
|
||||
{ return R(); }
|
||||
};
|
||||
|
||||
|
||||
template <class Head, typename R>
|
||||
class BaseVisitorImpl<Typelist<Head, NullType>, R>
|
||||
: public Visitor<Head, R>
|
||||
|
@ -225,7 +225,7 @@ namespace Loki
|
|||
virtual R Visit(Head&)
|
||||
{ return R(); }
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// class template BaseVisitable
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -241,9 +241,9 @@ struct DefaultCatchAll
|
|||
// class template BaseVisitable
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template
|
||||
template
|
||||
<
|
||||
typename R = void,
|
||||
typename R = void,
|
||||
template <typename, class> class CatchAll = DefaultCatchAll,
|
||||
bool ConstVisitable = false
|
||||
>
|
||||
|
@ -256,7 +256,7 @@ struct DefaultCatchAll
|
|||
typedef R ReturnType;
|
||||
virtual ~BaseVisitable() {}
|
||||
virtual ReturnType Accept(BaseVisitor&) = 0;
|
||||
|
||||
|
||||
protected: // give access only to the hierarchy
|
||||
template <class T>
|
||||
static ReturnType AcceptImpl(T& visited, BaseVisitor& guest)
|
||||
|
@ -277,7 +277,7 @@ struct DefaultCatchAll
|
|||
typedef R ReturnType;
|
||||
virtual ~BaseVisitable() {}
|
||||
virtual ReturnType Accept(BaseVisitor&) const = 0;
|
||||
|
||||
|
||||
protected: // give access only to the hierarchy
|
||||
template <class T>
|
||||
static ReturnType AcceptImpl(const T& visited, BaseVisitor& guest)
|
||||
|
@ -295,7 +295,7 @@ struct DefaultCatchAll
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// \def LOKI_DEFINE_VISITABLE()
|
||||
/// \ingroup VisitorGroup
|
||||
/// Put it in every class that you want to make visitable
|
||||
/// Put it in every class that you want to make visitable
|
||||
/// (in addition to deriving it from BaseVisitable<R>)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -306,7 +306,7 @@ struct DefaultCatchAll
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// \def LOKI_DEFINE_CONST_VISITABLE()
|
||||
/// \ingroup VisitorGroup
|
||||
/// Put it in every class that you want to make visitable by const member
|
||||
/// Put it in every class that you want to make visitable by const member
|
||||
/// functions (in addition to deriving it from BaseVisitable<R>)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -318,7 +318,7 @@ struct DefaultCatchAll
|
|||
/// \class CyclicVisitor
|
||||
///
|
||||
/// \ingroup VisitorGroup
|
||||
/// Put it in every class that you want to make visitable (in addition to
|
||||
/// Put it in every class that you want to make visitable (in addition to
|
||||
/// deriving it from BaseVisitable<R>
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -328,7 +328,7 @@ struct DefaultCatchAll
|
|||
public:
|
||||
typedef R ReturnType;
|
||||
// using Visitor<TList, R>::Visit;
|
||||
|
||||
|
||||
template <class Visited>
|
||||
ReturnType GenericVisit(Visited& host)
|
||||
{
|
||||
|
@ -336,7 +336,7 @@ struct DefaultCatchAll
|
|||
return subObj.Visit(host);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// \def LOKI_DEFINE_CYCLIC_VISITABLE(SomeVisitor)
|
||||
/// \ingroup VisitorGroup
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue