Customer classes must derive from this interface and implement the notify member in order to receive events from the space.
Sample usage:
Here is an example of using DataEventSession for registring a listener over matching entries:
// The Listener class for a Person entry
class PersonNotifyListener : public IRemoteEventListener
{
public:
// Constructor
PersonNotifyListener() : m_counter(0) {};
// Interface
int getCounter()
{
ACE_Guard<ACE_Mutex> guard(m_mtx);
return m_counter;
};
// Implement IRemoteEventListener method
virtual bool notify( const RemoteEvent& remoteEvent )
{
IEntryPtr temp(remoteEvent.getIEntry());
// Make the code thread-safe because the underlying infrastructure is implemented
// using multi-threading so this code is most likely to be accessed by multiple threads.
ACE_Guard<ACE_Mutex> guard(m_mtx);
m_counter++;
return true;
}
// Data
private:
int m_counter;
ACE_Mutex m_mtx;
};
Public Member Functions | |
virtual bool | notify (const RemoteEvent &remoteEvent)=0 |