Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
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]

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

Protected Types

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

Protected Member Functions

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

Protected Attributes

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

Private Member Functions

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

Private Attributes

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

Static Private Attributes

static PlotterBaseXMLs_instance
 The pointer to the singleton object. More...
 

Detailed Description

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

Author
Paul F. Kunz Paul_.nosp@m.Kunz.nosp@m.@slac.nosp@m..sta.nosp@m.nford.nosp@m..edu

Definition at line 41 of file PlotterBaseXML.h.

Member Typedef Documentation

◆ NodeList_t

typedef std::list< XmlElement * > NodeList_t
protectedinherited

The container type for element nodes.

Definition at line 47 of file BaseXML.h.

Constructor & Destructor Documentation

◆ PlotterBaseXML() [1/3]

PlotterBaseXML ( const PlotterBaseXML )
private

A private copy constructor in order to avoid copying.

Referenced by PlotterBaseXML::PlotterBaseXML().

◆ PlotterBaseXML() [2/3]

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, PlotterBaseXML::m_font, and PlotterBaseXML::~PlotterBaseXML().

◆ PlotterBaseXML() [3/3]

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, PlotterBaseXML::m_tuple_cut_xml, and PlotterBaseXML::PlotterBaseXML().

◆ ~PlotterBaseXML()

Member Function Documentation

◆ areDataSourcesSaved()

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

◆ createAxisModel()

void createAxisModel ( XmlElement tag,
const PlotterBase plotter,
hippodraw::Axes::Type  axis 
)
private

◆ createAxisModels()

void createAxisModels ( const XmlElement element,
PlotterBase plotter 
)
private

◆ createChildren()

void createChildren ( XmlElement tag,
const PlotterBase plotter 
)
private

◆ createCutChildren()

void createCutChildren ( XmlElement tag,
const CutPlotter plotter 
)
private

◆ createElement() [1/2]

XmlElement * createElement ( )
inherited

◆ createElement() [2/2]

XmlElement * createElement ( const PlotterBase plotter)

◆ createFontElement()

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

◆ createFontElements()

void createFontElements ( XmlElement tag,
const XyPlotter plotter 
)
private

◆ createFontObjects()

void createFontObjects ( const XmlElement plot_element,
PlotterBase plotter 
)
protected

◆ createPlotter()

PlotterBase * createPlotter ( const XmlElement element)
private

◆ createTextChildren()

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(), PlotterBaseXML::createFontElements(), TextPlotter::getParentDataRep(), BaseXML::m_controller, XmlController::m_xml_doc, and XmlElement::setAttribute().

Referenced by PlotterBaseXML::createChildren(), and PlotterBaseXML::createCutChildren().

◆ fillNodeList()

void fillNodeList ( const XmlElement element,
std::list< XmlElement * > &  nodelist 
)
inherited

◆ getCutTargets()

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::createPlotter(), and PlotterBaseXML::handleCutPlotter().

◆ getNode()

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(), BinningProjectorXML::getObject(), PlotterBaseXML::getObject(), ViewBaseXML::getObjects(), and BinningProjectorXML::setBins().

◆ getObject()

PlotterBase * getObject ( const XmlElement element)
virtual

◆ handleCutPlotter()

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(), PlotterBaseXML::handleTextPlotter(), BaseXML::m_controller, PlotterBaseXML::m_tuple_cut_xml, and CutPlotter::setCuts().

Referenced by PlotterBaseXML::getObject(), and PlotterBaseXML::handleFunction().

◆ handleFunction()

void handleFunction ( const XmlElement dr_element,
hippodraw::DataRep rep 
)
private

◆ handleTextPlotter()

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(), and PlotterBaseXML::handleCutPlotter().

◆ setId()

void setId ( XmlElement tag,
int  id 
)
protectedinherited

◆ tagName()

const string & tagName ( ) const
virtualinherited

Returns the tag name used by this class.

Definition at line 48 of file BaseXML.cxx.

References BaseXML::m_tagname.

Member Data Documentation

◆ m_axis

std::string m_axis
private

◆ m_axismodel

AxisModelXML* m_axismodel
private

◆ m_controller

XmlController* m_controller
protectedinherited

◆ m_datarep

DataRepXML* m_datarep
private

◆ m_font

FontXML* m_font
private

◆ m_id

const std::string m_id
protectedinherited

The attribute name for the identification of the object.

Definition at line 57 of file BaseXML.h.

Referenced by BaseXML::setId().

◆ m_pindex

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

◆ m_pointrep

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

◆ m_tagname

const std::string m_tagname
protectedinherited

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

◆ m_title

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

◆ m_transform_xml

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

◆ m_tuple_cut_xml

TupleCutXML* m_tuple_cut_xml
private

◆ m_type

const std::string m_type
protectedinherited

◆ m_x_label

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

◆ m_y_label

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

◆ m_z_label

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

◆ s_instance

PlotterBaseXML* s_instance
staticprivate

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