18 #include <itksys/SystemTools.hxx>
22 #include <boost/property_tree/ptree.hpp>
23 #define RAPIDXML_NO_EXCEPTIONS
24 #include <boost/property_tree/xml_parser.hpp>
49 std::ofstream outStream;
51 if( this->GetOutputStream() )
53 out = this->GetOutputStream();
55 outStream.open( this->GetOutputLocation().c_str() );
66 const std::string& locale =
"C";
67 const std::string& currLocale = setlocale( LC_ALL, NULL );
68 setlocale(LC_ALL, locale.c_str());
70 std::locale previousLocale(out->getloc());
74 std::string
filename = this->GetOutputLocation().c_str();
77 std::string ext = itksys::SystemTools::GetFilenameLastExtension(this->GetOutputLocation().c_str());
79 boost::property_tree::ptree type;
80 type.put(
"comptype", input->getOperationType());
81 boost::property_tree::xml_writer_settings<std::string> writerSettings(
' ', 2);
82 boost::property_tree::xml_parser::write_xml(filename, type, std::locale(), writerSettings);
84 setlocale(LC_ALL, currLocale.c_str());
DataCollection - Class to facilitate loading/accessing structured data.
static const std::string filename
static const char * GetStaticNameOfClass()
us::ServiceRegistration< IFileWriter > RegisterService(us::ModuleContext *context=us::GetModuleContext())
Base class for writing mitk::BaseData objects to files or streams.