GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4Queue.h
Go to the documentation of this file.
1 // $Id$
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #ifndef TGO4QUEUE_H
15 #define TGO4QUEUE_H
16 
17 #include "TNamed.h"
18 
19 class TCondition;
20 class TList;
21 class TMutex;
22 
31 class TGo4Queue : public TNamed {
32  public:
33  TGo4Queue(const char *name = nullptr);
34 
35  virtual ~TGo4Queue();
36 
37  void Clear(Option_t *opt = "") override;
38 
39  virtual void Wake();
40 
41  Bool_t IsEmpty() const;
42 
43  Int_t GetEntries() const { return fiEntries; }
44 
45  void SetMaxEntries(Int_t max) { fiMaxEntries = max; }
46 
47  protected:
48  TObject *Next();
49  TObject *Wait();
50  void Add(TObject *ob);
51 
52  private:
53  TMutex *fxMutex{nullptr};
54  TCondition *fxCondition{nullptr};
55  TList *fxList{nullptr};
56  Int_t fiEntries{0};
57  Int_t fiMaxEntries{0};
58  Bool_t fbWakeUpCall{kFALSE};
59 };
60 
61 #endif //TGO4QUEUE_H
void Add(TObject *ob)
Definition: TGo4Queue.cxx:67
Bool_t IsEmpty() const
Definition: TGo4Queue.cxx:80
void SetMaxEntries(Int_t max)
Definition: TGo4Queue.h:45
virtual void Wake()
Definition: TGo4Queue.cxx:86
Bool_t fbWakeUpCall
Definition: TGo4Queue.h:58
virtual ~TGo4Queue()
Definition: TGo4Queue.cxx:34
Int_t GetEntries() const
Definition: TGo4Queue.h:43
TMutex * fxMutex
Definition: TGo4Queue.h:53
TGo4Queue(const char *name=nullptr)
Definition: TGo4Queue.cxx:23
TCondition * fxCondition
Definition: TGo4Queue.h:54
Int_t fiEntries
Definition: TGo4Queue.h:56
void Clear(Option_t *opt="") override
Definition: TGo4Queue.cxx:43
Int_t fiMaxEntries
Definition: TGo4Queue.h:57
TObject * Wait()
Definition: TGo4Queue.cxx:49
TList * fxList
Definition: TGo4Queue.h:55
TObject * Next()
Definition: TGo4Queue.cxx:61