-
Notifications
You must be signed in to change notification settings - Fork 10
/
ModelComponent.cpp
43 lines (35 loc) · 1.32 KB
/
ModelComponent.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
42
43
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/*
* File: Element.cpp
* Author: cancian
*
* Created on 21 de Junho de 2018, 15:56
*/
#include "ModelComponent.h"
#include "Model.h"
ModelComponent::ModelComponent(Model* model) : ModelInfrastructure(typeid (this).name()) {
_model = model;
_nextComponents = new List<ModelComponent*>();
}
ModelComponent::ModelComponent(const ModelComponent& orig) : ModelInfrastructure(orig) {
}
ModelComponent::~ModelComponent() {
}
void ModelComponent::execute(Entity* entity, ModelComponent* component) {
this->_model->trace(Util::TraceLevel::TL_blockArrival, "Entity " + std::to_string(entity->getId()) + " has arrived at component \"" + component->_name + "\""); //std::to_string(component->_id));
try {
component->_execute(entity);
} catch (const std::exception& e) {
this->_model->traceError(e, "Error executing component " + component->show());
}
}
List<ModelComponent*>* ModelComponent::getNextComponents() const {
return _nextComponents;
}
std::string ModelComponent::show() {
return ModelInfrastructure::show(); // "{id=" + std::to_string(this->_id) + ",name=\""+this->_name + "\"}"; // , nextComponents[]=(" + _nextComponents->show() + ")}";
}