VkPeriodic(3x) VkPeriodic(3x)
VkPeriodic - Support for performing actions at regular periodic intervals
VkCallbackObject
#include <Vk/VkPeriodic.h>
PUBLIC PROTOCOL SUMMARY
Constructor/Destructor
VkPeriodic(int interval);
virtual void ~VkPeriodic(void);
Starting and Stopping
void start(void);
void stop(void);
PROTECTED PROTOCOL SUMMARY [Toc] [Back] Updates
virtual void tick(void);
Protected Data Members [Toc] [Back] VkPeriodic provides a simple, convenient interface to the Xt timeout
mechanism. For many applications, it is sufficient to call
XtAppAddTimeOut() directly. However, VkPeriodic provides the ability
to encapsulate a common use of XtAppAddTimeOut(), as a cyclic timer,
in a C++ class.
The VkPeriodic class can be used in one of two way. The first is to
derive a new class from VkPeriodic that overrides the tick() virtual
member function. The tick() member function is called for each cycle
of the periodic timeout. This approach has the advantage that any
data being used in connection with the timeout can be declared and
maintained as data member(s) of the derived class.
The VkPeriodic class also supports a ViewKit callback that allows
other C++ classes to register member functions to be called with
each periodic timeout. This approach is more convenient when a
simple timer is needed to drive some other class.
These two methods are not mutually-exclusive, and both approaches
may be used together at once.
Page 1
VkPeriodic(3x) VkPeriodic(3x)
FUNCTION DESCRIPTIONS [Toc] [Back] tick()
virtual void tick(void);
This function can be overridden by derived classes to allow them to
be notified when each timeout occurs.
VkPeriodic() [Toc] [Back]
VkPeriodic(int interval);
The constructor initializes a VkPeriodic object, creating a timer to
be called every interval milliseconds. The interval is approximate
because it relies on the underlying Xt mechanism, which is based on
select(). If an application does not return to the Xt event loop
regularly, the timeout will not occur.
~VkPeriodic()
virtual void ~VkPeriodic(void);
Clean up all memory allocated by a VkPeriodic object. Any pending
timer is removed.
start()
void start(void);
Start the timer. This function must be called to start the periodic
timeouts.
stop()
void stop(void);
Stop the timer.
static const char *const timerCallback;
static const char *const timerCallback;
This callback list allows other C++ classes derived from
VkCallbackObject to register member functions to be called at
periodic intervals.
INHERITED MEMBER FUNCTIONS [Toc] [Back] Inherited from VkCallbackObject
callCallbacks(), addCallback(), removeCallback(),
removeAllCallbacks()
ViewKit Programmer's Guide
Page 2
VkPeriodic(3x) VkPeriodic(3x)
The X Window System, DEC Press, Bob Sheifler and Jim Gettys
The X Window System Toolkit, DEC Press, Paul Asente and Ralph Swick
The OSF/Motif Programmers Reference, Prentice Hall, OSF
PPPPaaaaggggeeee 3333 [ Back ]
|