00001 #ifndef _CONFIGURATION_H_ 00002 #define _CONFIGURATION_H_ 00003 00004 #include <vector> 00005 #include <algorithm> 00006 #include <fstream> 00007 #include "ConfigObject.h" 00008 #include "Version.h" 00009 00010 #include <xercesc/dom/DOM.hpp> 00011 #include <xercesc/parsers/XercesDOMParser.hpp> 00012 00016 class Configuration{ 00017 00018 protected: 00019 string objectName; 00020 vector<ConfigObject*> list; 00021 bool modified; 00022 00023 Version* createMajorVersion(string n) const throw (ILCException::Exception); 00024 Version* createMinorVersion(int m, string n) const throw (ILCException::Exception); 00025 00031 static vector<Version*> getUnusedVersions(string object_name) throw (ILCException::Exception); 00032 00036 vector< map<string,string> > parse(string fileName) throw (ILCException::Exception); 00037 00038 00039 public: 00040 Configuration(); 00041 virtual ~Configuration(); 00042 00047 void add(ConfigObject* l); 00048 00053 vector<ConfigObject*>& getVector(); 00054 00058 int size(); 00059 00063 void clear(); 00069 virtual void download(int maj, int min) = 0; 00075 virtual Version* upload(string n) const = 0; 00082 virtual Version* upload(int maj, string n) const = 0; 00090 virtual Version* upload(int maj, int min) const = 0; 00091 00095 virtual void addFromXML(string fileName) = 0; 00096 00102 static vector<Version*> getVersions(string objectName) throw (ILCException::Exception); 00103 00111 static Version* getVersion(string objectName, int majorId, int minorId) throw (ILCException::Exception); 00112 00113 00120 static bool versionExist(string objectName, string n) throw (ILCException::Exception); 00121 00126 void setModified(bool b); 00127 00132 bool isModified(); 00133 00137 bool minorUpdateNeeded(); 00138 00143 vector<string> toXML(); 00144 00149 void saveToXML(string fileName); 00150 00151 }; 00152 #endif