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.

References dummiesForReserved_, and reserved_.

◆ ~FastMonEncoding()

evf::FastMonEncoding::~FastMonEncoding ( )
inline

Definition at line 46 of file FastMonitoringThread.h.

References dummiesForReserved_, and reserved_.

46  {
47  if (reserved_)
48  delete[] dummiesForReserved_;
49  }
edm::ModuleDescription * dummiesForReserved_

Member Function Documentation

◆ completeReservedWithDummies()

void evf::FastMonEncoding::completeReservedWithDummies ( )
inline

Definition at line 91 of file FastMonitoringThread.h.

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

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

◆ decode()

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

Definition at line 78 of file FastMonitoringThread.h.

References decoder_.

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

◆ encode()

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

Definition at line 51 of file FastMonitoringThread.h.

References PVValHelper::add(), and quickReference_.

Referenced by encodeString().

51  {
52  std::unordered_map<const void*, int>::const_iterator it = quickReference_.find(add);
53  return (it != quickReference_.end()) ? (*it).second : 0;
54  }
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 60 of file FastMonitoringThread.h.

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

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

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

Referenced by completeReservedWithDummies(), and updateReserved().

79  {
80  // translation_[*name]=current_;
82  if (decoder_.size() <= i)
83  decoder_.push_back(add);
84  else
86  }
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 95 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().

95  {
96  // translation_[*name]=current_;
98  decoder_.push_back(add);
99  current_++;
100  }
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 102 of file FastMonitoringThread.h.

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

102  {
103  // translation_[*name]=current_;
105  decoder_.push_back((void*)&add);
106  current_++;
107  }
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 87 of file FastMonitoringThread.h.

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

87  {
90  }
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 109 of file FastMonitoringThread.h.

References decoder_.

109 { return decoder_.size(); }
std::vector< const void * > 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_