/[LeafOK_CVS]/pvpgn-1.7.4/src/common/rcm.h
ViewVC logotype

Annotation of /pvpgn-1.7.4/src/common/rcm.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (vendor branch)
Tue Jun 6 03:41:38 2006 UTC (19 years, 9 months ago) by sysadm
Branch: GNU, MAIN
CVS Tags: arelease, HEAD
Changes since 1.1: +0 -0 lines
Content type: text/x-chdr
no message

1 sysadm 1.1 /*
2     * Copyright (C) 2004 Dizzy (dizzy@roedu.net)
3     *
4     * This program is free software; you can redistribute it and/or
5     * modify it under the terms of the GNU General Public License
6     * as published by the Free Software Foundation; either version 2
7     * of the License, or (at your option) any later version.
8     *
9     * This program is distributed in the hope that it will be useful,
10     * but WITHOUT ANY WARRANTY; without even the implied warranty of
11     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12     * GNU General Public License for more details.
13     *
14     * You should have received a copy of the GNU General Public License
15     * along with this program; if not, write to the Free Software
16     * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17     */
18    
19     /*
20     * Reference Change Mechanism
21     * an abstract interface to implement safe management of references of objects
22     * which do not share any specific dependencies
23     */
24    
25     #ifndef __RCM_H_TYPES__
26     #define __RCM_H_TYPES__
27    
28     #include "common/elist.h"
29    
30     /* reference change mechanism main object
31     * an object which wishes to be referenced using RCM has to include this */
32     typedef struct {
33     unsigned count;
34     t_elist refs; /* list of registered references */
35     } t_rcm;
36    
37     /* callback called when the object referenced is moved/deleted */
38     typedef int (*t_chref_cb)(void *data, void *newref);
39    
40     /* registered reference object
41     * an object which wants to register it's references to an rcm enabled object
42     * will have to include one of this for every rcm enabled referenced object
43     */
44     typedef struct {
45     t_chref_cb chref;
46     void *data;
47     t_elist refs_link;
48     } t_rcm_regref;
49    
50     #endif /* __RCM_H_TYPES__ */
51    
52     #ifndef __RCM_H_PROTOS__
53     #define __RCM_H_PROTOS__
54    
55     extern void rcm_init(t_rcm *rcm);
56     extern void rcm_regref_init(t_rcm_regref *regref, t_chref_cb cb, void *data);
57     extern void rcm_get(t_rcm *rcm, t_rcm_regref *regref);
58     extern void rcm_put(t_rcm *rcm, t_rcm_regref *regref);
59     /* the main function, cycles through the registered references and calls the
60     * registered callback with the new reference */
61     extern void rcm_chref(t_rcm *rcm, void *newref);
62    
63     #endif /* __RCM_H_PROTOS__ */

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1