Loading...
Searching...
No Matches
factory.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_CONCEPT_FACTORY_H
#define BALL_CONCEPT_FACTORY_H
#ifndef BALL_COMMON_H
# include <BALL/common.h>
#endif
namespace BALL
{
template <typename T>
class Factory
{
public:
static T* create() { return new T; }
static void* createVoid() { return (void*)new T; }
static const T& getDefault()
{
static T default_instance;
return default_instance;
}
};
}
#endif // BALL_CONCEPT_FACTORY_H
BALL::Factory
Definition factory.h:25
BALL::Factory::create
static T * create()
Return a pointer to a new instance of T.
Definition factory.h:29
BALL::Factory::getDefault
static const T & getDefault()
Return a reference to a (pre-instantiated) default object.
Definition factory.h:35
BALL::Factory::createVoid
static void * createVoid()
Return a void pointer to a new instance of T.
Definition factory.h:32
common.h
BALL
Definition constants.h:13