BALL
1.5.0
include
BALL
CONCEPT
factory.h
Go to the documentation of this file.
1
// -*- Mode: C++; tab-width: 2; -*-
2
// vi: set ts=2:
3
//
4
5
#ifndef BALL_CONCEPT_FACTORY_H
6
#define BALL_CONCEPT_FACTORY_H
7
8
#ifndef BALL_COMMON_H
9
# include <
BALL/common.h
>
10
#endif
11
12
13
namespace
BALL
14
{
15
23
template
<
typename
T>
24
class
Factory
25
{
26
public
:
27
29
static
T*
create
() {
return
new
T; }
30
32
static
void
*
createVoid
() {
return
(
void
*)
new
T; }
33
35
static
const
T&
getDefault
()
36
{
37
static
T default_instance;
38
return
default_instance;
39
}
40
};
41
}
42
43
#endif // BALL_CONCEPT_FACTORY_H
BALL::Factory::getDefault
static const T & getDefault()
Return a reference to a (pre-instantiated) default object.
Definition:
factory.h:35
BALL::Factory::create
static T * create()
Return a pointer to a new instance of T.
Definition:
factory.h:29
BALL
Definition:
constants.h:13
BALL::Factory
Definition:
factory.h:25
common.h
BALL::Factory::createVoid
static void * createVoid()
Return a void pointer to a new instance of T.
Definition:
factory.h:32
Generated by
1.8.20