libtrbase  1.0.2
Web server and task management solution.
subject.h File Reference
#include "tr/interface.h"
+ Include dependency graph for subject.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef void(* fptr_subjectAttach) (void *, void *)
 
typedef void(* fptr_subjectDetach) (void *, void *)
 
typedef void(* fptr_subjectNotify) (void *)
 

Functions

 TR_INTERFACE (TR_Subject)
 
void TR_subjectAttach (void *subject, void *observer)
 
void TR_subjectDetach (void *subject, void *observer)
 
void TR_subjectNotify (void *subject)
 

Detailed Description

Definition of the subject pattern implementation.

Author
Georg Hopp

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file subject.h.

Typedef Documentation

typedef void(* fptr_subjectAttach) (void *, void *)

Definition at line 29 of file subject.h.

typedef void(* fptr_subjectDetach) (void *, void *)

Definition at line 30 of file subject.h.

typedef void(* fptr_subjectNotify) (void *)

Definition at line 31 of file subject.h.

Function Documentation

TR_INTERFACE ( TR_Subject  )

Definition at line 33 of file subject.h.

References TR_IFID.

33  {
34  TR_IFID;
35  fptr_subjectAttach attach;
36  fptr_subjectDetach detach;
37  fptr_subjectNotify notify;
38 };
#define TR_IFID
Definition: interface.h:61
void(* fptr_subjectAttach)(void *, void *)
Definition: subject.h:29
void(* fptr_subjectDetach)(void *, void *)
Definition: subject.h:30
void(* fptr_subjectNotify)(void *)
Definition: subject.h:31
void TR_subjectAttach ( void *  subject,
void *  observer 
)
inline

Attach an observer to a subject. After a successfull call to this the subject will inform the observer about events.

Definition at line 46 of file subject.h.

References TR_CALL.

47 {
48  TR_CALL(subject, TR_Subject, attach, observer);
49 }
#define TR_CALL(object, _iface, method,...)
Definition: class.h:256
void TR_subjectDetach ( void *  subject,
void *  observer 
)
inline

Detach an Observer from a Subject. After this no events will be propagated from the subject to the observer anymore.

Definition at line 57 of file subject.h.

References TR_CALL.

58 {
59  TR_CALL(subject, TR_Subject, detach, observer);
60 }
#define TR_CALL(object, _iface, method,...)
Definition: class.h:256
void TR_subjectNotify ( void *  subject)
inline

Trigger the a notification of all attached observers.

Definition at line 67 of file subject.h.

References TR_CALL.

68 {
69  TR_CALL(subject, TR_Subject, notify);
70 }
#define TR_CALL(object, _iface, method,...)
Definition: class.h:256