| 1 | /* | ||
| 2 | * *********************************************** | ||
| 3 | * | ||
| 4 | * !!!! DO NOT EDIT !!!! | ||
| 5 | * | ||
| 6 | * This file was auto-generated by Build.PL. | ||
| 7 | * | ||
| 8 | * *********************************************** | ||
| 9 | * | ||
| 10 | * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| 11 | * contributor license agreements. See the NOTICE file distributed with | ||
| 12 | * this work for additional information regarding copyright ownership. | ||
| 13 | * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| 14 | * (the "License"); you may not use this file except in compliance with | ||
| 15 | * the License. You may obtain a copy of the License at | ||
| 16 | * | ||
| 17 | * http://www.apache.org/licenses/LICENSE-2.0 | ||
| 18 | * | ||
| 19 | * Unless required by applicable law or agreed to in writing, software | ||
| 20 | * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 22 | * See the License for the specific language governing permissions and | ||
| 23 | * limitations under the License. | ||
| 24 | */ | ||
| 25 | |||
| 26 | |||
| 27 | #ifndef H_LUCY_STORE_RAMFILEHANDLE | ||
| 28 | #define H_LUCY_STORE_RAMFILEHANDLE 1 | ||
| 29 | |||
| 30 | |||
| 31 | #ifdef __cplusplus | ||
| 32 | extern "C" { | ||
| 33 | #endif | ||
| 34 | |||
| 35 | #include "lucy_parcel.h" | ||
| 36 | |||
| 37 | /* Include the header for this class's parent. | ||
| 38 | */ | ||
| 39 | |||
| 40 | #include "Lucy/Store/FileHandle.h" | ||
| 41 | |||
| 42 | /* Define the struct layout for instances of this class. | ||
| 43 | */ | ||
| 44 | |||
| 45 | #ifdef C_LUCY_RAMFILEHANDLE | ||
| 46 | extern uint32_t lucy_RAMFH_IVARS_OFFSET; | ||
| 47 | typedef struct lucy_RAMFileHandleIVARS lucy_RAMFileHandleIVARS; | ||
| 48 | static CFISH_INLINE lucy_RAMFileHandleIVARS* | ||
| 49 | lucy_RAMFH_IVARS(lucy_RAMFileHandle *self) { | ||
| 50 | char *ptr = (char*)self + lucy_RAMFH_IVARS_OFFSET; | ||
| 51 | return (lucy_RAMFileHandleIVARS*)ptr; | ||
| 52 | } | ||
| 53 | #ifdef LUCY_USE_SHORT_NAMES | ||
| 54 | #define RAMFileHandleIVARS lucy_RAMFileHandleIVARS | ||
| 55 | #define RAMFH_IVARS lucy_RAMFH_IVARS | ||
| 56 | #endif | ||
| 57 | |||
| 58 | struct lucy_RAMFileHandleIVARS { | ||
| 59 | cfish_String* path; | ||
| 60 | uint32_t flags; | ||
| 61 | lucy_RAMFile* ram_file; | ||
| 62 | cfish_ByteBuf* contents; | ||
| 63 | int64_t len; | ||
| 64 | }; | ||
| 65 | |||
| 66 | #endif /* C_LUCY_RAMFILEHANDLE */ | ||
| 67 | |||
| 68 | /* Declare this class's inert variables. | ||
| 69 | */ | ||
| 70 | |||
| 71 | |||
| 72 | |||
| 73 | /* Declare both this class's inert functions and the C functions which | ||
| 74 | * implement this class's dynamic methods. | ||
| 75 | */ | ||
| 76 | |||
| 77 | LUCY_VISIBLE lucy_RAMFileHandle* | ||
| 78 | lucy_RAMFH_open(cfish_String* path, uint32_t flags, lucy_RAMFile* file); | ||
| 79 | |||
| 80 | LUCY_VISIBLE lucy_RAMFileHandle* | ||
| 81 | lucy_RAMFH_do_open(lucy_RAMFileHandle* self, cfish_String* path, uint32_t flags, lucy_RAMFile* file); | ||
| 82 | |||
| 83 | lucy_RAMFile* | ||
| 84 | LUCY_RAMFH_Get_File_IMP(lucy_RAMFileHandle* self); | ||
| 85 | |||
| 86 | bool | ||
| 87 | LUCY_RAMFH_Grow_IMP(lucy_RAMFileHandle* self, int64_t len); | ||
| 88 | |||
| 89 | void | ||
| 90 | LUCY_RAMFH_Destroy_IMP(lucy_RAMFileHandle* self); | ||
| 91 | |||
| 92 | bool | ||
| 93 | LUCY_RAMFH_Window_IMP(lucy_RAMFileHandle* self, lucy_FileWindow* window, int64_t offset, int64_t len); | ||
| 94 | |||
| 95 | bool | ||
| 96 | LUCY_RAMFH_Release_Window_IMP(lucy_RAMFileHandle* self, lucy_FileWindow* window); | ||
| 97 | |||
| 98 | bool | ||
| 99 | LUCY_RAMFH_Read_IMP(lucy_RAMFileHandle* self, char* dest, int64_t offset, size_t len); | ||
| 100 | |||
| 101 | bool | ||
| 102 | LUCY_RAMFH_Write_IMP(lucy_RAMFileHandle* self, const void* data, size_t len); | ||
| 103 | |||
| 104 | int64_t | ||
| 105 | LUCY_RAMFH_Length_IMP(lucy_RAMFileHandle* self); | ||
| 106 | |||
| 107 | bool | ||
| 108 | LUCY_RAMFH_Close_IMP(lucy_RAMFileHandle* self); | ||
| 109 | |||
| 110 | |||
| 111 | |||
| 112 | /* Define typedefs for each dynamic method, allowing us to cast generic | ||
| 113 | * pointers to the appropriate function pointer type more cleanly. | ||
| 114 | */ | ||
| 115 | |||
| 116 | typedef void* | ||
| 117 | (*LUCY_RAMFH_To_Host_t)(lucy_RAMFileHandle* self, void* vcache); | ||
| 118 | |||
| 119 | typedef cfish_Obj* | ||
| 120 | (*LUCY_RAMFH_Clone_t)(lucy_RAMFileHandle* self); | ||
| 121 | |||
| 122 | typedef bool | ||
| 123 | (*LUCY_RAMFH_Equals_t)(lucy_RAMFileHandle* self, cfish_Obj* other); | ||
| 124 | |||
| 125 | typedef int32_t | ||
| 126 | (*LUCY_RAMFH_Compare_To_t)(lucy_RAMFileHandle* self, cfish_Obj* other); | ||
| 127 | |||
| 128 | typedef void | ||
| 129 | (*LUCY_RAMFH_Destroy_t)(lucy_RAMFileHandle* self); | ||
| 130 | |||
| 131 | typedef cfish_String* | ||
| 132 | (*LUCY_RAMFH_To_String_t)(lucy_RAMFileHandle* self); | ||
| 133 | |||
| 134 | typedef bool | ||
| 135 | (*LUCY_RAMFH_Window_t)(lucy_RAMFileHandle* self, lucy_FileWindow* window, int64_t offset, int64_t len); | ||
| 136 | |||
| 137 | typedef bool | ||
| 138 | (*LUCY_RAMFH_Release_Window_t)(lucy_RAMFileHandle* self, lucy_FileWindow* window); | ||
| 139 | |||
| 140 | typedef bool | ||
| 141 | (*LUCY_RAMFH_Read_t)(lucy_RAMFileHandle* self, char* dest, int64_t offset, size_t len); | ||
| 142 | |||
| 143 | typedef bool | ||
| 144 | (*LUCY_RAMFH_Write_t)(lucy_RAMFileHandle* self, const void* data, size_t len); | ||
| 145 | |||
| 146 | typedef int64_t | ||
| 147 | (*LUCY_RAMFH_Length_t)(lucy_RAMFileHandle* self); | ||
| 148 | |||
| 149 | typedef bool | ||
| 150 | (*LUCY_RAMFH_Grow_t)(lucy_RAMFileHandle* self, int64_t len); | ||
| 151 | |||
| 152 | typedef bool | ||
| 153 | (*LUCY_RAMFH_Close_t)(lucy_RAMFileHandle* self); | ||
| 154 | |||
| 155 | typedef void | ||
| 156 | (*LUCY_RAMFH_Set_Path_t)(lucy_RAMFileHandle* self, cfish_String* path); | ||
| 157 | |||
| 158 | typedef cfish_String* | ||
| 159 | (*LUCY_RAMFH_Get_Path_t)(lucy_RAMFileHandle* self); | ||
| 160 | |||
| 161 | typedef lucy_RAMFile* | ||
| 162 | (*LUCY_RAMFH_Get_File_t)(lucy_RAMFileHandle* self); | ||
| 163 | |||
| 164 | |||
| 165 | |||
| 166 | /* Define type-safe wrappers for inert functions of Obj. | ||
| 167 | */ | ||
| 168 | |||
| 169 | static CFISH_INLINE cfish_Class* | ||
| 170 | lucy_RAMFH_get_class(lucy_RAMFileHandle *self) { | ||
| 171 | return cfish_Obj_get_class((cfish_Obj*)self); | ||
| 172 | } | ||
| 173 | |||
| 174 | static CFISH_INLINE cfish_String* | ||
| 175 | lucy_RAMFH_get_class_name(lucy_RAMFileHandle *self) { | ||
| 176 | return cfish_Obj_get_class_name((cfish_Obj*)self); | ||
| 177 | } | ||
| 178 | |||
| 179 | static CFISH_INLINE bool | ||
| 180 | lucy_RAMFH_is_a(lucy_RAMFileHandle *self, cfish_Class *ancestor) { | ||
| 181 | return cfish_Obj_is_a((cfish_Obj*)self, ancestor); | ||
| 182 | } | ||
| 183 | |||
| 184 | |||
| 185 | /* Define the inline functions which implement this class's virtual methods. | ||
| 186 | */ | ||
| 187 | |||
| 188 | extern LUCY_VISIBLE uint32_t LUCY_RAMFH_To_Host_OFFSET; | ||
| 189 | static CFISH_INLINE void* | ||
| 190 | LUCY_RAMFH_To_Host(lucy_RAMFileHandle* self, void* vcache) { | ||
| 191 | const LUCY_RAMFH_To_Host_t method = (LUCY_RAMFH_To_Host_t)cfish_obj_method(self, LUCY_RAMFH_To_Host_OFFSET); | ||
| 192 | return method(self, vcache); | ||
| 193 | } | ||
| 194 | |||
| 195 | extern LUCY_VISIBLE uint32_t LUCY_RAMFH_Clone_OFFSET; | ||
| 196 | static CFISH_INLINE cfish_Obj* | ||
| 197 | LUCY_RAMFH_Clone(lucy_RAMFileHandle* self) { | ||
| 198 | const LUCY_RAMFH_Clone_t method = (LUCY_RAMFH_Clone_t)cfish_obj_method(self, LUCY_RAMFH_Clone_OFFSET); | ||
| 199 | return method(self); | ||
| 200 | } | ||
| 201 | |||
| 202 | extern LUCY_VISIBLE uint32_t LUCY_RAMFH_Equals_OFFSET; | ||
| 203 | static CFISH_INLINE bool | ||
| 204 | LUCY_RAMFH_Equals(lucy_RAMFileHandle* self, cfish_Obj* other) { | ||
| 205 | const LUCY_RAMFH_Equals_t method = (LUCY_RAMFH_Equals_t)cfish_obj_method(self, LUCY_RAMFH_Equals_OFFSET); | ||
| 206 | return method(self, other); | ||
| 207 | } | ||
| 208 | |||
| 209 | extern LUCY_VISIBLE uint32_t LUCY_RAMFH_Compare_To_OFFSET; | ||
| 210 | static CFISH_INLINE int32_t | ||
| 211 | LUCY_RAMFH_Compare_To(lucy_RAMFileHandle* self, cfish_Obj* other) { | ||
| 212 | const LUCY_RAMFH_Compare_To_t method = (LUCY_RAMFH_Compare_To_t)cfish_obj_method(self, LUCY_RAMFH_Compare_To_OFFSET); | ||
| 213 | return method(self, other); | ||
| 214 | } | ||
| 215 | |||
| 216 | extern LUCY_VISIBLE uint32_t LUCY_RAMFH_Destroy_OFFSET; | ||
| 217 | static CFISH_INLINE void | ||
| 218 | LUCY_RAMFH_Destroy(lucy_RAMFileHandle* self) { | ||
| 219 | const LUCY_RAMFH_Destroy_t method = (LUCY_RAMFH_Destroy_t)cfish_obj_method(self, LUCY_RAMFH_Destroy_OFFSET); | ||
| 220 | method(self); | ||
| 221 | } | ||
| 222 | |||
| 223 | extern LUCY_VISIBLE uint32_t LUCY_RAMFH_To_String_OFFSET; | ||
| 224 | static CFISH_INLINE cfish_String* | ||
| 225 | LUCY_RAMFH_To_String(lucy_RAMFileHandle* self) { | ||
| 226 | const LUCY_RAMFH_To_String_t method = (LUCY_RAMFH_To_String_t)cfish_obj_method(self, LUCY_RAMFH_To_String_OFFSET); | ||
| 227 | return method(self); | ||
| 228 | } | ||
| 229 | |||
| 230 | extern LUCY_VISIBLE uint32_t LUCY_RAMFH_Window_OFFSET; | ||
| 231 | static CFISH_INLINE bool | ||
| 232 | LUCY_RAMFH_Window(lucy_RAMFileHandle* self, lucy_FileWindow* window, int64_t offset, int64_t len) { | ||
| 233 | const LUCY_RAMFH_Window_t method = (LUCY_RAMFH_Window_t)cfish_obj_method(self, LUCY_RAMFH_Window_OFFSET); | ||
| 234 | return method(self, window, offset, len); | ||
| 235 | } | ||
| 236 | |||
| 237 | extern LUCY_VISIBLE uint32_t LUCY_RAMFH_Release_Window_OFFSET; | ||
| 238 | static CFISH_INLINE bool | ||
| 239 | LUCY_RAMFH_Release_Window(lucy_RAMFileHandle* self, lucy_FileWindow* window) { | ||
| 240 | const LUCY_RAMFH_Release_Window_t method = (LUCY_RAMFH_Release_Window_t)cfish_obj_method(self, LUCY_RAMFH_Release_Window_OFFSET); | ||
| 241 | return method(self, window); | ||
| 242 | } | ||
| 243 | |||
| 244 | extern LUCY_VISIBLE uint32_t LUCY_RAMFH_Read_OFFSET; | ||
| 245 | static CFISH_INLINE bool | ||
| 246 | LUCY_RAMFH_Read(lucy_RAMFileHandle* self, char* dest, int64_t offset, size_t len) { | ||
| 247 | const LUCY_RAMFH_Read_t method = (LUCY_RAMFH_Read_t)cfish_obj_method(self, LUCY_RAMFH_Read_OFFSET); | ||
| 248 | return method(self, dest, offset, len); | ||
| 249 | } | ||
| 250 | |||
| 251 | extern LUCY_VISIBLE uint32_t LUCY_RAMFH_Write_OFFSET; | ||
| 252 | static CFISH_INLINE bool | ||
| 253 | LUCY_RAMFH_Write(lucy_RAMFileHandle* self, const void* data, size_t len) { | ||
| 254 | const LUCY_RAMFH_Write_t method = (LUCY_RAMFH_Write_t)cfish_obj_method(self, LUCY_RAMFH_Write_OFFSET); | ||
| 255 | return method(self, data, len); | ||
| 256 | } | ||
| 257 | |||
| 258 | extern LUCY_VISIBLE uint32_t LUCY_RAMFH_Length_OFFSET; | ||
| 259 | static CFISH_INLINE int64_t | ||
| 260 | LUCY_RAMFH_Length(lucy_RAMFileHandle* self) { | ||
| 261 | const LUCY_RAMFH_Length_t method = (LUCY_RAMFH_Length_t)cfish_obj_method(self, LUCY_RAMFH_Length_OFFSET); | ||
| 262 | return method(self); | ||
| 263 | } | ||
| 264 | |||
| 265 | extern LUCY_VISIBLE uint32_t LUCY_RAMFH_Grow_OFFSET; | ||
| 266 | static CFISH_INLINE bool | ||
| 267 | LUCY_RAMFH_Grow(lucy_RAMFileHandle* self, int64_t len) { | ||
| 268 | const LUCY_RAMFH_Grow_t method = (LUCY_RAMFH_Grow_t)cfish_obj_method(self, LUCY_RAMFH_Grow_OFFSET); | ||
| 269 | return method(self, len); | ||
| 270 | } | ||
| 271 | |||
| 272 | extern LUCY_VISIBLE uint32_t LUCY_RAMFH_Close_OFFSET; | ||
| 273 | static CFISH_INLINE bool | ||
| 274 | LUCY_RAMFH_Close(lucy_RAMFileHandle* self) { | ||
| 275 | const LUCY_RAMFH_Close_t method = (LUCY_RAMFH_Close_t)cfish_obj_method(self, LUCY_RAMFH_Close_OFFSET); | ||
| 276 | return method(self); | ||
| 277 | } | ||
| 278 | |||
| 279 | extern LUCY_VISIBLE uint32_t LUCY_RAMFH_Set_Path_OFFSET; | ||
| 280 | static CFISH_INLINE void | ||
| 281 | LUCY_RAMFH_Set_Path(lucy_RAMFileHandle* self, cfish_String* path) { | ||
| 282 | const LUCY_RAMFH_Set_Path_t method = (LUCY_RAMFH_Set_Path_t)cfish_obj_method(self, LUCY_RAMFH_Set_Path_OFFSET); | ||
| 283 | method(self, path); | ||
| 284 | } | ||
| 285 | |||
| 286 | extern LUCY_VISIBLE uint32_t LUCY_RAMFH_Get_Path_OFFSET; | ||
| 287 | static CFISH_INLINE cfish_String* | ||
| 288 | LUCY_RAMFH_Get_Path(lucy_RAMFileHandle* self) { | ||
| 289 | const LUCY_RAMFH_Get_Path_t method = (LUCY_RAMFH_Get_Path_t)cfish_obj_method(self, LUCY_RAMFH_Get_Path_OFFSET); | ||
| 290 | return method(self); | ||
| 291 | } | ||
| 292 | |||
| 293 | extern LUCY_VISIBLE uint32_t LUCY_RAMFH_Get_File_OFFSET; | ||
| 294 | static CFISH_INLINE lucy_RAMFile* | ||
| 295 | 69 | LUCY_RAMFH_Get_File(lucy_RAMFileHandle* self) { | |
| 296 | 69 | const LUCY_RAMFH_Get_File_t method = (LUCY_RAMFH_Get_File_t)cfish_obj_method(self, LUCY_RAMFH_Get_File_OFFSET); | |
| 297 | 69 | return method(self); | |
| 298 | } | ||
| 299 | |||
| 300 | |||
| 301 | |||
| 302 | /* Declare callbacks for wrapping host overrides. | ||
| 303 | */ | ||
| 304 | |||
| 305 | #ifdef CFISH_NO_DYNAMIC_OVERRIDES | ||
| 306 | #define Lucy_RAMFH_Get_File_OVERRIDE NULL | ||
| 307 | #else | ||
| 308 | lucy_RAMFile* | ||
| 309 | Lucy_RAMFH_Get_File_OVERRIDE(lucy_RAMFileHandle* self); | ||
| 310 | #endif | ||
| 311 | |||
| 312 | |||
| 313 | /* Define "short names" for this class's symbols. | ||
| 314 | */ | ||
| 315 | |||
| 316 | #ifdef LUCY_USE_SHORT_NAMES | ||
| 317 | #define RAMFileHandle lucy_RAMFileHandle | ||
| 318 | #define RAMFILEHANDLE LUCY_RAMFILEHANDLE | ||
| 319 | #define RAMFH_open lucy_RAMFH_open | ||
| 320 | #define RAMFH_do_open lucy_RAMFH_do_open | ||
| 321 | #define RAMFH_get_class lucy_RAMFH_get_class | ||
| 322 | #define RAMFH_get_class_name lucy_RAMFH_get_class_name | ||
| 323 | #define RAMFH_is_a lucy_RAMFH_is_a | ||
| 324 | #define RAMFH_Get_File_IMP LUCY_RAMFH_Get_File_IMP | ||
| 325 | #define RAMFH_Grow_IMP LUCY_RAMFH_Grow_IMP | ||
| 326 | #define RAMFH_Destroy_IMP LUCY_RAMFH_Destroy_IMP | ||
| 327 | #define RAMFH_Window_IMP LUCY_RAMFH_Window_IMP | ||
| 328 | #define RAMFH_Release_Window_IMP LUCY_RAMFH_Release_Window_IMP | ||
| 329 | #define RAMFH_Read_IMP LUCY_RAMFH_Read_IMP | ||
| 330 | #define RAMFH_Write_IMP LUCY_RAMFH_Write_IMP | ||
| 331 | #define RAMFH_Length_IMP LUCY_RAMFH_Length_IMP | ||
| 332 | #define RAMFH_Close_IMP LUCY_RAMFH_Close_IMP | ||
| 333 | #define RAMFH_To_Host LUCY_RAMFH_To_Host | ||
| 334 | #define RAMFH_To_Host_t LUCY_RAMFH_To_Host_t | ||
| 335 | #define RAMFH_Clone LUCY_RAMFH_Clone | ||
| 336 | #define RAMFH_Clone_t LUCY_RAMFH_Clone_t | ||
| 337 | #define RAMFH_Equals LUCY_RAMFH_Equals | ||
| 338 | #define RAMFH_Equals_t LUCY_RAMFH_Equals_t | ||
| 339 | #define RAMFH_Compare_To LUCY_RAMFH_Compare_To | ||
| 340 | #define RAMFH_Compare_To_t LUCY_RAMFH_Compare_To_t | ||
| 341 | #define RAMFH_Destroy LUCY_RAMFH_Destroy | ||
| 342 | #define RAMFH_Destroy_t LUCY_RAMFH_Destroy_t | ||
| 343 | #define RAMFH_To_String LUCY_RAMFH_To_String | ||
| 344 | #define RAMFH_To_String_t LUCY_RAMFH_To_String_t | ||
| 345 | #define RAMFH_Window LUCY_RAMFH_Window | ||
| 346 | #define RAMFH_Window_t LUCY_RAMFH_Window_t | ||
| 347 | #define RAMFH_Release_Window LUCY_RAMFH_Release_Window | ||
| 348 | #define RAMFH_Release_Window_t LUCY_RAMFH_Release_Window_t | ||
| 349 | #define RAMFH_Read LUCY_RAMFH_Read | ||
| 350 | #define RAMFH_Read_t LUCY_RAMFH_Read_t | ||
| 351 | #define RAMFH_Write LUCY_RAMFH_Write | ||
| 352 | #define RAMFH_Write_t LUCY_RAMFH_Write_t | ||
| 353 | #define RAMFH_Length LUCY_RAMFH_Length | ||
| 354 | #define RAMFH_Length_t LUCY_RAMFH_Length_t | ||
| 355 | #define RAMFH_Grow LUCY_RAMFH_Grow | ||
| 356 | #define RAMFH_Grow_t LUCY_RAMFH_Grow_t | ||
| 357 | #define RAMFH_Close LUCY_RAMFH_Close | ||
| 358 | #define RAMFH_Close_t LUCY_RAMFH_Close_t | ||
| 359 | #define RAMFH_Set_Path LUCY_RAMFH_Set_Path | ||
| 360 | #define RAMFH_Set_Path_t LUCY_RAMFH_Set_Path_t | ||
| 361 | #define RAMFH_Get_Path LUCY_RAMFH_Get_Path | ||
| 362 | #define RAMFH_Get_Path_t LUCY_RAMFH_Get_Path_t | ||
| 363 | #define RAMFH_Get_File LUCY_RAMFH_Get_File | ||
| 364 | #define RAMFH_Get_File_t LUCY_RAMFH_Get_File_t | ||
| 365 | #endif /* LUCY_USE_SHORT_NAMES */ | ||
| 366 | |||
| 367 | |||
| 368 | |||
| 369 | |||
| 370 | |||
| 371 | #ifdef __cplusplus | ||
| 372 | } | ||
| 373 | #endif | ||
| 374 | |||
| 375 | #endif /* H_LUCY_STORE_RAMFILEHANDLE */ | ||
| 376 | |||
| 377 | |||
| 378 | |||
| 379 |