1 | // This file is a part of Framsticks GDK library. |
---|
2 | // Copyright (C) 2002-2006 Szymon Ulatowski. See LICENSE.txt for details. |
---|
3 | // Refer to http://www.frams.alife.pl/ for further information. |
---|
4 | |
---|
5 | #ifndef _PARAMOBJ_H_ |
---|
6 | #define _PARAMOBJ_H_ |
---|
7 | |
---|
8 | #include "param.h" |
---|
9 | |
---|
10 | class ParamObject |
---|
11 | { |
---|
12 | public: |
---|
13 | /** make a ParamEntry* array for use with Param object. |
---|
14 | offsets in the array are calculated for the ExtObject array as the target. |
---|
15 | valid array can be created with makeObject(). |
---|
16 | sample code: |
---|
17 | @code |
---|
18 | ParamInterface *pi=...; // any param interface |
---|
19 | ParamEntry *tab=ParamObject::makeParamTab(pi); |
---|
20 | void* obj=ParamObject::makeObject(tab); |
---|
21 | void* obj2=ParamObject::makeObject(tab); |
---|
22 | Param par(tab,obj); |
---|
23 | par.set(...), par.get(...), par.load(...), par.save(...); |
---|
24 | par.select(obj); |
---|
25 | par.select(obj2); |
---|
26 | ParamObject::freeObject(obj); |
---|
27 | ParamObject::freeObject(obj2); |
---|
28 | */ |
---|
29 | static ParamEntry* makeParamTab(ParamInterface *pi,bool stripgroups=0,bool stripproc=0,int firstprop=0,int maxprops=9999,bool dupentries=false, int flagsexclude=0); |
---|
30 | |
---|
31 | /** deallocate paramtab obtained from makeParamTab() */ |
---|
32 | static void freeParamTab(ParamEntry *pe); |
---|
33 | |
---|
34 | /** @return the object, suitable for Param.select(...). |
---|
35 | @return NULL if 'pi' has no usable properties */ |
---|
36 | static void* makeObject(ParamEntry *tab); |
---|
37 | |
---|
38 | /** copy data from src to dst */ |
---|
39 | static void copyObject(void* dst,void* src); |
---|
40 | |
---|
41 | /** duplicate object */ |
---|
42 | static void* dupObject(void* obj); |
---|
43 | |
---|
44 | /** delete all data in the array and deallocate it */ |
---|
45 | static void freeObject(void* obj); |
---|
46 | }; |
---|
47 | |
---|
48 | #endif |
---|