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, cms::DDFilteredView *fv)
 
template<>
std::string getString (const std::string &s, 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<class FilteredView >
static std::string ExtractStringFromDDD< FilteredView >::getString ( const std::string &  ,
FilteredView *   
)
static

◆ getString() [2/3]

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

Definition at line 31 of file ExtractStringFromDDD.cc.

31  {
32  auto result = fv->getString(s);
33  return {result.data(), result.size()};
34 }

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

◆ getString() [3/3]

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

Definition at line 9 of file ExtractStringFromDDD.cc.

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 }

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

groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
alignCSCRings.s
s
Definition: alignCSCRings.py:92
DDfetch
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
DDFilteredView::specificsV
void specificsV(std::vector< const DDsvalues_type * > &result) const
User specific data attached to the current node.
Definition: DDFilteredView.cc:38
cms::DDFilteredView::getString
std::string_view getString(const std::string &) const
Definition: DDFilteredView.cc:618
heppy_batch.val
val
Definition: heppy_batch.py:351
DDValue
Definition: DDValue.h:21
Exception
Definition: hltDiff.cc:246
mps_fire.result
result
Definition: mps_fire.py:311