File Coverage

autogen/include/Clownfish/Vector.h
Criterion Covered Total %
statement 1 4 25.0
branch n/a
condition n/a
subroutine n/a
pod n/a
total 1 4 25.0


line stmt bran cond sub pod time code
1            
2            
3            

perltidy

4            
 
5             /* * *********************************************** * * !!!! DO NOT EDIT !!!! * * This file was auto-generated by Build.PL. * * *********************************************** * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef H_CLOWNFISH_VECTOR #define H_CLOWNFISH_VECTOR 1 #ifdef __cplusplus extern "C" { #endif #include "cfish_parcel.h" /* Include the header for this class's parent. */ #include "Clownfish/Obj.h" /* Define the struct layout for instances of this class. */ #ifdef C_CFISH_VECTOR extern uint32_t cfish_Vec_IVARS_OFFSET; typedef struct cfish_VectorIVARS cfish_VectorIVARS; static CFISH_INLINE cfish_VectorIVARS* cfish_Vec_IVARS(cfish_Vector *self) { char *ptr = (char*)self + cfish_Vec_IVARS_OFFSET; return (cfish_VectorIVARS*)ptr; } #ifdef CFISH_USE_SHORT_NAMES #define VectorIVARS cfish_VectorIVARS #define Vec_IVARS cfish_Vec_IVARS #endif struct cfish_Vector { CFISH_OBJ_HEAD cfish_Class* klass; cfish_Obj** elems; size_t size; size_t cap; }; #endif /* C_CFISH_VECTOR */ /* Declare this class's inert variables. */ /* Declare both this class's inert functions and the C functions which * implement this class's dynamic methods. */ CFISH_VISIBLE cfish_Vector* cfish_Vec_new(size_t capacity); CFISH_VISIBLE cfish_Vector* cfish_Vec_init(cfish_Vector* self, size_t capacity); void* CFISH_Vec_To_Host_IMP(cfish_Vector* self, void* vcache); void CFISH_Vec_Push_IMP(cfish_Vector* self, cfish_Obj* element); void CFISH_Vec_Push_All_IMP(cfish_Vector* self, cfish_Vector* other); cfish_Obj* CFISH_Vec_Pop_IMP(cfish_Vector* self); void CFISH_Vec_Insert_IMP(cfish_Vector* self, size_t tick, cfish_Obj* element); void CFISH_Vec_Insert_All_IMP(cfish_Vector* self, size_t tick, cfish_Vector* other); void CFISH_Vec_Grow_IMP(cfish_Vector* self, size_t capacity); cfish_Obj* CFISH_Vec_Fetch_IMP(cfish_Vector* self, size_t tick); void CFISH_Vec_Store_IMP(cfish_Vector* self, size_t tick, cfish_Obj* elem); cfish_Obj* CFISH_Vec_Delete_IMP(cfish_Vector* self, size_t tick); void CFISH_Vec_Excise_IMP(cfish_Vector* self, size_t offset, size_t length); cfish_Vector* CFISH_Vec_Clone_IMP(cfish_Vector* self); void CFISH_Vec_Sort_IMP(cfish_Vector* self); void CFISH_Vec_Resize_IMP(cfish_Vector* self, size_t size); void CFISH_Vec_Clear_IMP(cfish_Vector* self); size_t CFISH_Vec_Get_Size_IMP(cfish_Vector* self); size_t CFISH_Vec_Get_Capacity_IMP(cfish_Vector* self); cfish_Vector* CFISH_Vec_Slice_IMP(cfish_Vector* self, size_t offset, size_t length); bool CFISH_Vec_Equals_IMP(cfish_Vector* self, cfish_Obj* other); void CFISH_Vec_Destroy_IMP(cfish_Vector* self); /* Define typedefs for each dynamic method, allowing us to cast generic * pointers to the appropriate function pointer type more cleanly. */ typedef void* (*CFISH_Vec_To_Host_t)(cfish_Vector* self, void* vcache); typedef cfish_Vector* (*CFISH_Vec_Clone_t)(cfish_Vector* self); typedef bool (*CFISH_Vec_Equals_t)(cfish_Vector* self, cfish_Obj* other); typedef int32_t (*CFISH_Vec_Compare_To_t)(cfish_Vector* self, cfish_Obj* other); typedef void (*CFISH_Vec_Destroy_t)(cfish_Vector* self); typedef cfish_String* (*CFISH_Vec_To_String_t)(cfish_Vector* self); typedef void (*CFISH_Vec_Push_t)(cfish_Vector* self, cfish_Obj* element); typedef void (*CFISH_Vec_Push_All_t)(cfish_Vector* self, cfish_Vector* other); typedef cfish_Obj* (*CFISH_Vec_Pop_t)(cfish_Vector* self); typedef void (*CFISH_Vec_Insert_t)(cfish_Vector* self, size_t tick, cfish_Obj* element); typedef void (*CFISH_Vec_Insert_All_t)(cfish_Vector* self, size_t tick, cfish_Vector* other); typedef void (*CFISH_Vec_Grow_t)(cfish_Vector* self, size_t capacity); typedef cfish_Obj* (*CFISH_Vec_Fetch_t)(cfish_Vector* self, size_t tick); typedef void (*CFISH_Vec_Store_t)(cfish_Vector* self, size_t tick, cfish_Obj* elem); typedef cfish_Obj* (*CFISH_Vec_Delete_t)(cfish_Vector* self, size_t tick); typedef void (*CFISH_Vec_Excise_t)(cfish_Vector* self, size_t offset, size_t length); typedef void (*CFISH_Vec_Sort_t)(cfish_Vector* self); typedef void (*CFISH_Vec_Resize_t)(cfish_Vector* self, size_t size); typedef void (*CFISH_Vec_Clear_t)(cfish_Vector* self); typedef size_t (*CFISH_Vec_Get_Size_t)(cfish_Vector* self); typedef size_t (*CFISH_Vec_Get_Capacity_t)(cfish_Vector* self); typedef cfish_Vector* (*CFISH_Vec_Slice_t)(cfish_Vector* self, size_t offset, size_t length); /* Define type-safe wrappers for inert functions of Obj. */ static CFISH_INLINE cfish_Class* cfish_Vec_get_class(cfish_Vector *self) { return cfish_Obj_get_class((cfish_Obj*)self); } static CFISH_INLINE cfish_String* cfish_Vec_get_class_name(cfish_Vector *self) { return cfish_Obj_get_class_name((cfish_Obj*)self); } static CFISH_INLINE bool cfish_Vec_is_a(cfish_Vector *self, cfish_Class *ancestor) { return cfish_Obj_is_a((cfish_Obj*)self, ancestor); } /* Define the inline functions which implement this class's virtual methods. */ extern CFISH_VISIBLE uint32_t CFISH_Vec_To_Host_OFFSET; static CFISH_INLINE void* CFISH_Vec_To_Host(cfish_Vector* self, void* vcache) { #ifdef CFP_CFISH return CFISH_Vec_To_Host_IMP(self, vcache); #else const CFISH_Vec_To_Host_t method = (CFISH_Vec_To_Host_t)cfish_obj_method(self, CFISH_Vec_To_Host_OFFSET); return method(self, vcache); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Clone_OFFSET; static CFISH_INLINE cfish_Vector* CFISH_Vec_Clone(cfish_Vector* self) { #ifdef CFP_CFISH return CFISH_Vec_Clone_IMP(self); #else const CFISH_Vec_Clone_t method = (CFISH_Vec_Clone_t)cfish_obj_method(self, CFISH_Vec_Clone_OFFSET); return method(self); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Equals_OFFSET; static CFISH_INLINE bool CFISH_Vec_Equals(cfish_Vector* self, cfish_Obj* other) { #ifdef CFP_CFISH return CFISH_Vec_Equals_IMP(self, other); #else const CFISH_Vec_Equals_t method = (CFISH_Vec_Equals_t)cfish_obj_method(self, CFISH_Vec_Equals_OFFSET); return method(self, other); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Compare_To_OFFSET; static CFISH_INLINE int32_t CFISH_Vec_Compare_To(cfish_Vector* self, cfish_Obj* other) { #ifdef CFP_CFISH return CFISH_Obj_Compare_To_IMP((cfish_Obj*)self, other); #else const CFISH_Vec_Compare_To_t method = (CFISH_Vec_Compare_To_t)cfish_obj_method(self, CFISH_Vec_Compare_To_OFFSET); return method(self, other); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Destroy_OFFSET; static CFISH_INLINE void CFISH_Vec_Destroy(cfish_Vector* self) { #ifdef CFP_CFISH CFISH_Vec_Destroy_IMP(self); #else const CFISH_Vec_Destroy_t method = (CFISH_Vec_Destroy_t)cfish_obj_method(self, CFISH_Vec_Destroy_OFFSET); method(self); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_To_String_OFFSET; static CFISH_INLINE cfish_String* CFISH_Vec_To_String(cfish_Vector* self) { #ifdef CFP_CFISH return CFISH_Obj_To_String_IMP((cfish_Obj*)self); #else const CFISH_Vec_To_String_t method = (CFISH_Vec_To_String_t)cfish_obj_method(self, CFISH_Vec_To_String_OFFSET); return method(self); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Push_OFFSET; static CFISH_INLINE void CFISH_Vec_Push(cfish_Vector* self, cfish_Obj* element) { #ifdef CFP_CFISH CFISH_Vec_Push_IMP(self, element); #else const CFISH_Vec_Push_t method = (CFISH_Vec_Push_t)cfish_obj_method(self, CFISH_Vec_Push_OFFSET); method(self, element); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Push_All_OFFSET; static CFISH_INLINE void CFISH_Vec_Push_All(cfish_Vector* self, cfish_Vector* other) { #ifdef CFP_CFISH CFISH_Vec_Push_All_IMP(self, other); #else const CFISH_Vec_Push_All_t method = (CFISH_Vec_Push_All_t)cfish_obj_method(self, CFISH_Vec_Push_All_OFFSET); method(self, other); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Pop_OFFSET; static CFISH_INLINE cfish_Obj* CFISH_Vec_Pop(cfish_Vector* self) { #ifdef CFP_CFISH return CFISH_Vec_Pop_IMP(self); #else const CFISH_Vec_Pop_t method = (CFISH_Vec_Pop_t)cfish_obj_method(self, CFISH_Vec_Pop_OFFSET); return method(self); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Insert_OFFSET; static CFISH_INLINE void CFISH_Vec_Insert(cfish_Vector* self, size_t tick, cfish_Obj* element) { #ifdef CFP_CFISH CFISH_Vec_Insert_IMP(self, tick, element); #else const CFISH_Vec_Insert_t method = (CFISH_Vec_Insert_t)cfish_obj_method(self, CFISH_Vec_Insert_OFFSET); method(self, tick, element); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Insert_All_OFFSET; static CFISH_INLINE void CFISH_Vec_Insert_All(cfish_Vector* self, size_t tick, cfish_Vector* other) { #ifdef CFP_CFISH CFISH_Vec_Insert_All_IMP(self, tick, other); #else const CFISH_Vec_Insert_All_t method = (CFISH_Vec_Insert_All_t)cfish_obj_method(self, CFISH_Vec_Insert_All_OFFSET); method(self, tick, other); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Grow_OFFSET; static CFISH_INLINE void CFISH_Vec_Grow(cfish_Vector* self, size_t capacity) { #ifdef CFP_CFISH CFISH_Vec_Grow_IMP(self, capacity); #else const CFISH_Vec_Grow_t method = (CFISH_Vec_Grow_t)cfish_obj_method(self, CFISH_Vec_Grow_OFFSET); method(self, capacity); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Fetch_OFFSET; static CFISH_INLINE cfish_Obj* CFISH_Vec_Fetch(cfish_Vector* self, size_t tick) { #ifdef CFP_CFISH return CFISH_Vec_Fetch_IMP(self, tick); #else const CFISH_Vec_Fetch_t method = (CFISH_Vec_Fetch_t)cfish_obj_method(self, CFISH_Vec_Fetch_OFFSET); return method(self, tick); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Store_OFFSET; static CFISH_INLINE void CFISH_Vec_Store(cfish_Vector* self, size_t tick, cfish_Obj* elem) { #ifdef CFP_CFISH CFISH_Vec_Store_IMP(self, tick, elem); #else const CFISH_Vec_Store_t method = (CFISH_Vec_Store_t)cfish_obj_method(self, CFISH_Vec_Store_OFFSET); method(self, tick, elem); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Delete_OFFSET; static CFISH_INLINE cfish_Obj* CFISH_Vec_Delete(cfish_Vector* self, size_t tick) { #ifdef CFP_CFISH return CFISH_Vec_Delete_IMP(self, tick); #else const CFISH_Vec_Delete_t method = (CFISH_Vec_Delete_t)cfish_obj_method(self, CFISH_Vec_Delete_OFFSET); return method(self, tick); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Excise_OFFSET; static CFISH_INLINE void CFISH_Vec_Excise(cfish_Vector* self, size_t offset, size_t length) { #ifdef CFP_CFISH CFISH_Vec_Excise_IMP(self, offset, length); #else const CFISH_Vec_Excise_t method = (CFISH_Vec_Excise_t)cfish_obj_method(self, CFISH_Vec_Excise_OFFSET); method(self, offset, length); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Sort_OFFSET; static CFISH_INLINE void CFISH_Vec_Sort(cfish_Vector* self) { #ifdef CFP_CFISH CFISH_Vec_Sort_IMP(self); #else const CFISH_Vec_Sort_t method = (CFISH_Vec_Sort_t)cfish_obj_method(self, CFISH_Vec_Sort_OFFSET); method(self); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Resize_OFFSET; static CFISH_INLINE void CFISH_Vec_Resize(cfish_Vector* self, size_t size) { #ifdef CFP_CFISH CFISH_Vec_Resize_IMP(self, size); #else const CFISH_Vec_Resize_t method = (CFISH_Vec_Resize_t)cfish_obj_method(self, CFISH_Vec_Resize_OFFSET); method(self, size); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Clear_OFFSET; static CFISH_INLINE void CFISH_Vec_Clear(cfish_Vector* self) { #ifdef CFP_CFISH CFISH_Vec_Clear_IMP(self); #else const CFISH_Vec_Clear_t method = (CFISH_Vec_Clear_t)cfish_obj_method(self, CFISH_Vec_Clear_OFFSET); method(self); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Get_Size_OFFSET; static CFISH_INLINE size_t CFISH_Vec_Get_Size(cfish_Vector* self) { #ifdef CFP_CFISH return CFISH_Vec_Get_Size_IMP(self); #else const CFISH_Vec_Get_Size_t method = (CFISH_Vec_Get_Size_t)cfish_obj_method(self, CFISH_Vec_Get_Size_OFFSET); return method(self); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Get_Capacity_OFFSET; static CFISH_INLINE size_t CFISH_Vec_Get_Capacity(cfish_Vector* self) { #ifdef CFP_CFISH return CFISH_Vec_Get_Capacity_IMP(self); #else const CFISH_Vec_Get_Capacity_t method = (CFISH_Vec_Get_Capacity_t)cfish_obj_method(self, CFISH_Vec_Get_Capacity_OFFSET); return method(self); #endif } extern CFISH_VISIBLE uint32_t CFISH_Vec_Slice_OFFSET; static CFISH_INLINE cfish_Vector* CFISH_Vec_Slice(cfish_Vector* self, size_t offset, size_t length) { #ifdef CFP_CFISH return CFISH_Vec_Slice_IMP(self, offset, length); #else const CFISH_Vec_Slice_t method = (CFISH_Vec_Slice_t)cfish_obj_method(self, CFISH_Vec_Slice_OFFSET); return method(self, offset, length); #endif } /* Declare callbacks for wrapping host overrides. */ #ifdef CFISH_NO_DYNAMIC_OVERRIDES #else #endif /* Define "short names" for this class's symbols. */ #ifdef CFISH_USE_SHORT_NAMES #define Vector cfish_Vector #define VECTOR CFISH_VECTOR #define Vec_new cfish_Vec_new #define Vec_init cfish_Vec_init #define Vec_get_class cfish_Vec_get_class #define Vec_get_class_name cfish_Vec_get_class_name #define Vec_is_a cfish_Vec_is_a #define Vec_To_Host_IMP CFISH_Vec_To_Host_IMP #define Vec_Push_IMP CFISH_Vec_Push_IMP #define Vec_Push_All_IMP CFISH_Vec_Push_All_IMP #define Vec_Pop_IMP CFISH_Vec_Pop_IMP #define Vec_Insert_IMP CFISH_Vec_Insert_IMP #define Vec_Insert_All_IMP CFISH_Vec_Insert_All_IMP #define Vec_Grow_IMP CFISH_Vec_Grow_IMP #define Vec_Fetch_IMP CFISH_Vec_Fetch_IMP #define Vec_Store_IMP CFISH_Vec_Store_IMP #define Vec_Delete_IMP CFISH_Vec_Delete_IMP #define Vec_Excise_IMP CFISH_Vec_Excise_IMP #define Vec_Clone_IMP CFISH_Vec_Clone_IMP #define Vec_Sort_IMP CFISH_Vec_Sort_IMP #define Vec_Resize_IMP CFISH_Vec_Resize_IMP #define Vec_Clear_IMP CFISH_Vec_Clear_IMP #define Vec_Get_Size_IMP CFISH_Vec_Get_Size_IMP #define Vec_Get_Capacity_IMP CFISH_Vec_Get_Capacity_IMP #define Vec_Slice_IMP CFISH_Vec_Slice_IMP #define Vec_Equals_IMP CFISH_Vec_Equals_IMP #define Vec_Destroy_IMP CFISH_Vec_Destroy_IMP #define Vec_To_Host CFISH_Vec_To_Host #define Vec_To_Host_t CFISH_Vec_To_Host_t #define Vec_Clone CFISH_Vec_Clone #define Vec_Clone_t CFISH_Vec_Clone_t #define Vec_Equals CFISH_Vec_Equals #define Vec_Equals_t CFISH_Vec_Equals_t #define Vec_Compare_To CFISH_Vec_Compare_To #define Vec_Compare_To_t CFISH_Vec_Compare_To_t #define Vec_Destroy CFISH_Vec_Destroy #define Vec_Destroy_t CFISH_Vec_Destroy_t #define Vec_To_String CFISH_Vec_To_String #define Vec_To_String_t CFISH_Vec_To_String_t #define Vec_Push CFISH_Vec_Push #define Vec_Push_t CFISH_Vec_Push_t #define Vec_Push_All CFISH_Vec_Push_All #define Vec_Push_All_t CFISH_Vec_Push_All_t #define Vec_Pop CFISH_Vec_Pop #define Vec_Pop_t CFISH_Vec_Pop_t #define Vec_Insert CFISH_Vec_Insert #define Vec_Insert_t CFISH_Vec_Insert_t #define Vec_Insert_All CFISH_Vec_Insert_All #define Vec_Insert_All_t CFISH_Vec_Insert_All_t #define Vec_Grow CFISH_Vec_Grow #define Vec_Grow_t CFISH_Vec_Grow_t #define Vec_Fetch CFISH_Vec_Fetch #define Vec_Fetch_t CFISH_Vec_Fetch_t #define Vec_Store CFISH_Vec_Store #define Vec_Store_t CFISH_Vec_Store_t #define Vec_Delete CFISH_Vec_Delete #define Vec_Delete_t CFISH_Vec_Delete_t #define Vec_Excise CFISH_Vec_Excise #define Vec_Excise_t CFISH_Vec_Excise_t #define Vec_Sort CFISH_Vec_Sort #define Vec_Sort_t CFISH_Vec_Sort_t #define Vec_Resize CFISH_Vec_Resize #define Vec_Resize_t CFISH_Vec_Resize_t #define Vec_Clear CFISH_Vec_Clear #define Vec_Clear_t CFISH_Vec_Clear_t #define Vec_Get_Size CFISH_Vec_Get_Size #define Vec_Get_Size_t CFISH_Vec_Get_Size_t #define Vec_Get_Capacity CFISH_Vec_Get_Capacity #define Vec_Get_Capacity_t CFISH_Vec_Get_Capacity_t #define Vec_Slice CFISH_Vec_Slice #define Vec_Slice_t CFISH_Vec_Slice_t #endif /* CFISH_USE_SHORT_NAMES */ #ifdef __cplusplus } #endif #endif /* H_CLOWNFISH_VECTOR */