Homepage Demos Overview Downloads Tutorials Reference
Credits
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Search

Factory.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_Factory_h_
00003 #define INCLUDED_Factory_h_
00004 
00005 //! A lightweight class to override for constructing new objects (if you need to pass constructors parameters, etc.)
00006 /*! Say you don't want to construct your behavior at boot-up (if it's big and might not even be
00007  *  used) but your behavior needs special setup during creation (might be invoked
00008  *  several difference ways for instance) then you'll want to subclass this to do the setup when
00009  *  your behavior is activated.\n
00010  *  The default is to simply call the default constructor */
00011 template<class B>
00012 class Factory {
00013 public:
00014   static B* construct() { return new B(); } //!< Just returns a new B
00015 };
00016 
00017 //! Uses template to specify a constant parameter to the constructor
00018 template<class B, class A1, A1 a1>
00019 class Factory1Arg : public Factory<B> {
00020 public:
00021   static B* construct() { return new B(a1); } //!< Just returns a new B constructed with arguments @a a1
00022 };
00023 
00024 /*! @file
00025  * @brief Defines Factory, a lightweight class to override for constructing new objects
00026  * @author ejt (Creator)
00027  *
00028  * $Author: ejt $
00029  * $Name: tekkotsu-1_4_1 $
00030  * $Revision: 1.3 $
00031  * $State: Exp $
00032  * $Date: 2003/01/09 02:02:59 $
00033  */
00034 
00035 #endif
00036 

Tekkotsu v1.4
Generated Sat Jul 19 00:06:30 2003 by Doxygen 1.3.2