Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

RmVector.h

00001 //=================================================================================================//
00002 // filename: RmVector.h                                                                            //
00003 //                                                                                                 //
00004 //           ATI Research, Inc.                                                                    //
00005 //           3D Application Research Group                                                         //
00006 //                                                                                                 //
00007 // Description:                                                                                    //
00008 //                                                                                                 //
00009 //=================================================================================================//
00010 //   (C) 2004 ATI Research, Inc.  All rights reserved.                                             //
00011 //=================================================================================================//
00012 
00013 #ifndef _RM_CORE_VECTOR_H_
00014 #define _RM_CORE_VECTOR_H_
00015 
00016 #include <Core/RmTypes.h>
00017 
00018 //=============//
00019 // vector code //
00020 //=============//
00021 
00022 //==============//
00023 // return codes //
00024 //==============//
00025 #define RM_VECTOR_OK                0
00026 #define RM_VECTOR_REALLOCATE        -1
00027 #define RM_VECTOR_MEMORY_ERROR      -2
00028 #define RM_VECTOR_OUT_OF_RANGE      -3
00029 #define RM_VECTOR_NOT_FOUND         -4
00030 #define RM_VECTOR_INVALID_PARAM     -5
00031 
00032 //==========//
00033 // typedefs //
00034 //==========//
00035 typedef int (*SortFunc)(const void*, const void*);
00036 
00037 #define RM_VECTOR_STRUCT                              \
00038    int         count;                                 \
00039    int         initAlloc;                             \
00040    int         allocCount;                            \
00041    int         elementSize;                           \
00042    int         (*compare)(const void*, const void*);  \
00043    void        *data;                                 
00044 
00045 #define RM_VECTOR_TYPED_DATA(type)                    \
00046    int         count;                                 \
00047    int         initAlloc;                             \
00048    int         allocCount;                            \
00049    int         elementSize;                           \
00050    int         (*compare)(const type*, const type*);  \
00051    type        *data;                                 
00052 
00053 #define RM_VECTOR_NAMED_DATA(name)                          \
00054    int         name##Count;                                 \
00055    int         name##InitAlloc;                             \
00056    int         name##AllocCount;                            \
00057    int         name##ElementSize;                           \
00058    int         (*name##Compare)(const void*, const void*);  \
00059    void        *name##Data;                                 
00060 
00061 #define RM_VECTOR_TYPED_NAMED_DATA(type, name)              \
00062    int         name##Count;                                 \
00063    int         name##InitAlloc;                             \
00064    int         name##AllocCount;                            \
00065    int         name##ElementSize;                           \
00066    int         (*name##Compare)(const type*, const type*);  \
00067    type        *name;                                 
00068 
00069 //====================//
00070 // RmVector structure //
00071 //====================//
00072 typedef struct
00073 {
00074    int         count;
00075    int         initAlloc;
00076    int         allocCount;
00077    int         elementSize;
00078    int         (*compare)(const void*, const void*);
00079    void        *data;
00080 } RmVector;
00081 
00082 //====================//
00083 // RmVector functions //
00084 //====================//
00085 RM_API int   RmVectorAddElement(RmVector* v, void* element, int nIndex, char append);
00086 RM_API int   RmVectorAppend(RmVector* v, void* element, int nIndex);
00087 RM_API int   RmVectorAppendBack(RmVector* v, void* element);
00088 RM_API int   RmVectorCheckAlloc(RmVector* v);
00089 RM_API int   RmVectorFind(RmVector* v, void* element, int* result);
00090 RM_API int   RmVectorFree(RmVector* v);
00091 RM_API int   RmVectorInsert(RmVector* v, void* element, int nIndex);
00092 RM_API int   RmVectorRemoveIndex(RmVector* v, int nIndex);
00093 RM_API int   RmVectorRemoveSortedElement(RmVector* v, void* element);
00094 RM_API int   RmVectorSort(RmVector* v);
00095 RM_API int   RmVectorSortedInsert(RmVector* v, void* element);
00096 RM_API int   RmVectorSortedInsertAllowDuplicates(RmVector* v, void* element);
00097 
00098 #endif

Generated on Fri Feb 25 16:08:43 2005 for RenderMonkey SDK by doxygen 1.3.6