2009-01-13 04:40:13 +05:00
|
|
|
#ifndef FILE_FLAGS
|
|
|
|
#define FILE_FLAGS
|
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
/* File: flags.hh */
|
|
|
|
/* Author: Joachim Schoeberl */
|
|
|
|
/* Date: 10. Oct. 96 */
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2009-07-20 14:36:36 +06:00
|
|
|
namespace netgen
|
|
|
|
{
|
|
|
|
|
2009-01-13 04:40:13 +05:00
|
|
|
/**
|
|
|
|
Flag - Table.
|
|
|
|
A flag table maintains string variables, numerical
|
|
|
|
variables and boolean flags.
|
|
|
|
*/
|
|
|
|
class Flags
|
|
|
|
{
|
|
|
|
///
|
|
|
|
SYMBOLTABLE<char *> strflags;
|
|
|
|
///
|
|
|
|
SYMBOLTABLE<double> numflags;
|
|
|
|
///
|
|
|
|
SYMBOLTABLE<int> defflags;
|
|
|
|
///
|
2009-01-25 17:35:25 +05:00
|
|
|
SYMBOLTABLE<Array<char*>*> strlistflags;
|
2009-01-13 04:40:13 +05:00
|
|
|
///
|
2009-01-25 17:35:25 +05:00
|
|
|
SYMBOLTABLE<Array<double>*> numlistflags;
|
2009-01-13 04:40:13 +05:00
|
|
|
public:
|
|
|
|
///
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER Flags ();
|
2009-01-13 04:40:13 +05:00
|
|
|
///
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER ~Flags ();
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
/// Deletes all flags
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER void DeleteFlags ();
|
2009-01-13 04:40:13 +05:00
|
|
|
/// Sets string flag, overwrite if exists
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER void SetFlag (const char * name, const char * val);
|
2009-01-13 04:40:13 +05:00
|
|
|
/// Sets numerical flag, overwrite if exists
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER void SetFlag (const char * name, double val);
|
2009-01-13 04:40:13 +05:00
|
|
|
/// Sets boolean flag
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER void SetFlag (const char * name);
|
2018-01-08 20:45:53 +05:00
|
|
|
/// Sets string arary flag
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER void SetFlag (const char * name, const Array<char*> & val);
|
2009-01-13 04:40:13 +05:00
|
|
|
/// Sets double array flag
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER void SetFlag (const char * name, const Array<double> & val);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
/// Save flags to file
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER void SaveFlags (const char * filename) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
/// write flags to stream
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER void PrintFlags (ostream & ost) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
/// Load flags from file
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER void LoadFlags (const char * filename);
|
2009-01-13 04:40:13 +05:00
|
|
|
/// set flag of form -name=hello -val=0.5 -defined
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER void SetCommandLineFlag (const char * st);
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
/// Returns string flag, default value if not exists
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER const char * GetStringFlag (const char * name, const char * def) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
/// Returns numerical flag, default value if not exists
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER double GetNumFlag (const char * name, double def) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
/// Returns address of numerical flag, null if not exists
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER const double * GetNumFlagPtr (const char * name) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
/// Returns address of numerical flag, null if not exists
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER double * GetNumFlagPtr (const char * name);
|
2009-01-13 04:40:13 +05:00
|
|
|
/// Returns boolean flag
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER bool GetDefineFlag (const char * name) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
/// Returns string list flag, empty array if not exist
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER const Array<char*> & GetStringListFlag (const char * name) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
/// Returns num list flag, empty array if not exist
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER const Array<double> & GetNumListFlag (const char * name) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
|
|
|
|
/// Test, if string flag is defined
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER bool StringFlagDefined (const char * name) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
/// Test, if num flag is defined
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER bool NumFlagDefined (const char * name) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
/// Test, if string list flag is defined
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER bool StringListFlagDefined (const char * name) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
/// Test, if num list flag is defined
|
2011-03-04 02:42:20 +05:00
|
|
|
DLL_HEADER bool NumListFlagDefined (const char * name) const;
|
2009-01-13 04:40:13 +05:00
|
|
|
};
|
2009-07-20 14:36:36 +06:00
|
|
|
|
|
|
|
}
|
2009-01-13 04:40:13 +05:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|