made JsonApiServer an singleton through static method instance()

This commit is contained in:
csoler 2019-11-12 22:32:18 +01:00
parent 3b45fc5199
commit d19d1685de
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
9 changed files with 129 additions and 95 deletions

View file

@ -173,15 +173,16 @@ void p3ConfigMgr::addConfiguration(std::string file, pqiConfig *conf)
}
// Also check that the filename is not already registered for another config
for(std::list<pqiConfig*>::const_iterator it = mConfigs.begin(); it!= mConfigs.end(); ++it)
for(std::list<pqiConfig*>::iterator it = mConfigs.begin(); it!= mConfigs.end();)
if((*it)->filename == filename)
{
std::cerr << "!!!!!!!!!! Trying to register a config for file \"" << filename << "\" that is already registered" << std::endl;
std::cerr << "!!!!!!!!!! Please correct the code !" << std::endl;
return;
std::cerr << "(WW) Registering a config for file \"" << filename << "\" that is already registered. Replacing previous component." << std::endl;
it = mConfigs.erase(it);
}
else
++it;
conf->setFilename(filename);
conf->setFilename(filename);// (cyril) this is quite terrible. The constructor of pqiConfig should take the filename as parameter and hold the information.
mConfigs.push_back(conf);
}

View file

@ -106,13 +106,12 @@ void setHash(const RsFileHash& h);
RsMutex cfgMtx;
private:
/**
* This sets the name of the pqi configuation file
*/
void setFilename(const std::string& name);
private:
/**
* @param an index for the Confind which contains list of configuarations that can be tracked
*/