Listing 1: XMLBase class.

#include <string>
#include "ParamIO.h"
class XMLBase
{   
public:
    /** Utility method to load params from file uses virtual function readXML()
     **/
   inline bool readXMLFile(const std::string filename, 
                                      const std::string absolutePath = "");
   /** Utility method to save params to file uses virtual function writeXML()
    **/       
   inline bool writeXMLFile(const std::string filename, 
                                      const std::string absolutePath = "");
   /** Virtual functions to be over-ridden by derived classes. 
       No implementation here. **/
    /// Load parameters and settings
    virtual bool readXML(ParamIO &inXml, 
                                   const std::string absolutePath = "") = 0;
    /// Save parameters and settings
    virtual bool writeXML(ParamIO &outXml, 
                                   const std::string absolutePath = "") = 0;
};
// Load params from file
bool XMLBase::readXMLFile(const std::string filename, 
                                    const std::string absolutePath)
{  ParamIO xmlIn;
   xmlIn.readFile(filename.c_str());   
   return readXML(xmlIn, absolutePath); // This is a virtual call
}
// Save params to file
bool XMLBase::writeXMLFile(const std::string filename, 
                                     const std::string absolutePath)
{  bool res;
   ParamIO xmlOut;
   res = writeXML(xmlOut, absolutePath);  // This is a virtual call
   if (res)
      xmlOut.writeFile(filename.c_str());
   return res;
}