Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:55

0001 #ifndef DETECTOR_DESCRIPTION_CORE_DDSPECIFICS_H
0002 #define DETECTOR_DESCRIPTION_CORE_DDSPECIFICS_H
0003 
0004 #include <iosfwd>
0005 #include <map>
0006 #include <memory>
0007 #include <string>
0008 #include <utility>
0009 #include <vector>
0010 
0011 #include "DetectorDescription/Core/interface/DDBase.h"
0012 #include "DetectorDescription/Core/interface/DDExpandedView.h"
0013 #include "DetectorDescription/Core/interface/DDName.h"
0014 #include "DetectorDescription/Core/interface/DDsvalues.h"
0015 
0016 class DDExpandedView;
0017 class DDPartSelection;
0018 class DDSpecifics;
0019 
0020 namespace DDI {
0021   class Specific;
0022 }
0023 
0024 std::ostream &operator<<(std::ostream &, const std::vector<std::string> &);
0025 std::ostream &operator<<(std::ostream &, const DDSpecifics &);
0026 
0027 /**
0028   used to attach specific (user defined) data to nodes in the expanded view.
0029   - only a std::map<std::string,std::string> (std::map of name,value) 
0030 
0031 */
0032 //! Interface to attach user specific data to nodes in the expanded-view
0033 /** User data (currently only of type a \c std::map<std::string,std::string> ) can be attached
0034     to single nodes or set of nodes in the detector tree (represented in DDExpandedView).
0035     Nodes where user data has to be attached are selected by a very simplified XPath similar 
0036     notation.
0037     
0038     DDSpecifics are lightweighted reference-objects. For further information concerning
0039     reference-objects refere to the documentation of DDLogicalPart. 
0040 */
0041 class DDSpecifics : public DDBase<DDName, std::unique_ptr<DDI::Specific> > {
0042   friend std::ostream &operator<<(std::ostream &, const DDSpecifics &);
0043 
0044 public:
0045   //! Creates a uninitialized reference-object (see DDLogicalPart documentation for details on reference objects)
0046   DDSpecifics();
0047 
0048   //! Creates a initialized reference-object or a reference to an allready defined specifcs.
0049   /** If a DDSpecifics with \a name was already defined, this constructor creates a 
0050       lightweighted reference-object to it. Otherwise a (default) initialized reference-object
0051       is registered named \a name. 
0052       For further details concerning the usage of reference-objects refere
0053       to the documentation of DDLogicalPart.
0054   */
0055   DDSpecifics(const DDName &name);
0056 
0057   //! Creates a defined reference-object or replaces a already defined reference-object named \a name
0058   /**
0059       \arg \c name unique name 
0060       \arg \c partSelections collection of selection-strings which select expanded-nodes
0061       \arg \c svalues user data attached to nodes selected by \a partSelections
0062       
0063       <h3> Syntax of the selection std::string </h3>
0064       bla, bla, bla
0065   */
0066   DDSpecifics(const DDName &name,
0067               const std::vector<std::string> &partSelections,
0068               const DDsvalues_type &svalues,
0069               bool doRegex = true);
0070 
0071   //! Gives a reference to the collection of part-selections
0072   const std::vector<DDPartSelection> &selection() const;
0073 
0074   //! Reference to the user-data attached to all nodes selected by the selections-strings given through selection
0075   const DDsvalues_type &specifics() const;
0076 
0077   //! Calculates the geometrical history of a fully specified PartSelector
0078   std::pair<bool, DDExpandedView> node() const;
0079 };
0080 
0081 #endif