FRIBParallelanalysis  1.0
FrameworkforMPIParalleldataanalysisatFRIB
TCLTimer.h
1 /*
2  This software is Copyright by the Board of Trustees of Michigan
3  State University (c) Copyright 2005.
4 
5  You may use this software under the terms of the GNU public license
6  (GPL). The terms of this license are described at:
7 
8  http://www.gnu.org/licenses/gpl.txt
9 
10  Author:
11  Ron Fox
12  NSCL
13  Michigan State University
14  East Lansing, MI 48824-1321
15 */
16 
17 // CTCLTimer.h:
18 //
19 // This file defines the CTCLTimer class.
20 //
21 // Author:
22 // Ron Fox
23 // NSCL
24 // Michigan State University
25 // East Lansing, MI 48824-1321
26 // mailto:fox@nscl.msu.edu
27 //
28 // Copyright 1999 NSCL, All Rights Reserved.
29 //
31 
32 #ifndef TCLTIMER_H //Required for current class
33 #define TCLTIMER_H
34  //Required for base classes
35 #ifndef TCLINTERPRETEROBJECT_H
36 #include "TCLInterpreterObject.h"
37 #endif
38 
39 #ifndef TCLPLUSTYPES_H
40 #include <libtclplusdatatypes.h>
41 #endif
42 
43 
44 #include <tcl.h>
45 
46 
47 
49 {
50  Tcl_TimerToken m_tToken; // Timer token returned from Tcl_CreateTimerHandler.
51  TCLPLUS::UInt_t m_nMsec; // No. Milleseconds delay on timer.
52  TCLPLUS::Bool_t m_fSet; // kfTRUE if timer is pending (m_tToken valid).
53 
54 public:
55  //Default constructor
56 
57  CTCLTimer () :
59  m_tToken(0),
60  m_nMsec(0),
61  m_fSet(0)
62  { }
63  CTCLTimer(CTCLInterpreter* pInterp, TCLPLUS::UInt_t nMsec = 0) :
64  CTCLInterpreterObject(pInterp),
65  m_tToken(0),
66  m_nMsec(nMsec),
67  m_fSet(0)
68  {}
69  virtual ~CTCLTimer ( ) {
70  Clear();
71  }
72  //Destructor
73 
74  //Copy constructor [ not allowed ]
75 private:
76  CTCLTimer (const CTCLTimer& aCTCLTimer );
77 
78  //Operator= Assignment Operator [ not allowed ]
79 
80  CTCLTimer& operator= (const CTCLTimer& aCTCLTimer);
81 
82  //Operator== Equality Operator [ makes no sense ]
83  int operator== (const CTCLTimer& aCTCLTimer);
84 
85  // Selectors:
86 
87 public:
88 
89  Tcl_TimerToken getToken() const
90  {
91  return m_tToken;
92  }
93  TCLPLUS::UInt_t getMsec() const
94  {
95  return m_nMsec;
96  }
97  TCLPLUS::Bool_t IsSet() const
98  {
99  return m_fSet;
100  }
101  // Mutators:
102 
103 protected:
104 
105  void setToken (Tcl_TimerToken am_tToken)
106  {
107  m_tToken = am_tToken;
108  }
109  void setMsec (TCLPLUS::UInt_t am_nMsec)
110  {
111  m_nMsec = am_nMsec;
112  }
113  void setSet (TCLPLUS::Bool_t am_fSet)
114  {
115  m_fSet = am_fSet;
116  }
117  // Operations and overridables:
118 
119 public:
120  virtual void operator() () = 0;
121  static void CallbackRelay (ClientData pObject) ;
122  void Set () ;
123  void Set(TCLPLUS::UInt_t nms) {
124  m_nMsec = nms;
125  Set();
126  }
127  void Clear () ;
128 };
129 
130 #endif
131 
132 
133 
134 
Definition: TCLTimer.h:48
Definition: TCLInterpreterObject.h:46
Definition: TCLInterpreter.h:59