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:
DDLAlgoPosPart 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 59 of file DDXMLElement.h.

Constructor & Destructor Documentation

DDXMLElement::DDXMLElement ( DDLElementRegistry myreg)

Constructor.

Definition at line 18 of file DDXMLElement.cc.

19  : myRegistry_( myreg ),
20  attributes_(),
21  text_(),
22  autoClear_( false )
23 {}
DDLElementRegistry * myRegistry_
Definition: DDXMLElement.h:187
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:193
std::vector< std::string > text_
Definition: DDXMLElement.h:194
DDXMLElement::DDXMLElement ( DDLElementRegistry myreg,
const bool &  clearme 
)

Constructor for autoClear element.

Definition at line 25 of file DDXMLElement.cc.

26  : myRegistry_( myreg ),
27  attributes_(),
28  text_(),
29  autoClear_( clearme )
30 {}
DDLElementRegistry * myRegistry_
Definition: DDXMLElement.h:187
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:193
std::vector< std::string > text_
Definition: DDXMLElement.h:194
DDXMLElement::~DDXMLElement ( void  )
virtual

Destructor.

Definition at line 32 of file DDXMLElement.cc.

33 {}

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 285 of file DDXMLElement.cc.

References attributes_, end(), and i.

Referenced by getVectorAttribute().

287 {
288  for (size_t i = tv.size(); i < attributes_.size(); ++i)
289  {
290  DDXMLAttribute::const_iterator itnv = attributes_[i].find(name);
291  if (itnv != attributes_[i].end())
292  tv.push_back(itnv->second);
293  else
294  tv.push_back("");
295  }
296 }
int i
Definition: DBlmapReader.cc:9
virtual std::vector< DDXMLAttribute >::const_iterator end(void)
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:193
void DDXMLElement::appendText ( const std::string &  inText)

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

Definition at line 233 of file DDXMLElement.cc.

References runTheMatrix::msg, text_, and throwError().

Referenced by DDLSAX2FileHandler::characters().

234 {
235  static const std::string cr("\n");
236  if (text_.size() > 0) {
237  text_[text_.size() - 1] += cr;
238  text_[text_.size() - 1] += inText ;
239  } else
240  {
241  std::string msg = "DDXMLElement::appendText could not append to non-existent text.";
242  throwError(msg);
243  }
244 }
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
std::vector< std::string > text_
Definition: DDXMLElement.h:194
std::vector< DDXMLAttribute >::const_iterator DDXMLElement::begin ( void  )
virtual

Definition at line 306 of file DDXMLElement.cc.

References attributes_, and myIter_.

307 {
308  myIter_ = attributes_.begin();
309  return attributes_.begin();
310 }
std::vector< DDXMLAttribute >::const_iterator myIter_
Definition: DDXMLElement.h:197
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:193
void DDXMLElement::clear ( void  )
virtual

clear this element's contents.

Definition at line 65 of file DDXMLElement.cc.

References attributeAccumulator_, attributes_, and text_.

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

66 {
67  text_.clear();
68  attributes_.clear();
69  attributeAccumulator_.clear();
70 }
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:193
AttrAccumType attributeAccumulator_
Definition: DDXMLElement.h:195
std::vector< std::string > text_
Definition: DDXMLElement.h:194
std::vector< DDXMLAttribute >::const_iterator DDXMLElement::end ( void  )
virtual

Definition at line 313 of file DDXMLElement.cc.

References attributes_, and myIter_.

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

314 {
315  myIter_ = attributes_.end();
316  return attributes_.end();
317 }
std::vector< DDXMLAttribute >::const_iterator myIter_
Definition: DDXMLElement.h:197
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:193
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 159 of file DDXMLElement.cc.

References attributes_, DCOUT_V, end(), itostr(), runTheMatrix::msg, mergeVDriftHistosByStation::name, and throwError().

Referenced by Options.Options::__getitem__().

160 {
161  static const std::string sts;
162  if (aIndex < attributes_.size())
163  {
164  DDXMLAttribute::const_iterator it = attributes_[aIndex].find(name);
165  if (attributes_[aIndex].end() == it)
166  {
167  DCOUT_V('P', "WARNING: DDXMLElement::get did not find the requested attribute: " << name << std::endl << *this);
168  return sts;
169  }
170  else
171  return (it->second);
172  }
173  std::string msg = "DDXMLElement:get failed. It was asked for attribute " + name;
174  msg += " in position " + itostr(int(aIndex)) + " when there are only ";
175  msg += itostr(int(attributes_.size())) + " in the element storage.\n";
176  throwError(msg);
177  // meaningless...
178  return sts;
179 }
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:193
#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 74 of file DDXMLElement.cc.

References attributes_.

75 {
76  static const std::string ldef;
77  if (attributes_.size())
78  return get(name, attributes_.size() - 1);
79  return ldef;
80 }
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:193
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 91 of file DDXMLElement.cc.

References attributes_, itostr(), runTheMatrix::msg, mergeVDriftHistosByStation::name, and throwError().

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

92 {
93  if (aIndex < attributes_.size()
94  && attributes_[aIndex].find(attname) != attributes_[aIndex].end()) {
95  std::string ns = defaultNS;
96  // For the user to fully control namespaces they must provide for
97  // all name attributes something of the form, for example:
98  // <Solid name="ns:name" ...
99  // If defaultNS is "!" (magic I don't like) then find and set
100  // the namespace properly.
101  if ( defaultNS == "!" ) {
102  ns = "";
103  }
104  const std::string & name = attributes_[aIndex].find(attname)->second;
105  std::string rn = name;
106  size_t foundColon= name.find(':');
107  if (foundColon != std::string::npos) {
108  ns = name.substr(0,foundColon);
109  rn = name.substr(foundColon+1);
110 
111  }
112  // std::cout << "Name: " << rn << " Namespace: " << ns << std::endl;
113  return DDName(rn, ns);
114  }
115  // std::cout << "no " << attname << " default namespace: " << defaultNS << " at index " << aIndex << std::endl;
116  std::string msg = "DDXMLElement:getDDName failed. It was asked to make ";
117  msg += "a DDName using attribute: " + attname;
118  msg += " in position: " + itostr(int(aIndex)) + ". There are ";
119  msg += itostr(int(attributes_.size())) + " entries in the element.";
120  throwError(msg);
121  return DDName("justToCompile", "justToCompile"); // used to make sure it compiles
122 }
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:18
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:193
const std::string DDXMLElement::getText ( size_t  tindex = 0) const

retrieve the text blob.

Definition at line 247 of file DDXMLElement.cc.

References runTheMatrix::msg, text_, and throwError().

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

248 {
249  if (tindex > text_.size()) {
250  std::string msg = "DDXMLElement::getText tindex is greater than text_.size()).";
251  throwError(msg);
252  }
253  return text_[tindex];
254 }
void throwError(const std::string &keyMessage) const
format std::string for throw an error.
std::vector< std::string > text_
Definition: DDXMLElement.h:194
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 184 of file DDXMLElement.cc.

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

185 {
186  // The idea here is that the attributeAccumulator_ is a cache of
187  // on-the-fly generation from the std::vector<DDXMLAttribute> and the
188  // reason is simply to speed things up if it is requested more than once.
189  std::vector<std::string> tv;
190  AttrAccumType::const_iterator ita = attributeAccumulator_.find(name);
191  if (ita != attributeAccumulator_.end())
192  {
194  if (tv.size() < attributes_.size())
195  {
196  appendAttributes(tv, name);
197  }
198  DCOUT_V('P', "DDXMLElement::getAttribute found attribute named " << name << " in a map of size " << size());
199  }
200  else
201  {
202  if (attributes_.size())
203  {
204  appendAttributes(tv, name);
205  }
206  else
207  {
208  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.");
209  // throw DDException(msg);
210  }
211  }
212  return tv;
213 }
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:193
AttrAccumType attributeAccumulator_
Definition: DDXMLElement.h:195
#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 257 of file DDXMLElement.cc.

References text_.

Referenced by DDLSAX2FileHandler::characters().

258 {
259  if (text_.size() != 0)
260  return true;
261  return false;
262 }
std::vector< std::string > text_
Definition: DDXMLElement.h:194
bool DDXMLElement::isEmpty ( void  ) const
virtual

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

Definition at line 354 of file DDXMLElement.cc.

References attributes_.

355 {
356  return (attributes_.size() == 0 ? true : false);
357 }
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:193
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 44 of file DDXMLElement.cc.

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

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

48 {
49  attributes_.resize(attributes_.size()+1);
50  DDXMLAttribute & tAttributes = attributes_.back();
51 
52  // adds attributes
53  for (size_t i = 0; i < names.size(); ++i)
54  {
55  // tAttributes[ names[i] ] = values[i];
56  tAttributes.insert(std::make_pair(names[i], values[i]));
57  }
58 
59  preProcessElement( elemName, nmspace, cpv );
60  DCOUT_V('P', "DDXMLElement::loadAttributes completed. " << *this);
61 }
int i
Definition: DBlmapReader.cc:9
std::map< std::string, std::string > DDXMLAttribute
Definition: DDXMLElement.h:56
virtual void preProcessElement(const std::string &name, const std::string &nmspace, DDCompactView &cpv)
Called by loadAttributes AFTER attributes are loaded.
Definition: DDXMLElement.cc:37
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:193
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
static const HistoName names[]
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 226 of file DDXMLElement.cc.

References text_.

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

227 {
228  text_.push_back(inText);
229  // std::cout << "just put a std::string using loadText. size is now: " << text_.size() << std::endl;
230 }
std::vector< std::string > text_
Definition: DDXMLElement.h:194
std::vector< DDXMLAttribute >::const_iterator & DDXMLElement::operator++ ( int  inc)

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

Definition at line 320 of file DDXMLElement.cc.

References myIter_.

321 {
322  myIter_ = myIter_ + inc;
323  return myIter_;
324 }
std::vector< DDXMLAttribute >::const_iterator myIter_
Definition: DDXMLElement.h:197
const std::string & DDXMLElement::parent ( void  ) const

access to parent element name

Definition at line 327 of file DDXMLElement.cc.

References parentElement_.

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

328 {
329  return parentElement_;
330 }
std::string parentElement_
Definition: DDXMLElement.h:199
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 37 of file DDXMLElement.cc.

References DCOUT_V.

Referenced by loadAttributes().

38 {
39  DCOUT_V('P', "DDXMLElement::preProcessElementBase default, do nothing) started-completed.");
40 }
#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, DDLAlgoPosPart, DDLDivision, DDLElementaryMaterial, DDLPolyGenerator, DDLAlgorithm, DDLBox, DDLCone, DDLEllipsoid, DDLEllipticalTube, DDLOrb, DDLParallelepiped, DDLReflectionSolid, DDLShapelessSolid, DDLSphere, DDLPseudoTrap, DDLSpecPar, DDLTorus, DDLTrapezoid, and DDLTubs.

Definition at line 217 of file DDXMLElement.cc.

References autoClear_, clear(), DCOUT_V, and loadText().

Referenced by DDLSAX2FileHandler::endElement().

218 {
219  DCOUT_V('P', "DDXMLElement::processElementBase (default, do nothing) started-completed");
220  loadText(std::string());
221  if ( autoClear_ ) clear();
222 
223 }
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:65
void DDXMLElement::setParent ( const std::string &  pename)

Set parent element name to central list of names.

Definition at line 333 of file DDXMLElement.cc.

References parentElement_.

Referenced by DDLSAX2FileHandler::endElement().

334 {
335  parentElement_ = pename;
336 }
std::string parentElement_
Definition: DDXMLElement.h:199
void DDXMLElement::setSelf ( const std::string &  sename)

Set self element name to central list of names.

Definition at line 339 of file DDXMLElement.cc.

References myElement_.

Referenced by DDLSAX2FileHandler::endElement().

340 {
341  myElement_ = sename;
342 }
std::string myElement_
Definition: DDXMLElement.h:198
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 271 of file DDXMLElement.cc.

References attributes_.

Referenced by operator<<().

272 {
273  os << "Output of current element attributes:" << std::endl;
274  for (std::vector<DDXMLAttribute>::const_iterator itv = attributes_.begin();
275  itv != attributes_.end(); ++itv)
276  {
277  for (DDXMLAttribute::const_iterator it = itv->begin();
278  it != itv->end(); ++it)
279  os << it->first << " = " << it->second << "\t";
280  os << std::endl;
281  }
282 }
std::vector< DDXMLAttribute > attributes_
Definition: DDXMLElement.h:193
void DDXMLElement::throwError ( const std::string &  keyMessage) const

format std::string for throw an error.

Definition at line 360 of file DDXMLElement.cc.

References runTheMatrix::msg, and myElement_.

Referenced by appendText(), DDLVector::errorOut(), DDLMap::errorOut(), get(), getDDName(), getText(), DDLDivision::makeDivider(), DDLTubs::processElement(), DDLTrapezoid::processElement(), DDLDivision::processElement(), DDLPolyGenerator::processElement(), DDLAlgoPosPart::processElement(), DDLBooleanSolid::processElement(), DDLRotationAndReflection::processElement(), DDLCompositeMaterial::processElement(), and DDLRotationByAxis::processOne().

361 {
362  std::string msg = keyMessage + "\n";
363  // if (myElement_) {
364  msg += " Element " + myElement_ +"\n";
365  // }
366  // msg += " File " + DDLParser::instance()->getCurrFileName() + ".\n";
367  throw DDException(msg);
368 }
An exception for DDD errors.
Definition: DDException.h:23
std::string myElement_
Definition: DDXMLElement.h:198

Friends And Related Function Documentation

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

Definition at line 264 of file DDXMLElement.cc.

265 {
266  element.stream(os);
267  return os;
268 }
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 195 of file DDXMLElement.h.

Referenced by clear(), and getVectorAttribute().

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

Definition at line 196 of file DDXMLElement.h.

Referenced by processElement().

std::string DDXMLElement::myElement_
private

Definition at line 198 of file DDXMLElement.h.

Referenced by setSelf(), and throwError().

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

Definition at line 197 of file DDXMLElement.h.

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

DDLElementRegistry* DDXMLElement::myRegistry_
protected
std::string DDXMLElement::parentElement_
private

Definition at line 199 of file DDXMLElement.h.

Referenced by parent(), and setParent().

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

Definition at line 194 of file DDXMLElement.h.

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