configObjects/State.h

00001 #ifndef _STATE_H_
00002 #define _STATE_H_
00003 
00004 #include <iostream>
00005 #include <sstream>
00006 #include <string>
00007 #include <set>
00008 
00009 #include "Version.h"
00010 #include "../db/DBConnection.h"
00011 #include "LdaConfiguration.h"
00012 #include "DccConfiguration.h"
00013 #include "DifConfiguration.h"
00014 #include "AsicConfiguration.h"
00015 
00016 using namespace std;
00017 
00022 class State{
00023 
00024  private:
00025   string name;
00026   Version* lda_version;
00027   Version* dcc_version;
00028   Version* dif_version;
00029   Version* asic_version;
00030 
00031   // When a user ask for a configuration, we keep a pointer on this new object for later use
00032   // This is to avoid multiple downloads and to keep a link on the configuration the user is possibly modifing
00033   // We will  delete these pointers when the state is deleted, so the user should not do it...
00034   LdaConfiguration* downloadedLdaConf;
00035   DccConfiguration* downloadedDccConf;
00036   DifConfiguration* downloadedDifConf;
00037   AsicConfiguration* downloadedAsicConf;
00038 
00039   string comment;
00040   bool locked;
00041 
00042   bool isValid();
00043   string checkParams(string request, Version* v, string params) throw (ILCException::Exception);
00044 
00045  public:
00049   State();
00054   State(string n);
00058   State(const State& s);
00059 
00060   State& operator=(const State& s);
00061   ~State();
00062 
00067   void setName(string n);
00072   void setComment(string c);
00078   void setLdaVersion(Version* v);
00084   void setDccVersion(Version* v);
00090   void setDifVersion(Version* v);
00096   void setAsicVersion(Version* v);
00097 
00098   string getName();
00099   
00104   Version* getLdaVersion();
00109   Version* getDccVersion();
00114   Version* getDifVersion();
00119   Version* getAsicVersion();
00120 
00121   bool isLocked();
00122 
00126   void upload() throw (ILCException::Exception);
00127 
00133   static State* download(string n) throw (ILCException::Exception);
00134 
00135 
00136   vector<int> getDifIDs();
00137   vector<int> getAsicIDs();
00138   vector<int> getDccIDs();
00139   vector<string> getLdaIDs();
00140   vector<int> getUsedDifIDs();
00141   vector<int> getUsedDccIDs();
00142   vector<string> getUsedLdaIDs();
00143   vector<string> getUsedLdaByDccIDs();
00144   vector<string> getUsedLdaChannelByDif();
00145   vector<string> getUsedLdaChannelByDcc();
00146 
00151   LdaConfiguration* getLdaConfiguration() throw (ILCException::Exception);
00156   DccConfiguration* getDccConfiguration() throw (ILCException::Exception);
00161   DifConfiguration* getDifConfiguration() throw (ILCException::Exception);
00166   AsicConfiguration* getAsicConfiguration() throw (ILCException::Exception);
00167 
00171   void lock();
00172 
00177   vector<State*> getStates();
00178 
00183   static vector<string> getUnusedStateNames() throw (ILCException::Exception);
00184 
00189   static void deleteState(string n) throw (ILCException::Exception);
00190 
00191 
00195   State* clone();
00196 
00201   void recursiveUpload();
00202 
00208   bool stateExist(string n);
00209 
00213   bool toBeUpdated();
00214 
00219   void saveToXML(string fileName);
00220 
00226   string checkLdaParams(string params) throw (ILCException::Exception);
00232   string checkDccParams(string params) throw (ILCException::Exception);
00239   string checkDifParams(string difType, string params) throw (ILCException::Exception);
00246   string checkAsicParams(string asicType, string params) throw (ILCException::Exception);
00247 
00254   static State* createStateFromXML(string stateName, string fileName);
00255 };
00256 
00257 #endif

Generated on Tue Feb 28 15:35:34 2012 for ILCConfigurationDB by  doxygen 1.4.7