Me@3: /* Me@3: * File: Vector.h Me@3: * Author: Me Me@3: * Me@3: * Created on May 14, 2010, 3:08 PM Me@3: */ Me@3: Me@4: #ifndef _DYNARRAY_H Me@4: #define _DYNARRAY_H Me@3: hausers@12: #include "../../VMS_Implementations/VMS_impl/VMS_primitive_data_types.h" Me@4: Me@4: Me@4: //A dynamic array is same as any other array, but add a DynArrayInfo next Me@4: // to it. Accesses and updates of array indexes are done normally, it's Me@4: // only when add a new element into array that use the extra info. Me@4: // An add can cause the pointer to the normal array to change.. so must Me@4: // be protected to single VP at a time. Me@3: typedef struct Me@3: { Me@4: void ***addrOfPtrToArray; //addr of array of ptrs == triple * Me@4: int32 numInArray; Me@4: int32 sizeOfArray; Me@3: } Me@4: DynArrayInfo; Me@3: Me@4: DynArrayInfo * Me@4: makeDynArrayInfoFrom( void ***addrOfPtrToArray, int32 sizeOfArray ); Me@3: Me@4: DynArrayInfo * Me@4: makeDynArrayOfSize( void ***addrOfPtrToArray, int32 sizeOfArray ); Me@3: Me@4: int32 Me@4: addToDynArray( void *value, DynArrayInfo *info ); Me@3: Me@4: void Me@4: makeHighestDynArrayIndexBe( DynArrayInfo *info, int32 highestIndex ); Me@4: Me@4: void Me@4: increaseSizeOfDynArrayTo( DynArrayInfo *info, int32 newSize ); Me@4: Me@4: typedef void (*FreeFnPtr) ( void * ); //fn has to cast void * to whatever Me@4: Me@4: void Me@4: freeDynArrayDeep( DynArrayInfo *info, FreeFnPtr freeFnPtr ); Me@4: Me@4: void Me@4: freeDynArrayFlat( DynArrayInfo *info ); Me@4: Me@4: Me@4: typedef void (*DynArrayFnPtr) ( void * ); //fn has to cast void * Me@4: Me@4: void Me@4: forAllInDynArrayDo( DynArrayInfo *info, DynArrayFnPtr fnPtr ); Me@4: Me@4: #endif /* _DYNARRAY_H */ Me@4: