libsheepy
libsheepyCSmallDouble.h
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2023 Remy Noulin
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in all
13 // copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 // SOFTWARE.
22 #pragma once
23 
24 // Class smallDouble
25 typedef struct smallDouble smallDoublet;
26 
32 #define helpTextSmallDouble "TODO smallDouble help brief, class description /*, definitions,*/ methods, examples"
33 
34 // for object inheriting smallDouble, cast to smallDouble to be able to use this class functions and generics
35 #define cDo(self) ( (smallDoublet*) self )
36 
37 typedef void (*freeSmallDoubleFt) (smallDoublet *self);
38 typedef void (*terminateSmallDoubleFt) (smallDoublet **self);
39 typedef char* (*toStringSmallDoubleFt) (smallDoublet *self);
40 typedef smallDoublet* (*duplicateSmallDoubleFt) (smallDoublet *self);
41 
42 // smallDouble functions
49 typedef void (*smashSmallDoubleFt) (smallDoublet **self);
50 
54 typedef void (*finishSmallDoubleFt) (smallDoublet **self);
55 
56 typedef const char* (*helpSmallDoubleFt) (smallDoublet *self);
57 
64 typedef double (*getSmallDoubleFt) (smallDoublet *self);
65 
72 typedef smallDoublet* (*setSmallDoubleFt) (smallDoublet *self, double value);
73 
74 typedef smallDoublet* (*setBoolSmallDoubleFt)(smallDoublet* self, bool p2);
75 typedef smallDoublet* (*setSmallDoubleFt)(smallDoublet* self, double p2);
76 typedef smallDoublet* (*setInt64SmallDoubleFt)(smallDoublet* self, int64_t p2);
77 typedef smallDoublet* (*setInt32SmallDoubleFt)(smallDoublet* self, int32_t p2);
78 typedef smallDoublet* (*setUint32SmallDoubleFt)(smallDoublet* self, uint32_t p2);
79 typedef smallDoublet* (*setUint64SmallDoubleFt)(smallDoublet* self, uint64_t p2);
80 typedef smallDoublet* (*setSSmallDoubleFt)(smallDoublet* self, const char* p2);
81 typedef smallDoublet* (*setSmallBoolSmallDoubleFt)(smallDoublet* self, smallBoolt* p2);
82 typedef smallDoublet* (*setSmallDoubleSmallDoubleFt)(smallDoublet* self, smallDoublet* p2);
83 typedef smallDoublet* (*setSmallIntSmallDoubleFt)(smallDoublet* self, smallIntt* p2);
84 typedef smallDoublet* (*setSmallJsonSmallDoubleFt)(smallDoublet* self, smallJsont* p2);
85 typedef smallDoublet* (*setSmallStringSmallDoubleFt)(smallDoublet* self, smallStringt* p2);
86 
93 typedef double* (*getPSmallDoubleFt) (smallDoublet *self);
94 
95 typedef bool (*equalSmallDoubleChaFt)(smallDoublet* self, char p2);
96 typedef bool (*equalSmallDoubleCharFt)(smallDoublet* self, const char * p2);
97 typedef bool (*equalSmallDoubleBaseFt)(smallDoublet* self, baset* p2);
98 typedef bool (*equalSmallDoubleBoolFt)(smallDoublet* self, bool p2);
99 typedef bool (*equalSmallDoubleDoubleFt)(smallDoublet* self, double p2);
100 typedef bool (*equalSmallDoubleInt64Ft)(smallDoublet* self, int64_t p2);
101 typedef bool (*equalSmallDoubleInt32Ft)(smallDoublet* self, int32_t p2);
102 typedef bool (*equalSmallDoubleUint32Ft)(smallDoublet* self, uint32_t p2);
103 typedef bool (*equalSmallDoubleUint64Ft)(smallDoublet* self, uint64_t p2);
106 typedef bool (*equalSmallDoubleFt)(smallDoublet* self, smallDoublet* p2);
110 
120 typedef smallDoublet* (*readFileSmallDoubleFt)(smallDoublet *self, const char *filePath);
121 typedef smallDoublet* (*readFileSmallJsonSmallDoubleFt)(smallDoublet *self, smallJsont *filePath);
122 typedef smallDoublet* (*readFileSmallStringSmallDoubleFt)(smallDoublet *self, smallStringt *filePath);
123 typedef smallDoublet* (*readStreamSmallDoubleFt)(smallDoublet *self, FILE *fp);
124 
134 typedef int (*writeFileSmallDoubleFt) (smallDoublet *self, const char *filePath);
135 typedef int (*writeFileSmallJsonSmallDoubleFt) (smallDoublet *self, smallJsont *filePath);
137 typedef int (*writeStreamSmallDoubleFt) (smallDoublet *self, FILE *fp);
138 
148 typedef int (*appendFileSmallDoubleFt)(smallDoublet *self, const char *filePath);
150 
168 #define SMALLDOUBLEFUNCTIONST \
169  helpSmallDoubleFt help;\
170  getSmallDoubleFt get;\
171  setSmallDoubleFt set;\
172  setBoolSmallDoubleFt setBool;\
173  setInt64SmallDoubleFt setInt64;\
174  setInt32SmallDoubleFt setInt32;\
175  setUint32SmallDoubleFt setUint32;\
176  setUint64SmallDoubleFt setUint64;\
177  setSSmallDoubleFt setS;\
178  setSmallBoolSmallDoubleFt setSmallBool;\
179  setSmallDoubleSmallDoubleFt setSmallDouble;\
180  setSmallIntSmallDoubleFt setSmallInt;\
181  setSmallJsonSmallDoubleFt setSmallJson;\
182  setSmallStringSmallDoubleFt setSmallString;\
183  getPSmallDoubleFt getP;\
184  equalSmallDoubleChaFt equalCha;\
185  equalSmallDoubleCharFt equalChar;\
186  equalSmallDoubleBaseFt equalBase;\
187  equalSmallDoubleBoolFt equalBool;\
188  equalSmallDoubleDoubleFt equalDouble;\
189  equalSmallDoubleInt64Ft equalInt64;\
190  equalSmallDoubleInt32Ft equalInt32;\
191  equalSmallDoubleUint32Ft equalUint32;\
192  equalSmallDoubleUint64Ft equalUint64;\
193  equalSmallDoubleSmallBoolFt equalSmallBool;\
194  equalSmallDoubleSmallBytesFt equalSmallBytes;\
195  equalSmallDoubleFt equal;\
196  equalSmallDoubleSmallIntFt equalSmallInt;\
197  equalSmallDoubleSmallJsonFt equalSmallJson;\
198  equalSmallDoubleSmallStringFt equalSmallString;\
199  readFileSmallDoubleFt readFile;\
200  readFileSmallJsonSmallDoubleFt readFileSmallJson;\
201  readFileSmallStringSmallDoubleFt readFileSmallString;\
202  readStreamSmallDoubleFt readStream;\
203  writeFileSmallDoubleFt writeFile;\
204  writeFileSmallJsonSmallDoubleFt writeFileSmallJson;\
205  writeFileSmallStringSmallDoubleFt writeFileSmallString;\
206  writeStreamSmallDoubleFt writeStream;\
207  appendFileSmallDoubleFt appendFile;\
208  appendFileSmallStringSmallDoubleFt appendFileSmallString
209 
210 typedef struct {
219 
223 struct smallDouble {
224  const char *type;
226 
228 };
229 
230 // smallDouble
231 
232 #define createSmallDouble(obj) ;smallDoublet obj; initiateSmallDouble(&obj)
233 #define createAllocateSmallDouble(obj) ;smallDoublet *obj; initiateAllocateSmallDouble(&obj)
234 
237 void finalizeRecycleSmallDouble(void *arg UNUSED);
238 void finalizeSmallDouble(void);
239 
240 // initialize class methods, call registerMethodsSmallDouble from classes inheriting this class
242 
244 
245 // terminate smallDoublet val when it is out of scope
247 
248 // free smallDoublet local val when it is out of scope
250 
251 // free smallDoublet val when it is out of scope
253 
254 // finish smallDoublet val when it is out of scope
256 
260 #define cleanSmallDoubleP(name) smallDoublet *name CLEANUP(cleanUpSmallDoubleTerminateG)
261 
265 #define cleanAllocateSmallDouble(obj) ;cleanSmallDoubleP(obj); initiateAllocateSmallDouble(&obj)
266 
270 #define cleanSmallDouble(name) smallDoublet name CLEANUP(cleanUpSmallDoubleFreeLocalG); initiateSmallDouble(&name)
271 
275 #define cleanFreeSmallDouble(name) smallDoublet *name CLEANUP(cleanUpSmallDoubleFreeG)
276 
280 #define cleanFinishSmallDoubleP(name) smallDoublet *name CLEANUP(cleanUpSmallDoubleFinishG)
281 
283 
284 void freeSmallDoubleG (smallDoublet *self);
285 
286 double getDoubleSmallDoubleG (smallDoublet *self, double retType UNUSED, int64_t index UNUSED);
287 
289 smallDoublet* setSmallDoubleG (smallDoublet* self, double p2);
290 smallDoublet* setInt64SmallDoubleG (smallDoublet* self, int64_t p2);
291 smallDoublet* setInt32SmallDoubleG (smallDoublet* self, int32_t p2);
292 smallDoublet* setUint32SmallDoubleG (smallDoublet* self, uint32_t p2);
293 smallDoublet* setUint64SmallDoubleG (smallDoublet* self, uint64_t p2);
294 smallDoublet* setSSmallDoubleG (smallDoublet* self, const char* p2);
300 
301 double* getDoublePSmallDoubleG (smallDoublet *self, double* retType UNUSED, int64_t index UNUSED);
302 
303 bool equalSmallDoubleChaG (smallDoublet* self, char p2);
304 bool equalSmallDoubleCharG (smallDoublet* self, const char * p2);
305 bool equalSmallDoubleBaseG (smallDoublet* self, baset* p2);
306 bool equalSmallDoubleBoolG (smallDoublet* self, bool p2);
307 bool equalSmallDoubleDoubleG (smallDoublet* self, double p2);
308 bool equalSmallDoubleInt64G (smallDoublet* self, int64_t p2);
309 bool equalSmallDoubleInt32G (smallDoublet* self, int32_t p2);
310 bool equalSmallDoubleUint32G (smallDoublet* self, uint32_t p2);
311 bool equalSmallDoubleUint64G (smallDoublet* self, uint64_t p2);
318 
319 smallDoublet* readFileSmallDoubleG (smallDoublet *self, const char *filePath);
323 int writeFileSmallDoubleG (smallDoublet *self, const char *filePath);
326 int writeStreamSmallDoubleG (smallDoublet *self, FILE *fp);
327 int appendFileSmallDoubleFG (smallDoublet *self, const char *filePath); //TODO remove F - oGMacros generates a macro making the compilation fail
329 // end class smallDouble
int writeStreamSmallDoubleG(smallDoublet *self, FILE *fp)
bool equalSmallDoubleBoolG(smallDoublet *self, bool p2)
bool equalSmallDoubleFG(smallDoublet *self, smallDoublet *p2)
bool equalSmallDoubleCharG(smallDoublet *self, const char *p2)
double(* getSmallDoubleFt)(smallDoublet *self)
get double
int writeFileSmallDoubleG(smallDoublet *self, const char *filePath)
int(* appendFileSmallDoubleFt)(smallDoublet *self, const char *filePath)
append double to filePath
bool equalSmallDoubleUint32G(smallDoublet *self, uint32_t p2)
void initiateAllocateSmallDouble(smallDoublet **self)
void(* smashSmallDoubleFt)(smallDoublet **self)
free self but not the smallDouble buffer
smallDoublet * duplicateSmallDoubleG(smallDoublet *self)
toStringSmallDoubleFt toString
duplicateSmallDoubleFt duplicate
int(* writeFileSmallJsonSmallDoubleFt)(smallDoublet *self, smallJsont *filePath)
void(* finishSmallDoubleFt)(smallDoublet **self)
free container
bool equalSmallDoubleChaG(smallDoublet *self, char p2)
smallDoublet *(* duplicateSmallDoubleFt)(smallDoublet *self)
bool equalSmallDoubleSmallIntG(smallDoublet *self, smallIntt *p2)
bool(* equalSmallDoubleChaFt)(smallDoublet *self, char p2)
char *(* toStringSmallDoubleFt)(smallDoublet *self)
void cleanUpSmallDoubleTerminateG(smallDoublet **val)
int(* writeFileSmallDoubleFt)(smallDoublet *self, const char *filePath)
write double to file
double getDoubleSmallDoubleG(smallDoublet *self, double retType UNUSED, int64_t index UNUSED)
bool(* equalSmallDoubleUint64Ft)(smallDoublet *self, uint64_t p2)
bool(* equalSmallDoubleSmallBytesFt)(smallDoublet *self, smallBytest *p2)
smallDoublet * setSSmallDoubleG(smallDoublet *self, const char *p2)
bool equalSmallDoubleUint64G(smallDoublet *self, uint64_t p2)
smallDoublet * setBoolSmallDoubleG(smallDoublet *self, bool p2)
void(* terminateSmallDoubleFt)(smallDoublet **self)
smallDoublet * setSmallIntSmallDoubleG(smallDoublet *self, smallIntt *p2)
bool equalSmallDoubleInt32G(smallDoublet *self, int32_t p2)
bool(* equalSmallDoubleBoolFt)(smallDoublet *self, bool p2)
int(* writeStreamSmallDoubleFt)(smallDoublet *self, FILE *fp)
void freeSmallDoubleG(smallDoublet *self)
smallDoublet * setSmallBoolSmallDoubleG(smallDoublet *self, smallBoolt *p2)
int appendFileSmallStringSmallDoubleG(smallDoublet *self, smallStringt *filePath)
void finalizeRecycleSmallDouble(void *arg UNUSED)
bool equalSmallDoubleSmallStringG(smallDoublet *self, smallStringt *p2)
int(* writeFileSmallStringSmallDoubleFt)(smallDoublet *self, smallStringt *filePath)
int(* appendFileSmallStringSmallDoubleFt)(smallDoublet *self, smallStringt *filePath)
int appendFileSmallDoubleFG(smallDoublet *self, const char *filePath)
bool equalSmallDoubleSmallBytesG(smallDoublet *self, smallBytest *p2)
END_TEST FILE * fp
bool(* equalSmallDoubleInt32Ft)(smallDoublet *self, int32_t p2)
smallDoublet * setInt64SmallDoubleG(smallDoublet *self, int64_t p2)
smallDoublet * setSmallStringSmallDoubleG(smallDoublet *self, smallStringt *p2)
int writeFileSmallStringSmallDoubleG(smallDoublet *self, smallStringt *filePath)
bool(* equalSmallDoubleInt64Ft)(smallDoublet *self, int64_t p2)
void cleanUpSmallDoubleFreeG(smallDoublet **val)
bool(* equalSmallDoubleFt)(smallDoublet *self, smallDoublet *p2)
smallDoublet * setUint32SmallDoubleG(smallDoublet *self, uint32_t p2)
void finalizeSmallDouble(void)
finishSmallDoubleFt finish
bool(* equalSmallDoubleSmallStringFt)(smallDoublet *self, smallStringt *p2)
smallDoublet * setSmallDoubleG(smallDoublet *self, double p2)
void cleanUpSmallDoubleFinishG(smallDoublet **val)
bool(* equalSmallDoubleSmallBoolFt)(smallDoublet *self, smallBoolt *p2)
void initiateSmallDouble(smallDoublet *self)
bool equalSmallDoubleSmallBoolG(smallDoublet *self, smallBoolt *p2)
void cleanUpSmallDoubleFreeLocalG(smallDoublet *val)
bool(* equalSmallDoubleUint32Ft)(smallDoublet *self, uint32_t p2)
smallDoublet * readFileSmallStringSmallDoubleG(smallDoublet *self, smallStringt *filePath)
in value value
void registerMethodsSmallDouble(smallDoubleFunctionst *f)
smallDoublet * readStreamSmallDoubleG(smallDoublet *self, FILE *fp)
double * getDoublePSmallDoubleG(smallDoublet *self, double *retType UNUSED, int64_t index UNUSED)
smallDoublet * allocSmallDouble(double value)
#define UNUSED
Definition: libsheepy.h:8195
bool equalSmallDoubleBaseG(smallDoublet *self, baset *p2)
smallDoublet * readFileSmallJsonSmallDoubleG(smallDoublet *self, smallJsont *filePath)
smallDoublet * setUint64SmallDoubleG(smallDoublet *self, uint64_t p2)
smallDoublet * setSmallJsonSmallDoubleG(smallDoublet *self, smallJsont *p2)
bool(* equalSmallDoubleSmallJsonFt)(smallDoublet *self, smallJsont *p2)
bool(* equalSmallDoubleSmallIntFt)(smallDoublet *self, smallIntt *p2)
terminateSmallDoubleFt terminate
base class
int writeFileSmallJsonSmallDoubleG(smallDoublet *self, smallJsont *filePath)
void(* freeSmallDoubleFt)(smallDoublet *self)
bool(* equalSmallDoubleDoubleFt)(smallDoublet *self, double p2)
small double
smallDoublet * setInt32SmallDoubleG(smallDoublet *self, int32_t p2)
bool(* equalSmallDoubleCharFt)(smallDoublet *self, const char *p2)
smallDoublet * readFileSmallDoubleG(smallDoublet *self, const char *filePath)
bool(* equalSmallDoubleBaseFt)(smallDoublet *self, baset *p2)
bool equalSmallDoubleInt64G(smallDoublet *self, int64_t p2)
bool equalSmallDoubleSmallJsonG(smallDoublet *self, smallJsont *p2)
smallDoublet * setSmallDoubleSmallDoubleG(smallDoublet *self, smallDoublet *p2)
smallDoubleFunctionst * f
bool equalSmallDoubleDoubleG(smallDoublet *self, double p2)