PlotterBaseXML Class Reference

A class that is does XML serialization and de-serialization of derived classes of PlotterBase. More...

#include <PlotterBaseXML.h>

Inheritance diagram for PlotterBaseXML:
Inheritance graph
[legend]
Collaboration diagram for PlotterBaseXML:
Collaboration graph
[legend]

List of all members.

Public Member Functions

bool areDataSourcesSaved (const PlotterBase &plotter)
 Returns true if all the NTuple objects used by the plotter are save to or read from a file.
XmlElementcreateElement ()
 Creates a new element node.
XmlElementcreateElement (const PlotterBase &plotter)
 Returns a newly created XmlElement with attributes set for plotter.
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 object.
const XmlElementgetNode (const XmlElement *element) const
 Returns the single child node of element of the type that can be handled by this object.
virtual PlotterBasegetObject (const XmlElement *element)
 Returns the PlotterBase object represented by the element.
 PlotterBaseXML (XmlController *controller)
 The only public constructor.
virtual const std::string & tagName () const
 Returns the tag name used by this class.
 ~PlotterBaseXML ()
 The destructor.

Protected Types

typedef std::list< XmlElement * > NodeList_t
 The container type for element nodes.

Protected Member Functions

void createFontObjects (const XmlElement *, PlotterBase *plotter)
 Creates the FontBase objects, if any.
 PlotterBaseXML (const std::string &, XmlController *controller)
 A constructor used by derived class to override the node name.
void setId (XmlElement &tag, int id)
 Sets the unique identification of the object.

Protected Attributes

XmlControllerm_controller
 The singleton XML controller object.
const std::string m_id
 The attribute name for the identification of the object.
const std::string m_tagname
 The tag name used for elements created by this class.
const std::string m_type
 The attribute name for the type of object.

Private Member Functions

void createAxisModel (XmlElement &, const PlotterBase &, hippodraw::Axes::Type axis)
 Creates an axis model child element for the specified axis.
void createAxisModels (const XmlElement *element, PlotterBase *plotter)
 Re-creates AxisModelBase objects from the XML element.
void createChildren (XmlElement &, const PlotterBase &)
 Creates the children elements.
void createCutChildren (XmlElement &, const CutPlotter &plotter)
 Creates the child elements for the special case when the plotter is a derived class of CutPlotter.
void createFontElement (XmlElement &tag, const XyPlotter &plotter, hippodraw::Axes::Type axis)
 Creates an element for label font.
void createFontElements (XmlElement &tag, const XyPlotter &plotter)
 Creates all the font elements, if needed.
PlotterBasecreatePlotter (const XmlElement *element)
 Creates the plotter object from the XML element.
void createTextChildren (XmlElement &, const TextPlotter &plotter)
 Creates the child elements for the special case when the plotter is a TextPlotter.
void getCutTargets (const XmlElement *element, CutPlotter *plotter)
 Searches for and connects up the target DataRep objects of the plotter.
void handleCutPlotter (const XmlElement *element, CutPlotter *plotter)
 Handles the Cut attributes from the XML element.
void handleFunction (const XmlElement *element, hippodraw::DataRep *rep)
 Handles the DataRep object if it is FunctionRep.
int handleTextPlotter (const XmlElement *element, TextPlotter *plotter)
 Handles the TextPlotter special attributes from the XML element.
 PlotterBaseXML (const PlotterBaseXML &)
 A private copy constructor in order to avoid copying.

Private Attributes

std::string m_axis
 The attribute name of labeling an axis for the AxisModelBase elements.
AxisModelXMLm_axismodel
 The AxisModelXML instance used by this object.
DataRepXMLm_datarep
 The DataRepXML instance used by this object.
FontXMLm_font
 The FontXML instance used by this object.
std::string m_pindex
 The attribute name used to save and restore index of parent DataRep.
PointRepXMLm_pointrep
 The PointRepXML instance used by this object.
std::string m_title
 The attribute name for the plot title.
TransformXMLm_transform_xml
 The TransfromXML instance used by this object.
TupleCutXMLm_tuple_cut_xml
 The TupleCutXML instance used by this object.
std::string m_x_label
 The attribute name for X axis label.
std::string m_y_label
 The attribute name for Y axis label.
std::string m_z_label
 The attribute name for Z axis label.

Static Private Attributes

static PlotterBaseXMLs_instance
 The pointer to the singleton object.

Detailed Description

A class that is does XML serialization and de-serialization of derived classes of PlotterBase.

Author:
Paul F. Kunz <Paul_Kunz@slac.stanford.edu>

Definition at line 41 of file PlotterBaseXML.h.


Member Typedef Documentation

typedef std::list< XmlElement * > NodeList_t [protected, inherited]

The container type for element nodes.

Definition at line 47 of file BaseXML.h.


Constructor & Destructor Documentation

PlotterBaseXML ( const PlotterBaseXML  )  [private]

A private copy constructor in order to avoid copying.

PlotterBaseXML ( const std::string &  name,
XmlController controller 
) [protected]

A constructor used by derived class to override the node name.

Definition at line 73 of file PlotterBaseXML.cxx.

References PlotterBaseXML::m_axismodel, PlotterBaseXML::m_datarep, and PlotterBaseXML::m_font.

PlotterBaseXML ( XmlController controller  ) 

The only public constructor.

The parameter controller must object of class derived from XMLController.

Definition at line 55 of file PlotterBaseXML.cxx.

References PlotterBaseXML::m_axismodel, PlotterBaseXML::m_datarep, PlotterBaseXML::m_font, PlotterBaseXML::m_pointrep, PlotterBaseXML::m_transform_xml, and PlotterBaseXML::m_tuple_cut_xml.

~PlotterBaseXML (  ) 

Member Function Documentation

bool areDataSourcesSaved ( const PlotterBase plotter  ) 

Returns true if all the NTuple objects used by the plotter are save to or read from a file.

Definition at line 94 of file PlotterBaseXML.cxx.

References DisplayController::areDataSourcesSaved(), and DisplayController::instance().

Referenced by ViewBaseXML::areDataSourcesSaved().

void createAxisModel ( XmlElement tag,
const PlotterBase plotter,
hippodraw::Axes::Type  axis 
) [private]
void createAxisModels ( const XmlElement element,
PlotterBase plotter 
) [private]
void createChildren ( XmlElement tag,
const PlotterBase plotter 
) [private]
void createCutChildren ( XmlElement tag,
const CutPlotter plotter 
) [private]
XmlElement * createElement (  )  [inherited]
XmlElement * createElement ( const PlotterBase plotter  ) 
void createFontElement ( XmlElement tag,
const XyPlotter plotter,
hippodraw::Axes::Type  axis 
) [private]
void createFontElements ( XmlElement tag,
const XyPlotter plotter 
) [private]
void createFontObjects ( const XmlElement plot_element,
PlotterBase plotter 
) [protected]
PlotterBase * createPlotter ( const XmlElement element  )  [private]
void createTextChildren ( XmlElement tag,
const TextPlotter plotter 
) [private]

Creates the child elements for the special case when the plotter is a TextPlotter.

It adds a element reference the target DataRep of its own TextDataRep object.

Definition at line 190 of file PlotterBaseXML.cxx.

References XmlNode::appendChild(), XmlDocument::createElement(), TextPlotter::getParentDataRep(), BaseXML::m_controller, XmlController::m_xml_doc, and XmlElement::setAttribute().

Referenced by PlotterBaseXML::createChildren().

void fillNodeList ( const XmlElement element,
std::list< XmlElement * > &  nodelist 
) [inherited]
void getCutTargets ( const XmlElement element,
CutPlotter plotter 
) [private]

Searches for and connects up the target DataRep objects of the plotter.

Definition at line 489 of file PlotterBaseXML.cxx.

References CutPlotter::addCutTarget(), XmlElement::fillNodeList(), XmlController::getDataRep(), XmlElement::getID(), and BaseXML::m_controller.

Referenced by PlotterBaseXML::handleCutPlotter().

const XmlElement * getNode ( const XmlElement element  )  const [inherited]

Returns the single child node of element of the type that can be handled by this object.

If no such node exists, returns a null pointer.

Definition at line 53 of file BaseXML.cxx.

References XmlElement::getNode(), and BaseXML::m_tagname.

Referenced by PointRepXML::createObject(), DataRepXML::createObject(), PlotterBaseXML::getObject(), BinningProjectorXML::getObject(), ViewBaseXML::getObjects(), and BinningProjectorXML::setBins().

PlotterBase * getObject ( const XmlElement element  )  [virtual]
void handleCutPlotter ( const XmlElement plot_element,
CutPlotter plotter 
) [private]

Handles the Cut attributes from the XML element.

Bug:
Old documents, before intro of function cuts, can not be read as they will be missing the cut representation.

Definition at line 538 of file PlotterBaseXML.cxx.

References hippodraw::Axes::convert(), BaseXML::fillNodeList(), PlotterBaseXML::getCutTargets(), XmlElement::getID(), XmlController::getTupleCut(), BaseXML::m_controller, PlotterBaseXML::m_tuple_cut_xml, and CutPlotter::setCuts().

Referenced by PlotterBaseXML::getObject().

void handleFunction ( const XmlElement dr_element,
hippodraw::DataRep rep 
) [private]
int handleTextPlotter ( const XmlElement element,
TextPlotter plotter 
) [private]

Handles the TextPlotter special attributes from the XML element.

Returns 1 if successful, 0 otherwise.

Definition at line 572 of file PlotterBaseXML.cxx.

References XmlController::getDataRep(), XmlElement::getID(), XmlElement::getNode(), BaseXML::m_controller, and TextPlotter::setParentDataRep().

Referenced by PlotterBaseXML::getObject().

void setId ( XmlElement tag,
int  id 
) [protected, inherited]
const string & tagName (  )  const [virtual, inherited]

Returns the tag name used by this class.

Definition at line 48 of file BaseXML.cxx.

References BaseXML::m_tagname.


Member Data Documentation

std::string m_axis [private]
XmlController* m_controller [protected, inherited]
DataRepXML* m_datarep [private]
FontXML* m_font [private]
const std::string m_id [protected, inherited]

The attribute name for the identification of the object.

Definition at line 57 of file BaseXML.h.

Referenced by BaseXML::setId().

std::string m_pindex [private]

The attribute name used to save and restore index of parent DataRep.

Definition at line 91 of file PlotterBaseXML.h.

Referenced by PlotterBaseXML::createElement(), and PlotterBaseXML::createPlotter().

PointRepXML* m_pointrep [private]

The PointRepXML instance used by this object.

Definition at line 56 of file PlotterBaseXML.h.

Referenced by PlotterBaseXML::PlotterBaseXML(), and PlotterBaseXML::~PlotterBaseXML().

const std::string m_tagname [protected, inherited]

The tag name used for elements created by this class.

Definition at line 50 of file BaseXML.h.

Referenced by BaseXML::createElement(), BaseXML::fillNodeList(), BaseXML::getNode(), and BaseXML::tagName().

std::string m_title [private]

The attribute name for the plot title.

Definition at line 74 of file PlotterBaseXML.h.

Referenced by PlotterBaseXML::createElement(), and PlotterBaseXML::createPlotter().

The TransfromXML instance used by this object.

Definition at line 59 of file PlotterBaseXML.h.

Referenced by PlotterBaseXML::createChildren(), PlotterBaseXML::getObject(), PlotterBaseXML::PlotterBaseXML(), and PlotterBaseXML::~PlotterBaseXML().

const std::string m_type [protected, inherited]
std::string m_x_label [private]

The attribute name for X axis label.

Definition at line 78 of file PlotterBaseXML.h.

Referenced by PlotterBaseXML::createElement(), and PlotterBaseXML::createPlotter().

std::string m_y_label [private]

The attribute name for Y axis label.

Definition at line 82 of file PlotterBaseXML.h.

Referenced by PlotterBaseXML::createElement(), and PlotterBaseXML::createPlotter().

std::string m_z_label [private]

The attribute name for Z axis label.

Definition at line 86 of file PlotterBaseXML.h.

Referenced by PlotterBaseXML::createElement(), and PlotterBaseXML::createPlotter().

PlotterBaseXML* s_instance [static, private]

The pointer to the singleton object.

Definition at line 47 of file PlotterBaseXML.h.


The documentation for this class was generated from the following files:

Generated for HippoDraw Class Library by doxygen