PlotterBaseXML Class Reference

#include <PlotterBaseXML.h>

Inheritance diagram for PlotterBaseXML:

Inheritance graph
BaseXML
[legend]
Collaboration diagram for PlotterBaseXML:

Collaboration graph
ViewBaseXMLBaseXMLHiNTupleXMLDataRepXMLMapMatrixProjectorXMLNTupleProjectorXMLPointRepXMLBinToColorXMLColorXMLBinningProjectorXMLBinsBaseXMLBinnerAxisXMLNTupleXMLFunctionProjectorXMLTupleCutXMLFontXMLAxisModelXMLAxisTickXMLTransformXMLXmlControllerXmlElementXmlNodeXmlDocumentViewFactory
[legend]
List of all members.

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.

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.


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 &  ,
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 (  ) 

The destructor.

Definition at line 84 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.


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 ,
const PlotterBase ,
hippodraw::Axes::Type  axis 
) [private]

Creates an axis model child element for the specified axis.

Definition at line 261 of file PlotterBaseXML.cxx.

References XmlNode::appendChild(), BaseXML::createElement(), PlotterBase::getAxisModel(), PlotterBaseXML::m_axis, PlotterBaseXML::m_axismodel, AxisModelXML::setAttributes(), hippodraw::Axes::X, hippodraw::Axes::Y, and hippodraw::Axes::Z.

Referenced by PlotterBaseXML::createChildren().

void createAxisModels ( const XmlElement element,
PlotterBase plotter 
) [private]

Re-creates AxisModelBase objects from the XML element.

Definition at line 402 of file PlotterBaseXML.cxx.

References BaseXML::fillNodeList(), AxisModelXML::getAxis(), PlotterBase::getAxisModel(), AxisModelBase::getLabelLocation(), AxisModelBase::getScaleLocation(), AxisModelXML::isLog(), PlotterBaseXML::m_axis, PlotterBaseXML::m_axismodel, AxisModelXML::setAttributes(), PlotterBase::setAxisModel(), and hippodraw::Axes::Z.

Referenced by PlotterBaseXML::getObject().

void createChildren ( XmlElement ,
const PlotterBase  
) [private]

Creates the children elements.

Definition at line 101 of file PlotterBaseXML.cxx.

References XmlNode::appendChild(), PlotterBaseXML::createAxisModel(), PlotterBaseXML::createCutChildren(), DataRepXML::createElement(), TransformXML::createElement(), PlotterBaseXML::createFontElements(), PlotterBaseXML::createTextChildren(), PlotterBase::getDataRep(), PlotterBase::getNumDataReps(), PlotterBase::getTransform(), PlotterBase::hasAxis(), PlotterBaseXML::m_datarep, PlotterBaseXML::m_transform_xml, hippodraw::Axes::X, hippodraw::Axes::Y, and hippodraw::Axes::Z.

Referenced by PlotterBaseXML::createElement().

void createCutChildren ( XmlElement ,
const CutPlotter plotter 
) [private]

Creates the child elements for the special case when the plotter is a derived class of CutPlotter.

Definition at line 160 of file PlotterBaseXML.cxx.

References XmlNode::appendChild(), XmlDocument::createElement(), BaseXML::createElement(), CutPlotter::getCuts(), CutPlotter::getCutTargets(), BaseXML::m_controller, PlotterBaseXML::m_tuple_cut_xml, XmlController::m_xml_doc, and XmlElement::setAttribute().

Referenced by PlotterBaseXML::createChildren().

XmlElement * createElement (  )  [inherited]

Creates a new element node.

Uses the current document as determined by the XMLController.

Definition at line 43 of file BaseXML.cxx.

References XmlDocument::createElement(), BaseXML::m_tagname, and XmlController::m_xml_doc.

Referenced by PlotterBaseXML::createAxisModel(), DataRepXML::createChildren(), BinningProjectorXML::createChildren(), AxisModelXML::createChildren(), NTupleXML::createChildren2D(), PlotterBaseXML::createCutChildren(), ViewBaseXML::createElement(), TupleCutXML::createElement(), TransformXML::createElement(), PointRepXML::createElement(), PlotterBaseXML::createElement(), NTupleXML::createElement(), NTupleProjectorXML::createElement(), MapMatrixProjectorXML::createElement(), HiNTupleXML::createElement(), FunctionProjectorXML::createElement(), DataRepXML::createElement(), ColorXML::createElement(), BinToColorXML::createElement(), BinsBaseXML::createElement(), BinningProjectorXML::createElement(), BinnerAxisXML::createElement(), PlotterBaseXML::createFontElement(), and PlotterBaseXML::createFontElements().

XmlElement * createElement ( const PlotterBase plotter  ) 

Returns a newly created XmlElement with attributes set for plotter.

Definition at line 285 of file PlotterBaseXML.cxx.

References PlotterBaseXML::createChildren(), BaseXML::createElement(), PlotterBase::getInternalLabel(), PlotterBase::getInternalTitle(), PlotterBase::getParentDataRepIndex(), PlotterBase::getParentPlotter(), BaseXML::m_controller, PlotterBaseXML::m_pindex, PlotterBaseXML::m_title, BaseXML::m_type, PlotterBaseXML::m_x_label, PlotterBaseXML::m_y_label, PlotterBaseXML::m_z_label, PlotterBase::name(), XmlElement::setAttribute(), BaseXML::setId(), hippodraw::Axes::X, hippodraw::Axes::Y, and hippodraw::Axes::Z.

Referenced by ViewBaseXML::createChild().

void createFontElement ( XmlElement tag,
const XyPlotter plotter,
hippodraw::Axes::Type  axis 
) [private]

Creates an element for label font.

Definition at line 228 of file PlotterBaseXML.cxx.

References XmlNode::appendChild(), BaseXML::createElement(), XyPlotter::labelFont(), PlotterBaseXML::m_axis, PlotterBaseXML::m_font, hippodraw::Axes::X, hippodraw::Axes::Y, and hippodraw::Axes::Z.

Referenced by PlotterBaseXML::createFontElements().

void createFontElements ( XmlElement tag,
const XyPlotter plotter 
) [private]

Creates all the font elements, if needed.

Definition at line 207 of file PlotterBaseXML.cxx.

References XmlNode::appendChild(), hippodraw::Axes::convert(), BaseXML::createElement(), PlotterBaseXML::createFontElement(), PlotterBaseXML::m_axis, PlotterBaseXML::m_font, XyPlotter::titleFont(), and num_util::type().

Referenced by PlotterBaseXML::createChildren().

void createFontObjects ( const XmlElement ,
PlotterBase plotter 
) [protected]

Creates the FontBase objects, if any.

Definition at line 375 of file PlotterBaseXML.cxx.

References BaseXML::fillNodeList(), PlotterBaseXML::m_axis, BaseXML::m_controller, PlotterBaseXML::m_font, and hippodraw::Axes::T.

Referenced by PlotterBaseXML::getObject().

PlotterBase * createPlotter ( const XmlElement element  )  [private]

Creates the plotter object from the XML element.

Definition at line 432 of file PlotterBaseXML.cxx.

References XmlElement::attribute(), hippodraw::String::ci_find(), Factory::create(), PlotterFactory::instance(), BaseXML::m_controller, PlotterBaseXML::m_pindex, PlotterBaseXML::m_title, BaseXML::m_type, PlotterBaseXML::m_x_label, PlotterBaseXML::m_y_label, PlotterBaseXML::m_z_label, PlotterBase::setBottomMargin(), PlotterBase::setEnableZ(), PlotterBase::setLeftMargin(), PlotterBase::setTopMargin(), PlotterBase::setZMargin(), num_util::type(), hippodraw::Axes::X, hippodraw::Axes::Y, and hippodraw::Axes::Z.

Referenced by PlotterBaseXML::getObject().

void createTextChildren ( XmlElement ,
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]

Fills the nodelist with immediate child nodes of element with nodes that can be handled by this object.

Definition at line 58 of file BaseXML.cxx.

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

Referenced by ViewBaseXML::connectPlotters(), PlotterBaseXML::createAxisModels(), AxisModelXML::createChildren(), PlotterBaseXML::createFontObjects(), BinToColorXML::createObject(), BinsBaseXML::createObject(), XmlController::getDataReps(), PlotterBaseXML::getObject(), TupleCutXML::getObjects(), XmlController::getTupleCuts(), XmlController::getViews(), PlotterBaseXML::handleCutPlotter(), XmlController::openNTuples(), and TupleCutXML::setAttributes().

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(), 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]

Returns the PlotterBase object represented by the element.

Definition at line 318 of file PlotterBaseXML.cxx.

References FunctionController::addDataRep(), PlotterBaseXML::createAxisModels(), PlotterBaseXML::createFontObjects(), TransformXML::createObject(), PlotterBaseXML::createPlotter(), BaseXML::fillNodeList(), XmlController::getDataRep(), XmlElement::getID(), BaseXML::getNode(), PlotterBaseXML::handleCutPlotter(), PlotterBaseXML::handleFunction(), PlotterBaseXML::handleTextPlotter(), FunctionController::instance(), BaseXML::m_controller, PlotterBaseXML::m_datarep, PlotterBaseXML::m_transform_xml, and PlotterBase::setTransform().

Referenced by ViewBaseXML::getObjects().

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::String::convert(), BaseXML::fillNodeList(), PlotterBaseXML::getCutTargets(), XmlController::getTupleCut(), BaseXML::m_controller, PlotterBaseXML::m_tuple_cut_xml, and CutPlotter::setCuts().

Referenced by PlotterBaseXML::getObject().

void handleFunction ( const XmlElement element,
hippodraw::DataRep rep 
) [private]

Handles the DataRep object if it is FunctionRep.

Definition at line 520 of file PlotterBaseXML.cxx.

References XmlController::getDataRep(), XmlElement::getID(), XmlElement::getNode(), BaseXML::m_controller, and FunctionRep::setTarget().

Referenced by PlotterBaseXML::getObject().

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]

Sets the unique identification of the object.

Definition at line 64 of file BaseXML.cxx.

References BaseXML::m_id, and XmlElement::setAttribute().

Referenced by ViewBaseXML::createElement(), TupleCutXML::createElement(), PlotterBaseXML::createElement(), NTupleProjectorXML::createElement(), MapMatrixProjectorXML::createElement(), HiNTupleXML::createElement(), FunctionProjectorXML::createElement(), DataRepXML::createElement(), BinningProjectorXML::createElement(), PointRepXML::setAttributes(), and NTupleXML::setAttributes().

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]

The attribute name of labeling an axis for the AxisModelBase elements.

Definition at line 70 of file PlotterBaseXML.h.

Referenced by PlotterBaseXML::createAxisModel(), PlotterBaseXML::createAxisModels(), PlotterBaseXML::createFontElement(), PlotterBaseXML::createFontElements(), and PlotterBaseXML::createFontObjects().

AxisModelXML* m_axismodel [private]

The AxisModelXML instance used by this object.

Definition at line 50 of file PlotterBaseXML.h.

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

XmlController* m_controller [protected, inherited]

The singleton XML controller object.

Definition at line 60 of file BaseXML.h.

Referenced by ViewBaseXML::connectPlotters(), NTupleProjectorXML::createChildren(), PlotterBaseXML::createCutChildren(), DataRepXML::createDataRep(), ViewBaseXML::createElement(), TupleCutXML::createElement(), PlotterBaseXML::createElement(), NTupleProjectorXML::createElement(), MapMatrixProjectorXML::createElement(), HiNTupleXML::createElement(), FunctionProjectorXML::createElement(), DataRepXML::createElement(), BinningProjectorXML::createElement(), PlotterBaseXML::createFontObjects(), DataRepXML::createFunctionTargetChild(), DataRepXML::createObject(), PlotterBaseXML::createPlotter(), PlotterBaseXML::createTextChildren(), PlotterBaseXML::getCutTargets(), PlotterBaseXML::getObject(), ViewBaseXML::getObjects(), PlotterBaseXML::handleCutPlotter(), PlotterBaseXML::handleFunction(), PlotterBaseXML::handleTextPlotter(), PointRepXML::setAttributes(), and NTupleXML::setAttributes().

DataRepXML* m_datarep [private]

The DataRepXML instance used by this object.

Definition at line 53 of file PlotterBaseXML.h.

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

FontXML* m_font [private]

The FontXML instance used by this object.

Definition at line 65 of file PlotterBaseXML.h.

Referenced by PlotterBaseXML::createFontElement(), PlotterBaseXML::createFontElements(), PlotterBaseXML::createFontObjects(), PlotterBaseXML::PlotterBaseXML(), and PlotterBaseXML::~PlotterBaseXML().

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().

TransformXML* m_transform_xml [private]

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().

TupleCutXML* m_tuple_cut_xml [private]

The TupleCutXML instance used by this object.

Definition at line 62 of file PlotterBaseXML.h.

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

const std::string m_type [protected, inherited]

The attribute name for the type of object.

Used to create object from one of the classes derived from Factory.

Definition at line 54 of file BaseXML.h.

Referenced by DataRepXML::createDataRep(), TransformXML::createElement(), PlotterBaseXML::createElement(), DataRepXML::createElement(), BinToColorXML::createElement(), BinsBaseXML::createElement(), TransformXML::createObject(), PointRepXML::createObject(), DataRepXML::createObject(), BinToColorXML::createObject(), BinsBaseXML::createObject(), BinnerAxisXML::createObject(), PlotterBaseXML::createPlotter(), PointRepXML::setAttributes(), and BinnerAxisXML::setAttributes().

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