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 > &
std::map< int, PlotterBase * > m_plotter_map
The mapping from PlotterBase Id to created PlotterBase.
std::list< ViewBase * > m_views
A list of reconstructed views.
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...
void getTupleCuts()
Creates all the TupleCut objects and fills the reference map.
ViewBaseXML * m_view
The singleton instance of a ViewBaseXML object.
TupleCutXML class interface.
virtual XmlElement * createElement(const std::string &tagName)=0
Creates a new DOM element wrapper object and returns a pointer to it.
static CutController * instance()
Returns the pointer to the singleton instance.
void connectDataRep(DataRep *rep, const std::vector< const ViewBase * > &views)
Connects the DataRep object to its appropriate Cut Plotter.
virtual Status openNTuples()
Attempts to open ntuple files in the current document and put them into the map.
void fillNTupleMap()
Fills the NTuple map with NTuple objects currently in memory.
const std::list< ViewBase * > & getFromDocument(ViewFactory *facotry, const std::vector< const ViewBase * > &views)
Restores the views in the current document.
HiNTupleXML * m_ntuple
The singleton instance of the XML handler for data source.
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.
std::string getName(const XmlElement &tag) const
Returns the name of the HiNTuple object.
virtual void getObjects(const XmlElement *element)
Creates an object derived from ViewBase.
XmlController class interface.
std::list< std::string > m_missing_tuples
A list of missing NTuples.
virtual int getID() const =0
Returns the ID of the element, if it has one.
A class that is does XML serialization and de-serialization of derived classes of DataRep...
virtual Status saveToFile(const std::string &filename)=0
Saves the document to the file.
virtual bool serializeViews(const std::vector< const ViewBase * > &views)
Serializes the ViewBase objects in views and their appropriate subcomponents.
bool isPasteboardEmpty()
Returns true if global pasteboard is empty.
std::map< int, const DataSource * > m_tuple_map
A mapping from XML id to created data sources.
ViewBaseXML class interface.
std::map< const void *, int > m_addr_map
The map of memory address to unique integer identifier.
TupleCut * getObject(const XmlElement &tag) const
Creates an TupleCut object and sets its properties from the XmlElement.
A pure virtual base class of XML element wrapper.
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...
The class expresses a cut on a DataSource, i.e.
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.
hippodraw::DataSource class interface.
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 addViews(const std::vector< const ViewBase * > &views)
Adds ViewBase elements to the root of the document.
A abstract base class for font handling.
XmlElement class interface.
The base class for the PlotterBase hierarchy.
hippodraw::DataRep * createObject(const XmlElement *element)
Returns a newly created object based on the XmlElement.
std::list< std::string > & getMissingTuples()
Return a list of missing tuples.
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.
XmlDocument class interface.
virtual void newDocument(const std::string &name)=0
Creates a new document.
A class XML creation and parsing of XmlElement for ViewBase class.
The base class for data representations.
std::map< const DataSource *, XmlElement * > m_data
The map of data sources to XmlElements for the current document.
A singleton class that is does XML serialization and deserialization of derived classes of HiNTuple...
Status openFile(const std::string &filename)
Attempts to open and parse the specified HippoDraw document.
virtual void appendChild(const XmlNode &child)=0
Appends a child element to the element.
An abstract base class of XML document element wrapper.
std::map< int, const TupleCut * > m_tuple_cut_map
A mapping from XML id to created TupleCut.
XmlDocument * m_selectboard
A copy of a selection.
void saveToSelectionCopy(const std::vector< const ViewBase * > &views)
Saves the document represented by the list of ViewBase objects to the selection copy.
virtual Status openDocument(const std::string &filename)
Opens an existing DOM Document file filename.
int m_id
The next integer identifier to be generated.
virtual ~XmlController()
The destructor.
const DataSource * getDataSource(int ref_id)
Returns pointer to data source from the xml reference ID.
Status
Status codes for opening an XML document.
std::vector< int > m_missing_ids
A vector of the ids in the Xml file of the missing NTuples.
virtual Status openUpdatedNTuples()
Open the missing tuples updated by GUI.
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...
virtual void createDocument(const std::string &doc_name)
Creates an DOM Document with name doc_name.
int getId(const void *address)
Returns the unique integer identifier for given address.
Status
Return codes of opening file.
XmlDocument * m_pasteboard
The pasteboard object.
A singleton class that is the interface between GUI and the DataSource objects.
hippodraw::CutController class interface
TupleCutXML * m_tuple_cut_xml
The singleton instance of the XML handler for TupleCut objects.
virtual Status setContent(const std::string &filename)=0
Sets the content of the XML document from the text in the file filename.
void clearDataSourceMap()
Deletes each element in the map and clears the map.
XmlController()
A default constructor for avoiding creation except by itself or with derived classes.
void getDataSources(std::vector< DataSource * > &, bool all=true) const
Clears and fills the vector with the registered DataSource objects.
The abstract base class for a factory that creates objects closely related to the graphics subsystem ...
HiNTupleXML class interface.
The abstract base class for views.
ViewFactory class interface.
XmlElement * createElement(const ViewBase &view)
Returns a newly created XmlElement with attributes set for view.
void saveToPasteboard(const std::vector< const ViewBase * > &)
Saves the document represented by the list of ViewBase objects to the pasteboard. ...
static XmlDocument * m_xml_doc
The current document being generated or read.
void saveToDocument(const std::vector< const ViewBase * > &selviews)
Save the ViewBase objects in selview to a XML in memory document.
const DataSource * getObject(const XmlElement &tag) const
Returns the DataSource corresponding to XmlElement.
std::map< const void *, int >::iterator AddrMapIterator_t
The iterator for memory address to unique integer identifier.
virtual ViewBase * createView(PlotterBase *plotter) const =0
Creates a view for the plotter.
XmlElement * createElement(const DataSource &ntuple)
Returns a newly created XmlElement for DataSource.
void registerPlotter(int id, PlotterBase *plotter)
Registers the plotter with id.
virtual XmlElement * addDataSource(const DataSource *ntuple)
Adds the DataSource to the document if it doesn't already exist.
virtual void getViews()
De-serializes the ViewBase objects.
DataSourceController class interface.
DataRep * getDataRep(int ref)
Returns a pointer to the DataRep from the xml reference Id.
virtual XmlElement * documentElement() const =0
Returns the root document element.
ViewFactory * m_view_factory
The factory to be used for creating views.
virtual void appendChild(XmlElement &)=0
Appends the root element to the document.
A singleton class that handles the application logic for cuts.
FontBase * createFont() const
Creates a empty QtFont object.
void fillTupleCutMap(const std::vector< const ViewBase * > &views)
Fills the TupleCut map with TupleCut objecs contained in one in the list of views.
std::map< int, DataRep * > m_datarep_map
A mapping from DataRep Id to created DataRep.
void getDataReps()
Creates all the DataRep objects and fills the reference map.
DataRepXML * m_datarep_xml
The singleton instance of the DataRepXML object.
hippodraw::DataRepXML class interface
ViewBase * createView(PlotterBase *)
Creates a new view for the current PlotterBase object and adds it to the list of views.
PlotterBase * getPlotter(int ref)
Returns a pointer to the PlotterBase object from the XML refereed Id.
const TupleCut * getTupleCut(int ref_id)
Returns pointer to the TupleCut from the xml reference Id.
static DataSourceController * instance()
Returns the pointer to the singleton instance.
Base class for DataSource.
A class that is does XML serialization and de-serialization of derived classes of TupleCut...
hippodraw::ViewBase class interface