factory.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: factory.h,v 1.10 2003/08/26 08:04:07 oliver Exp $
00005 //
00006 
00007 #ifndef BALL_CONCEPT_FACTORY_H
00008 #define BALL_CONCEPT_FACTORY_H
00009 
00010 #ifndef BALL_COMMON_H
00011 # include <BALL/common.h>
00012 #endif
00013 
00014 
00015 namespace BALL
00016 {
00017 
00025   template <typename T>
00026   class Factory
00027   {
00028     public:
00029     
00031     static T* create() { return new T; }
00032 
00034     static void* createVoid() { return (void*)new T; }
00035 
00037     static const T& getDefault() 
00038     { 
00039       static T default_instance;
00040       return default_instance;
00041     }
00042   };
00043 }
00044 
00045 #endif // BALL_CONCEPT_FACTORY_H