ALBA
albaObserverCallback.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaObserverCallback
5 Authors: Marco Petrone
6
7 Copyright (c) BIC
8 All rights reserved. See Copyright.txt or
9
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16#ifndef __albaObserverCallback_h
17#define __albaObserverCallback_h
18//----------------------------------------------------------------------------
19// includes :
20//----------------------------------------------------------------------------
21#include "albaObject.h"
22#include "albaObserver.h"
23
24//------------------------------------------------------------------------------
25// albaObserverCallback
26//------------------------------------------------------------------------------
37class ALBA_EXPORT albaObserverCallback:public albaObject, public albaObserver
38{
39public:
42
44
46 void SetCallback(void (*f)(void *sender, albaID eid, void *clientdata));
47
49 void SetClientData(void *cd);
50
53
55 virtual void OnEvent(albaEventBase *e);
56
57protected:
58 void (*m_Callback)(void *, albaID, void *);
60};
61
62#endif /* __albaObserverCallback_h */
long albaID
type for IDs inside ALBA
Definition: albaDefines.h:58
Implementation of the message object for the Subject/Observer design pattern.
Definition: albaEventBase.h:49
Abstract superclass for all ALBA classes implementing RTTI APIs.
Definition: albaObject.h:38
Concrete implementation of Observer calling a callback function.
virtual ~albaObserverCallback()
virtual void OnEvent(albaEventBase *e)
process the events sent by subjects
albaTypeMacro(albaObserverCallback, albaObject)
void SetClientData(void *cd)
set client data to be passed to callback function
void SetCallback(void(*f)(void *sender, albaID eid, void *clientdata))
Set function callback to be called by this observer.
void * GetClientData()
return client data passed to callback function
Interface implementing the Observer of the Subject/Observer design pattern.
Definition: albaObserver.h:36