sipXcallLib home page


TaoListenerEventMessage.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 _TaoListenerEventMessage_h_
13 #define _TaoListenerEventMessage_h_
14 
15 // SYSTEM INCLUDES
16 //#include <...>
17 
18 // APPLICATION INCLUDES
19 #include "os/OsMsg.h"
20 #include "ptapi/PtEvent.h"
21 
22 // DEFINES
23 // MACROS
24 // EXTERNAL FUNCTIONS
25 // EXTERNAL VARIABLES
26 // CONSTANTS
27 // STRUCTS
28 // TYPEDEFS
29 // FORWARD DECLARATIONS
30 
31 //: Message Sent to Tao from the lower layers in notification of events (call backs).
32 // The lower layer subsystems generate TaoListenerEventMessages which
33 // are sent to listeners (i.e. tao) registered on the subsystem.
34 // These messages indicate events which have occurred in the subsystem,
35 // typically a state change on an object(s). The state change (new and
36 // previous), the object(s) involved are contained in the data members
37 // of this message. The actual signature (i.e. usage and meaning of
38 // the data members) for each of these messages differs for each type
39 // of event. It is expected that the TaoServer can generically
40 // serialize these messages and send them through the transport layer.
41 // It is only the TaoEventDispatcher (or its registered listeners) that has
42 // to understand the signature, in order to invoke the method on the
43 // registered listener (call back). This seems to hint at an event factory
44 // which knows how to construct a specific class of Event based upon the
45 // signature of the message.
46 // <BR><BR>
47 //
48 // The TaoListenerEventMessage contains two simple data types
49 // strings and ints. It contains 3 of each type, the application of
50 // which (i.e. signature) is specific to the event. As a general
51 // rule of thumb it is recommended that object handle(s) or reference(s)
52 // are set in the lower numbers and the state change (both new
53 // and previous value) in the lowest available members.
54 // <BR><BR>
55 //
56 // The eventId is the identifier of the signature for the message. This
57 // can be used to identify which event class is to be constructed and
58 // which method on the listener is to be invoked. The eventId's are
59 // defined in the enumeration PtEvent::PtEventId. These event id's
60 // are needed in tao, ptapi and jtapi/jni. It seems desirable to
61 // define these in one place and ptapi seemed the lesser of evils.
62 // <BR><BR>
63 //
64 // Lower level subsystems which support this message for tao should
65 // implement the following methods:
66 // <BR>
67 // addTaoListener(OsServer& rMessageConsumer)
68 // <BR>
69 // removeTaoListener(OsServer& rMessageConsumer)
70 // <BR>
71 // Instances of this message are queued on the listener's queue
72 // as the events occur. It is exdpected that the addTaoListener
73 // method will be extended in the future to pass some sort of
74 // mask that the subsystem will use to filter out messages which
75 // the registering tao listener is not interested in. Most likely
76 // the mask will operate based upon the eventId.
77 
78 class TaoListenerEventMessage : public OsMsg
79 {
80 /* //////////////////////////// PUBLIC //////////////////////////////////// */
81 public:
82 
83 /* ============================ CREATORS ================================== */
84 
86  int intData1 = 0,
87  int intData2 = 0,
88  int intData3 = 0,
89  const char* stringData1 = NULL,
90  const char* stringData2 = NULL,
91  const char* stringData3 = NULL);
92  //:Default constructor
93 
94  TaoListenerEventMessage(const TaoListenerEventMessage& rTaoListenerEventMessage);
95  //:Copy constructor
96 
97  virtual
99  //:Destructor
100 
101 /* ============================ MANIPULATORS ============================== */
102 
104  //:Assignment operator
105 
106  void setStringData1(const char* stringData);
107  void setStringData2(const char* stringData);
108  void setStringData3(const char* stringData);
109 
110  void setEventId(int id) { mEventId = (PtEvent::PtEventId)id; };
111 /* ============================ ACCESSORS ================================= */
112 
113  int getEventId() { return mEventId; };
114 
115  void getStringData1(UtlString& stringData);
116  void getStringData2(UtlString& stringData);
117  void getStringData3(UtlString& stringData);
118 
119  int getIntData1();
120  void setIntData1(int intData);
121  int getIntData2();
122  void setIntData2(int intData);
123  int getIntData3();
124  void setIntData3(int intData);
125 
126 /* ============================ INQUIRY =================================== */
127 
128 /* //////////////////////////// PROTECTED ///////////////////////////////// */
129 protected:
130 
131 /* //////////////////////////// PRIVATE /////////////////////////////////// */
132 private:
134 
135  UtlString mStringData1;
136  UtlString mStringData2;
137  UtlString mStringData3;
138 
142 
143 
144 };
145 
146 /* ============================ INLINE METHODS ============================ */
147 
148 #endif // _TaoListenerEventMessage_h_
TaoListenerEventMessage(PtEvent::PtEventId eventId=PtEvent::EVENT_INVALID, int intData1=0, int intData2=0, int intData3=0, const char *stringData1=NULL, const char *stringData2=NULL, const char *stringData3=NULL)
Definition: TaoListenerEventMessage.cpp:28
PtEventId
Definition: PtEvent.h:83
UtlString mStringData2
Definition: TaoListenerEventMessage.h:136
int getIntData3()
Definition: TaoListenerEventMessage.cpp:163
int mIntData2
Definition: TaoListenerEventMessage.h:140
TaoListenerEventMessage & operator=(const TaoListenerEventMessage &rhs)
Definition: TaoListenerEventMessage.cpp:73
Definition: PtEvent.h:85
void setEventId(int id)
Definition: TaoListenerEventMessage.h:110
void setStringData1(const char *stringData)
Definition: TaoListenerEventMessage.cpp:90
void setStringData2(const char *stringData)
Definition: TaoListenerEventMessage.cpp:96
void setStringData3(const char *stringData)
Definition: TaoListenerEventMessage.cpp:102
int getEventId()
Definition: TaoListenerEventMessage.h:113
void setIntData2(int intData)
Definition: TaoListenerEventMessage.cpp:113
int getIntData2()
Definition: TaoListenerEventMessage.cpp:158
virtual ~TaoListenerEventMessage()
Definition: TaoListenerEventMessage.cpp:62
void getStringData1(UtlString &stringData)
Definition: TaoListenerEventMessage.cpp:125
int mIntData3
Definition: TaoListenerEventMessage.h:141
UtlString mStringData3
Definition: TaoListenerEventMessage.h:137
Definition: TaoListenerEventMessage.h:78
void getStringData3(UtlString &stringData)
Definition: TaoListenerEventMessage.cpp:143
PtEvent::PtEventId mEventId
Definition: TaoListenerEventMessage.h:133
UtlString mStringData1
Definition: TaoListenerEventMessage.h:135
void setIntData1(int intData)
Definition: TaoListenerEventMessage.cpp:108
int getIntData1()
Definition: TaoListenerEventMessage.cpp:153
void getStringData2(UtlString &stringData)
Definition: TaoListenerEventMessage.cpp:134
int mIntData1
Definition: TaoListenerEventMessage.h:139
void setIntData3(int intData)
Definition: TaoListenerEventMessage.cpp:118