Coconut Framework  beta
CNFixedArray.h
Go to the documentation of this file.
1 
8 #ifndef CNFIXEDARRAY_H
9 #define CNFIXEDARRAY_H
10 
11 #include "CNForwarders.h"
12 #include "CNType.h"
13 #include <stdint.h>
14 
18 struct CNFixedArray {
20  struct CNResource * resource ;
22  uint64_t maxNum ;
24  void ** arrayBody ;
25 } ;
26 
28 typedef CNBoolean (*CNVisitElementOfFixedArrayFuncRef)(uint64_t index, void * src, void * info) ;
29 
36 void
37 CNInitFixedArray(struct CNFixedArray * dst, uint64_t maxnum, struct CNResource * resource) ;
38 
43 void
44 CNDestroyFixedArray(struct CNFixedArray * dst) ;
45 
51 static inline struct CNResource *
53 {
54  return src->resource ;
55 }
56 
62 static inline uint64_t
63 CNCountOfFixedArray(const struct CNFixedArray * src)
64 {
65  return src->maxNum ;
66 }
67 
75 void *
76 CNSetPointerToFixedArray(struct CNFixedArray * dst, uint64_t index, void * src) ;
77 
85 void *
86 CNPointerInFixedArray(const struct CNFixedArray * src, uint64_t index) ;
87 
94 struct CNList
95 CNElementListOfFixedArray(const struct CNFixedArray * src, struct CNResource * resource) ;
96 
105 CNBoolean
106 CNVisitElementOfFixedArray(const struct CNFixedArray * src, CNVisitElementOfFixedArrayFuncRef visitfunc, void * info) ;
107 
108 #endif /* CNFIXEDARRAY_H */
Array of fixed number of pointers.
Definition: CNFixedArray.h:18
struct CNList CNElementListOfFixedArray(const struct CNFixedArray *src, struct CNResource *resource)
Make element list of array.
List of pointers.
Definition: CNList.h:17
void ** arrayBody
Definition: CNFixedArray.h:24
Forward declaration of data types.
CNBoolean(* CNVisitElementOfFixedArrayFuncRef)(uint64_t index, void *src, void *info)
Definition: CNFixedArray.h:28
struct CNResource * resource
Definition: CNFixedArray.h:20
void * CNSetPointerToFixedArray(struct CNFixedArray *dst, uint64_t index, void *src)
Set pointer to the array at the given index.
uint64_t maxNum
Definition: CNFixedArray.h:22
void CNInitFixedArray(struct CNFixedArray *dst, uint64_t maxnum, struct CNResource *resource)
Initialize pointer array.
void * CNPointerInFixedArray(const struct CNFixedArray *src, uint64_t index)
Get element in the fixed array.
void CNDestroyFixedArray(struct CNFixedArray *dst)
Release all resource the fixed array.
Define primitive data types.
static uint64_t CNCountOfFixedArray(const struct CNFixedArray *src)
Get the count of elements in the fixed array.
Definition: CNFixedArray.h:63
static struct CNResource * CNResourceOfFixedArray(const struct CNFixedArray *src)
Get resource of fixed array.
Definition: CNFixedArray.h:52
unsigned int CNBoolean
Boolean type.
Definition: CNType.h:14
CNBoolean CNVisitElementOfFixedArray(const struct CNFixedArray *src, CNVisitElementOfFixedArrayFuncRef visitfunc, void *info)
Visit all elements in the fixed array.