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