| 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_BYTEBUF
#define H_CLOWNFISH_BYTEBUF 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_BYTEBUF
extern uint32_t cfish_BB_IVARS_OFFSET;
typedef struct cfish_ByteBufIVARS cfish_ByteBufIVARS;
static CFISH_INLINE cfish_ByteBufIVARS*
cfish_BB_IVARS(cfish_ByteBuf *self) {
   char *ptr = (char*)self + cfish_BB_IVARS_OFFSET;
   return (cfish_ByteBufIVARS*)ptr;
}
#ifdef CFISH_USE_SHORT_NAMES
  #define ByteBufIVARS cfish_ByteBufIVARS
  #define BB_IVARS cfish_BB_IVARS
#endif
struct cfish_ByteBuf {
    CFISH_OBJ_HEAD
    cfish_Class* klass;
    char* buf;
    size_t size;
    size_t cap;
};
#endif /* C_CFISH_BYTEBUF */
/* 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_ByteBuf*
cfish_BB_new(size_t capacity);
CFISH_VISIBLE cfish_ByteBuf*
cfish_BB_init(cfish_ByteBuf* self, size_t capacity);
CFISH_VISIBLE cfish_ByteBuf*
cfish_BB_new_bytes(const void* bytes, size_t size);
CFISH_VISIBLE cfish_ByteBuf*
cfish_BB_init_bytes(cfish_ByteBuf* self, const void* bytes, size_t size);
CFISH_VISIBLE cfish_ByteBuf*
cfish_BB_new_steal_bytes(void* bytes, size_t size, size_t capacity);
CFISH_VISIBLE cfish_ByteBuf*
cfish_BB_init_steal_bytes(cfish_ByteBuf* self, void* bytes, size_t size, size_t capacity);
void*
CFISH_BB_To_Host_IMP(cfish_ByteBuf* self, void* vcache);
void
CFISH_BB_Set_Size_IMP(cfish_ByteBuf* self, size_t size);
size_t
CFISH_BB_Get_Size_IMP(cfish_ByteBuf* self);
char*
CFISH_BB_Get_Buf_IMP(cfish_ByteBuf* self);
size_t
CFISH_BB_Get_Capacity_IMP(cfish_ByteBuf* self);
void
CFISH_BB_Cat_Bytes_IMP(cfish_ByteBuf* self, const void* bytes, size_t size);
void
CFISH_BB_Cat_IMP(cfish_ByteBuf* self, cfish_Blob* blob);
char*
CFISH_BB_Grow_IMP(cfish_ByteBuf* self, size_t capacity);
cfish_Blob*
CFISH_BB_Yield_Blob_IMP(cfish_ByteBuf* self);
cfish_String*
CFISH_BB_Utf8_To_String_IMP(cfish_ByteBuf* self);
cfish_String*
CFISH_BB_Trusted_Utf8_To_String_IMP(cfish_ByteBuf* self);
bool
CFISH_BB_Equals_IMP(cfish_ByteBuf* self, cfish_Obj* other);
bool
CFISH_BB_Equals_Bytes_IMP(cfish_ByteBuf* self, const void* bytes, size_t size);
int32_t
CFISH_BB_Compare_To_IMP(cfish_ByteBuf* self, cfish_Obj* other);
cfish_ByteBuf*
CFISH_BB_Clone_IMP(cfish_ByteBuf* self);
void
CFISH_BB_Destroy_IMP(cfish_ByteBuf* self);
/* Define typedefs for each dynamic method, allowing us to cast generic
  * pointers to the appropriate function pointer type more cleanly.
  */
typedef void*
(*CFISH_BB_To_Host_t)(cfish_ByteBuf* self, void* vcache);
typedef cfish_ByteBuf*
(*CFISH_BB_Clone_t)(cfish_ByteBuf* self);
typedef bool
(*CFISH_BB_Equals_t)(cfish_ByteBuf* self, cfish_Obj* other);
typedef int32_t
(*CFISH_BB_Compare_To_t)(cfish_ByteBuf* self, cfish_Obj* other);
typedef void
(*CFISH_BB_Destroy_t)(cfish_ByteBuf* self);
typedef cfish_String*
(*CFISH_BB_To_String_t)(cfish_ByteBuf* self);
typedef void
(*CFISH_BB_Set_Size_t)(cfish_ByteBuf* self, size_t size);
typedef size_t
(*CFISH_BB_Get_Size_t)(cfish_ByteBuf* self);
typedef char*
(*CFISH_BB_Get_Buf_t)(cfish_ByteBuf* self);
typedef size_t
(*CFISH_BB_Get_Capacity_t)(cfish_ByteBuf* self);
typedef void
(*CFISH_BB_Cat_Bytes_t)(cfish_ByteBuf* self, const void* bytes, size_t size);
typedef void
(*CFISH_BB_Cat_t)(cfish_ByteBuf* self, cfish_Blob* blob);
typedef char*
(*CFISH_BB_Grow_t)(cfish_ByteBuf* self, size_t capacity);
typedef cfish_Blob*
(*CFISH_BB_Yield_Blob_t)(cfish_ByteBuf* self);
typedef cfish_String*
(*CFISH_BB_Utf8_To_String_t)(cfish_ByteBuf* self);
typedef cfish_String*
(*CFISH_BB_Trusted_Utf8_To_String_t)(cfish_ByteBuf* self);
typedef bool
(*CFISH_BB_Equals_Bytes_t)(cfish_ByteBuf* self, const void* bytes, size_t size);
/* Define type-safe wrappers for inert functions of Obj.
  */
static CFISH_INLINE cfish_Class*
cfish_BB_get_class(cfish_ByteBuf *self) {
    return cfish_Obj_get_class((cfish_Obj*)self);
}
static CFISH_INLINE cfish_String*
cfish_BB_get_class_name(cfish_ByteBuf *self) {
    return cfish_Obj_get_class_name((cfish_Obj*)self);
}
static CFISH_INLINE bool
cfish_BB_is_a(cfish_ByteBuf *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_BB_To_Host_OFFSET;
static CFISH_INLINE void*
CFISH_BB_To_Host(cfish_ByteBuf* self, void* vcache) {
#ifdef CFP_CFISH
    return CFISH_BB_To_Host_IMP(self, vcache);
#else
    const CFISH_BB_To_Host_t method = (CFISH_BB_To_Host_t)cfish_obj_method(self, CFISH_BB_To_Host_OFFSET);
    return method(self, vcache);
#endif
}
extern CFISH_VISIBLE uint32_t CFISH_BB_Clone_OFFSET;
static CFISH_INLINE cfish_ByteBuf*
CFISH_BB_Clone(cfish_ByteBuf* self) {
#ifdef CFP_CFISH
    return CFISH_BB_Clone_IMP(self);
#else
    const CFISH_BB_Clone_t method = (CFISH_BB_Clone_t)cfish_obj_method(self, CFISH_BB_Clone_OFFSET);
    return method(self);
#endif
}
extern CFISH_VISIBLE uint32_t CFISH_BB_Equals_OFFSET;
static CFISH_INLINE bool
CFISH_BB_Equals(cfish_ByteBuf* self, cfish_Obj* other) {
#ifdef CFP_CFISH
    return CFISH_BB_Equals_IMP(self, other);
#else
    const CFISH_BB_Equals_t method = (CFISH_BB_Equals_t)cfish_obj_method(self, CFISH_BB_Equals_OFFSET);
    return method(self, other);
#endif
}
extern CFISH_VISIBLE uint32_t CFISH_BB_Compare_To_OFFSET;
static CFISH_INLINE int32_t
CFISH_BB_Compare_To(cfish_ByteBuf* self, cfish_Obj* other) {
#ifdef CFP_CFISH
    return CFISH_BB_Compare_To_IMP(self, other);
#else
    const CFISH_BB_Compare_To_t method = (CFISH_BB_Compare_To_t)cfish_obj_method(self, CFISH_BB_Compare_To_OFFSET);
    return method(self, other);
#endif
}
extern CFISH_VISIBLE uint32_t CFISH_BB_Destroy_OFFSET;
static CFISH_INLINE void
CFISH_BB_Destroy(cfish_ByteBuf* self) {
#ifdef CFP_CFISH
    CFISH_BB_Destroy_IMP(self);
#else
    const CFISH_BB_Destroy_t method = (CFISH_BB_Destroy_t)cfish_obj_method(self, CFISH_BB_Destroy_OFFSET);
    method(self);
#endif
}
extern CFISH_VISIBLE uint32_t CFISH_BB_To_String_OFFSET;
static CFISH_INLINE cfish_String*
CFISH_BB_To_String(cfish_ByteBuf* self) {
#ifdef CFP_CFISH
    return CFISH_Obj_To_String_IMP((cfish_Obj*)self);
#else
    const CFISH_BB_To_String_t method = (CFISH_BB_To_String_t)cfish_obj_method(self, CFISH_BB_To_String_OFFSET);
    return method(self);
#endif
}
extern CFISH_VISIBLE uint32_t CFISH_BB_Set_Size_OFFSET;
static CFISH_INLINE void
CFISH_BB_Set_Size(cfish_ByteBuf* self, size_t size) {
#ifdef CFP_CFISH
    CFISH_BB_Set_Size_IMP(self, size);
#else
    const CFISH_BB_Set_Size_t method = (CFISH_BB_Set_Size_t)cfish_obj_method(self, CFISH_BB_Set_Size_OFFSET);
    method(self, size);
#endif
}
extern CFISH_VISIBLE uint32_t CFISH_BB_Get_Size_OFFSET;
static CFISH_INLINE size_t
CFISH_BB_Get_Size(cfish_ByteBuf* self) {
#ifdef CFP_CFISH
    return CFISH_BB_Get_Size_IMP(self);
#else
    const CFISH_BB_Get_Size_t method = (CFISH_BB_Get_Size_t)cfish_obj_method(self, CFISH_BB_Get_Size_OFFSET);
    return method(self);
#endif
}
extern CFISH_VISIBLE uint32_t CFISH_BB_Get_Buf_OFFSET;
static CFISH_INLINE char*
CFISH_BB_Get_Buf(cfish_ByteBuf* self) {
#ifdef CFP_CFISH
    return CFISH_BB_Get_Buf_IMP(self);
#else
    const CFISH_BB_Get_Buf_t method = (CFISH_BB_Get_Buf_t)cfish_obj_method(self, CFISH_BB_Get_Buf_OFFSET);
    return method(self);
#endif
}
extern CFISH_VISIBLE uint32_t CFISH_BB_Get_Capacity_OFFSET;
static CFISH_INLINE size_t
CFISH_BB_Get_Capacity(cfish_ByteBuf* self) {
#ifdef CFP_CFISH
    return CFISH_BB_Get_Capacity_IMP(self);
#else
    const CFISH_BB_Get_Capacity_t method = (CFISH_BB_Get_Capacity_t)cfish_obj_method(self, CFISH_BB_Get_Capacity_OFFSET);
    return method(self);
#endif
}
extern CFISH_VISIBLE uint32_t CFISH_BB_Cat_Bytes_OFFSET;
static CFISH_INLINE void
CFISH_BB_Cat_Bytes(cfish_ByteBuf* self, const void* bytes, size_t size) {
#ifdef CFP_CFISH
    CFISH_BB_Cat_Bytes_IMP(self, bytes, size);
#else
    const CFISH_BB_Cat_Bytes_t method = (CFISH_BB_Cat_Bytes_t)cfish_obj_method(self, CFISH_BB_Cat_Bytes_OFFSET);
    method(self, bytes, size);
#endif
}
extern CFISH_VISIBLE uint32_t CFISH_BB_Cat_OFFSET;
static CFISH_INLINE void
CFISH_BB_Cat(cfish_ByteBuf* self, cfish_Blob* blob) {
#ifdef CFP_CFISH
    CFISH_BB_Cat_IMP(self, blob);
#else
    const CFISH_BB_Cat_t method = (CFISH_BB_Cat_t)cfish_obj_method(self, CFISH_BB_Cat_OFFSET);
    method(self, blob);
#endif
}
extern CFISH_VISIBLE uint32_t CFISH_BB_Grow_OFFSET;
static CFISH_INLINE char*
CFISH_BB_Grow(cfish_ByteBuf* self, size_t capacity) {
#ifdef CFP_CFISH
    return CFISH_BB_Grow_IMP(self, capacity);
#else
    const CFISH_BB_Grow_t method = (CFISH_BB_Grow_t)cfish_obj_method(self, CFISH_BB_Grow_OFFSET);
    return method(self, capacity);
#endif
}
extern CFISH_VISIBLE uint32_t CFISH_BB_Yield_Blob_OFFSET;
static CFISH_INLINE cfish_Blob*
CFISH_BB_Yield_Blob(cfish_ByteBuf* self) {
#ifdef CFP_CFISH
    return CFISH_BB_Yield_Blob_IMP(self);
#else
    const CFISH_BB_Yield_Blob_t method = (CFISH_BB_Yield_Blob_t)cfish_obj_method(self, CFISH_BB_Yield_Blob_OFFSET);
    return method(self);
#endif
}
extern CFISH_VISIBLE uint32_t CFISH_BB_Utf8_To_String_OFFSET;
static CFISH_INLINE cfish_String*
CFISH_BB_Utf8_To_String(cfish_ByteBuf* self) {
#ifdef CFP_CFISH
    return CFISH_BB_Utf8_To_String_IMP(self);
#else
    const CFISH_BB_Utf8_To_String_t method = (CFISH_BB_Utf8_To_String_t)cfish_obj_method(self, CFISH_BB_Utf8_To_String_OFFSET);
    return method(self);
#endif
}
extern CFISH_VISIBLE uint32_t CFISH_BB_Trusted_Utf8_To_String_OFFSET;
static CFISH_INLINE cfish_String*
CFISH_BB_Trusted_Utf8_To_String(cfish_ByteBuf* self) {
#ifdef CFP_CFISH
    return CFISH_BB_Trusted_Utf8_To_String_IMP(self);
#else
    const CFISH_BB_Trusted_Utf8_To_String_t method = (CFISH_BB_Trusted_Utf8_To_String_t)cfish_obj_method(self, CFISH_BB_Trusted_Utf8_To_String_OFFSET);
    return method(self);
#endif
}
extern CFISH_VISIBLE uint32_t CFISH_BB_Equals_Bytes_OFFSET;
static CFISH_INLINE bool
CFISH_BB_Equals_Bytes(cfish_ByteBuf* self, const void* bytes, size_t size) {
#ifdef CFP_CFISH
    return CFISH_BB_Equals_Bytes_IMP(self, bytes, size);
#else
    const CFISH_BB_Equals_Bytes_t method = (CFISH_BB_Equals_Bytes_t)cfish_obj_method(self, CFISH_BB_Equals_Bytes_OFFSET);
    return method(self, bytes, size);
#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 ByteBuf cfish_ByteBuf
  #define BYTEBUF CFISH_BYTEBUF
  #define BB_new cfish_BB_new
  #define BB_init cfish_BB_init
  #define BB_new_bytes cfish_BB_new_bytes
  #define BB_init_bytes cfish_BB_init_bytes
  #define BB_new_steal_bytes cfish_BB_new_steal_bytes
  #define BB_init_steal_bytes cfish_BB_init_steal_bytes
  #define BB_get_class cfish_BB_get_class
  #define BB_get_class_name cfish_BB_get_class_name
  #define BB_is_a cfish_BB_is_a
  #define BB_To_Host_IMP CFISH_BB_To_Host_IMP
  #define BB_Set_Size_IMP CFISH_BB_Set_Size_IMP
  #define BB_Get_Size_IMP CFISH_BB_Get_Size_IMP
  #define BB_Get_Buf_IMP CFISH_BB_Get_Buf_IMP
  #define BB_Get_Capacity_IMP CFISH_BB_Get_Capacity_IMP
  #define BB_Cat_Bytes_IMP CFISH_BB_Cat_Bytes_IMP
  #define BB_Cat_IMP CFISH_BB_Cat_IMP
  #define BB_Grow_IMP CFISH_BB_Grow_IMP
  #define BB_Yield_Blob_IMP CFISH_BB_Yield_Blob_IMP
  #define BB_Utf8_To_String_IMP CFISH_BB_Utf8_To_String_IMP
  #define BB_Trusted_Utf8_To_String_IMP CFISH_BB_Trusted_Utf8_To_String_IMP
  #define BB_Equals_IMP CFISH_BB_Equals_IMP
  #define BB_Equals_Bytes_IMP CFISH_BB_Equals_Bytes_IMP
  #define BB_Compare_To_IMP CFISH_BB_Compare_To_IMP
  #define BB_Clone_IMP CFISH_BB_Clone_IMP
  #define BB_Destroy_IMP CFISH_BB_Destroy_IMP
  #define BB_To_Host CFISH_BB_To_Host
  #define BB_To_Host_t CFISH_BB_To_Host_t
  #define BB_Clone CFISH_BB_Clone
  #define BB_Clone_t CFISH_BB_Clone_t
  #define BB_Equals CFISH_BB_Equals
  #define BB_Equals_t CFISH_BB_Equals_t
  #define BB_Compare_To CFISH_BB_Compare_To
  #define BB_Compare_To_t CFISH_BB_Compare_To_t
  #define BB_Destroy CFISH_BB_Destroy
  #define BB_Destroy_t CFISH_BB_Destroy_t
  #define BB_To_String CFISH_BB_To_String
  #define BB_To_String_t CFISH_BB_To_String_t
  #define BB_Set_Size CFISH_BB_Set_Size
  #define BB_Set_Size_t CFISH_BB_Set_Size_t
  #define BB_Get_Size CFISH_BB_Get_Size
  #define BB_Get_Size_t CFISH_BB_Get_Size_t
  #define BB_Get_Buf CFISH_BB_Get_Buf
  #define BB_Get_Buf_t CFISH_BB_Get_Buf_t
  #define BB_Get_Capacity CFISH_BB_Get_Capacity
  #define BB_Get_Capacity_t CFISH_BB_Get_Capacity_t
  #define BB_Cat_Bytes CFISH_BB_Cat_Bytes
  #define BB_Cat_Bytes_t CFISH_BB_Cat_Bytes_t
  #define BB_Cat CFISH_BB_Cat
  #define BB_Cat_t CFISH_BB_Cat_t
  #define BB_Grow CFISH_BB_Grow
  #define BB_Grow_t CFISH_BB_Grow_t
  #define BB_Yield_Blob CFISH_BB_Yield_Blob
  #define BB_Yield_Blob_t CFISH_BB_Yield_Blob_t
  #define BB_Utf8_To_String CFISH_BB_Utf8_To_String
  #define BB_Utf8_To_String_t CFISH_BB_Utf8_To_String_t
  #define BB_Trusted_Utf8_To_String CFISH_BB_Trusted_Utf8_To_String
  #define BB_Trusted_Utf8_To_String_t CFISH_BB_Trusted_Utf8_To_String_t
  #define BB_Equals_Bytes CFISH_BB_Equals_Bytes
  #define BB_Equals_Bytes_t CFISH_BB_Equals_Bytes_t
#endif /* CFISH_USE_SHORT_NAMES */
#ifdef __cplusplus
}
#endif
#endif /* H_CLOWNFISH_BYTEBUF */ |