YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
ObjectFactory.hpp
Go to the documentation of this file.
1
#ifndef YAPOG_OBJECTFACTORY_HPP
2
# define YAPOG_OBJECTFACTORY_HPP
3
4
# include "
YAPOG/Macros.hpp
"
5
# include "
YAPOG/System/String.hpp
"
6
# include "
YAPOG/Collection/Map.hpp
"
7
# include "
YAPOG/Game/ID.hpp
"
8
9
namespace
yap
10
{
11
struct
IObjectIDLoader;
12
struct
IObjectLoader;
13
struct
IReader;
14
15
class
YAPOG_LIB
ObjectFactory
16
{
17
DISALLOW_COPY
(
ObjectFactory
);
18
19
public
:
20
21
static
ObjectFactory
& Instance ();
22
23
template
<
typename
T>
24
T* Get (
const
String
& typeName,
const
ID
&
id
);
25
26
template
<
typename
T>
27
T* Create (
const
String
& typeName,
const
ID
&
id
);
28
29
template
<
typename
T>
30
T* Create (
const
ID
& typeID,
const
ID
&
id
);
31
40
template
<
typename
T>
41
T* Create (
42
const
String
& typeName,
43
IReader
& reader,
44
const
String
& rootNodeName);
45
46
void
RegisterLoader (
const
String
& typeName,
IObjectIDLoader
* loader);
47
void
RegisterLoader (
const
String
& typeName,
IObjectLoader
* loader);
48
49
void
AddType (
const
ID
&
id
,
const
String
& type);
50
const
String
& GetType (
const
ID
&
id
)
const
;
51
const
ID
& GetID (
const
String
& type)
const
;
52
53
const
collection::Map<ID, String>
& GetTypes ()
const
;
54
55
private
:
56
57
ObjectFactory
();
58
~
ObjectFactory
();
59
60
bool
ContainsLoader (
const
String
& typeName)
const
;
61
62
static
const
UInt64
INITIAL_ID
;
63
static
UInt64
currentID_
;
64
65
collection::Map<String, IObjectIDLoader*>
objectIDLoaders_
;
66
collection::Map<String, IObjectLoader*>
objectLoaders_
;
67
68
collection::Map<ID, String>
types_
;
69
collection::Map<String, ID>
ids_
;
70
};
71
}
// namespace yap
72
73
# include "
YAPOG/Game/Factory/ObjectFactory.hxx
"
74
75
#endif // YAPOG_OBJECTFACTORY_HPP
YAPOG
include
YAPOG
Game
Factory
ObjectFactory.hpp
Generated on Mon Sep 17 2012 22:24:23 for YAPOG by
1.8.1.1