Public Member Functions | List of all members
om::GUIModelSubscriber Class Referenceabstract

#include "/cvmfs/"

Inheritance diagram for om::GUIModelSubscriber:
om::ButtonBank om::CaptionBox om::ComparisonBox om::HistogramBrowser om::HistogramInfo om::PlotViewer om::WatchListBox

Public Member Functions

 GUIModelSubscriber (unsigned int which)
 ~GUIModelSubscriber ()
bool GetLock ()
void ReleaseLock ()
virtual void GUIModelDataIssue (const GUIModelData &m, unsigned int which)=0

Detailed Description

Any class which needs to be informated about state changes in the GUIModel

Definition at line 11 of file GUIModelSubscriber.h.

Constructor & Destructor Documentation

GUIModelSubscriber::GUIModelSubscriber ( unsigned int  which)

Create a GUIModel subscriber.

which- bit set indicating which messages we want

See GUIModelData for the list of possibilities

Definition at line 10 of file GUIModelSubscriber.cxx.

References om::GUIModel::Instance(), and om::GUIModel::Subscribe().

11 {
12  GUIModel::Instance().Subscribe(this, which);
13 }
void Subscribe(GUIModelSubscriber *s, unsigned int which)
Definition: GUIModel.cxx:35
static GUIModel & Instance()
Definition: GUIModel.cxx:11
GUIModelSubscriber::~GUIModelSubscriber ( )

Definition at line 17 of file GUIModelSubscriber.cxx.

References om::GUIModel::Instance(), and om::GUIModel::Unsubscribe().

18 {
20 }
static GUIModel & Instance()
Definition: GUIModel.cxx:11
void Unsubscribe(GUIModelSubscriber *s)
Definition: GUIModel.cxx:43

Member Function Documentation

bool GUIModelSubscriber::GetLock ( )

Definition at line 24 of file GUIModelSubscriber.cxx.

References gsLock, MECModelEnuComparisons::i, and kSleep.

Referenced by om::CaptionBox::GUIModelDataIssue(), om::HistogramInfo::GUIModelDataIssue(), om::ButtonBank::GUIModelDataIssue(), om::HistogramBrowser::GUIModelDataIssue(), om::PlotViewer::GUIModelDataIssue(), and om::WatchListBox::GUIModelDataIssue().

25 {
26  unsigned int i;
27  const unsigned int kSleep = 1000; // 1 msec
28  const unsigned int kCount = 10000; // 10k tries at 1 msec = 10 seconds
29  for (i=0; i<kCount; ++i) {
30  if (gsLock==false) {
31  gsLock = true;
32  return true;
33  }
34  usleep(kSleep);
35  }
36  return false;
37 }
static bool gsLock
static const unsigned int kSleep
Definition: IPC.cxx:21
virtual void om::GUIModelSubscriber::GUIModelDataIssue ( const GUIModelData m,
unsigned int  which 
pure virtual

Receive notifications when the GUI model data has changed

m- The new model data
which- Which element of the data has changed

See GUIModel.h for the definitions of "which".

Note: To prevent collisions between threads, users should implement their "GUIModelDataIssue" methods following this pattern:

{ book aok = this->GetLock(); if (!aok) return;

...your code here...

this->ReleaseLock(); }

Implemented in om::WatchListBox, om::PlotViewer, om::HistogramBrowser, om::ButtonBank, om::ComparisonBox, om::CaptionBox, and om::HistogramInfo.

void GUIModelSubscriber::ReleaseLock ( )

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