1 //============================================================================= 2 // 3 // Adventure Game Studio (AGS) 4 // 5 // Copyright (C) 1999-2011 Chris Jones and 2011-20xx others 6 // The full list of copyright holders can be found in the Copyright.txt 7 // file, which is part of this source code distribution. 8 // 9 // The AGS source code is provided under the Artistic License 2.0. 10 // A copy of this license can be found in the file License.txt and at 11 // http://www.opensource.org/licenses/artistic-license-2.0.php 12 // 13 //============================================================================= 14 15 #ifndef __CC_DYNAMICARRAY_H 16 #define __CC_DYNAMICARRAY_H 17 18 #include "ac/dynobj/cc_dynamicobject.h" // ICCDynamicObject 19 20 #define CC_DYNAMIC_ARRAY_TYPE_NAME "CCDynamicArray" 21 #define ARRAY_MANAGED_TYPE_FLAG 0x80000000 22 23 struct CCDynamicArray : ICCDynamicObject 24 { 25 // return the type name of the object 26 virtual const char *GetType(); 27 virtual int Dispose(const char *address, bool force); 28 // serialize the object into BUFFER (which is BUFSIZE bytes) 29 // return number of bytes used 30 virtual int Serialize(const char *address, char *buffer, int bufsize); 31 virtual void Unserialize(int index, const char *serializedData, int dataSize); 32 int32_t Create(int numElements, int elementSize, bool isManagedType); 33 34 // Legacy support for reading and writing object values by their relative offset 35 virtual const char* GetFieldPtr(const char *address, intptr_t offset); 36 virtual void Read(const char *address, intptr_t offset, void *dest, int size); 37 virtual uint8_t ReadInt8(const char *address, intptr_t offset); 38 virtual int16_t ReadInt16(const char *address, intptr_t offset); 39 virtual int32_t ReadInt32(const char *address, intptr_t offset); 40 virtual float ReadFloat(const char *address, intptr_t offset); 41 virtual void Write(const char *address, intptr_t offset, void *src, int size); 42 virtual void WriteInt8(const char *address, intptr_t offset, uint8_t val); 43 virtual void WriteInt16(const char *address, intptr_t offset, int16_t val); 44 virtual void WriteInt32(const char *address, intptr_t offset, int32_t val); 45 virtual void WriteFloat(const char *address, intptr_t offset, float val); 46 }; 47 48 extern CCDynamicArray globalDynamicArray; 49 50 #endif