CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends
DDXMLElement Class Reference

This is a base class for processing XML elements in the DDD. More...

#include <DDXMLElement.h>

Inheritance diagram for DDXMLElement:
DDLAlgorithm DDLDivision DDLLogicalPart DDLMap DDLMaterial DDLNumeric DDLPosPart DDLRotationAndReflection DDLRotationByAxis DDLSolid DDLSpecPar DDLString DDLVector

Public Member Functions

void appendText (const std::string &inText)
 append to the current (i.e. most recently added) More...
 
virtual std::vector
< DDXMLAttribute >
::const_iterator 
begin (void)
 
virtual void clear (void)
 clear this element's contents. More...
 
 DDXMLElement (DDLElementRegistry *myreg)
 Constructor. More...
 
 DDXMLElement (DDLElementRegistry *myreg, const bool &clearme)
 Constructor for autoClear element. More...
 
virtual std::vector
< DDXMLAttribute >
::const_iterator 
end (void)
 
virtual const std::string & get (const std::string &name, size_t aIndex=0) const
 Returns a specific value from the aIndex set of attributes. More...
 
virtual const std::string & getAttribute (const std::string &name) const
 Access to attributes by name. More...
 
virtual const DDXMLAttributegetAttributeSet (size_t aIndex=0) const
 Get a "row" of attributes, i.e. one attribute set. More...
 
virtual const DDName getDDName (const std::string &defaultNS, const std::string &attname=std::string("name"), size_t aIndex=0)
 
const std::string getText (size_t tindex=0) const
 retrieve the text blob. More...
 
virtual std::vector< std::string > getVectorAttribute (const std::string &name)
 Returns a set of values as a std::vector of strings, given the attribute name. More...
 
virtual bool gotText (void) const
 gotText()? kind of like gotMilk? Yes = text has already been encountered. More...
 
virtual bool isEmpty (void) const
 Have any elements of this type been encountered but not processed? More...
 
void loadAttributes (const std::string &elemName, const std::vector< std::string > &names, const std::vector< std::string > &values, const std::string &nmspace, DDCompactView &cpv)
 Load the element attributes. More...
 
void loadText (const std::string &inText)
 Used to load both text and XML comments into this object. More...
 
std::vector< DDXMLAttribute >
::const_iterator & 
operator++ (int inc)
 Allow the elements of this type to be iterated over using ++ operator. More...
 
const std::string & parent (void) const
 access to parent element name More...
 
virtual void preProcessElement (const std::string &name, const std::string &nmspace, DDCompactView &cpv)
 Called by loadAttributes AFTER attributes are loaded. More...
 
virtual void processElement (const std::string &name, const std::string &nmspace, DDCompactView &cpv)
 Processing the element. More...
 
void setParent (const std::string &pename)
 Set parent element name to central list of names. More...
 
void setSelf (const std::string &sename)
 Set self element name to central list of names. More...
 
virtual size_t size (void) const
 Number of elements accumulated. More...
 
virtual void stream (std::ostream &os) const
 Allow for the elements to have their own streaming method, but also provide a default. More...
 
void throwError (const std::string &keyMessage) const
 format std::string for throw an error. More...
 
virtual ~DDXMLElement (void)
 Destructor. More...
 

Static Public Member Functions

static std::string itostr (int i)
 WARNING: abused by other classes in this system: yet another conversion from int to std::string... More...
 

Protected Attributes

DDLElementRegistrymyRegistry_
 

Private Member Functions

void appendAttributes (std::vector< std::string > &tv, const std::string &name)
 behind the scenes appending to pAttributes... More...
 

Private Attributes

AttrAccumType attributeAccumulator_
 
std::vector< DDXMLAttributeattributes_
 
bool autoClear_
 
std::string myElement_
 
std::vector< DDXMLAttribute >
::const_iterator 
myIter_
 
std::string parentElement_
 
std::vector< std::string > text_
 

Friends

std::ostream & operator<< (std::ostream &os, const DDXMLElement &element)
 

Detailed Description

This is a base class for processing XML elements in the DDD.

     DDXMLElement                       

Component of DDL XML Parsing

A DDXMLElement stores all the attributes and text of an XML element. It is designed to accumulate this information unless cleared. In other words, it accumulates sets of attributes, and allows the appending of text indefinitely, as opposed to, say, creating another class which is designed to hold a std::vector of single element information. This is contrary to the way that XML normally defines an element, but for DDL, this works fine.

One of the things that one needs to build in to each subclass is when an element needs to be cleared. For some, emptying the std::vectors should happen at the end (of the processElement method). For some, clearing is ONLY done by the parent. For example, SpecPar and its child PartSelector. or Polyhedra and its child ZSection. In some cases elements can be in one or more parent elements as well as on their own (Vector, Map). For these the processing currently depends on the parent so one must clear only as appropriate.

Definition at line 58 of file DDXMLElement.h.

Constructor & Destructor Documentation

DDXMLElement::DDXMLElement ( DDLElementRegistry myreg)

Constructor.

Definition at line 15 of file DDXMLElement.cc.

16  : myRegistry_( myreg ),
17  attributes_(),
18  text_(),
19  autoClear_( false )
20 {}
DDLElementRegistry * myRegistry_
Definition: DDXMLElement.h:186
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:192
std::vector< std::string > text_
Definition: DDXMLElement.h:193
DDXMLElement::DDXMLElement ( DDLElementRegistry myreg,
const bool &  clearme 
)

Constructor for autoClear element.

Definition at line 22 of file DDXMLElement.cc.

23  : myRegistry_( myreg ),
24  attributes_(),
25  text_(),
26  autoClear_( clearme )
27 {}
DDLElementRegistry * myRegistry_
Definition: DDXMLElement.h:186
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:192
std::vector< std::string > text_
Definition: DDXMLElement.h:193
DDXMLElement::~DDXMLElement ( void  )
virtual

Destructor.

Definition at line 29 of file DDXMLElement.cc.

30 {}

Member Function Documentation

void DDXMLElement::appendAttributes ( std::vector< std::string > &  tv,
const std::string &  name 
)
private

behind the scenes appending to pAttributes...

Definition at line 244 of file DDXMLElement.cc.

References attributes_, end(), and i.

Referenced by getVectorAttribute().

246 {
247  for (size_t i = tv.size(); i < attributes_.size(); ++i)
248  {
249  DDXMLAttribute::const_iterator itnv = attributes_[i].find(name);
250  if (itnv != attributes_[i].end())
251  tv.push_back(itnv->second);
252  else
253  tv.push_back("");
254  }
255 }
int i
Definition: DBlmapReader.cc:9
virtual std::vector< DDXMLAttribute >::const_iterator end(void)
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:192
void DDXMLElement::appendText ( const std::string &  inText)

append to the current (i.e. most recently added)

Definition at line 192 of file DDXMLElement.cc.

References visualization-live-secondInstance_cfg::msg, AlCaHLTBitMon_QueryRunRegistry::string, text_, and throwError().

Referenced by DDLSAX2FileHandler::characters().

193 {
194  static const std::string cr("\n");
195  if (text_.size() > 0) {
196  text_[text_.size() - 1] += cr;
197  text_[text_.size() - 1] += inText ;
198  } else
199  {
200  std::string msg = "DDXMLElement::appendText could not append to non-existent text.";
201  throwError(msg);
202  }
203 }
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
std::vector< std::string > text_
Definition: DDXMLElement.h:193
std::vector< DDXMLAttribute >::const_iterator DDXMLElement::begin ( void  )
virtual

Definition at line 265 of file DDXMLElement.cc.

References attributes_, and myIter_.

266 {
267  myIter_ = attributes_.begin();
268  return attributes_.begin();
269 }
std::vector< DDXMLAttribute >::const_iterator myIter_
Definition: DDXMLElement.h:196
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:192
void DDXMLElement::clear ( void  )
virtual

clear this element's contents.

Definition at line 61 of file DDXMLElement.cc.

References attributeAccumulator_, attributes_, and text_.

Referenced by DDLVector::clearall(), Vispa.Views.WidgetView.WidgetView::closeEvent(), Vispa.Views.BoxDecayView.BoxDecayView::closeEvent(), Vispa.Share.FindAlgorithm.FindAlgorithm::findUsingFindDialog(), DDLAlgorithm::preProcessElement(), DDLReflectionSolid::preProcessElement(), DDLPosPart::preProcessElement(), DDLRotationSequence::preProcessElement(), DDLBooleanSolid::preProcessElement(), DDLShapelessSolid::preProcessElement(), DDLPolyGenerator::preProcessElement(), DDLCompositeMaterial::preProcessElement(), DDLLogicalPart::preProcessElement(), DDLSpecPar::processElement(), DDLAlgorithm::processElement(), DDLElementaryMaterial::processElement(), DDLDivision::processElement(), DDLPolyGenerator::processElement(), DDLBooleanSolid::processElement(), DDLPosPart::processElement(), DDLRotationSequence::processElement(), DDLNumeric::processElement(), DDLString::processElement(), DDLRotationAndReflection::processElement(), DDLRotationByAxis::processElement(), DDLCompositeMaterial::processElement(), DDLLogicalPart::processElement(), DDLVector::processElement(), DDLMap::processElement(), processElement(), Vispa.Views.LineDecayView.LineDecayView::setDataObjects(), Vispa.Views.WidgetView.WidgetView::setDataObjects(), DDLMaterial::setReference(), DDLSolid::setReference(), BeautifulSoup.Tag::setString(), Vispa.Views.TreeView.TreeView::updateContent(), Vispa.Views.TableView.TableView::updateContent(), Vispa.Views.BoxDecayView.BoxDecayView::updateContent(), and Vispa.Views.PropertyView.PropertyView::updateContent().

62 {
63  text_.clear();
64  attributes_.clear();
65  attributeAccumulator_.clear();
66 }
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:192
AttrAccumType attributeAccumulator_
Definition: DDXMLElement.h:194
std::vector< std::string > text_
Definition: DDXMLElement.h:193
std::vector< DDXMLAttribute >::const_iterator DDXMLElement::end ( void  )
virtual

Definition at line 272 of file DDXMLElement.cc.

References attributes_, and myIter_.

Referenced by appendAttributes(), Types.LuminosityBlockRange::cppID(), Types.EventRange::cppID(), and get().

273 {
274  myIter_ = attributes_.end();
275  return attributes_.end();
276 }
std::vector< DDXMLAttribute >::const_iterator myIter_
Definition: DDXMLElement.h:196
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:192
const std::string & DDXMLElement::get ( const std::string &  name,
size_t  aIndex = 0 
) const
virtual

Returns a specific value from the aIndex set of attributes.

Definition at line 119 of file DDXMLElement.cc.

References attributes_, DCOUT_V, end(), itostr(), visualization-live-secondInstance_cfg::msg, mergeVDriftHistosByStation::name, AlCaHLTBitMon_QueryRunRegistry::string, and throwError().

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), util.rrapi.RRApi::columns(), rrapi.RRApi::columns(), util.rrapi.RRApi::count(), rrapi.RRApi::count(), rrapi.RRApi::data(), util.rrapi.RRApi::data(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), rrapi.RRApi::report(), util.rrapi.RRApi::report(), rrapi.RRApi::reports(), util.rrapi.RRApi::reports(), util.rrapi.RRApi::tables(), rrapi.RRApi::tables(), rrapi.RRApi::tags(), util.rrapi.RRApi::tags(), rrapi.RRApi::templates(), util.rrapi.RRApi::templates(), util.rrapi.RRApi::workspaces(), and rrapi.RRApi::workspaces().

120 {
121  static const std::string sts;
122  if (aIndex < attributes_.size())
123  {
124  DDXMLAttribute::const_iterator it = attributes_[aIndex].find(name);
125  if (attributes_[aIndex].end() == it)
126  {
127  DCOUT_V('P', "WARNING: DDXMLElement::get did not find the requested attribute: " << name << std::endl << *this);
128  return sts;
129  }
130  else
131  return (it->second);
132  }
133  std::string msg = "DDXMLElement:get failed. It was asked for attribute " + name;
134  msg += " in position " + itostr(int(aIndex)) + " when there are only ";
135  msg += itostr(int(attributes_.size())) + " in the element storage.\n";
136  throwError(msg);
137  // meaningless...
138  return sts;
139 }
static std::string itostr(int i)
WARNING: abused by other classes in this system: yet another conversion from int to std::string...
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
virtual std::vector< DDXMLAttribute >::const_iterator end(void)
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:192
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
const std::string & DDXMLElement::getAttribute ( const std::string &  name) const
virtual

Access to attributes by name.

Definition at line 70 of file DDXMLElement.cc.

References attributes_, and AlCaHLTBitMon_QueryRunRegistry::string.

71 {
72  static const std::string ldef;
73  if (attributes_.size())
74  return get(name, attributes_.size() - 1);
75  return ldef;
76 }
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:192
const DDXMLAttribute & DDXMLElement::getAttributeSet ( size_t  aIndex = 0) const
virtual
const DDName DDXMLElement::getDDName ( const std::string &  defaultNS,
const std::string &  attname = std::string( "name" ),
size_t  aIndex = 0 
)
virtual

Definition at line 86 of file DDXMLElement.cc.

References attributes_, itostr(), visualization-live-secondInstance_cfg::msg, mergeVDriftHistosByStation::name, AlCaHLTBitMon_QueryRunRegistry::string, and throwError().

Referenced by DDLRotationAndReflection::isLeftHanded(), DDLTubs::processElement(), DDLPseudoTrap::processElement(), DDLTorus::processElement(), DDLSpecPar::processElement(), DDLTrapezoid::processElement(), DDLParallelepiped::processElement(), DDLCone::processElement(), DDLEllipsoid::processElement(), DDLEllipticalTube::processElement(), DDLReflectionSolid::processElement(), DDLAlgorithm::processElement(), DDLShapelessSolid::processElement(), DDLOrb::processElement(), DDLSphere::processElement(), DDLBox::processElement(), DDLPolyGenerator::processElement(), DDLDivision::processElement(), DDLElementaryMaterial::processElement(), DDLPosPart::processElement(), DDLRotationSequence::processElement(), DDLNumeric::processElement(), DDLBooleanSolid::processElement(), DDLString::processElement(), DDLRotationAndReflection::processElement(), DDLRotationByAxis::processElement(), DDLCompositeMaterial::processElement(), DDLLogicalPart::processElement(), DDLVector::processElement(), and DDLMap::processElement().

87 {
88  if (aIndex < attributes_.size()
89  && attributes_[aIndex].find(attname) != attributes_[aIndex].end()) {
90  std::string ns = defaultNS;
91  // For the user to fully control namespaces they must provide for
92  // all name attributes something of the form, for example:
93  // <Solid name="ns:name" ...
94  // If defaultNS is "!" (magic I don't like) then find and set
95  // the namespace properly.
96  if ( defaultNS == "!" ) {
97  ns = "";
98  }
99  const std::string & name = attributes_[aIndex].find(attname)->second;
100  std::string rn = name;
101  size_t foundColon= name.find(':');
102  if (foundColon != std::string::npos) {
103  ns = name.substr(0,foundColon);
104  rn = name.substr(foundColon+1);
105 
106  }
107  return DDName(rn, ns);
108  }
109  std::string msg = "DDXMLElement:getDDName failed. It was asked to make ";
110  msg += "a DDName using attribute: " + attname;
111  msg += " in position: " + itostr(int(aIndex)) + ". There are ";
112  msg += itostr(int(attributes_.size())) + " entries in the element.";
113  throwError(msg);
114  return DDName("justToCompile", "justToCompile"); // used to make sure it compiles
115 }
static std::string itostr(int i)
WARNING: abused by other classes in this system: yet another conversion from int to std::string...
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:14
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:192
const std::string DDXMLElement::getText ( size_t  tindex = 0) const

retrieve the text blob.

Definition at line 206 of file DDXMLElement.cc.

References visualization-live-secondInstance_cfg::msg, AlCaHLTBitMon_QueryRunRegistry::string, text_, and throwError().

Referenced by DDLVector::processElement(), and DDLMap::processElement().

207 {
208  if (tindex > text_.size()) {
209  std::string msg = "DDXMLElement::getText tindex is greater than text_.size()).";
210  throwError(msg);
211  }
212  return text_[tindex];
213 }
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
std::vector< std::string > text_
Definition: DDXMLElement.h:193
std::vector< std::string > DDXMLElement::getVectorAttribute ( const std::string &  name)
virtual

Returns a set of values as a std::vector of strings, given the attribute name.

Definition at line 144 of file DDXMLElement.cc.

References appendAttributes(), attributeAccumulator_, attributes_, DCOUT_V, mergeVDriftHistosByStation::name, and size().

145 {
146  // The idea here is that the attributeAccumulator_ is a cache of
147  // on-the-fly generation from the std::vector<DDXMLAttribute> and the
148  // reason is simply to speed things up if it is requested more than once.
149  std::vector<std::string> tv;
150  AttrAccumType::const_iterator ita = attributeAccumulator_.find(name);
151  if (ita != attributeAccumulator_.end())
152  {
154  if (tv.size() < attributes_.size())
155  {
156  appendAttributes(tv, name);
157  }
158  DCOUT_V('P', "DDXMLElement::getAttribute found attribute named " << name << " in a map of size " << size());
159  }
160  else
161  {
162  if (attributes_.size())
163  {
164  appendAttributes(tv, name);
165  }
166  else
167  {
168  DCOUT_V('P', "DDXMLAttributeAccumulator::getAttribute was asked to provide a std::vector of values for an attribute named " << name << " but there was no such attribute.");
169  // throw cms::Exception("DDException") << msg;
170  }
171  }
172  return tv;
173 }
void appendAttributes(std::vector< std::string > &tv, const std::string &name)
behind the scenes appending to pAttributes...
virtual size_t size(void) const
Number of elements accumulated.
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:192
AttrAccumType attributeAccumulator_
Definition: DDXMLElement.h:194
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
bool DDXMLElement::gotText ( void  ) const
virtual

gotText()? kind of like gotMilk? Yes = text has already been encountered.

Definition at line 216 of file DDXMLElement.cc.

References text_.

Referenced by DDLSAX2FileHandler::characters().

217 {
218  if (text_.size() != 0)
219  return true;
220  return false;
221 }
std::vector< std::string > text_
Definition: DDXMLElement.h:193
bool DDXMLElement::isEmpty ( void  ) const
virtual

Have any elements of this type been encountered but not processed?

Definition at line 313 of file DDXMLElement.cc.

References attributes_.

314 {
315  return (attributes_.size() == 0 ? true : false);
316 }
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:192
std::string DDXMLElement::itostr ( int  i)
static
void DDXMLElement::loadAttributes ( const std::string &  elemName,
const std::vector< std::string > &  names,
const std::vector< std::string > &  values,
const std::string &  nmspace,
DDCompactView cpv 
)

Load the element attributes.

The loadAttributes method loads the attributes of the element into a std::map<std::string, std::string> which is used to store Name-Value pairs. It takes as input two std::vectors of strings containing "synchronized" names and values.

In the SAX2 based calling process, this is done on a startElement event.

Definition at line 41 of file DDXMLElement.cc.

References attributes_, DCOUT_V, i, and preProcessElement().

Referenced by DDLRotationByAxis::processElement(), DDLMaterial::setReference(), DDLSolid::setReference(), and DDLSAX2FileHandler::startElement().

45 {
46  attributes_.resize(attributes_.size()+1);
47  DDXMLAttribute & tAttributes = attributes_.back();
48 
49  // adds attributes
50  for (size_t i = 0; i < names.size(); ++i)
51  {
52  tAttributes.insert(std::make_pair(names[i], values[i]));
53  }
54 
55  preProcessElement( elemName, nmspace, cpv );
56  DCOUT_V('P', "DDXMLElement::loadAttributes completed. " << *this);
57 }
int i
Definition: DBlmapReader.cc:9
static const HistoName names[]
std::map< std::string, std::string > DDXMLAttribute
Definition: DDXMLElement.h:55
virtual void preProcessElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv)
Called by loadAttributes AFTER attributes are loaded.
Definition: DDXMLElement.cc:34
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:192
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
void DDXMLElement::loadText ( const std::string &  inText)

Used to load both text and XML comments into this object.

At the current time this is done simply as a way for the user of this class to accumulate text and/or comments as std::vector of strings, each one matching the std::vector of attributes. Therefore loadText starts a new text storage.

Definition at line 186 of file DDXMLElement.cc.

References text_.

Referenced by DDLSAX2FileHandler::characters(), processElement(), and DDLSAX2FileHandler::startElement().

187 {
188  text_.push_back(inText);
189 }
std::vector< std::string > text_
Definition: DDXMLElement.h:193
std::vector< DDXMLAttribute >::const_iterator & DDXMLElement::operator++ ( int  inc)

Allow the elements of this type to be iterated over using ++ operator.

Definition at line 279 of file DDXMLElement.cc.

References myIter_.

280 {
281  myIter_ = myIter_ + inc;
282  return myIter_;
283 }
std::vector< DDXMLAttribute >::const_iterator myIter_
Definition: DDXMLElement.h:196
const std::string & DDXMLElement::parent ( void  ) const

access to parent element name

Definition at line 286 of file DDXMLElement.cc.

References parentElement_.

Referenced by BeautifulSoup.PageElement::_invert(), Vispa.Gui.ConnectableWidget.ConnectableWidget::addMenuEntry(), Vispa.Views.LineDecayView.LineDecayContainer::applyFilter(), Vispa.Views.BoxDecayView.BoxDecayContainer::arrangeUsingRelations(), Vispa.Views.BoxDecayView.BoxDecayContainer::autolayoutAlgorithm(), Vispa.Gui.ZoomableScrollableWidgetOwner.ZoomableScrollableWidgetOwner::autosizeScrollArea(), Vispa.Views.BoxDecayView.BoxDecayContainer::autosizeScrollArea(), Vispa.Gui.PortWidget.PortWidget::connectionPoint(), Vispa.Main.StartupScreen.StartupScreen::createDescriptionWidget(), Vispa.Views.BoxDecayView.BoxDecayContainer::dataAccessor(), Vispa.Views.LineDecayView.LineDecayContainer::dataAccessor(), Vispa.Views.LineDecayView.DecayLine::dataAccessor(), Vispa.Views.LineDecayView.LineDecayContainer::delete(), Vispa.Views.LineDecayView.DecayNode::delete(), Vispa.Views.LineDecayView.DecayLine::delete(), Vispa.Gui.VispaWidget.VispaWidget::delete(), Vispa.Gui.VispaWidget.VispaWidget::dragWidget(), Vispa.Share.ImageExporter.ImageExporter::exportImageDialog(), Vispa.Views.LineDecayView.DecayLine::extendedSize(), Vispa.Gui.VispaWidget.VispaWidget::keyPressEvent(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.ConnectableWidget.ConnectableWidget::leaveEvent(), Vispa.Gui.PortWidget.PortWidget::moduleParent(), Vispa.Gui.WidgetContainer.WidgetContainer::mouseDoubleClickEvent(), Vispa.Gui.VispaWidget.VispaWidget::mouseDoubleClickEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), Vispa.Views.LineDecayView.ParticleWidget::mousePressEvent(), Vispa.Views.LineDecayView.DecayNode::move(), Vispa.Views.LineDecayView.LineDecayContainer::noDecorationsMode(), Vispa.Views.LineDecayView.LineDecayContainer::operationId(), Vispa.Views.LineDecayView.DecayLine::paint(), Vispa.Gui.VispaWidget.VispaWidget::paintEvent(), Vispa.Gui.ConnectableWidget.ConnectableWidget::positionizeMenuWidget(), DDLDivision::processElement(), DDLString::processElement(), DDLNumeric::processElement(), DDLRotationByAxis::processElement(), DDLVector::processElement(), DDLMap::processElement(), Vispa.Views.LineDecayView.DecayLine::qtLineStyle(), Vispa.Views.WidgetView.WidgetView::restoreSelection(), Vispa.Views.WidgetView.WidgetView::select(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), DDLSolid::setReference(), Vispa.Views.LineDecayView.LineDecayContainer::sizeHint(), Vispa.Views.LineDecayView.LineDecayContainer::tabController(), Vispa.Views.BoxDecayView.BoxDecayContainer::toggleCollapsed(), Vispa.Views.LineDecayView.DecayNode::unite(), Vispa.Views.PropertyView.PropertyView::valueChanged(), Vispa.Views.BoxDecayView.BoxDecayContainer::widgetByObject(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::widgetDoubleClicked(), and Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::widgetDragged().

287 {
288  return parentElement_;
289 }
std::string parentElement_
Definition: DDXMLElement.h:198
void DDXMLElement::preProcessElement ( const std::string &  name,
const std::string &  nmspace,
DDCompactView cpv 
)
virtual

Called by loadAttributes AFTER attributes are loaded.

The preProcessElement method can assume that the attributes are loaded and perform any code that is necessary at the start of an element.

This would allow users to call their own code to setup anything necessary for the continued processing of the child elements.

Reimplemented in DDLMap, DDLVector, DDLLogicalPart, DDLCompositeMaterial, DDLPolyGenerator, DDLRotationByAxis, DDLShapelessSolid, DDLBooleanSolid, DDLNumeric, DDLPosPart, DDLRotationSequence, DDLString, DDLDivision, DDLReflectionSolid, and DDLAlgorithm.

Definition at line 34 of file DDXMLElement.cc.

References DCOUT_V.

Referenced by loadAttributes().

35 {
36  DCOUT_V('P', "DDXMLElement::preProcessElementBase default, do nothing) started-completed.");
37 }
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
void DDXMLElement::processElement ( const std::string &  name,
const std::string &  nmspace,
DDCompactView cpv 
)
virtual

Processing the element.

The processElement method completes any necessary work to process the XML element.

For example, this can be used to call the DDCore to make the geometry in memory. There is a default for this so that if not declared in the inheriting class, no processing is done.

Reimplemented in DDLMap, DDLVector, DDLLogicalPart, DDLCompositeMaterial, DDLRotationByAxis, DDLRotationAndReflection, DDLBooleanSolid, DDLNumeric, DDLPosPart, DDLRotationSequence, DDLString, DDLDivision, DDLElementaryMaterial, DDLPolyGenerator, DDLAlgorithm, DDLBox, DDLCone, DDLEllipsoid, DDLEllipticalTube, DDLOrb, DDLParallelepiped, DDLReflectionSolid, DDLShapelessSolid, DDLSphere, DDLPseudoTrap, DDLSpecPar, DDLTorus, DDLTrapezoid, and DDLTubs.

Definition at line 177 of file DDXMLElement.cc.

References autoClear_, clear(), DCOUT_V, loadText(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DDLSAX2FileHandler::endElement().

178 {
179  DCOUT_V('P', "DDXMLElement::processElementBase (default, do nothing) started-completed");
181  if ( autoClear_ ) clear();
182 
183 }
void loadText(const std::string &inText)
Used to load both text and XML comments into this object.
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
virtual void clear(void)
clear this element&#39;s contents.
Definition: DDXMLElement.cc:61
void DDXMLElement::setParent ( const std::string &  pename)

Set parent element name to central list of names.

Definition at line 292 of file DDXMLElement.cc.

References parentElement_.

Referenced by lumiQTWidget.LumiCanvas::__init__(), and DDLSAX2FileHandler::endElement().

293 {
294  parentElement_ = pename;
295 }
std::string parentElement_
Definition: DDXMLElement.h:198
void DDXMLElement::setSelf ( const std::string &  sename)

Set self element name to central list of names.

Definition at line 298 of file DDXMLElement.cc.

References myElement_.

Referenced by DDLSAX2FileHandler::endElement().

299 {
300  myElement_ = sename;
301 }
std::string myElement_
Definition: DDXMLElement.h:197
size_t DDXMLElement::size ( void  ) const
virtual
void DDXMLElement::stream ( std::ostream &  os) const
virtual

Allow for the elements to have their own streaming method, but also provide a default.

Definition at line 230 of file DDXMLElement.cc.

References attributes_.

Referenced by operator<<().

231 {
232  os << "Output of current element attributes:" << std::endl;
233  for (std::vector<DDXMLAttribute>::const_iterator itv = attributes_.begin();
234  itv != attributes_.end(); ++itv)
235  {
236  for (DDXMLAttribute::const_iterator it = itv->begin();
237  it != itv->end(); ++it)
238  os << it->first << " = " << it->second << "\t";
239  os << std::endl;
240  }
241 }
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:192
void DDXMLElement::throwError ( const std::string &  keyMessage) const

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const DDXMLElement element 
)
friend

Definition at line 223 of file DDXMLElement.cc.

224 {
225  element.stream(os);
226  return os;
227 }
virtual void stream(std::ostream &os) const
Allow for the elements to have their own streaming method, but also provide a default.

Member Data Documentation

AttrAccumType DDXMLElement::attributeAccumulator_
private

Definition at line 194 of file DDXMLElement.h.

Referenced by clear(), and getVectorAttribute().

std::vector<DDXMLAttribute> DDXMLElement::attributes_
private
bool DDXMLElement::autoClear_
private

Definition at line 195 of file DDXMLElement.h.

Referenced by processElement().

std::string DDXMLElement::myElement_
private

Definition at line 197 of file DDXMLElement.h.

Referenced by setSelf(), and throwError().

std::vector<DDXMLAttribute>::const_iterator DDXMLElement::myIter_
private

Definition at line 196 of file DDXMLElement.h.

Referenced by begin(), end(), and operator++().

DDLElementRegistry* DDXMLElement::myRegistry_
protected

Definition at line 186 of file DDXMLElement.h.

Referenced by DDLVector::do_makeDouble(), DDLMap::do_makeDouble(), DDLBooleanSolid::dumpBooleanSolid(), DDLRotationAndReflection::isLeftHanded(), DDLRotationAndReflection::makeX(), DDLRotationAndReflection::makeY(), DDLRotationAndReflection::makeZ(), DDLAlgorithm::preProcessElement(), DDLReflectionSolid::preProcessElement(), DDLRotationSequence::preProcessElement(), DDLBooleanSolid::preProcessElement(), DDLPosPart::preProcessElement(), DDLShapelessSolid::preProcessElement(), DDLPolyGenerator::preProcessElement(), DDLCompositeMaterial::preProcessElement(), DDLLogicalPart::preProcessElement(), DDLTubs::processElement(), DDLSpecPar::processElement(), DDLTorus::processElement(), DDLPseudoTrap::processElement(), DDLTrapezoid::processElement(), DDLParallelepiped::processElement(), DDLCone::processElement(), DDLSphere::processElement(), DDLOrb::processElement(), DDLAlgorithm::processElement(), DDLBox::processElement(), DDLEllipsoid::processElement(), DDLEllipticalTube::processElement(), DDLReflectionSolid::processElement(), DDLDivision::processElement(), DDLPolyGenerator::processElement(), DDLElementaryMaterial::processElement(), DDLNumeric::processElement(), DDLBooleanSolid::processElement(), DDLPosPart::processElement(), DDLRotationSequence::processElement(), DDLRotationAndReflection::processElement(), DDLRotationByAxis::processElement(), DDLCompositeMaterial::processElement(), DDLLogicalPart::processElement(), DDLVector::processElement(), DDLMap::processElement(), DDLRotationByAxis::processOne(), DDLMaterial::setReference(), and DDLSolid::setReference().

std::string DDXMLElement::parentElement_
private

Definition at line 198 of file DDXMLElement.h.

Referenced by parent(), and setParent().

std::vector<std::string> DDXMLElement::text_
private

Definition at line 193 of file DDXMLElement.h.

Referenced by appendText(), clear(), getText(), gotText(), and loadText().