XmlController.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*- */
2 
14 #ifndef _XmlController_H_
15 #define _XmlController_H_
16 
17 #include "pattern/libhippo.h"
18 
19 
20 #include <list>
21 #include <map>
22 #include <string>
23 #include <vector>
24 
25 namespace hippodraw {
26 class DataRep;
27 class DataRepXML;
28 class DataSource;
29 class FontBase;
30 class HiNTupleXML;
31 class PlotterBase;
32 class TupleCut;
33 class TupleCutXML;
34 class ViewBase;
35 class ViewBaseXML;
36 class ViewFactory;
37 class XmlDocument;
38 class XmlElement;
39 
54 {
55 
56 public:
57 
59  enum Status { Success, OpenError, ParseError, NTupleError };
60 
61 private:
62 
65 
67  XmlController ( const XmlController & );
68 
71  std::list < std::string > m_missing_tuples;
72 
75  std::vector < int > m_missing_ids;
76 
79  void clearDataSourceMap ();
80 
82  void fillNTupleMap ();
83 
86  void fillTupleCutMap ( const std::vector < const ViewBase * > & views );
87 
91  void saveToDocument ( const std::vector < const ViewBase * > & selviews );
92 
94  const std::list < ViewBase * > &
95  getFromDocument ( ViewFactory * facotry,
96  const std::vector < const ViewBase * > & views );
97 
100 
103 
105  std::list < ViewBase * > m_views;
106 
108  std::map < const DataSource *, XmlElement * > m_data;
109 
112  std::map < const void *, int > m_addr_map;
113 
116  typedef std::map < const void *, int >::iterator AddrMapIterator_t;
117 
120  int m_id;
121 
123  std::map < int, const DataSource * > m_tuple_map;
124 
126  std::map < int, const TupleCut * > m_tuple_cut_map;
127 
129  std::map < int, DataRep * > m_datarep_map;
130 
132  std::map < int, PlotterBase * > m_plotter_map;
133 
136 
139 
142 
145 
148 
152  virtual void newDocument ( const std::string & name ) = 0;
153 
160  virtual Status openDocument ( const std::string & filename );
161 
165  virtual Status openNTuples ( );
166 
167 
169  void getDataReps ();
170 
172  void getTupleCuts ();
173 
175  virtual void getViews ( );
176 
178  void getViews ( const XmlElement * root );
179 
180 protected:
181 
184  XmlController();
185 
186 public:
187 
189  virtual ~XmlController();
190 
195 
198  virtual void createDocument ( const std::string & doc_name );
199 
201  virtual bool fileExists ( const std::string & filename ) const = 0;
202 
206  Status openFile ( const std::string & filename );
207 
210  virtual const std::list < ViewBase * > & getViews ( ViewFactory * );
211 
214  bool areDataSourcesSaved ( const std::vector < const ViewBase * > & views );
215 
219  virtual bool
220  serializeViews ( const std::vector < const ViewBase * > & views );
221 
223  bool isPasteboardEmpty ();
224 
230  const std::list < ViewBase * > &
231  getFromPasteboard ( ViewFactory * factory,
232  const std::vector < const ViewBase * > & views );
233 
236  const std::list < ViewBase * > &
237  getFromSelectionCopy ( ViewFactory * factory,
238  const std::vector < const ViewBase * > & views );
239 
244  void saveToPasteboard ( const std::vector < const ViewBase * > & );
245 
250  void saveToSelectionCopy ( const std::vector < const ViewBase * > & views );
251 
254  Status saveToFile ( const std::vector < const ViewBase * > & views,
255  const std::string & filename );
256 
257 
259  PlotterBase * createDisplay ( );
260 
262  void addViews ( const std::vector < const ViewBase * > & views );
263 
267  ViewBase * createView ( PlotterBase * );
268 
271  FontBase * createFont () const;
272 
275  virtual XmlElement * addDataSource ( const DataSource * ntuple );
276 
278  const DataSource * getDataSource ( int ref_id );
279 
282  const TupleCut * getTupleCut ( int ref_id );
283 
285  DataRep * getDataRep ( int ref );
286 
290  PlotterBase * getPlotter ( int ref );
291 
294  void registerPlotter ( int id, PlotterBase * plotter );
295 
298  int getId ( const void * address );
299 
303  std::list < std::string > & getMissingTuples ();
304 
307  virtual Status openUpdatedNTuples ( );
308 
309 };
310 
311 } // namespace hippodraw
312 
313 #endif // _XmlController_H_
std::map< int, PlotterBase * > m_plotter_map
The mapping from PlotterBase Id to created PlotterBase.
#define MDL_HIPPOPLOT_API
Definition: libhippo.h:36
std::list< ViewBase * > m_views
A list of reconstructed views.
ViewBaseXML * m_view
The singleton instance of a ViewBaseXML object.
HiNTupleXML * m_ntuple
The singleton instance of the XML handler for data source.
std::list< std::string > m_missing_tuples
A list of missing NTuples.
Definition: XmlController.h:71
A class that is does XML serialization and de-serialization of derived classes of DataRep...
Definition: DataRepXML.h:46
std::map< int, const DataSource * > m_tuple_map
A mapping from XML id to created data sources.
std::map< const void *, int > m_addr_map
The map of memory address to unique integer identifier.
A pure virtual base class of XML element wrapper.
Definition: XmlElement.h:30
The class expresses a cut on a DataSource, i.e.
Definition: TupleCut.h:43
A abstract base class for font handling.
Definition: FontBase.h:32
The base class for the PlotterBase hierarchy.
Definition: PlotterBase.h:55
A class XML creation and parsing of XmlElement for ViewBase class.
Definition: ViewBaseXML.h:29
The base class for data representations.
Definition: DataRep.h:68
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...
Definition: HiNTupleXML.h:29
An abstract base class of XML document element wrapper.
Definition: XmlDocument.h:32
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.
int m_id
The next integer identifier to be generated.
std::vector< int > m_missing_ids
A vector of the ids in the Xml file of the missing NTuples.
Definition: XmlController.h:75
Status
Return codes of opening file.
Definition: XmlController.h:59
XmlDocument * m_pasteboard
The pasteboard object.
Definition: XmlController.h:99
TupleCutXML * m_tuple_cut_xml
The singleton instance of the XML handler for TupleCut objects.
The abstract base class for a factory that creates objects closely related to the graphics subsystem ...
Definition: ViewFactory.h:35
The abstract base class for views.
Definition: ViewBase.h:62
static XmlDocument * m_xml_doc
The current document being generated or read.
std::map< const void *, int >::iterator AddrMapIterator_t
The iterator for memory address to unique integer identifier.
XmlElement * m_element
The XmlElement object used to parse the DOM tree.
ViewFactory * m_view_factory
The factory to be used for creating views.
Definition: XmlController.h:64
A base class that is the interface between GUI and the XML serialization and deserialization.
Definition: XmlController.h:53
std::map< int, DataRep * > m_datarep_map
A mapping from DataRep Id to created DataRep.
DataRepXML * m_datarep_xml
The singleton instance of the DataRepXML object.
Base class for DataSource.
Definition: DataSource.h:55
A class that is does XML serialization and de-serialization of derived classes of TupleCut...
Definition: TupleCutXML.h:32

Generated for HippoDraw Class Library by doxygen