14 #include "msdevstudio/MSconfig.h" 93 if ( status !=
Success )
return status;
110 list < XmlElement * > nodelist;
113 std::list < XmlElement * >::const_iterator first = nodelist.begin();
115 while ( first != nodelist.end() ) {
117 int id = element->
getID ();
122 catch (
const std::runtime_error & ) {
137 std::list < string >::iterator it;
164 const list < ViewBase * > &
167 const std::vector < const ViewBase * > & views )
174 const list < ViewBase * > &
177 const std::vector < const ViewBase * > & views )
184 const list < ViewBase * > &
187 const std::vector < const ViewBase * > & views )
201 const list < ViewBase * > &
216 #ifdef ITERATOR_MEMBER_DEFECT 219 vector < const ViewBase * > ::const_iterator first = views.begin ();
220 while ( first != views.end () ) {
223 if ( yes ==
false )
break;
246 map < const DataSource *, XmlElement * > ::iterator first
248 for ( ; first !=
m_data.end (); ++ first ) {
249 delete first->second;
287 const std::string & filename )
302 addViews (
const std::vector < const ViewBase * > & views )
306 std::vector < const ViewBase * >::const_iterator it = views.begin();
307 for ( ; it != views.end(); ++it ) {
333 std::map < const DataSource *, XmlElement * >::const_iterator it
335 if ( it !=
m_data.end () ) {
350 std::map < int, const DataSource * >::const_iterator it
363 std::map < int, const TupleCut * >::iterator it
378 std::map < int, DataRep * >::iterator it
390 std::map < int, PlotterBase * >::iterator it
411 vector < DataSource * > tuples;
413 #ifdef ITERATOR_MEMBER_DEFECT 416 vector < DataSource * > ::const_iterator first = tuples.begin();
417 for ( ; first != tuples.end(); ++first ) {
418 const void * addr = reinterpret_cast <
const void * > ( *first );
419 int ref =
getId ( addr );
428 vector < const TupleCut * > cut_list;
433 vector < const TupleCut * > :: iterator first = cut_list.begin ();
434 while ( first != cut_list.end () ) {
436 void * addr = reinterpret_cast <
void * > ( &cut );
437 int id =
getId ( addr );
445 list < XmlElement * > nodelist;
448 #ifdef ITERATOR_MEMBER_DEFECT 451 list < XmlElement * > ::const_iterator first = nodelist.begin();
453 for ( ; first != nodelist.end(); ++first ) {
455 int id = element->
getID ();
465 list < XmlElement * > nodelist;
469 std::list < XmlElement * >::const_iterator first = nodelist.begin();
471 for ( ; first != nodelist.end(); ++first ) {
474 vector < TupleCut * > cuts;
476 for (
unsigned int i = 0; i < cuts.size (); i++ ) {
477 int id = element -> getID ();
478 if ( i == 1 )
id = -id;
484 int id = element->
getID ();
498 list < XmlElement * > nodelist;
501 if ( nodelist.empty () )
return;
504 std::list < XmlElement * >::const_iterator first = nodelist.begin ();
505 for ( ; first != nodelist.end(); ++ first ) {
509 m_view -> connectPlotters ( root );
530 std::list < std::string > &
void saveToPasteboard(const std::vector< const ViewBase * > &)
Saves the document represented by the list of ViewBase objects to the pasteboard. ...
TupleCutXML class interface.
void addViews(const std::vector< const ViewBase * > &views)
Adds ViewBase elements to the root of the document.
void fillTupleCutMap(const std::vector< const ViewBase * > &views)
Fills the TupleCut map with TupleCut objecs contained in one in the list of views.
static DataSourceController * instance()
Returns the pointer to the singleton instance.
void registerPlotter(int id, PlotterBase *plotter)
Registers the plotter with id.
Status
Return codes of opening file.
void fillNodeList(const XmlElement *element, std::list< XmlElement * > &nodelist)
Fills the nodelist with immediate child nodes of element with nodes that can be handled by this objec...
A abstract base class for font handling.
std::list< ViewBase *> m_views
A list of reconstructed views.
std::map< const DataSource *, XmlElement *> m_data
The map of data sources to XmlElements for the current document.
std::map< const void *, int >::iterator AddrMapIterator_t
The iterator for memory address to unique integer identifier.
std::map< int, PlotterBase *> m_plotter_map
The mapping from PlotterBase Id to created PlotterBase.
virtual bool serializeViews(const std::vector< const ViewBase * > &views)
Serializes the ViewBase objects in views and their appropriate subcomponents.
virtual ~XmlController()
The destructor.
const std::list< ViewBase *> & getFromPasteboard(ViewFactory *factory, const std::vector< const ViewBase * > &views)
Creates and returns a list of objects that was copied to the pasteboard.
virtual ViewBase * createView(PlotterBase *plotter) const =0
Creates a view for the plotter.
static XmlDocument * m_xml_doc
The current document being generated or read.
std::list< std::string > & getMissingTuples()
Return a list of missing tuples.
int getId(const void *address)
Returns the unique integer identifier for given address.
ViewBaseXML * m_view
The singleton instance of a ViewBaseXML object.
TupleCutXML * m_tuple_cut_xml
The singleton instance of the XML handler for TupleCut objects.
std::map< int, const DataSource *> m_tuple_map
A mapping from XML id to created data sources.
XmlElement * createElement(const DataSource &ntuple)
Returns a newly created XmlElement for DataSource.
const TupleCut * getTupleCut(int ref_id)
Returns pointer to the TupleCut from the xml reference Id.
PlotterBase * getPlotter(int ref)
Returns a pointer to the PlotterBase object from the XML refereed Id.
void saveToDocument(const std::vector< const ViewBase * > &selviews)
Save the ViewBase objects in selview to a XML in memory document.
Status saveToFile(const std::vector< const ViewBase * > &views, const std::string &filename)
Saves the document represented by list of ViewBase objects to file with name filename.
DataRep * getDataRep(int ref)
Returns a pointer to the DataRep from the xml reference Id.
std::list< std::string > m_missing_tuples
A list of missing NTuples.
void saveToSelectionCopy(const std::vector< const ViewBase * > &views)
Saves the document represented by the list of ViewBase objects to the selection copy.
hippodraw::DataRep * createObject(const XmlElement *element)
Returns a newly created object based on the XmlElement.
bool areDataSourcesSaved(const ViewBase &view)
Returns true if all the NTuple objects used by the view have been save to or read from a file...
ViewBase * createView(PlotterBase *)
Creates a new view for the current PlotterBase object and adds it to the list of views.
virtual void createDocument(const std::string &doc_name)
Creates an DOM Document with name doc_name.
DataSourceController class interface.
hippodraw::ViewBase class interface
The base class for data representations.
std::map< const void *, int > m_addr_map
The map of memory address to unique integer identifier.
FontBase * createFont() const
Creates a empty QtFont object.
Base class for DataSource.
HiNTupleXML * m_ntuple
The singleton instance of the XML handler for data source.
bool isPasteboardEmpty()
Returns true if global pasteboard is empty.
void fillNTupleMap()
Fills the NTuple map with NTuple objects currently in memory.
virtual void getViews()
De-serializes the ViewBase objects.
void getTupleCuts()
Creates all the TupleCut objects and fills the reference map.
HiNTupleXML class interface.
virtual Status saveToFile(const std::string &filename)=0
Saves the document to the file.
The base class for the PlotterBase hierarchy.
The abstract base class for a factory that creates objects closely related to the graphics subsystem ...
XmlDocument * m_pasteboard
The pasteboard object.
virtual XmlElement * addDataSource(const DataSource *ntuple)
Adds the DataSource to the document if it doesn't already exist.
void getDataSources(std::vector< DataSource * > &, bool all=true) const
Clears and fills the vector with the registered DataSource objects.
void clearDataSourceMap()
Deletes each element in the map and clears the map.
DataRepXML * m_datarep_xml
The singleton instance of the DataRepXML object.
virtual Status openUpdatedNTuples()
Open the missing tuples updated by GUI.
hippodraw::DataSource class interface.
A pure virtual base class of XML element wrapper.
XmlDocument class interface.
const DataSource * getDataSource(int ref_id)
Returns pointer to data source from the xml reference ID.
std::vector< int > m_missing_ids
A vector of the ids in the Xml file of the missing NTuples.
const DataSource * getObject(const XmlElement &tag) const
Returns the DataSource corresponding to XmlElement.
A class XML creation and parsing of XmlElement for ViewBase class.
XmlElement * createElement(const ViewBase &view)
Returns a newly created XmlElement with attributes set for view.
The abstract base class for views.
ViewFactory class interface.
virtual XmlElement * documentElement() const =0
Returns the root document element.
virtual XmlElement * createElement(const std::string &tagName)=0
Creates a new DOM element wrapper object and returns a pointer to it.
std::map< int, DataRep *> m_datarep_map
A mapping from DataRep Id to created DataRep.
XmlController class interface.
A singleton class that is does XML serialization and deserialization of derived classes of HiNTuple...
const std::list< ViewBase *> & getFromDocument(ViewFactory *facotry, const std::vector< const ViewBase * > &views)
Restores the views in the current document.
Status
Status codes for opening an XML document.
virtual Status openDocument(const std::string &filename)
Opens an existing DOM Document file filename.
A singleton class that handles the application logic for cuts.
virtual void newDocument(const std::string &name)=0
Creates a new document.
ViewBaseXML class interface.
A class that is does XML serialization and de-serialization of derived classes of DataRep...
static CutController * instance()
Returns the pointer to the singleton instance.
hippodraw::CutController class interface
std::string getName(const XmlElement &tag) const
Returns the name of the HiNTuple object.
hippodraw::DataRepXML class interface
XmlDocument * m_selectboard
A copy of a selection.
Status openFile(const std::string &filename)
Attempts to open and parse the specified HippoDraw document.
ViewFactory * m_view_factory
The factory to be used for creating views.
TupleCut * getObject(const XmlElement &tag) const
Creates an TupleCut object and sets its properties from the XmlElement.
int m_id
The next integer identifier to be generated.
A singleton class that is the interface between GUI and the DataSource objects.
virtual Status openNTuples()
Attempts to open ntuple files in the current document and put them into the map.
void connectDataRep(DataRep *rep, const std::vector< const ViewBase * > &views)
Connects the DataRep object to its appropriate Cut Plotter.
virtual Status setContent(const std::string &filename)=0
Sets the content of the XML document from the text in the file filename.
XmlController()
A default constructor for avoiding creation except by itself or with derived classes.
bool areDataSourcesSaved(const std::vector< const ViewBase * > &views)
Returns true if all the NTuple objects used by the views have been saved to or read from a file...
virtual int getID() const =0
Returns the ID of the element, if it has one.
XmlElement class interface.
virtual void getObjects(const XmlElement *element)
Creates an object derived from ViewBase.
const std::list< ViewBase *> & getFromSelectionCopy(ViewFactory *factory, const std::vector< const ViewBase * > &views)
Creates and returns objects that were copied to the selection copy.
void getDataReps()
Creates all the DataRep objects and fills the reference map.
An abstract base class of XML document element wrapper.
virtual void appendChild(const XmlNode &child)=0
Appends a child element to the element.
The class expresses a cut on a DataSource, i.e.
void fillTupleCutList(const std::vector< const ViewBase * > &views, std::vector< const TupleCut * > &cut_list)
Fills the cut_map with the TupleCut objects contained the list of views, if any.
A class that is does XML serialization and de-serialization of derived classes of TupleCut...
virtual void appendChild(XmlElement &)=0
Appends the root element to the document.
std::map< int, const TupleCut *> m_tuple_cut_map
A mapping from XML id to created TupleCut.