-
Notifications
You must be signed in to change notification settings - Fork 0
/
Entity.cpp
41 lines (30 loc) · 917 Bytes
/
Entity.cpp
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
#include "Entity.h"
#include "Simulation.h"
namespace IMSim {
Entity::Entity(Simulation* simulation) {
this->simulation = simulation;
this->name = NULL;
if( simulation != NULL ) {
this->id = simulation->getNextId();
DEBUG(("ENTITY [ %d:%p ] created", this->id, this), this->simulation->now());
}
}
Entity::Entity(Simulation* simulation, const char* name) {
this->simulation = simulation;
this->id = simulation->getNextId();
this->name = name;
DEBUG(("ENTITY [ %d:%p '%s' ] created", this->id, this, this->name), this->simulation->now());
}
Entity::~Entity() {
DEBUG(("ENTITY [ %d:%p %s ] destroyed", this->id, this, this->name == NULL ? "" : this->name ), this->simulation->now());
}
Simulation* Entity::getSimulation() {
return this->simulation;
}
char* Entity::getName() {
return (char *)this->name;
}
ENTITY_ID Entity::getId() {
return this->id;
}
}