CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions
ExtractStringFromDDD< FilteredView > Class Template Reference

#include <ExtractStringFromDDD.h>

Public Member Functions

template<>
std::string getString (const std::string &s, DDFilteredView *fv)
 
template<>
std::string getString (const std::string &s, cms::DDFilteredView *fv)
 

Static Public Member Functions

static std::string getString (const std::string &, FilteredView *)
 

Detailed Description

template<class FilteredView>
class ExtractStringFromDDD< FilteredView >

Helper function to extract a string from a SpecPar; only returns the first one and complains if more than 1 is found.

Definition at line 12 of file ExtractStringFromDDD.h.

Member Function Documentation

◆ getString() [1/3]

template<>
std::string ExtractStringFromDDD< DDFilteredView >::getString ( const std::string &  s,
DDFilteredView fv 
)

Definition at line 9 of file ExtractStringFromDDD.cc.

References DDfetch(), Exception, mps_fire::result, alignCSCRings::s, DDFilteredView::specificsV(), groupFilesInBlocks::temp, and heppy_batch::val.

9  {
10  DDValue val(s);
11  std::vector<const DDsvalues_type *> result;
12  fv->specificsV(result);
13  std::vector<const DDsvalues_type *>::iterator it = result.begin();
14  bool foundIt = false;
15  for (; it != result.end(); ++it) {
16  foundIt = DDfetch(*it, val);
17  if (foundIt)
18  break;
19  }
20  if (foundIt) {
21  std::vector<std::string> const &temp = val.strings();
22  if (temp.size() != 1) {
23  throw cms::Exception("Configuration") << " ERROR: I need 1 " << s << " tags";
24  }
25  return temp[0];
26  }
27  return "NotFound";
28 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
void specificsV(std::vector< const DDsvalues_type *> &result) const
User specific data attached to the current node.

◆ getString() [2/3]

template<class FilteredView >
static std::string ExtractStringFromDDD< FilteredView >::getString ( const std::string &  ,
FilteredView *   
)
static

◆ getString() [3/3]

template<>
std::string ExtractStringFromDDD< cms::DDFilteredView >::getString ( const std::string &  s,
cms::DDFilteredView fv 
)

Definition at line 31 of file ExtractStringFromDDD.cc.

References cms::DDFilteredView::getString(), mps_fire::result, and alignCSCRings::s.

31  {
32  auto result = fv->getString(s);
33  return {result.data(), result.size()};
34 }
std::string_view getString(const std::string &) const