CASToR  3.2
Tomographic Reconstruction (PET/SPECT/CT)
code/include/management/gOptions.hh
Go to the documentation of this file.
1 
9 #ifndef GOPTIONS_HH
10 #define GOPTIONS_HH 1
11 
12 // =====================================================================
13 // ---------------------------------------------------------------------
14 // ---------------------------------------------------------------------
15 // =====================================================================
25 #define KEYWORD_MANDATORY true
26 
27 #define KEYWORD_OPTIONAL false
28 
29 #define KEYWORD_MANDATORY_NOT_FOUND 1
30 
31 #define KEYWORD_OPTIONAL_SUCCESS 0
32 
33 #define KEYWORD_OPTIONAL_ERROR 1
34 
35 #define KEYWORD_OPTIONAL_NOT_FOUND 2
36 
38 // =====================================================================
39 // ---------------------------------------------------------------------
40 // ---------------------------------------------------------------------
41 // =====================================================================
42 // Functions for command line parameters reading
43 // Functions parsing a string composed of several numbers separated by commas.
56 template<typename T> int ReadStringOption(const string& a_input, T* ap_return, int a_nbElts, const string& sep, const string& a_option);
57 
58 // =====================================================================
59 // ---------------------------------------------------------------------
60 // ---------------------------------------------------------------------
61 // =====================================================================
62 // Functions for ASCII file input reading
83 template<typename T> int ReadDataASCIIFile(const string& a_file, const string& a_keyword, T* ap_return, int a_nbElts, bool a_mandatoryFlag);
84 
111 template<typename T> int ReadDataASCIIFile(const string& a_file, const string& a_keyword, T* ap_return, int a_nbElts, int a_nbLines, bool a_mandatoryFlag);
112 
140 template<typename T> int ReadDataASCIIFile(const string& a_file, const string& a_keyword, T** a2p_return, int a_nbElts, int a_nbLines, bool a_mandatoryFlag);
141 
170 template<typename T> int ReadDataASCIIFile(const string& a_file, const string& a_keyword, T* ap_return, int a_nbElts, bool a_mandatoryFlag, string a_firstTag, string a_lastTag);
171 
206 template<typename T> int ReadDataASCIIFile(const string& a_file, const string& a_keyword, T** a2p_return, int a_nbElts, int a_nbLines, bool a_mandatoryFlag, string a_firstTag, string a_lastTag);
207 
208 // =====================================================================
209 // ---------------------------------------------------------------------
210 // ---------------------------------------------------------------------
211 // =====================================================================
212 // Functions for data conversion
221 int ConvertFromString(const string& a_str, string* a_result);
222 
232 int ConvertFromString(const string& a_str, float* a_result);
233 
243 int ConvertFromString(const string& a_str, double* a_result);
244 
254 int ConvertFromString(const string& a_str, long double* a_result);
255 
265 int ConvertFromString(const string& a_str, int* a_result);
266 
276 int ConvertFromString(const string& a_str, int64_t* a_result);
277 
287 int ConvertFromString(const string& a_str, uint8_t* a_result);
288 
298 int ConvertFromString(const string& a_str, uint16_t* a_result);
299 
309 int ConvertFromString(const string& a_str, uint32_t* a_result);
310 
320 int ConvertFromString(const string& a_str, bool* a_result);
321 
322 
331 bool FLTNBIsEqual(FLTNB a, FLTNB b, FLTNB a_eps);
332 
333 
340 string GetFileFromPath(const string& a_pathToFile);
341 
348 string GetPathOfFile(const string& a_pathToFile);
349 
356 string ConvertAllSlashOccurrencesToBackSlash(const string& a_path);
357 
358 #endif
string ConvertAllSlashOccurrencesToBackSlash(const string &a_path)
string GetPathOfFile(const string &a_pathToFile)
Simply return the path to the directory of a file path string passed in parameter.
int ReadStringOption(const string &a_input, T *ap_return, int a_nbElts, const string &sep, const string &a_option)
Parse the &#39;a_input&#39; string corresponding to the &#39;a_option&#39; into &#39;a_nbElts&#39; elements, using the &#39;sep&#39; separator. The results are returned in the templated &#39;ap_return&#39; dynamic templated array. Call "ConvertFromString()" to perform the correct conversion depending on the type of the data to convert.
bool FLTNBIsEqual(FLTNB a, FLTNB b, FLTNB a_eps)
Comparison of FLTNB numbers.
int ConvertFromString(const string &a_str, string *a_result)
Copy the &#39;a_str&#39; string in the position pointed by &#39;a_result&#39;.
string GetFileFromPath(const string &a_pathToFile)
Simply return the file from a path string passed in parameter.
int ReadDataASCIIFile(const string &a_file, const string &a_keyword, T *ap_return, int a_nbElts, bool a_mandatoryFlag)
Look for "a_nbElts" elts in the "a_file" file matching the "a_keyword" string passed as parameter a...