CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
evf::FastMonEncoding Struct Reference

#include <FastMonitoringThread.h>

Public Member Functions

void completeReservedWithDummies ()
 
const void * decode (unsigned int index)
 
int encode (const void *add) const
 
int encodeString (const std::string *add)
 
 FastMonEncoding (unsigned int res)
 
void fillReserved (const void *add, unsigned int i)
 
void update (const void *add)
 
void updatePreinit (std::string const &add)
 
void updateReserved (const void *add)
 
unsigned int vecsize ()
 
 ~FastMonEncoding ()
 

Public Attributes

int current_
 
int currentReserved_
 
std::vector< const void * > decoder_
 
edm::ModuleDescriptiondummiesForReserved_
 
std::unordered_map< const void *, int > quickReference_
 
std::unordered_map< std::string, int > quickReferencePreinit_
 
unsigned int reserved_
 

Detailed Description

Definition at line 40 of file FastMonitoringThread.h.

Constructor & Destructor Documentation

◆ FastMonEncoding()

evf::FastMonEncoding::FastMonEncoding ( unsigned int  res)
inline

Definition at line 41 of file FastMonitoringThread.h.

42  if (reserved_)
44  // completeReservedWithDummies();
45  }

References dummiesForReserved_, and reserved_.

◆ ~FastMonEncoding()

evf::FastMonEncoding::~FastMonEncoding ( )
inline

Definition at line 46 of file FastMonitoringThread.h.

46  {
47  if (reserved_)
48  delete[] dummiesForReserved_;
49  }

References dummiesForReserved_, and reserved_.

Member Function Documentation

◆ completeReservedWithDummies()

void evf::FastMonEncoding::completeReservedWithDummies ( )
inline

Definition at line 91 of file FastMonitoringThread.h.

91  {
92  for (unsigned int i = currentReserved_; i < reserved_; i++)
94  }

References currentReserved_, dummiesForReserved_, fillReserved(), mps_fire::i, and reserved_.

◆ decode()

const void* evf::FastMonEncoding::decode ( unsigned int  index)
inline

Definition at line 78 of file FastMonitoringThread.h.

78 { return decoder_[index]; }

References decoder_.

◆ encode()

int evf::FastMonEncoding::encode ( const void *  add) const
inline

Definition at line 51 of file FastMonitoringThread.h.

51  {
52  std::unordered_map<const void*, int>::const_iterator it = quickReference_.find(add);
53  return (it != quickReference_.end()) ? (*it).second : 0;
54  }

References PVValHelper::add(), and quickReference_.

Referenced by encodeString().

◆ encodeString()

int evf::FastMonEncoding::encodeString ( const std::string *  add)
inline

Definition at line 60 of file FastMonitoringThread.h.

60  {
61  std::unordered_map<const void*, int>::const_iterator it = quickReference_.find((void*)add);
62  if (it == quickReference_.end()) {
63  //try to match by string content (encode only used
64  auto it = quickReferencePreinit_.find(*add);
65  if (it == quickReferencePreinit_.end())
66  return 0;
67  else {
68  //overwrite pointer in decoder and add to reference
69  decoder_[(*it).second] = (void*)add;
70  quickReference_[(void*)add] = (*it).second;
71  quickReferencePreinit_.erase(it);
72  return encode((void*)add);
73  }
74  }
75  return (*it).second;
76  }

References PVValHelper::add(), decoder_, encode(), quickReference_, and quickReferencePreinit_.

◆ fillReserved()

void evf::FastMonEncoding::fillReserved ( const void *  add,
unsigned int  i 
)
inline

Definition at line 79 of file FastMonitoringThread.h.

79  {
80  // translation_[*name]=current_;
82  if (decoder_.size() <= i)
83  decoder_.push_back(add);
84  else
86  }

References PVValHelper::add(), currentReserved_, decoder_, mps_fire::i, and quickReference_.

Referenced by completeReservedWithDummies(), and updateReserved().

◆ update()

void evf::FastMonEncoding::update ( const void *  add)
inline

◆ updatePreinit()

void evf::FastMonEncoding::updatePreinit ( std::string const &  add)
inline

Definition at line 102 of file FastMonitoringThread.h.

102  {
103  // translation_[*name]=current_;
105  decoder_.push_back((void*)&add);
106  current_++;
107  }

References PVValHelper::add(), current_, decoder_, and quickReferencePreinit_.

◆ updateReserved()

void evf::FastMonEncoding::updateReserved ( const void *  add)
inline

Definition at line 87 of file FastMonitoringThread.h.

87  {
90  }

References PVValHelper::add(), currentReserved_, and fillReserved().

◆ vecsize()

unsigned int evf::FastMonEncoding::vecsize ( )
inline

Definition at line 109 of file FastMonitoringThread.h.

109 { return decoder_.size(); }

References decoder_.

Member Data Documentation

◆ current_

int evf::FastMonEncoding::current_

Definition at line 114 of file FastMonitoringThread.h.

Referenced by update(), and updatePreinit().

◆ currentReserved_

int evf::FastMonEncoding::currentReserved_

◆ decoder_

std::vector<const void*> evf::FastMonEncoding::decoder_

◆ dummiesForReserved_

edm::ModuleDescription* evf::FastMonEncoding::dummiesForReserved_

◆ quickReference_

std::unordered_map<const void*, int> evf::FastMonEncoding::quickReference_

Definition at line 110 of file FastMonitoringThread.h.

Referenced by encode(), encodeString(), fillReserved(), and update().

◆ quickReferencePreinit_

std::unordered_map<std::string, int> evf::FastMonEncoding::quickReferencePreinit_

Definition at line 111 of file FastMonitoringThread.h.

Referenced by encodeString(), and updatePreinit().

◆ reserved_

unsigned int evf::FastMonEncoding::reserved_
evf::FastMonEncoding::fillReserved
void fillReserved(const void *add, unsigned int i)
Definition: FastMonitoringThread.h:79
mps_fire.i
i
Definition: mps_fire.py:428
evf::FastMonEncoding::currentReserved_
int currentReserved_
Definition: FastMonitoringThread.h:115
evf::FastMonEncoding::reserved_
unsigned int reserved_
Definition: FastMonitoringThread.h:113
edm::ModuleDescription
Definition: ModuleDescription.h:21
evf::FastMonEncoding::current_
int current_
Definition: FastMonitoringThread.h:114
evf::FastMonEncoding::quickReferencePreinit_
std::unordered_map< std::string, int > quickReferencePreinit_
Definition: FastMonitoringThread.h:111
PVValHelper::add
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
Definition: PVValidationHelpers.cc:12
evf::FastMonEncoding::decoder_
std::vector< const void * > decoder_
Definition: FastMonitoringThread.h:112
res
Definition: Electron.h:6
evf::FastMonEncoding::encode
int encode(const void *add) const
Definition: FastMonitoringThread.h:51
evf::FastMonEncoding::dummiesForReserved_
edm::ModuleDescription * dummiesForReserved_
Definition: FastMonitoringThread.h:116
evf::FastMonEncoding::quickReference_
std::unordered_map< const void *, int > quickReference_
Definition: FastMonitoringThread.h:110
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46