| 1 | /* |
| 2 | * Copyright (C) 2004 Dizzy |
| 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__cxx . . $ `src/common/rcm.h:26:9`! |
| 26 | #define __RCM_H_TYPES__cxx . . $ `src/common/rcm.h:26:9`! |
| 27 | |
| 28 | #include "common/elist.h"cxx . . $ `<file>/src/common/elist.h`/ |
| 29 | |
| 30 | namespace pvpgncxx . . $ pvpgn/ |
| 31 | { |
| 32 | |
| 33 | /* reference change mechanism main object |
| 34 | * an object which wishes to be referenced using RCM has to include this */ |
| 35 | typedef structcxx . . $ pvpgn/$anonymous_type_f1a35baf0b4bd22c_0# { |
| 36 | unsigned countcxx . . $ pvpgn/$anonymous_type_f1a35baf0b4bd22c_0#count.; |
| 37 | t_elistcxx . . $ pvpgn/t_elist# refscxx . . $ pvpgn/$anonymous_type_f1a35baf0b4bd22c_0#refs.; /* list of registered references */ |
| 38 | } t_rcmcxx . . $ pvpgn/t_rcm#; |
| 39 | |
| 40 | /* callback called when the object referenced is moved/deleted */ |
| 41 | typedef int(*t_chref_cbcxx . . $ pvpgn/t_chref_cb#)(void *data, void *newref); |
| 42 | |
| 43 | /* registered reference object |
| 44 | * an object which wants to register it's references to an rcm enabled object |
| 45 | * will have to include one of this for every rcm enabled referenced object |
| 46 | */ |
| 47 | typedef structcxx . . $ pvpgn/$anonymous_type_f1a35baf0b4bd22c_1# { |
| 48 | t_chref_cbcxx . . $ pvpgn/t_chref_cb# chrefcxx . . $ pvpgn/$anonymous_type_f1a35baf0b4bd22c_1#chref.; |
| 49 | void *datacxx . . $ pvpgn/$anonymous_type_f1a35baf0b4bd22c_1#data.; |
| 50 | t_elistcxx . . $ pvpgn/t_elist# refs_linkcxx . . $ pvpgn/$anonymous_type_f1a35baf0b4bd22c_1#refs_link.; |
| 51 | } t_rcm_regrefcxx . . $ pvpgn/t_rcm_regref#; |
| 52 | |
| 53 | } |
| 54 | |
| 55 | #endif /* __RCM_H_TYPES__ */ |
| 56 | |
| 57 | #ifndef __RCM_H_PROTOS__cxx . . $ `src/common/rcm.h:58:9`! |
| 58 | #define __RCM_H_PROTOS__cxx . . $ `src/common/rcm.h:58:9`! |
| 59 | |
| 60 | namespace pvpgncxx . . $ pvpgn/ |
| 61 | { |
| 62 | |
| 63 | extern void rcm_initcxx . . $ pvpgn/rcm_init(4e7ec8a10da33803).(t_rcmcxx . . $ pvpgn/t_rcm# *rcm); |
| 64 | extern void rcm_regref_initcxx . . $ pvpgn/rcm_regref_init(93d760c169d7201f).(t_rcm_regrefcxx . . $ pvpgn/t_rcm_regref# *regref, t_chref_cbcxx . . $ pvpgn/t_chref_cb# cb, void *data); |
| 65 | extern void rcm_getcxx . . $ pvpgn/rcm_get(549b400a20fa1303).(t_rcmcxx . . $ pvpgn/t_rcm# *rcm, t_rcm_regrefcxx . . $ pvpgn/t_rcm_regref# *regref); |
| 66 | extern void rcm_putcxx . . $ pvpgn/rcm_put(549b400a20fa1303).(t_rcmcxx . . $ pvpgn/t_rcm# *rcm, t_rcm_regrefcxx . . $ pvpgn/t_rcm_regref# *regref); |
| 67 | /* the main function, cycles through the registered references and calls the |
| 68 | * registered callback with the new reference */ |
| 69 | extern void rcm_chrefcxx . . $ pvpgn/rcm_chref(2947fde9a44a0de7).(t_rcmcxx . . $ pvpgn/t_rcm# *rcm, void *newref); |
| 70 | |
| 71 | } |
| 72 | |
| 73 | #endif /* __RCM_H_PROTOS__ */ |