libtrbase  1.0.2
Web server and task management solution.
i_subject.c File Reference
#include "tr/class.h"
#include "tr/interface/subject.h"
+ Include dependency graph for i_subject.c:

Go to the source code of this file.

Functions

 TR_CREATE_INTERFACE (TR_Subject, 3)
 
void TR_subjectAttach (void *, void *)
 
void TR_subjectDetach (void *, void *)
 
void TR_subjectNotify (void *)
 

Detailed Description

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 i_subject.c.

Function Documentation

TR_CREATE_INTERFACE ( TR_Subject  ,
 
)

Create the TR_Subject interface

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