Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

PlotterBaseXML Class Reference

#include <PlotterBaseXML.h>

Inheritance diagram for PlotterBaseXML:

Inheritance graph
[legend]
Collaboration diagram for PlotterBaseXML:

Collaboration graph
[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 39 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::stringtagName () const
 Returns the tag name used by this class.

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 AxisModel 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, 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 * > BaseXML::NodeList_t [protected, inherited]
 

The container type for element nodes.

Definition at line 45 of file BaseXML.h.


Constructor & Destructor Documentation

PlotterBaseXML::PlotterBaseXML const PlotterBaseXML  )  [private]
 

A private copy constructor in order to avoid copying.

PlotterBaseXML::PlotterBaseXML const std::string ,
XmlController controller
[protected]
 

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

Definition at line 68 of file PlotterBaseXML.cxx.

References m_axismodel, m_datarep, and m_font.

PlotterBaseXML::PlotterBaseXML XmlController controller  ) 
 

The only public constructor.

The parameter controller must object of class derived from XMLController.

Definition at line 50 of file PlotterBaseXML.cxx.

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


Member Function Documentation

bool PlotterBaseXML::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 78 of file PlotterBaseXML.cxx.

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

Referenced by ViewBaseXML::areDataSourcesSaved().

void PlotterBaseXML::createAxisModel XmlElement ,
const PlotterBase ,
hippodraw::Axes::Type  axis
[private]
 

Creates an AxisModel child element for the specified axis.

Definition at line 237 of file PlotterBaseXML.cxx.

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

Referenced by createChildren().

void PlotterBaseXML::createAxisModels const XmlElement element,
PlotterBase plotter
[private]
 

Re-creates AxisModelBase objects from the XML element.

Definition at line 375 of file PlotterBaseXML.cxx.

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

Referenced by getObject().

void PlotterBaseXML::createChildren XmlElement ,
const PlotterBase
[private]
 

Creates the children elements.

Definition at line 85 of file PlotterBaseXML.cxx.

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

Referenced by createElement().

void PlotterBaseXML::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 142 of file PlotterBaseXML.cxx.

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

Referenced by createChildren().

XmlElement * BaseXML::createElement  )  [inherited]
 

Creates a new element node.

Uses the current document as determined by the XMLController.

Definition at line 41 of file BaseXML.cxx.

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

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

XmlElement * PlotterBaseXML::createElement const PlotterBase plotter  ) 
 

Returns a newly created XmlElement with attributes set for plotter.

Definition at line 260 of file PlotterBaseXML.cxx.

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

Referenced by ViewBaseXML::createChild().

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

Creates an element for label font.

Definition at line 205 of file PlotterBaseXML.cxx.

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

Referenced by createFontElements().

void PlotterBaseXML::createFontElements XmlElement tag,
const XyPlotter plotter
[private]
 

Creates all the font elements, if needed.

Definition at line 185 of file PlotterBaseXML.cxx.

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

Referenced by createChildren().

void PlotterBaseXML::createFontObjects const XmlElement ,
PlotterBase plotter
[protected]
 

Creates the FontBase objects, if any.

Definition at line 348 of file PlotterBaseXML.cxx.

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

Referenced by getObject().

PlotterBase * PlotterBaseXML::createPlotter const XmlElement element  )  [private]
 

Creates the plotter object from the XML element.

Definition at line 405 of file PlotterBaseXML.cxx.

References XmlElement::attribute(), Factory< Type >::create(), PlotterFactory::instance(), BaseXML::m_controller, m_pindex, m_title, BaseXML::m_type, m_x_label, m_y_label, m_z_label, PlotterBase::setEnableZ(), num_util::type(), hippodraw::Axes::X, hippodraw::Axes::Y, and hippodraw::Axes::Z.

Referenced by getObject().

void PlotterBaseXML::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 170 of file PlotterBaseXML.cxx.

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

Referenced by createChildren().

void BaseXML::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 56 of file BaseXML.cxx.

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

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

void PlotterBaseXML::getCutTargets const XmlElement element,
CutPlotter plotter
[private]
 

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

Definition at line 449 of file PlotterBaseXML.cxx.

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

Referenced by handleCutPlotter().

const XmlElement * BaseXML::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 51 of file BaseXML.cxx.

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

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

PlotterBase * PlotterBaseXML::getObject const XmlElement element  )  [virtual]
 

Returns the PlotterBase object represented by the element.

Definition at line 293 of file PlotterBaseXML.cxx.

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

Referenced by ViewBaseXML::getObjects().

void PlotterBaseXML::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 489 of file PlotterBaseXML.cxx.

References getCutTargets(), XmlElement::getID(), BaseXML::getNode(), XmlController::getTupleCut(), BaseXML::m_controller, m_pointrep, m_tuple_cut_xml, and CutPlotter::setCuts().

Referenced by getObject().

void PlotterBaseXML::handleFunction const XmlElement dr_element,
DataRep rep
[private]
 

Handles the DataRep object if it is FunctionRep.

Todo:
Should this be handled by FunctionProjectorXML?

Definition at line 471 of file PlotterBaseXML.cxx.

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

Referenced by getObject().

int PlotterBaseXML::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 513 of file PlotterBaseXML.cxx.

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

Referenced by getObject().

void BaseXML::setId XmlElement tag,
int  id
[protected, inherited]
 

Sets the unique identification of the object.

Definition at line 62 of file BaseXML.cxx.

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

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

const string & BaseXML::tagName  )  const [virtual, inherited]
 

Returns the tag name used by this class.

Definition at line 46 of file BaseXML.cxx.

References BaseXML::m_tagname.


Member Data Documentation

std::string PlotterBaseXML::m_axis [private]
 

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

Definition at line 68 of file PlotterBaseXML.h.

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

AxisModelXML* PlotterBaseXML::m_axismodel [private]
 

The AxisModelXML instance used by this object.

Definition at line 48 of file PlotterBaseXML.h.

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

XmlController* BaseXML::m_controller [protected, inherited]
 

The singleton XML controller object.

Definition at line 58 of file BaseXML.h.

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

DataRepXML* PlotterBaseXML::m_datarep [private]
 

The DataRepXML instance used by this object.

Definition at line 51 of file PlotterBaseXML.h.

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

FontXML* PlotterBaseXML::m_font [private]
 

The FontXML instance used by this object.

Definition at line 63 of file PlotterBaseXML.h.

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

const std::string BaseXML::m_id [protected, inherited]
 

The attribute name for the identification of the object.

Definition at line 55 of file BaseXML.h.

Referenced by BaseXML::setId().

std::string PlotterBaseXML::m_pindex [private]
 

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

Definition at line 89 of file PlotterBaseXML.h.

Referenced by createElement(), and createPlotter().

PointRepXML* PlotterBaseXML::m_pointrep [private]
 

The PointRepXML instance used by this object.

Definition at line 54 of file PlotterBaseXML.h.

Referenced by handleCutPlotter(), and PlotterBaseXML().

const std::string BaseXML::m_tagname [protected, inherited]
 

The tag name used for elements created by this class.

Definition at line 48 of file BaseXML.h.

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

std::string PlotterBaseXML::m_title [private]
 

The attribute name for the plot title.

Definition at line 72 of file PlotterBaseXML.h.

Referenced by createElement(), and createPlotter().

TransformXML* PlotterBaseXML::m_transform_xml [private]
 

The TransfromXML instance used by this object.

Definition at line 57 of file PlotterBaseXML.h.

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

TupleCutXML* PlotterBaseXML::m_tuple_cut_xml [private]
 

The TupleCutXML instance used by this object.

Definition at line 60 of file PlotterBaseXML.h.

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

const std::string BaseXML::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 52 of file BaseXML.h.

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

std::string PlotterBaseXML::m_x_label [private]
 

The attribute name for X axis label.

Definition at line 76 of file PlotterBaseXML.h.

Referenced by createElement(), and createPlotter().

std::string PlotterBaseXML::m_y_label [private]
 

The attribute name for Y axis label.

Definition at line 80 of file PlotterBaseXML.h.

Referenced by createElement(), and createPlotter().

std::string PlotterBaseXML::m_z_label [private]
 

The attribute name for Z axis label.

Definition at line 84 of file PlotterBaseXML.h.

Referenced by createElement(), and createPlotter().

PlotterBaseXML* PlotterBaseXML::s_instance [static, private]
 

The pointer to the singleton object.

Definition at line 45 of file PlotterBaseXML.h.


The documentation for this class was generated from the following files:
Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3