BALL
1.4.1
|
00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 00005 #ifndef BALL_CONCEPT_FACTORY_H 00006 #define BALL_CONCEPT_FACTORY_H 00007 00008 #ifndef BALL_COMMON_H 00009 # include <BALL/common.h> 00010 #endif 00011 00012 00013 namespace BALL 00014 { 00015 00023 template <typename T> 00024 class Factory 00025 { 00026 public: 00027 00029 static T* create() { return new T; } 00030 00032 static void* createVoid() { return (void*)new T; } 00033 00035 static const T& getDefault() 00036 { 00037 static T default_instance; 00038 return default_instance; 00039 } 00040 }; 00041 } 00042 00043 #endif // BALL_CONCEPT_FACTORY_H