Public Member Functions | Private Attributes | Static Private Attributes | List of all members
om::CurrentHistogram Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-03/OnlineMonitoring/viewer/CurrentHistogram.h"

Public Member Functions

 CurrentHistogram ()
 
int Set (const char *nm)
 
int Forward ()
 
int Reload ()
 
int Backward ()
 
const char * Current () const
 
bool ForwardOK () const
 
bool BackwardOK () const
 
bool ReloadOK () const
 

Private Attributes

std::deque< std::stringfHistory
 
std::deque< std::string >::iterator fPlace
 

Static Private Attributes

static const unsigned int kMaxHistory =16
 < How deep do we allow the history to go? More...
 

Detailed Description

Hold the current and past state of the current histogram setting.

Definition at line 10 of file CurrentHistogram.h.

Constructor & Destructor Documentation

CurrentHistogram::CurrentHistogram ( )

Definition at line 5 of file CurrentHistogram.cxx.

5  :
6  fHistory(0),
7  fPlace(fHistory.end())
8 { }
std::deque< std::string > fHistory
std::deque< std::string >::iterator fPlace

Member Function Documentation

int CurrentHistogram::Backward ( )

Definition at line 89 of file CurrentHistogram.cxx.

References BackwardOK(), and fPlace.

Referenced by om::GUIModel::HistogramBack().

90 {
91  if (this->BackwardOK()) { ++fPlace; return 1; }
92  return 0;
93 }
std::deque< std::string >::iterator fPlace
bool CurrentHistogram::BackwardOK ( ) const

Definition at line 64 of file CurrentHistogram.cxx.

References fHistory, fPlace, and MECModelEnuComparisons::i.

Referenced by Backward(), and om::ButtonBank::GUIModelDataIssue().

65 {
66  std::deque<std::string>::iterator i(fPlace+1);
67  if (i >= fHistory.end()) return false;
68  return true;
69 }
std::deque< std::string > fHistory
std::deque< std::string >::iterator fPlace
const char * CurrentHistogram::Current ( ) const

Definition at line 97 of file CurrentHistogram.cxx.

References fHistory, and fPlace.

Referenced by om::PlotClickHandler::DecodeClick(), om::CaptionBox::GUIModelDataIssue(), om::ComparisonBox::GUIModelDataIssue(), om::HistogramBrowser::GUIModelDataIssue(), and om::PlotViewer::GUIModelDataIssue().

98 {
99  if (fPlace == fHistory.end()) return "";
100  return fPlace->c_str();
101 }
std::deque< std::string > fHistory
std::deque< std::string >::iterator fPlace
int CurrentHistogram::Forward ( )

Definition at line 81 of file CurrentHistogram.cxx.

References ForwardOK(), and fPlace.

Referenced by om::GUIModel::HistogramForward().

82 {
83  if (this->ForwardOK()) { --fPlace; return 1; }
84  return 0;
85 }
std::deque< std::string >::iterator fPlace
bool CurrentHistogram::ForwardOK ( ) const

Definition at line 56 of file CurrentHistogram.cxx.

References fHistory, and fPlace.

Referenced by Forward(), and om::ButtonBank::GUIModelDataIssue().

57 {
58  if (fPlace == fHistory.begin()) return false;
59  return true;
60 }
std::deque< std::string > fHistory
std::deque< std::string >::iterator fPlace
int om::CurrentHistogram::Reload ( )
bool CurrentHistogram::ReloadOK ( ) const

Definition at line 73 of file CurrentHistogram.cxx.

References fHistory, and fPlace.

Referenced by om::ButtonBank::GUIModelDataIssue().

74 {
75  if (fPlace == fHistory.end() || *fPlace == "") return false;
76  return true;
77 }
std::deque< std::string > fHistory
std::deque< std::string >::iterator fPlace
int CurrentHistogram::Set ( const char *  nm)

Definition at line 12 of file CurrentHistogram.cxx.

References fHistory, fPlace, kMaxHistory, Munits::nm, and string.

Referenced by om::GUIModel::SetCurrentHistogram().

13 {
14 
15  //
16  // Check if we're already there...
17  //
18  if (fPlace != fHistory.end() && *fPlace == nm) return 0;
19 
20  //
21  // If we're at the front of the deque, add the new histo to the front.
22  //
23  if(fPlace == fHistory.begin()) fHistory.push_front(std::string(nm));
24 
25  // If we're in the middle of the deque, erase everything forward of this spot
26  // and add the new histo.
27  if(fPlace != fHistory.begin()) {
28 
29  // Erase entries between the [beginning and current place).
30  std::deque<std::string>::iterator i1(fHistory.begin());
31  std::deque<std::string>::iterator i2(fPlace);
32  fHistory.erase(i1, i2);
33 
34  // Add histo to the new beginning.
35  fHistory.push_front(std::string(nm));
36 
37  }
38 
39  //
40  // If we've grown too big, truncate by dropping oldest entries at
41  // beginning of list.
42  //
43  if (fHistory.size() > kMaxHistory) fHistory.resize(kMaxHistory);
44 
45  //
46  // Set our place in the history to the new end of the list
47  //
48  fPlace = fHistory.begin();
49 
50  return 1;
51 
52 }
static const unsigned int kMaxHistory
< How deep do we allow the history to go?
static constexpr Double_t nm
Definition: Munits.h:133
std::deque< std::string > fHistory
std::deque< std::string >::iterator fPlace
enum BeamMode string

Member Data Documentation

std::deque<std::string> om::CurrentHistogram::fHistory
private

Definition at line 30 of file CurrentHistogram.h.

Referenced by BackwardOK(), Current(), ForwardOK(), ReloadOK(), and Set().

std::deque<std::string>::iterator om::CurrentHistogram::fPlace
private

Definition at line 31 of file CurrentHistogram.h.

Referenced by Backward(), BackwardOK(), Current(), Forward(), ForwardOK(), ReloadOK(), and Set().

const unsigned int om::CurrentHistogram::kMaxHistory =16
staticprivate

< How deep do we allow the history to go?

Definition at line 27 of file CurrentHistogram.h.

Referenced by Set().


The documentation for this class was generated from the following files: