2 #ifndef __READERENVIRONMENT_H_INCLUDED__
3 #define __READERENVIRONMENT_H_INCLUDED__
14 //#ifndef __INSTANTHANDLER_H_INCLUDED
15 #include "InstantHandler.h"
29 class ReaderEnvironment
33 //=========== CONSTANTS ==============
34 std::string NUMCONCEPTS;
37 std::string NUMOBJECTS;
42 std::string NUMINSTANTS;
49 //====== LIFECYCLE ========
51 ReaderEnvironment(std::string nameConfigurationFile,std::map<std::string,T>* things);
52 ReaderEnvironment(std::string nameConceptFile,std::string nameObjectFile,std::map<std::string,T>* things);
53 ReaderEnvironment(std::string nameOtherConceptsFile, std::string nameConceptFile,std::string nameObjectFile, std::map<std::string,T>* things);
56 //====== OPERATIONS =======
58 * @return environment builded
60 SomeEnvironment<T>* getEnvironment();
62 //====== ACCESS ==========
68 //======= ATTRIBUTES=======
72 SomeEnvironment<T>* environment;
74 * things of the environment
76 std::map<std::string,T>* things;
78 * name of the configuration file
80 std::string nameConfigurationFile;
82 * name of the configuration file for the objects
84 std::string nameObjectFile;
86 * name of the configuration file for the concepts
88 std::string nameConceptFile;
90 * name of the configuration file for other concepts
92 std::string nameOtherConceptsFile;
97 std::map<std::string,std::string> dataInFile;
101 InstantHandler<T>* instantHandler;
103 * concepts number count
105 int numberOfConcepts;
108 //======== PRIVATE METHODS ==========
110 * build the environment
113 void buildEnvironment();
115 * read the configuration file
117 void readFile(std::string nameFile);
120 * add the concepts of the file to the environment
124 * adds the things to the environment
128 * add the instants defined in the file for the name of the
130 * @param nameObject, name of the object for which we want to search
133 bool addInstantToThing(std::string nameObject,std::string index);
135 * build the instant from the string readed in the file
136 * @param instant, string with the description of the instant
137 * @param nameObject, name of the object for wich we can add an instant or several instants
140 bool addInstants(std::string nameObject,std::string instant);
142 * Returns the instant object of the instant string given
143 * 1 1 1 1 and returns an instant object (1,1,1,1)
144 * @param instant, instant for which we want to construct an Instant object
146 Instant* getInstant(std::string instant);
148 * Returns the number of the concept in the instant string read
149 * @param instant,instant where we are going to search the number of the
150 * concept that is in the position given
151 * @param position, position of the concept for which we want the number in the instant given
153 int getNumConcept(std::string& instant,int position );
155 * Returns the name of the concept in the concepts defined given the number
156 * of the concept in the instant
157 * @param nameConcept, string where is going to be load the name of the concept
158 * @param numConcept, number of the concept in the instant for which we are looking
162 void getConceptName(std::string& nameConcept,int numConcept);
165 * Returns the number of decimals places of the number given
167 int getNumberOfDecimalPlaces(int number);
170 * Clean the line readed from the file
172 void cleanLine(std::string & line);
177 //include the implementation of the template
178 #include "ReaderEnvironment_Txx.h"