18 const std::string &xmlFileName,
19 const Ptr<ParameterList> ¶mList
22 XMLParameterListReader xmlPLReader;
23 xmlPLReader.setAllowsDuplicateSublists(
false );
24 FileInputSource xmlFile(xmlFileName);
25 XMLObject xmlParams = xmlFile.getObject();
26 paramList->setParameters(xmlPLReader.toParameterList(xmlParams));
41 const std::string &xmlFileName,
42 RCP<DependencySheet> depSheet)
44 XMLParameterListReader xmlPLReader;
45 xmlPLReader.setAllowsDuplicateSublists(
false );
46 FileInputSource xmlFile(xmlFileName);
47 XMLObject xmlParams = xmlFile.getObject();
48 return xmlPLReader.toParameterList(xmlParams, depSheet);
53 const std::string &xmlStr,
54 const Ptr<ParameterList> ¶mList,
58 XMLParameterListReader xmlPLReader;
59 xmlPLReader.setAllowsDuplicateSublists(
false );
60 StringInputSource xmlStrSrc(xmlStr);
61 XMLObject xmlParams = xmlStrSrc.getObject();
62 if(overwrite) paramList->setParameters(xmlPLReader.toParameterList(xmlParams));
63 else paramList->setParametersNotAlreadySet(xmlPLReader.toParameterList(xmlParams));
78 RCP<DependencySheet> depSheet)
80 XMLParameterListReader xmlPLReader;
81 xmlPLReader.setAllowsDuplicateSublists(
false );
82 StringInputSource xmlStrSrc(xmlStr);
83 XMLObject xmlParams = xmlStrSrc.getObject();
84 return xmlPLReader.toParameterList(xmlParams, depSheet);
89 const ParameterList ¶mList,
91 RCP<const DependencySheet> depSheet
94 XMLParameterListWriter plWriter;
95 XMLObject xml = plWriter.toXML(paramList, depSheet);
96 xmlOut << xml << std::endl;
101 const ParameterList ¶mList,
102 const std::string &xmlFileName,
103 RCP<const DependencySheet> depSheet
106 std::ofstream ofs(xmlFileName.c_str());
Simple helper functions that make it easy to read and write XML to and from a parameterlist.
Writes an XML object to a parameter list.
Writes a ParameterList to an XML object.
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT void updateParametersFromXmlString(const std::string &xmlStr, const Ptr< ParameterList > ¶mList, bool overwrite=true)
Reads XML parameters from a std::string and updates those already in the given parameter list.
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT void writeParameterListToXmlOStream(const ParameterList ¶mList, std::ostream &xmlOut, RCP< const DependencySheet > depSheet=null)
Write parameters and sublists in XML format to an std::ostream.
RCP< ParameterList > parameterList()
Nonmember constructor.
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT void updateParametersFromXmlFile(const std::string &xmlFileName, const Ptr< ParameterList > ¶mList)
Reads XML parameters from a file and updates those already in the given parameter list.
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT RCP< ParameterList > getParametersFromXmlString(const std::string &xmlStr)
Reads XML parameters from a std::string and return them in a new parameter list.
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT void writeParameterListToXmlFile(const ParameterList ¶mList, const std::string &xmlFileName, RCP< const DependencySheet > depSheet=null)
Write parameters and sublist to an XML file.
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT RCP< ParameterList > getParametersFromXmlFile(const std::string &xmlFileName)
Reads XML parameters from a file and return them in a new parameter list.
Smart reference counting pointer class for automatic garbage collection.