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 36 of file FastMonitoringThread.h.

Constructor & Destructor Documentation

◆ FastMonEncoding()

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

Definition at line 37 of file FastMonitoringThread.h.

References dummiesForReserved_, and reserved_.

◆ ~FastMonEncoding()

evf::FastMonEncoding::~FastMonEncoding ( )
inline

Definition at line 42 of file FastMonitoringThread.h.

References dummiesForReserved_, and reserved_.

42  {
43  if (reserved_)
44  delete[] dummiesForReserved_;
45  }
edm::ModuleDescription * dummiesForReserved_

Member Function Documentation

◆ completeReservedWithDummies()

void evf::FastMonEncoding::completeReservedWithDummies ( )
inline

Definition at line 87 of file FastMonitoringThread.h.

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

87  {
88  for (unsigned int i = currentReserved_; i < reserved_; i++)
90  }
edm::ModuleDescription * dummiesForReserved_
void fillReserved(const void *add, unsigned int i)

◆ decode()

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

Definition at line 74 of file FastMonitoringThread.h.

References decoder_.

74 { return decoder_[index]; }
std::vector< const void * > decoder_

◆ encode()

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

Definition at line 47 of file FastMonitoringThread.h.

References PVValHelper::add(), and quickReference_.

Referenced by encodeString().

47  {
48  std::unordered_map<const void*, int>::const_iterator it = quickReference_.find(add);
49  return (it != quickReference_.end()) ? (*it).second : 0;
50  }
void add(std::map< std::string, TH1 *> &h, TH1 *hist)
std::unordered_map< const void *, int > quickReference_

◆ encodeString()

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

Definition at line 56 of file FastMonitoringThread.h.

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

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

◆ fillReserved()

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

Definition at line 75 of file FastMonitoringThread.h.

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

Referenced by completeReservedWithDummies(), and updateReserved().

75  {
76  // translation_[*name]=current_;
78  if (decoder_.size() <= i)
79  decoder_.push_back(add);
80  else
82  }
std::vector< const void * > decoder_
void add(std::map< std::string, TH1 *> &h, TH1 *hist)
std::unordered_map< const void *, int > quickReference_

◆ update()

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

Definition at line 91 of file FastMonitoringThread.h.

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

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

91  {
92  // translation_[*name]=current_;
94  decoder_.push_back(add);
95  current_++;
96  }
std::vector< const void * > decoder_
void add(std::map< std::string, TH1 *> &h, TH1 *hist)
std::unordered_map< const void *, int > quickReference_

◆ updatePreinit()

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

Definition at line 98 of file FastMonitoringThread.h.

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

98  {
99  // translation_[*name]=current_;
101  decoder_.push_back((void*)&add);
102  current_++;
103  }
std::vector< const void * > decoder_
std::unordered_map< std::string, int > quickReferencePreinit_
void add(std::map< std::string, TH1 *> &h, TH1 *hist)

◆ updateReserved()

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

Definition at line 83 of file FastMonitoringThread.h.

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

83  {
86  }
void fillReserved(const void *add, unsigned int i)
void add(std::map< std::string, TH1 *> &h, TH1 *hist)

◆ vecsize()

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

Definition at line 105 of file FastMonitoringThread.h.

References decoder_.

105 { return decoder_.size(); }
std::vector< const void * > decoder_

Member Data Documentation

◆ current_

int evf::FastMonEncoding::current_

Definition at line 110 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 106 of file FastMonitoringThread.h.

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

◆ quickReferencePreinit_

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

Definition at line 107 of file FastMonitoringThread.h.

Referenced by encodeString(), and updatePreinit().

◆ reserved_

unsigned int evf::FastMonEncoding::reserved_