Coconut Framework  beta
CNFixedObjectArray.h
Go to the documentation of this file.
1 
8 #ifndef CNFIXEDOBJECTARRAY_H
9 #define CNFIXEDOBJECTARRAY_H
10 
11 #include "CNFixedArray.h"
12 #include "CNObject.h"
13 
18 {
21 } ;
22 
29 static inline void
30 CNInitFixedObjectArray(struct CNFixedObjectArray * dst, uint64_t maxnum, struct CNResource * resource)
31 {
32  CNInitFixedArray(&(dst->coreArray), maxnum, resource) ;
33 }
34 
39 void
41 
47 static inline uint64_t
49 {
50  return CNCountOfFixedArray(&(src->coreArray)) ;
51 }
52 
61 static inline void
62 CNSetObjectToFixedObjectArray(struct CNFixedObjectArray * dst, unsigned int index, struct CNObject * src)
63 {
64  CNRetainObject(src) ;
65  struct CNObject * orgobj = CNSetPointerToFixedArray(&(dst->coreArray), index, src) ;
66  if(orgobj != NULL){
67  CNReleaseObject(src) ;
68  }
69 }
70 
78 static inline struct CNObject *
79 CNObjectInFixedObjectArray(const struct CNFixedObjectArray * src, unsigned int index)
80 {
81  return (struct CNObject *) CNPointerInFixedArray(&(src->coreArray), index) ;
82 }
83 
90 struct CNObjectList
91 CNElementListOfFixedObjectArray(const struct CNFixedObjectArray * src, struct CNResource * resource) ;
92 
101 static inline CNBoolean
103 {
104  return CNVisitElementOfFixedArray(&(src->coreArray), visitfunc, info) ;
105 }
106 
107 #endif /* CNFIXEDOBJECTARRAY_H */
108 
109 
Array of fixed number of pointers.
Definition: CNFixedArray.h:18
struct CNFixedArray coreArray
Definition: CNFixedObjectArray.h:20
static CNBoolean CNVisitElementOfFixedObjectArray(const struct CNFixedObjectArray *src, CNVisitElementOfFixedArrayFuncRef visitfunc, void *info)
Visit all elements in the array.
Definition: CNFixedObjectArray.h:102
static uint64_t CNCountOfFixedObjectArray(const struct CNFixedObjectArray *src)
Get the count of elements in the array.
Definition: CNFixedObjectArray.h:48
CNBoolean(* CNVisitElementOfFixedArrayFuncRef)(uint64_t index, void *src, void *info)
Definition: CNFixedArray.h:28
void CNDestroyFixedObjectArray(struct CNFixedObjectArray *dst)
Destroy instance array.
struct CNResource * resource
Definition: CNFixedArray.h:20
List of CNObject.
Definition: CNObjectList.h:17
Root object.
Definition: CNObject.h:38
void * CNSetPointerToFixedArray(struct CNFixedArray *dst, uint64_t index, void *src)
Set pointer to the array at the given index.
static void CNSetObjectToFixedObjectArray(struct CNFixedObjectArray *dst, unsigned int index, struct CNObject *src)
Set objectto the array at the given index.
Definition: CNFixedObjectArray.h:62
static struct CNObject * CNObjectInFixedObjectArray(const struct CNFixedObjectArray *src, unsigned int index)
Get object in the array.
Definition: CNFixedObjectArray.h:79
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.
static void CNInitFixedObjectArray(struct CNFixedObjectArray *dst, uint64_t maxnum, struct CNResource *resource)
Initialize instance array.
Definition: CNFixedObjectArray.h:30
Array of instances.
Definition: CNFixedObjectArray.h:17
Define CNFixedArray data structure.
Define CNObject data structure.
void CNReleaseObject(struct CNObject *dst)
Release the object.
static void CNRetainObject(struct CNObject *dst)
Retain the object.
Definition: CNObject.h:75
struct CNObjectList CNElementListOfFixedObjectArray(const struct CNFixedObjectArray *src, struct CNResource *resource)
Make object list of array.
static uint64_t CNCountOfFixedArray(const struct CNFixedArray *src)
Get the count of elements in the fixed array.
Definition: CNFixedArray.h:63
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.