ApplicationConfig.h 2.47 KB
#ifndef APPLICATIONCONFIG_H
#define APPLICATIONCONFIG_H

#include <string>
#include <map>

#include "../Common/TREPSTypes.h"

using namespace std;
using namespace TREPS::Common;

namespace TREPS
{
	namespace Application
	{
		typedef map<const string, string> AppConfMap;

		class ApplicationConfigClass
		{
			public :
				ApplicationConfigClass(const char *appPath);

				//load config file
				bool load(const char *configFile);

				//get workind dir path. All workind dir will be create in this dir
				string getWorkingDirPath(void);

				//get data dir (contain time formats definition file, logger config file, etc...)
				string getDataDirPath(void);

				//get xsd dir for xml validation
				string getXSDDirPath(void);

				//get the full path of the frames definition file
				string getFramesFilePath(void);

				//get the full path of the time formats definition file
				string getTimesFilePath(void);

				//get the full path of the units definition file
				string getUnitsFilePath(void);

				//get the full path of the exports definition file
				string getExportsFilePath(void);

				//get the full path of the file formats definition file
				string getFormatsFilePath(void);

				//proxy username to use
				string getProxyUsername(void);

				//proxy password to use
				string getProxyPassword(void);

				//get full path to the logger config file
				string getLog4cxxConfigPath(void);

				//get the logger name
				string getLog4cxxLoggerName(void);

				//get tags used to detect automatically a frame in a file
				t_StringList getFramesTags(void);

				//get the char used for ASCII header line
				//default value to '#'
				char getASCIIHeaderChar(void);

				//use cache
				//not finished and with some bugs => forced to false
				bool getUseCache(void);

				//life time of a working dir before to delete (in seconds)
				//default to 86400 s
				long int getWorkingDirLifeTime(void);

				//max file size for source file (in octets)
				//default to 20971520 octets (20 Mo)
				long int getMaxSourceFileSize(void);

				//max file records for source file
				//default to 100000
				long int getMaxSourceFileRecords(void);

				//base URL to the CDPP/3DView tool
				string get3DViewWSBaseURL(void);

			private :
				//current application path
				string appPath;

				//map that contains all config var
				AppConfMap map;

				//get config var
				string get(const char *var);

				//get config var list (the separator is a coma ',')
				t_StringList getList(const char *var);
		};
	}
}

#endif