18 #include "msdevstudio/MSconfig.h"
41 using std::runtime_error;
44 using namespace hippodraw;
47 :
BaseXML (
"HiNTuple", controller ),
56 const void * addr = reinterpret_cast <
const void * > ( & ntuple );
60 const string & full_name = ntuple.
getName ();
61 tag -> setAttribute (
m_name, full_name );
72 #ifndef STRING_CLEAR_DEFECT // change to ifdef when M4 macro is implemented
73 if ( ! ok ) name.erase ( name.begin(), name.end() );
75 if ( ! ok ) name.clear();
92 string::size_type pos = fullname.find_last_of (
":" );
93 if ( pos != string::npos && pos != 1 ) {
94 filename = fullname.substr ( 0, pos );
95 name = fullname.substr ( pos + 2 );
102 pos = filename.find_last_of (
"." );
103 if ( pos != string::npos ) {
104 suffix = filename.substr ( pos + 1 );
107 if ( suffix.empty () == false ) {
108 if ( suffix ==
"fits" || suffix ==
"gz" ) {
111 ntuple = controller -> createNTuple ( filename, name );
113 string what (
"Can not open file\n" );
114 what += filename +
"\n";
115 what +=
"because application was not built with FITS support";
116 throw runtime_error ( what );
119 else if ( suffix ==
"root" ) {
122 ntuple = controller -> createNTuple ( filename, name );
124 string what (
"Can not open file\n" );
125 what += filename +
"\n";
126 what +=
"because application was not bult with ROOT support";
127 throw runtime_error ( what );
144 const string fullname =
getName ( tag );
145 if ( fullname.empty() )
return 0;
XmlElement * createElement()
Creates a new element node.
static FitsController * instance()
Returns the singleton instance of the FitsController.
hippodraw::RootController class interface.
virtual bool attribute(const std::string &name, bool &value) const =0
Sets value to the attribute name's value.
std::string getName(const XmlElement &tag) const
Returns the name of the HiNTuple object.
XmlController class interface.
A pure virtual base class of XML element wrapper.
DataSource * createNTuple(const std::string &filename)
Creates and registers an NTuple from data in file filename.
void setId(XmlElement &tag, int id)
Sets the unique identification of the object.
hippodraw::NTuple class interface.
hippodraw::FitsController class interface.
A singleton class that is the interface between GUI and the NTuple objects.
XmlController * m_controller
The singleton XML controller object.
static NTupleController * instance()
Returns the pointer to the singleton instance.
XmlElement class interface.
A Controller class for FITS files.
const DataSource * getObject(const XmlElement &tag) const
Returns the DataSource corresponding to XmlElement.
A base class of XML element controllers.
static RootController * instance()
Returns the singleton instance of the RootController.
std::string m_name
The tag name for the name attribute.
hippodraw::NTupleController class interface
HiNTupleXML(const HiNTupleXML &)
A private copy constructor in order to avoid copying.
A Controller class for ROOT files.
A base class that is the interface between GUI and the XML serialization and deserialization.
HiNTupleXML class interface.
const std::string & getName() const
Returns the name of the data source.
Base class for DataSource.