ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
dynobj_manager.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 //=============================================================================
23 //
24 // Dynamic object management utilities.
25 // TODO: frankly, many of these functions could be factored out by a direct
26 // use of ManagedPool class.
27 //
28 //=============================================================================
29 
30 #ifndef AGS_ENGINE_AC_DYNOBJ_MANAGER_H
31 #define AGS_ENGINE_AC_DYNOBJ_MANAGER_H
32 
33 #include "ags/shared/core/types.h"
34 #include "ags/engine/script/runtime_script_value.h"
35 #include "ags/engine/ac/dynobj/cc_script_object.h"
36 
37 namespace AGS3 {
38 
39 // Forward declaration
40 namespace AGS {
41 namespace Shared {
42 class Stream;
43 } // namespace Shared
44 } // namespace AGS
45 
46 using namespace AGS; // FIXME later
47 
48 // register a memory handle for the object and allow script
49 // pointers to point to it
50 extern int32_t ccRegisterManagedObject(void *object, IScriptObject *, ScriptValueType obj_type = kScValScriptObject);
51 // register a de-serialized object
52 extern int32_t ccRegisterUnserializedObject(int index, void *object, IScriptObject *, ScriptValueType obj_type = kScValScriptObject);
53 // unregister a particular object
54 extern int ccUnRegisterManagedObject(void *object);
55 // remove all registered objects
56 extern void ccUnregisterAllObjects();
57 // serialize all objects to disk
58 extern void ccSerializeAllObjects(Shared::Stream *out);
59 // un-serialise all objects (will remove all currently registered ones)
60 extern int ccUnserializeAllObjects(Shared::Stream *in, ICCObjectCollectionReader *callback);
61 // dispose the object if RefCount==0
62 extern void ccAttemptDisposeObject(int32_t handle);
63 // translate between object handles and memory addresses
64 extern int32_t ccGetObjectHandleFromAddress(void *address);
65 extern void *ccGetObjectAddressFromHandle(int32_t handle);
66 extern ScriptValueType ccGetObjectAddressAndManagerFromHandle(int32_t handle, void *&object, IScriptObject *&manager);
67 
68 extern int ccAddObjectReference(int32_t handle);
69 extern int ccReleaseObjectReference(int32_t handle);
70 
71 } // namespace AGS3
72 
73 #endif
Definition: achievements_tables.h:27
Definition: ags.h:40