summaryrefslogtreecommitdiff
path: root/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Pulser.h
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Pulser.h')
-rw-r--r--TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Pulser.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Pulser.h b/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Pulser.h
new file mode 100644
index 00000000000..9b0d8b6b4cc
--- /dev/null
+++ b/TAO/CIAO/tests/RTCCM/Priority_Test/Controllers/Pulser.h
@@ -0,0 +1,75 @@
+// $Id$
+
+/**
+ * @file Pulser.h
+ *
+ * Header file for the Pulser class.
+ *
+ * @author Nanbor Wang <nanbor@cse.wustl.edu>
+ */
+
+#ifndef PULSER_H
+#define PULSER_H
+
+#include "corba.h"
+#include "ace/Thread_Manager.h"
+#include "ace/Task.h"
+
+namespace PTImpl
+{
+ // Forward decl.
+ class Pulse_Handler
+ {
+ public:
+ /// Helper function to be called back by Pulse_Handler
+ virtual void pulse (void) = 0;
+ };
+
+ /**
+ * @brief Active pulse generater
+ */
+ class Pulser : public ACE_Task_Base
+ {
+ public:
+ // Default constructor
+ Pulser (Pulse_Handler *cb);
+ ~Pulser ();
+
+ int open (void);
+
+ int close (void);
+
+ int start (CORBA::Long hertz);
+
+ int stop (void);
+
+ int active (void);
+
+ // Handle the timeout.
+ virtual int handle_timeout (const ACE_Time_Value &tv,
+ const void *arg);
+
+ // Called when <Time_Handler> is removed.
+ virtual int handle_close (ACE_HANDLE handle,
+ ACE_Reactor_Mask close_mask);
+
+ virtual int svc (void);
+
+ private:
+ /// Tracking whether we are actively generating pulse or not.
+ long active_;
+
+ /// Flag to indicate completion of this active object.
+ int done_;
+
+ /// The timer id we are waiting.
+ int tid_;
+
+ Pulse_Handler *pulser_callback_;
+
+ ACE_Thread_Manager thr_mgr_;
+ };
+
+}
+
+#endif /* PULSER_H */