CASToR  1.1
Tomographic Reconstruction (PET/SPECT)
 All Classes Files Functions Variables Typedefs Macros Groups Pages
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_NOT_FOUND 2
32 
34 // =====================================================================
35 // ---------------------------------------------------------------------
36 // ---------------------------------------------------------------------
37 // =====================================================================
38 // Functions for command line parameters reading
39 // Functions parsing a string composed of several numbers separated by commas.
52 template<typename T> int ReadStringOption(const string& a_input, T* ap_return, int a_nbElts, const string& sep, const string& a_option);
53 
54 // =====================================================================
55 // ---------------------------------------------------------------------
56 // ---------------------------------------------------------------------
57 // =====================================================================
58 // Functions for ASCII file input reading
79 template<typename T> int ReadDataASCIIFile(const string& a_file, const string& a_keyword, T* ap_return, int a_nbElts, bool a_mandatoryFlag);
80 
107 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);
108 
136 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);
137 
166 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);
167 
202 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);
203 
204 // =====================================================================
205 // ---------------------------------------------------------------------
206 // ---------------------------------------------------------------------
207 // =====================================================================
208 // Functions for data conversion
217 int ConvertFromString(const string& a_str, string* a_result);
218 
228 int ConvertFromString(const string& a_str, float* a_result);
229 
239 int ConvertFromString(const string& a_str, double* a_result);
240 
250 int ConvertFromString(const string& a_str, long double* a_result);
251 
261 int ConvertFromString(const string& a_str, int* a_result);
262 
272 int ConvertFromString(const string& a_str, int64_t* a_result);
273 
283 int ConvertFromString(const string& a_str, uint8_t* a_result);
284 
294 int ConvertFromString(const string& a_str, uint16_t* a_result);
295 
305 int ConvertFromString(const string& a_str, uint32_t* a_result);
306 
316 int ConvertFromString(const string& a_str, bool* a_result);
317 
318 
327 bool FLTNBIsEqual(FLTNB a, FLTNB b, FLTNB a_eps);
328 
329 
336 string GetFileFromPath(const string& a_pathToFile);
337 
344 string GetPathOfFile(const string& a_pathToFile);
345 
352 string ConvertAllSlashOccurrencesToBackSlash(const string& a_path);
353 
354 #endif
string ConvertAllSlashOccurrencesToBackSlash(const string &a_path)
Definition: gOptions.cc:1164
#define FLTNB
Definition: gVariables.hh:55
string GetFileFromPath(const string &a_pathToFile)
Simply return the file from a path string passed in parameter.
Definition: gOptions.cc:1119
int ConvertFromString(const string &a_str, string *a_result)
Copy the 'a_str' string in the position pointed by 'a_result'.
Definition: gOptions.cc:749
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...
Definition: gOptions.cc:111
string GetPathOfFile(const string &a_pathToFile)
Simply return the path to the directory of a file path string passed in parameter.
Definition: gOptions.cc:1144
int ReadStringOption(const string &a_input, T *ap_return, int a_nbElts, const string &sep, const string &a_option)
Parse the 'a_input' string corresponding to the 'a_option' into 'a_nbElts' elements, using the 'sep' separator. The results are returned in the templated 'ap_return' dynamic templated array. Call "ConvertFromString()" to perform the correct conversion depending on the type of the data to convert.
Definition: gOptions.cc:50
bool FLTNBIsEqual(FLTNB a, FLTNB b, FLTNB a_eps)
Comparison of FLTNB numbers.
Definition: gOptions.cc:1184