sipxportlib  Version 3.3
OsCallback.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 
12 #ifndef _OsCallback_h_
13 #define _OsCallback_h_
14 
15 // SYSTEM INCLUDES
16 
17 // APPLICATION INCLUDES
18 #include <os/OsNotification.h>
19 
20 // DEFINES
21 // MACROS
22 // EXTERNAL FUNCTIONS
23 // EXTERNAL VARIABLES
24 // CONSTANTS
25 // STRUCTS
26 
27 // TYPEDEFS
28 typedef void (*OsCallbackFunc) (const intptr_t userData, const intptr_t eventData);
29 
30 // FORWARD DECLARATIONS
31 
32 //:Callback function that is executed when the event is signaled.
33 //:Event notification method where a callback function is executed in the
34 //:Notifier's context when the corresponding event occurs.
35 
36 // <p><b>Background</b>
37 // <p>First, a little bit of terminology. The task that wishes to be notified
38 // when an event occurs is the "Listener" task. The task that signals when
39 // a given event occurs is the "Notifier" task. A Notifier informs the
40 // Listener that a given event has occurred by sending an "Event
41 // Notification".<br><br>
42 //
43 // <p><b>Expected Usage</b>
44 // <p>When the corresponding event occurs, the designated callback routine is
45 // invoked in the Notifier's task context.
46 
47 class OsCallback : public OsNotification
48 {
49 /* //////////////////////////// PUBLIC //////////////////////////////////// */
50 public:
51 
52 /* ============================ CREATORS ================================== */
53 
54  OsCallback(const intptr_t userData, const OsCallbackFunc func);
55  //:Constructor
56 
57  virtual
58  ~OsCallback();
59  //:Destructor
60 
61 /* ============================ MANIPULATORS ============================== */
62 
63  virtual OsStatus signal(const intptr_t eventData);
64  //:Signal the occurrence of the event by executing the callback function
65  // Always return OS_SUCCESS.
66 
67 /* ============================ ACCESSORS ================================= */
68 
69 /* ============================ INQUIRY =================================== */
70 
71 /* //////////////////////////// PROTECTED ///////////////////////////////// */
72 protected:
73 
74 /* //////////////////////////// PRIVATE /////////////////////////////////// */
75 private:
76 
77  OsCallbackFunc mFunc; // routine that will be invoked in the notifier's
78  // context to signal the event
79  intptr_t mUserData; // data specified on behalf of the user and
80  // not otherwise used by this class -- the user
81  // data is specified as an argument to the class
82  // constructor
83 
84  OsCallback(const OsCallback& rOsCallback);
85  //:Copy constructor (not implemented for this class)
86 
87  OsCallback& operator=(const OsCallback& rhs);
88  //:Assignment operator (not implemented for this class)
89 
90 };
91 
92 /* ============================ INLINE METHODS ============================ */
93 
94 #endif // _OsCallback_h_
95 
virtual OsStatus signal(const intptr_t eventData)
Definition: OsCallback.cpp:48
Definition: OsNotification.h:35
OsStatus
Definition: OsStatus.h:27
Definition: OsCallback.h:47
OsCallback(const intptr_t userData, const OsCallbackFunc func)
Definition: OsCallback.cpp:31
virtual ~OsCallback()
Definition: OsCallback.cpp:39
void(* OsCallbackFunc)(const intptr_t userData, const intptr_t eventData)
Definition: OsCallback.h:28
_W64 signed int intptr_t
Definition: stdint.h:118