sipXcallLib home page


PtEventListener.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 _PtEventListener_h_
13 #define _PtEventListener_h_
14 
15 // SYSTEM INCLUDES
16 // APPLICATION INCLUDES
17 #include "ptapi/PtEvent.h"
18 
19 // DEFINES
20 // MACROS
21 // EXTERNAL FUNCTIONS
22 // EXTERNAL VARIABLES
23 // CONSTANTS
24 // STRUCTS
25 // TYPEDEFS
26 // FORWARD DECLARATIONS
27 class PtEventMask;
28 
29 //:Base class for listener objects.
30 // The listener class is used to register interest and obtain notification
31 // of events of interest on Pingtel objects. The PtEventListener is
32 // specialized, in the provided derived classes, with methods for each event
33 // type that a Pingtel object may generate. An application that is
34 // interested in being notified of specific events must implement
35 // the derived class for the listener capable of receiving those events
36 // (the default implementation provides only empty stubs). The application
37 // then registers the listener (via an appropriate add<type>Listener method)
38 // on the object signaling the events of interest. As events occur, they are
39 // reported to all listeners that have registered interest in events of that
40 // type. Events are reported by invoking a method on the listener that
41 // corresponds to the event type and passing it the event object as an
42 // argument.
43 // <p>
44 //
45 // To provide finer granularity on the control of events that get passed to
46 // the listener, the PtEventMask may be used to define the specific events
47 // that are to be passed. The PtEventMask may be used only to reduce the
48 // event types that a listener will receive. The full set of events
49 // a listener may receive is defined by the derived listener class. Reducing
50 // the events that a listener is interested in is a useful means of optimizing
51 // the performance of the Pingtel system. Due to the distributed nature
52 // of the Pingtel system, reducing the number of unnecessary events that
53 // get sent results in less network latency and traffic.
54 
56 {
57 /* //////////////////////////// PUBLIC //////////////////////////////////// */
58 public:
59 
61 
62 /* ============================ CREATORS ================================== */
63 
64  PtEventListener(PtEventMask* pMask = NULL);
65  //:Default constructor
67 
68  virtual
70  //:Destructor
71 
72 /* ============================ MANIPULATORS ============================== */
73 
74 
75 /* ============================ ACCESSORS ================================= */
76 
77  PtStatus getEventMask(const PtEventMask*& rpMask) const;
78  //:Returns the PtEventMask that defines the events of interest
79  // The event mask is read only. Unpredictable results will occur if
80  // the event mask is modified after a listener is constructed.
81  // The mask may be NULL where it is assumed that all events applicable
82  // to the derived listener are of interest.
86 
87  static const char* className();
88  //:Returns the name of this class
89  // Returns the string representation of the name of this class.
90 
91 /* ============================ INQUIRY =================================== */
92 
93  virtual PtBoolean isClass(const char* pClassName);
94  //:Determines if this object if of the specified type.
98 
99  virtual PtBoolean isInstanceOf(const char* pClassName);
100  //:Determines if this object is either an instance of or is derived from
101  //:the specified type.
105 
107  //:Determines if the given event type is of interest to this listener.
111 
112 /* //////////////////////////// PROTECTED ///////////////////////////////// */
113 protected:
115 
116 /* //////////////////////////// PRIVATE /////////////////////////////////// */
117 private:
118 
119  PtEventListener(const PtEventListener& rPtEventListener);
120  //:Copy constructor
121 
122  PtEventListener& operator=(const PtEventListener& rhs);
123  //:Assignment operator
124 };
125 
126 /* ============================ INLINE METHODS ============================ */
127 
128 #endif // _PtEventListener_h_
PtStatus
Definition: PtDefs.h:49
PtEventId
Definition: PtEvent.h:83
int PtBoolean
Definition: PtDefs.h:71
PT_CLASS_INFO_MEMBERS PtEventListener(PtEventMask *pMask=NULL)
Definition: PtEventListener.cpp:29
#define PT_CLASS_INFO_MEMBERS
Definition: PtDefs.h:73
PtStatus getEventMask(const PtEventMask *&rpMask) const
PtEventListener & operator=(const PtEventListener &rhs)
Definition: PtEventListener.cpp:49
Definition: PtEventListener.h:55
virtual PtBoolean isInstanceOf(const char *pClassName)
param: (in) pClassName - The string to compare with the name of this class. retcode: TRUE - If the gi...
PtBoolean isEventEnabled(PtEvent::PtEventId &eventId)
param: (in) pClassName - The string to compare with the name of this class retcode: TRUE - If this ob...
PtEventMask * mpMask
param: (in) eventId - The event id corresponding to the event type retcode: TRUE - If the given event...
Definition: PtEventListener.h:114
static const char * className()
param: (out) rpMask - Reference to a pointer to the PtEventMask. retcode: PT_SUCCESS - Success retcod...
virtual PtBoolean isClass(const char *pClassName)
Definition: PtEventMask.h:39
virtual ~PtEventListener()
param: (in) pMask - Event mask defining events the listener is interested in. This must be a subset o...
Definition: PtEventListener.cpp:41