2 # ---------------------------------------------------------------------
4 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
6 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
7 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
8 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
10 # This software is governed by the CeCILL-B license under French law and
11 # abiding by the rules of distribution of free software. You can use,
12 # modify and/ or redistribute the software under the terms of the CeCILL-B
13 # license as circulated by CEA, CNRS and INRIA at the following URL
14 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
15 # or in the file LICENSE.txt.
17 # As a counterpart to the access to the source code and rights to copy,
18 # modify and redistribute granted by the license, users are provided only
19 # with a limited warranty and the software's author, the holder of the
20 # economic rights, and the successive licensors have only limited
23 # The fact that you are presently reading this means that you have had
24 # knowledge of the CeCILL-B license and that you accept its terms.
25 # ------------------------------------------------------------------------ */
28 #ifndef __READERENVIRONMENT_H_INCLUDED__
29 #define __READERENVIRONMENT_H_INCLUDED__
40 //#ifndef __INSTANTHANDLER_H_INCLUDED
41 #include "InstantHandler.h"
55 class ReaderEnvironment
59 //=========== CONSTANTS ==============
60 std::string NUMCONCEPTS;
63 std::string NUMOBJECTS;
68 std::string NUMINSTANTS;
75 //====== LIFECYCLE ========
77 ReaderEnvironment(std::string nameConfigurationFile,std::map<std::string,T>* things);
78 ReaderEnvironment(std::string nameConceptFile,std::string nameObjectFile,std::map<std::string,T>* things);
79 ReaderEnvironment(std::string nameOtherConceptsFile, std::string nameConceptFile,std::string nameObjectFile, std::map<std::string,T>* things);
82 //====== OPERATIONS =======
84 * @return environment builded
86 SomeEnvironment<T>* getEnvironment();
88 //====== ACCESS ==========
94 //======= ATTRIBUTES=======
98 SomeEnvironment<T>* environment;
100 * things of the environment
102 std::map<std::string,T>* things;
104 * name of the configuration file
106 std::string nameConfigurationFile;
108 * name of the configuration file for the objects
110 std::string nameObjectFile;
112 * name of the configuration file for the concepts
114 std::string nameConceptFile;
116 * name of the configuration file for other concepts
118 std::string nameOtherConceptsFile;
123 std::map<std::string,std::string> dataInFile;
127 InstantHandler<T>* instantHandler;
129 * concepts number count
131 int numberOfConcepts;
134 //======== PRIVATE METHODS ==========
136 * build the environment
139 void buildEnvironment();
141 * read the configuration file
143 void readFile(std::string nameFile);
146 * add the concepts of the file to the environment
150 * adds the things to the environment
154 * add the instants defined in the file for the name of the
156 * @param nameObject, name of the object for which we want to search
159 bool addInstantToThing(std::string nameObject,std::string index);
161 * build the instant from the string readed in the file
162 * @param instant, string with the description of the instant
163 * @param nameObject, name of the object for wich we can add an instant or several instants
166 bool addInstants(std::string nameObject,std::string instant);
168 * Returns the instant object of the instant string given
169 * 1 1 1 1 and returns an instant object (1,1,1,1)
170 * @param instant, instant for which we want to construct an Instant object
172 Instant* getInstant(std::string instant);
174 * Returns the number of the concept in the instant string read
175 * @param instant,instant where we are going to search the number of the
176 * concept that is in the position given
177 * @param position, position of the concept for which we want the number in the instant given
179 int getNumConcept(std::string& instant,int position );
181 * Returns the name of the concept in the concepts defined given the number
182 * of the concept in the instant
183 * @param nameConcept, string where is going to be load the name of the concept
184 * @param numConcept, number of the concept in the instant for which we are looking
188 void getConceptName(std::string& nameConcept,int numConcept);
191 * Returns the number of decimals places of the number given
193 int getNumberOfDecimalPlaces(int number);
196 * Clean the line readed from the file
198 void cleanLine(std::string & line);
203 //include the implementation of the template
204 #include "ReaderEnvironment_Txx.h"