aboutsummaryrefslogtreecommitdiffstats
path: root/yage/entity/entity.h
blob: e6742893be9f6606822c8a19d443338fa9e8ba3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/** ---------------------------------------------------------------------------
 * @file: entity.h
 *
 * Copyright (c) 2017 Yann Herklotz Grave <ymherklotz@gmail.com>
 * MIT License, see LICENSE file for more details.
 * ----------------------------------------------------------------------------
 */

#ifndef YAGE_ENGINE_ENTITY_H
#define YAGE_ENGINE_ENTITY_H

#include <vector>

namespace yage
{

typedef unsigned EntityHandle;

class Space;

/**
 * Entity convenience class. It contains handles to where the entity is in the
 * entity manager of the space, and a pointer back to the space itself.
 *
 * This class cannot be instantiated outside of a Space and should only be
 * instantiated through an entity manager, as otherwise the handle will not have
 * a meaning.
 */
class Entity
{
public:
    /**
     * Creates an instance of an Entity with a handle that is associated to it.
     * This handle refers to the position of he Entity in the list that is held
     * by the EntityManager, and therefore the id is enough to refer to it.
     */
    Entity(EntityHandle handle);

    /**
     * Handle getter, as the user will only interact with the id itself. The
     * handle is the unique identifier that the user can use to refer to the
     * entity.
     */
    EntityHandle getHandle() const;

private:
    /**
     * Entity handle for the entity manager.
     */
    EntityHandle handle_;
};

} // namespace yage

#endif