CMS 3D CMS Logo

Public Member Functions | Friends

DDSpecifics Class Reference

Interface to attach user specific data to nodes in the expanded-view. More...

#include <DDSpecifics.h>

Inheritance diagram for DDSpecifics:
DDBase< DDName, DDI::Specific * >

List of all members.

Public Member Functions

 DDSpecifics ()
 Creates a uninitialized reference-object (see DDLogicalPart documentation for details on reference objects)
 DDSpecifics (const DDName &name)
 Creates a initialized reference-object or a reference to an allready defined specifcs.
 DDSpecifics (const DDName &name, const selectors_type &partSelections, const DDsvalues_type &svalues, bool doRegex=true)
 Creates a defined reference-object or replaces a already defined reference-object named name.
std::pair< bool, DDExpandedViewnode () const
 Calculates the geometrical history of a fully specified PartSelector.
bool nodes (DDNodes &nds) const
 Calculates all expanded-nodes which are selected by the selection-strings.
const std::vector
< DDPartSelection > & 
selection () const
 Gives a reference to the collection of part-selections.
const DDsvalues_typespecifics () const
 Reference to the user-data attached to all nodes selected by the selections-strings given through selection.
 ~DDSpecifics ()

Friends

std::ostream & operator<< (std::ostream &, const DDSpecifics &)

Detailed Description

Interface to attach user specific data to nodes in the expanded-view.

used to attach specific (user defined) data to nodes in the expanded view.

DDSpecifics are lightweighted reference-objects. For further information concerning reference-objects refere to the documentation of DDLogicalPart.

Definition at line 40 of file DDSpecifics.h.


Constructor & Destructor Documentation

DDSpecifics::DDSpecifics ( )

Creates a uninitialized reference-object (see DDLogicalPart documentation for details on reference objects)

Definition at line 15 of file DDSpecifics.cc.

DDSpecifics::DDSpecifics ( const DDName name)

Creates a initialized reference-object or a reference to an allready defined specifcs.

If a DDSpecifics with name was already defined, this constructor creates a lightweighted reference-object to it. Otherwise a (default) initialized reference-object is registered named name. For further details concerning the usage of reference-objects refere to the documentation of DDLogicalPart.

Definition at line 19 of file DDSpecifics.cc.

References DDI::Singleton< I >::instance(), and DDBase< DDName, DDI::Specific * >::prep_.

                                            : DDBase<DDName,Specific*>()
{
  prep_ = StoreT::instance().create(name);
}
DDSpecifics::DDSpecifics ( const DDName name,
const selectors_type partSelections,
const DDsvalues_type svalues,
bool  doRegex = true 
)

Creates a defined reference-object or replaces a already defined reference-object named name.

  • name unique name
  • partSelections collection of selection-strings which select expanded-nodes
  • svalues user data attached to nodes selected by partSelections

Syntax of the selection std::string

bla, bla, bla

Definition at line 25 of file DDSpecifics.cc.

References DCOUT, Exception, DDI::Singleton< I >::instance(), DDBase< DDName, DDI::Specific * >::prep_, DDBase< DDName, DDI::Specific * >::rep(), and v.

 : DDBase<DDName,Specific*>()
{
  prep_ = StoreT::instance().create(name, new Specific(partSelections,svalues,doRegex));   
  typedef std::vector<std::pair<DDLogicalPart,std::pair<DDPartSelection*,DDsvalues_type*> > > strange_type;
  strange_type v;
  rep().updateLogicalPart(v);
  strange_type::iterator it = v.begin();
  for(; it != v.end(); ++it) {
    if (it->first.isDefined().second) {
      it->first.addSpecifics(it->second);
      DCOUT('C', "add specifics to LP: partsel=" << *(it->second.first) );
    }
    else {
      std::string serr("Definition of LogicalPart missing! name=");
      serr+= it->first.ddname().fullname();
      throw cms::Exception("DDException") << serr;
    }
  }
} 
DDSpecifics::~DDSpecifics ( )

Definition at line 50 of file DDSpecifics.cc.

{ }

Member Function Documentation

std::pair< bool, DDExpandedView > DDSpecifics::node ( ) const

Calculates the geometrical history of a fully specified PartSelector.

node() will only work, if

  • there is only one PartSelection std::string
  • the PartSelection std::string specifies exactly one full path concatenating always direct children including their copy-number and will return (true,const DDGeoHistory&) if the std::string matches an expanded-part in the ExpandedView, else it will return (false, xxx), whereas xxx is a history which is not valid.

Definition at line 77 of file DDSpecifics.cc.

References DDBase< DDName, DDI::Specific * >::rep().

{
  return rep().node();
}
bool DDSpecifics::nodes ( DDNodes nds) const

Calculates all expanded-nodes which are selected by the selection-strings.

Definition at line 64 of file DDSpecifics.cc.

References DDBase< DDName, DDI::Specific * >::rep().

{
   return rep().nodes(result);
}
const std::vector< DDPartSelection > & DDSpecifics::selection ( ) const

Gives a reference to the collection of part-selections.

Definition at line 53 of file DDSpecifics.cc.

References DDBase< DDName, DDI::Specific * >::rep().

Referenced by DDCoreToDDXMLOutput::specpar(), and DDStreamer::specs_write().

{ 
  return rep().selection(); 
}
const DDsvalues_type & DDSpecifics::specifics ( void  ) const

Reference to the user-data attached to all nodes selected by the selections-strings given through selection.

Definition at line 59 of file DDSpecifics.cc.

References DDBase< DDName, DDI::Specific * >::rep().

Referenced by DDCoreToDDXMLOutput::specpar(), and DDStreamer::specs_write().

{ 
  return rep().specifics(); 
}         

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const DDSpecifics sp 
) [friend]

Definition at line 88 of file DDSpecifics.cc.

{
  DDBase<DDName,DDI::Specific*>::def_type defined(sp.isDefined());
  if (defined.first) {
    os << *(defined.first) << " ";
    if (defined.second) {
      sp.rep().stream(os); 
    }
    else {
      os << "* specific not defined * ";  
    }
  }  
  else {
    os << "* specific not declared * ";  
  }  
  return os;

}