Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef DDString_h
0002 #define DDString_h
0003 
0004 #include "DetectorDescription/Core/interface/DDBase.h"
0005 #include "DetectorDescription/Core/interface/DDName.h"
0006 #include <string>
0007 #include <iostream>
0008 #include <memory>
0009 
0010 class DDString;
0011 
0012 //! output operator for printing ...
0013 std::ostream& operator<<(std::ostream& o, const DDString& cons);
0014 
0015 //! a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector>
0016 class DDString : public DDBase<DDName, std::unique_ptr<std::string> > {
0017 public:
0018   //! an uninitialized constant; one can assign an initialized constant to make it valid
0019   DDString();
0020 
0021   //! a refenrence to a constant
0022   DDString(const DDName& name);
0023 
0024   //! creation of a new named constant; if it already existed with the given name, it's overwritten with new values
0025   DDString(const DDName& name, std::unique_ptr<std::string> value);
0026 
0027   //! return the first stored value; does not check boundaries!
0028   const std::string& value() const { return rep(); }
0029 
0030   //! convert to a std::string
0031   operator std::string() const { return rep(); }
0032 };
0033 
0034 #endif