sipxportlib  Version 3.3
OsProtectEvent.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 _OsProtectedEvent_h_
13 #define _OsProtectedEvent_h_
14 
15 #include "os/OsEvent.h"
16 #include "os/OsBSem.h"
17 #include "os/OsTime.h"
18 #include "utl/UtlString.h"
19 
20 //#define TAO_DEBUG
21 
22 class OsProtectedEvent : public OsEvent
23 {
24 /* //////////////////////////// PUBLIC //////////////////////////////////// */
25 public:
26 
27 /* ============================ CREATORS ================================== */
28 
29  OsProtectedEvent(const intptr_t userData=0);
30 
31  virtual ~OsProtectedEvent();
32 
33 /* ============================ MANIPULATORS ============================== */
34 
35 
36  virtual OsStatus signal(const intptr_t eventData);
37  //:Set the event data and signal the occurrence of the event
38  // Return OS_ALREADY_SIGNALED if the event has already been signaled
39  // (and has not yet been cleared), otherwise return OS_SUCCESS.
40 
41  virtual OsStatus reset(void);
42  //:Reset the event so that it may be signaled again
43  // Return OS_NOT_SIGNALED if the event has not been signaled (or has
44  // already been cleared), otherwise return OS_SUCCESS.
45 
46  virtual OsStatus wait(int msgId, const OsTime& rTimeout=OsTime::OS_INFINITY);
47  //:Wait for the event to be signaled
48  // Return OS_BUSY if the timeout expired, otherwise return OS_SUCCESS.
49 
50  void setStringData(UtlString& rStringData);
51 
52  void setIntData(intptr_t rIntData);
53 
54  void setIntData2(intptr_t rIntData);
55 
56  void setInUse(UtlBoolean inUse);
57 
58 /* ============================ ACCESSORS ================================= */
59 
61  //:Return the user data specified when this object was constructed.
62  // Always returns OS_SUCCESS.
63 
65 
67  //:Return the user data specified when this object was constructed.
68  // Always returns OS_SUCCESS.
69 
70 /* ============================ INQUIRY =================================== */
71 
72  virtual UtlBoolean isInUse();
73  //:Return TRUE if the event has been signaled, otherwise FALSE
74 
75 /* //////////////////////////// PRIVATE /////////////////////////////////// */
76 private:
77 
78  OsBSem mRefSem;
79  UtlString mStringData;
80  intptr_t mIntData;
81  intptr_t mIntData2;
82  int mRef;
83 
84 
85 };
86 
87 #endif // _OsProtectedEvent_h_
void setStringData(UtlString &rStringData)
Definition: OsProtectEvent.cpp:74
virtual OsStatus wait(int msgId, const OsTime &rTimeout=OsTime::OS_INFINITY)
Definition: OsProtectEvent.cpp:64
OsStatus getStringData(UtlString &data)
Definition: OsProtectEvent.cpp:104
OsStatus getIntData2(intptr_t &data)
Definition: OsProtectEvent.cpp:121
void setInUse(UtlBoolean inUse)
Definition: OsProtectEvent.cpp:93
OsProtectedEvent(const intptr_t userData=0)
Definition: OsProtectEvent.cpp:26
void setIntData(intptr_t rIntData)
Definition: OsProtectEvent.cpp:83
OsStatus
Definition: OsStatus.h:27
virtual OsStatus reset(void)
Reset the event so that it may be signaled again.
Definition: OsProtectEvent.cpp:52
virtual OsStatus signal(const intptr_t eventData)
Set the event data and signal the occurrence of the event.
Definition: OsProtectEvent.cpp:43
Definition: UtlString.h:48
Definition: OsTime.h:45
Events are used to synchronize a task with an ISR or between two tasks.
Definition: OsEvent.h:70
Definition: OsTime.h:37
void setIntData2(intptr_t rIntData)
Definition: OsProtectEvent.cpp:88
int UtlBoolean
Definition: UtlDefs.h:41
OsStatus getIntData(intptr_t &data)
Definition: OsProtectEvent.cpp:115
virtual UtlBoolean isInUse()
Definition: OsProtectEvent.cpp:129
Definition: OsProtectEvent.h:22
_W64 signed int intptr_t
Definition: stdint.h:118
virtual ~OsProtectedEvent()
Definition: OsProtectEvent.cpp:35