CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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

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, DDFilteredView::specificsV(), DDValue::strings(), groupFilesInBlocks::temp, and hgcalPerformanceValidation::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
tuple result
Definition: mps_fire.py:311
void specificsV(std::vector< const DDsvalues_type * > &result) const
User specific data attached to the current node.
template<class FilteredView >
static std::string ExtractStringFromDDD< FilteredView >::getString ( const std::string &  ,
FilteredView *   
)
static
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(), and mps_fire::result.

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