p3Config improved coding style

This commit is contained in:
Gioacchino Mazzurco 2017-02-23 13:20:07 +01:00
parent f9b0063704
commit 828792f2b5

View File

@ -144,7 +144,6 @@ void setHash(const RsFileHash& h);
* Class data is protected by mutex's so that anyone can call these * Class data is protected by mutex's so that anyone can call these
* functions, at any time. * functions, at any time.
*/ */
class p3ConfigMgr class p3ConfigMgr
{ {
public: public:
@ -177,7 +176,7 @@ class p3ConfigMgr
*/ */
void addConfiguration(std::string file, pqiConfig *conf); void addConfiguration(std::string file, pqiConfig *conf);
/* saves config, and disables further saving /** saves config, and disables further saving
* used for exiting the system * used for exiting the system
*/ */
void completeConfiguration(); void completeConfiguration();
@ -209,55 +208,53 @@ class p3ConfigMgr
/***************************************************************************************************/ /***************************************************************************************************/
//! abstract class for configuration saving, aimed at rs services that uses RsItem config data /**
/*! * @brief Abstract class for configuration saving.
* The aim of this class is to provide a way for rs services and object to save particular * Aimed at rs services that uses RsItem config data, provide a way for RS
* configurations an items (and load them up as well). * services to save and load particular configurations as items.
*/ */
class p3Config: public pqiConfig struct p3Config : pqiConfig
{ {
public:
p3Config(); p3Config();
virtual bool loadConfiguration(RsFileHash &loadHash); virtual bool loadConfiguration(RsFileHash &loadHash);
virtual bool saveConfiguration(); virtual bool saveConfiguration();
protected:
protected: /// Key Functions to be overloaded for Full Configuration
virtual RsSerialiser *setupSerialiser() = 0;
/* Key Functions to be overloaded for Full Configuration */ /**
virtual RsSerialiser *setupSerialiser() = 0;
/**
* saves list of derived object * saves list of derived object
* @param cleanup this inform you if you need to call saveDone() to unlock/allow * @param cleanup this inform you if you need to call saveDone() to
* access to resources pointed to by handles (list) returned by function: thus false, call saveDone after returned list finished with * unlock/allow access to resources pointed to by handles (list)
* and vice versa * returned by function: thus false, call saveDone after returned list
* finished with and vice versa
* @return list of config items derived object wants to saves * @return list of config items derived object wants to saves
*/ */
virtual bool saveList(bool &cleanup, std::list<RsItem *>&) = 0; virtual bool saveList(bool &cleanup, std::list<RsItem *>&) = 0;
/** /**
* loads up list of configs items for derived object * loads up list of configs items for derived object
* @param load list of config items to load up * @param load list of config items to load up
*/ */
virtual bool loadList(std::list<RsItem *>& load) = 0; virtual bool loadList(std::list<RsItem *>& load) = 0;
/** /**
* callback for mutex unlocking * callback for mutex unlocking
* in derived classes (should only be needed if cleanup = false) * in derived classes (should only be needed if cleanup = false)
*/ */
virtual void saveDone() { return; } virtual void saveDone() {}
private: private:
bool loadConfig(); bool loadConfig();
bool saveConfig(); bool saveConfig();
bool loadAttempt(const std::string&,const std::string&, std::list<RsItem *>& load); bool loadAttempt( const std::string&, const std::string&,
std::list<RsItem *>& load );
}; /* end of p3Config */ }; // end of p3Config
class p3GeneralConfig: public p3Config class p3GeneralConfig: public p3Config