design_pattern_for_c  V 1.00
flyweight.h
Go to the documentation of this file.
1 
5 #ifndef FLYWEIGHT_H_
6 #define FLYWEIGHT_H_
7 
8 #include <stddef.h>
9 #include "dp_util.h"
10 
22  void (*constructor)(void *this, size_t size, void *input_parameter);
33  int (*equall_operand)(void *this, size_t size, void *input_parameter);
41  int (*setter)(void *this, size_t size, void *input_parameter);
48  void (*destructor)(void *this);
49 };
50 
53 
57 struct flyweight_factory_t;
58 
61 
73 
81 void * flyweight_get(FlyweightFactory this, void * constructor_parameter);
82 
90 int flyweight_set(FlyweightFactory this, void * constructor_parameter, void * data, int (*setter)(void *this, size_t size, void *input_parameter));
91 
98 #endif/*FLYWEIGHT_*/
struct flyweight_factory_t * FlyweightFactory
FlyweightFactory definition.
Definition: flyweight.h:60
Utility headers
void flyweight_factory_free(FlyweightFactory this)
clear class handle
Definition: flyweight.c:293
void * flyweight_get(FlyweightFactory this, void *constructor_parameter)
getter
Definition: flyweight.c:244
size_t class_size
methods
Definition: flyweight.c:44
void(* destructor)(void *this)
destructor
Definition: flyweight.h:48
int flyweight_set(FlyweightFactory this, void *constructor_parameter, void *data, int(*setter)(void *this, size_t size, void *input_parameter))
setter
Definition: flyweight.c:264
FlyweightFactory member definition, defined in flyweight.c.
Definition: flyweight.c:41
struct flyweight_methods_t * FlyweightMethodsIF
Definition: flyweight.h:52
int(* setter)(void *this, size_t size, void *input_parameter)
setter
Definition: flyweight.h:41
void(* constructor)(void *this, size_t size, void *input_parameter)
constructor of class
Definition: flyweight.h:22
FlyweightFactory flyweight_factory_new(size_t class_size, int is_threadsafe, FlyweightMethodsIF methods)
define class for flyweight
Definition: flyweight.c:212
flyweight_methods_t methods
Definition: flyweight.c:43
int(* equall_operand)(void *this, size_t size, void *input_parameter)
operand ==
Definition: flyweight.h:33
Flyweight methods interface definition, to set flyweight_factory_new.
Definition: flyweight.h:14