Added Doxygen documentation
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@771 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
6060322298
commit
228666b49c
4 changed files with 104 additions and 41 deletions
|
@ -25,6 +25,19 @@
|
|||
|
||||
#include <cassert>
|
||||
|
||||
/**
|
||||
* \defgroup FactoriesGroup Factories
|
||||
* \defgroup AbstractFactoryGroup Abstract Factory
|
||||
* \ingroup FactoriesGroup
|
||||
* \brief Implements an abstract object factory.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \class AbstractFactory
|
||||
* \ingroup AbstractFactoryGroup
|
||||
* \brief Implements an abstract object factory.
|
||||
*/
|
||||
|
||||
namespace Loki
|
||||
{
|
||||
|
||||
|
|
|
@ -53,9 +53,9 @@ using std::cout;
|
|||
using std::endl;
|
||||
|
||||
/**
|
||||
* \defgroup FactoryGroup Factory
|
||||
* \defgroup FactoriesGroup Factories
|
||||
* \defgroup CachedFactoryGroup Cached Factory
|
||||
* \ingroup FactoryGroup
|
||||
* \ingroup FactoriesGroup
|
||||
* \brief CachedFactory provides an extension of a Factory with caching
|
||||
* support.
|
||||
*
|
||||
|
@ -630,7 +630,7 @@ namespace Loki
|
|||
|
||||
/**
|
||||
* \class CachedFactory
|
||||
* \ingroup FactoryGroup
|
||||
* \ingroup CachedFactoryGroup
|
||||
* \brief Factory with caching support
|
||||
*
|
||||
* This class acts as a Factory (it creates objects)
|
||||
|
|
|
@ -28,17 +28,64 @@
|
|||
//unreachable code if OnUnknownType throws an exception
|
||||
#endif
|
||||
|
||||
/// \defgroup FactoryGroup Factory
|
||||
/**
|
||||
* \defgroup FactoriesGroup Factories
|
||||
* \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.
|
||||
* Factory Method, one of the patterns from the Design Patterns book, handles
|
||||
* this problem by defining a separate method for creating the objects, which
|
||||
* subclasses can then override to specify the derived type of product that will
|
||||
* be created.
|
||||
* <br>
|
||||
* More generally, the term Factory Method is often used to refer to any method
|
||||
* 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>
|
||||
* 2. aFactory.Register( 1, createProductNull );<br>
|
||||
* 3. aFactory.CreateObject( 1 ); <br>
|
||||
* </code><br>
|
||||
* <br>
|
||||
* - 1. The declaration<br>
|
||||
* You want a Factory that produces AbstractProduct.<br>
|
||||
* The client will refer to a creation method through an int.<br>
|
||||
* - 2.The registration<br>
|
||||
* The code that will contribute to the Factory will now need to declare its
|
||||
* 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>
|
||||
* {<br>
|
||||
* return new Product<br>
|
||||
* }<br>
|
||||
* </code><br>
|
||||
* - 3. The use<br>
|
||||
* Now the client can create object by calling the Factory's CreateObject method
|
||||
* with the right identifier. If the ProductCreator were to have arguments
|
||||
* (<i>ie :Product* createProductParm( int a, int b )</i>)
|
||||
*/
|
||||
|
||||
namespace Loki
|
||||
{
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// \class DefaultFactoryError
|
||||
///
|
||||
/// \ingroup FactoryGroup
|
||||
/// Manages the "Unknown Type" error in an object factory
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* \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
|
||||
*
|
||||
*/
|
||||
|
||||
template <typename IdentifierType, class AbstractProduct>
|
||||
struct DefaultFactoryError
|
||||
|
@ -974,12 +1021,15 @@ template <typename AP, typename Id, typename P1 >
|
|||
|
||||
#endif //#define ENABLE_NEW_FACTORY_CODE
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// \class CloneFactory
|
||||
///
|
||||
/// \ingroup FactoryGroup
|
||||
/// Implements a generic cloning factory
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/**
|
||||
* \defgroup CloneFactoryGroup Clone Factory
|
||||
* \ingroup FactoriesGroup
|
||||
* \brief Creates a copy from a polymorphic object.
|
||||
*
|
||||
* \class CloneFactory
|
||||
* \ingroup CloneFactoryGroup
|
||||
* \brief Creates a copy from a polymorphic object.
|
||||
*/
|
||||
|
||||
template
|
||||
<
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace Loki
|
|||
bool operator<(const Key<F, I> &k1, const Key<F, I> &k2);
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* A Key class
|
||||
*/
|
||||
template<
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue