// SYSTEM INCLUDES // PROJECT INCLUDES // LOCAL INCLUDES #include "Instant.h" // FORWARD REFERENCES //NAMESPACE //====== LIFECYCLE ======== template EnvironmentHandler

::EnvironmentHandler(SomeEnvironment

* environment) { this->environment=environment; } template EnvironmentHandler

::~EnvironmentHandler() { //deleting actual instants this->actualInstants.clear(); //deleting environment if(this->environment) delete this->environment; } //====== OPERATIONS ======= /* * change the actual intants associated to the * names given */ template void EnvironmentHandler

::nextInstants(std::vector nameConcepts) { int size,i,indexConcept,indexInConcept,sizeConcept; size=nameConcepts.size(); std::map::iterator actualInstantsIterator; std::string nameConcepti; for(i=0;isecond; indexConcept=environment->getIndexConcept(nameConcepti); indexInConcept=instant->getIndexInConcept(indexConcept); indexInConcept++; sizeConcept=environment->getSizeConcept(nameConcepti); if(indexInConceptsetConcept(indexConcept,indexInConcept); } } } /* * add an actual Instant to a concept, it means, this instant * has all index fixed, except the index in the instant of the concept * identified by nameConcept */ template void EnvironmentHandler

::addActualInstantOfCOncept(std::string nameConcept,Instant* instant) { actualInstants.insert(std::pair(nameConcept,instant)); } /* * removes the pair in the map of actual concepts */ template void EnvironmentHandler

::removeActualInstantOfConcept(std::string nameConcept) { std::map::iterator actualInstantsIterator=actualInstants.find(nameConcept); if(actualInstantsIterator!=actualInstants.end()) actualInstants.erase(actualInstantsIterator); } //====== INQUIRY ========= /* * get all the actual instants */ template void EnvironmentHandler

::getActualsInstants(std::vector& instantsVector) { std::map::iterator actualInstantsIterator= actualInstants.begin(); while(actualInstantsIterator!=actualInstants.end()) { Instant* instant=actualInstantsIterator->second; instantsVector.push_back(instant); actualInstantsIterator++; } } /* * get the actual instant fot the concept identified by the name */ template Instant* EnvironmentHandler

::getActualInstant(std::string nameConcept) { std::map::iterator actualInstantsIterator=actualInstants.find(nameConcept); if(actualInstantsIterator!=actualInstants.end()) { return instant=actualInstantsIterator->second; } else return (Instant*)NULL; } //====== ACCESS ==========