39 #include "PetscTools.hpp" 41 #include "ParameterCollection.hpp" 76 if(PetscTools::AmMaster())
79 myfile.open(rFilename.c_str());
80 myfile <<
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
81 myfile <<
"<parameter_collection>" << std::endl;
83 typedef std::map<std::string, std::pair<std::string, boost::shared_ptr<BaseParameterInstance> > >::iterator it_type;
86 myfile <<
"<parameter>" << std::endl;
87 myfile <<
"<added_by>" << (iterator->second).first <<
"</added_by>"<< std::endl;
88 myfile << (iterator->second).second;
89 myfile <<
"</parameter>" << std::endl;
91 myfile <<
"</parameter_collection>" << std::endl;
104 std::map<std::string, std::pair<std::string, boost::shared_ptr<BaseParameterInstance> > >::iterator it =
mParameters.find(pParameter->GetName());
105 if(it !=
mParameters.end() && rFirstInstantiated != it->first)
107 it->second = std::pair<std::string, boost::shared_ptr<BaseParameterInstance> >(rFirstInstantiated, pParameter);
111 mParameters[pParameter->GetName()] = std::pair<std::string, boost::shared_ptr<BaseParameterInstance> >(rFirstInstantiated, pParameter);
119 mpInstance = boost::shared_ptr<ParameterCollection>();
static boost::shared_ptr< ParameterCollection > SharedInstance()
static boost::shared_ptr< ParameterCollection > mpInstance
std::map< std::string, std::pair< std::string, boost::shared_ptr< BaseParameterInstance > > > mParameters
boost::shared_ptr< BaseParameterInstance > GetParameter(const std::string &rName)
void AddParameter(boost::shared_ptr< BaseParameterInstance > pParameter, const std::string &rFirstInstantiated)
void DumpToFile(const std::string &rFilename)
static ParameterCollection * Instance()