From 1f311e887c19fc247f1bc64666dd63dc99451abd Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 9 May 2014 17:17:42 +0100 Subject: [PATCH] Add missing *.class code template files --- src/accessor.class | 93 ++++++++++++++++++++++++++++++++++++++++++++ src/action.class | 45 +++++++++++++++++++++ src/box.class | 34 ++++++++++++++++ src/dumper.class | 45 +++++++++++++++++++++ src/expression.class | 55 ++++++++++++++++++++++++++ src/iterator.class | 41 +++++++++++++++++++ src/nearest.class | 34 ++++++++++++++++ 7 files changed, 347 insertions(+) create mode 100644 src/accessor.class create mode 100644 src/action.class create mode 100644 src/box.class create mode 100644 src/dumper.class create mode 100644 src/expression.class create mode 100644 src/iterator.class create mode 100644 src/nearest.class diff --git a/src/accessor.class b/src/accessor.class new file mode 100644 index 000000000..d447e40a6 --- /dev/null +++ b/src/accessor.class @@ -0,0 +1,93 @@ +static grib_section* sub_section(grib_accessor* a); +static int get_native_type(grib_accessor*); +static int pack_missing(grib_accessor*); +static int is_missing(grib_accessor*); +static int pack_bytes(grib_accessor*,const unsigned char*, size_t *len); +static int pack_double(grib_accessor*, const double* val,size_t *len); +static int pack_long(grib_accessor*, const long* val,size_t *len); +static int pack_string(grib_accessor*, const char*, size_t *len); +static int pack_expression(grib_accessor*, grib_expression*); +static int unpack_bytes (grib_accessor*,unsigned char*, size_t *len); +static int unpack_double(grib_accessor*, double* val,size_t *len); +static int unpack_long(grib_accessor*, long* val,size_t *len); +static int unpack_string (grib_accessor*, char*, size_t *len); +static size_t string_length(grib_accessor*); +static long byte_count(grib_accessor*); +static long byte_offset(grib_accessor*); +static long next_offset(grib_accessor*); +static int value_count(grib_accessor*,long*); +static void destroy(grib_context*,grib_accessor*); +static void dump(grib_accessor*, grib_dumper*); +static void init(grib_accessor*,const long, grib_arguments* ); +static void post_init(grib_accessor*); +static void init_class(grib_accessor_class*); +static int notify_change(grib_accessor*,grib_accessor*); +static void update_size(grib_accessor*,size_t); +static size_t preferred_size(grib_accessor*,int); +static void resize(grib_accessor*,size_t); +static int nearest_smaller_value (grib_accessor*, double,double*); +static grib_accessor* next(grib_accessor*, int); +static int compare(grib_accessor*, grib_accessor*); +static int unpack_double_element(grib_accessor*,size_t i, double* val); +static int unpack_double_subarray(grib_accessor*, double* val,size_t start,size_t len); +static int clear(grib_accessor*); + +typedef struct grib_accessor_NAME { + grib_accessor att; +MEMBERS +} grib_accessor_NAME; + +extern grib_accessor_class* SUPER; + +static grib_accessor_class _grib_accessor_class_NAME = { + &SUPER, /* super */ + "NAME", /* name */ + sizeof(grib_accessor_NAME), /* size */ + 0, /* inited */ + &init_class, /* init_class */ + &init, /* init */ + &post_init, /* post_init */ + &destroy, /* free mem */ + &dump, /* describes himself */ + &next_offset, /* get length of section */ + &string_length, /* get length of string */ + &value_count, /* get number of values */ + &byte_count, /* get number of bytes */ + &byte_offset, /* get offset to bytes */ + &get_native_type, /* get native type */ + &sub_section, /* get sub_section */ + &pack_missing, /* grib_pack procedures long */ + &is_missing, /* grib_pack procedures long */ + &pack_long, /* grib_pack procedures long */ + &unpack_long, /* grib_unpack procedures long */ + &pack_double, /* grib_pack procedures double */ + &unpack_double, /* grib_unpack procedures double */ + &pack_string, /* grib_pack procedures string */ + &unpack_string, /* grib_unpack procedures string */ + &pack_bytes, /* grib_pack procedures bytes */ + &unpack_bytes, /* grib_unpack procedures bytes */ + &pack_expression, /* pack_expression */ + ¬ify_change, /* notify_change */ + &update_size, /* update_size */ + &preferred_size, /* preferred_size */ + &resize, /* resize */ + &nearest_smaller_value, /* nearest_smaller_value */ + &next, /* next accessor */ + &compare, /* compare vs. another accessor */ + &unpack_double_element, /* unpack only ith value */ + &unpack_double_subarray, /* unpack a subarray */ + &clear, /* clear */ +}; + + +grib_accessor_class* grib_accessor_class_NAME = &_grib_accessor_class_NAME; + +ADD_TO_FILE grib_accessor_class.h extern grib_accessor_class* grib_accessor_class_NAME; +ADD_TO_FILE grib_accessor_factory.h { "NAME", &grib_accessor_class_NAME, }, +ADD_TO_FILE grib_accessor_factory_hash_list NAME, &grib_accessor_class_NAME + +static void init_class(grib_accessor_class* c) +{ +INIT +} + diff --git a/src/action.class b/src/action.class new file mode 100644 index 000000000..c7716ae96 --- /dev/null +++ b/src/action.class @@ -0,0 +1,45 @@ +static void init_class (grib_action_class*); +static void init (grib_action* d); +static void dump (grib_action* d, FILE*,int); +static void xref (grib_action* d, FILE* f,const char* path); +static void compile (grib_action* a, grib_compiler* compiler); +static void destroy (grib_context*,grib_action*); +static int create_accessor(grib_section*,grib_action*,grib_loader*); +static int notify_change(grib_action* a, grib_accessor* observer,grib_accessor* observed); +static grib_action* reparse(grib_action* a,grib_accessor* acc,int *doit); +static int execute(grib_action* a,grib_handle* h); + + +typedef struct grib_action_NAME { + grib_action act; +MEMBERS +} grib_action_NAME; + +extern grib_action_class* SUPER; + +static grib_action_class _grib_action_class_NAME = { + &SUPER, /* super */ + "action_class_NAME", /* name */ + sizeof(grib_action_NAME), /* size */ + 0, /* inited */ + &init_class, /* init_class */ + &init, /* init */ + &destroy, /* destroy */ + + &dump, /* dump */ + &xref, /* xref */ + + &create_accessor, /* create_accessor*/ + + ¬ify_change, /* notify_change */ + &reparse, /* reparse */ + &execute, /* execute */ + &compile, /* compile */ +}; + +grib_action_class* grib_action_class_NAME = &_grib_action_class_NAME; + +static void init_class(grib_action_class* c) +{ +INIT +} diff --git a/src/box.class b/src/box.class new file mode 100644 index 000000000..23460a8c1 --- /dev/null +++ b/src/box.class @@ -0,0 +1,34 @@ + +static void init_class (grib_box_class*); + +static int init (grib_box* box,grib_handle* h,grib_arguments* args); +static grib_points* get_points(grib_box* box, double north, double west, double south,double east,int *err); +static int destroy (grib_box* box); + +typedef struct grib_box_NAME{ + grib_box box; + MEMBERS +} grib_box_NAME; + +extern grib_box_class* SUPER; + +static grib_box_class _grib_box_class_NAME = { + &SUPER, /* super */ + "NAME", /* name */ + sizeof(grib_box_NAME), /* size of instance */ + 0, /* inited */ + &init_class, /* init_class */ + &init, /* constructor */ + &destroy, /* destructor */ + &get_points, /* get points */ +}; + +grib_box_class* grib_box_class_NAME = &_grib_box_class_NAME; + +ADD_TO_FILE grib_box_class.h extern grib_box_class* grib_box_class_NAME; +ADD_TO_FILE grib_box_factory.h { "NAME", &grib_box_class_NAME, }, + +static void init_class(grib_box_class* c) +{ +INIT +} diff --git a/src/dumper.class b/src/dumper.class new file mode 100644 index 000000000..8710f19d3 --- /dev/null +++ b/src/dumper.class @@ -0,0 +1,45 @@ +static void init_class (grib_dumper_class*); +static int init (grib_dumper* d); +static int destroy (grib_dumper*); +static void dump_long (grib_dumper* d, grib_accessor* a,const char* comment); +static void dump_bits (grib_dumper* d, grib_accessor* a,const char* comment); +static void dump_double (grib_dumper* d, grib_accessor* a,const char* comment); +static void dump_string (grib_dumper* d, grib_accessor* a,const char* comment); +static void dump_bytes (grib_dumper* d, grib_accessor* a,const char* comment); +static void dump_values (grib_dumper* d, grib_accessor* a); +static void dump_label (grib_dumper* d, grib_accessor* a,const char* comment); +static void dump_section (grib_dumper* d, grib_accessor* a,grib_block_of_accessors* block); +static void header (grib_dumper*,grib_handle*); +static void footer (grib_dumper*,grib_handle*); + +typedef struct grib_dumper_NAME { + grib_dumper dumper; +MEMBERS +} grib_dumper_NAME; + +extern grib_dumper_class* SUPER; + +static grib_dumper_class _grib_dumper_class_NAME = { + &SUPER, /* super */ + "NAME", /* name */ + sizeof(grib_dumper_NAME), /* size */ + 0, /* inited */ + &init_class, /* init_class */ + &init, /* init */ + &destroy, /* free mem */ + &dump_long, /* dump long */ + &dump_double, /* dump double */ + &dump_string, /* dump string */ + &dump_label, /* dump labels */ + &dump_bytes, /* dump bytes */ + &dump_bits, /* dump bits */ + &dump_section, /* dump section */ + &dump_values, /* dump values */ + &header, /* header */ + &footer, /* footer */ +}; + +grib_dumper_class* grib_dumper_class_NAME = &_grib_dumper_class_NAME; + +ADD_TO_FILE grib_dumper_class.h extern grib_dumper_class* grib_dumper_class_NAME; +ADD_TO_FILE grib_dumper_factory.h { "NAME", &grib_dumper_class_NAME, }, diff --git a/src/expression.class b/src/expression.class new file mode 100644 index 000000000..378155b40 --- /dev/null +++ b/src/expression.class @@ -0,0 +1,55 @@ +typedef const char* string; /* to keep make_class.pl happy */ + + +static void init_class (grib_expression_class*); + +static void init(grib_expression* e); +static void destroy(grib_context*,grib_expression* e); + +static void print(grib_context*,grib_expression*,grib_handle*); +static void compile(grib_expression*,grib_compiler*); +static void add_dependency(grib_expression* e, grib_accessor* observer); +static string get_name(grib_expression* e); + +static int native_type(grib_expression*,grib_handle*); + +static int evaluate_long(grib_expression*,grib_handle*,long*); +static int evaluate_double(grib_expression*,grib_handle*,double*); +static string evaluate_string(grib_expression*,grib_handle*,char*,size_t*,int*); + +typedef struct grib_expression_NAME{ + grib_expression base; + MEMBERS +} grib_expression_NAME; + +extern grib_expression_class* SUPER; + +static grib_expression_class _grib_expression_class_NAME = { + &SUPER, /* super */ + "NAME", /* name */ + sizeof(grib_expression_NAME),/* size of instance */ + 0, /* inited */ + &init_class, /* init_class */ + &init, /* constructor */ + &destroy, /* destructor */ + &print, + &compile, + &add_dependency, + + &native_type, + &get_name, + + &evaluate_long, + &evaluate_double, + &evaluate_string, +}; + +grib_expression_class* grib_expression_class_NAME = &_grib_expression_class_NAME; + +ADD_TO_FILE grib_expression_class.h extern grib_expression_class* grib_expression_class_NAME; +ADD_TO_FILE grib_expression_factory.h { "NAME", &grib_expression_class_NAME, }, + +static void init_class(grib_expression_class* c) +{ +INIT +} diff --git a/src/iterator.class b/src/iterator.class new file mode 100644 index 000000000..95e2bf0ca --- /dev/null +++ b/src/iterator.class @@ -0,0 +1,41 @@ + +static void init_class (grib_iterator_class*); + +static int init (grib_iterator* i,grib_handle*,grib_arguments*); +static int next (grib_iterator* i, double *lat, double *lon, double *val); +static int previous (grib_iterator* ei, double *lat, double *lon, double *val); +static int destroy (grib_iterator* i); +static int reset (grib_iterator* i); +static long has_next (grib_iterator* i); + + +typedef struct grib_iterator_NAME{ + grib_iterator it; + MEMBERS +} grib_iterator_NAME; + +extern grib_iterator_class* SUPER; + +static grib_iterator_class _grib_iterator_class_NAME = { + &SUPER, /* super */ + "NAME", /* name */ + sizeof(grib_iterator_NAME),/* size of instance */ + 0, /* inited */ + &init_class, /* init_class */ + &init, /* constructor */ + &destroy, /* destructor */ + &next, /* Next Value */ + &previous, /* Previous Value */ + &reset, /* Reset the counter */ + &has_next, /* has next values */ +}; + +grib_iterator_class* grib_iterator_class_NAME = &_grib_iterator_class_NAME; + +ADD_TO_FILE grib_iterator_class.h extern grib_iterator_class* grib_iterator_class_NAME; +ADD_TO_FILE grib_iterator_factory.h { "NAME", &grib_iterator_class_NAME, }, + +static void init_class(grib_iterator_class* c) +{ +INIT +} diff --git a/src/nearest.class b/src/nearest.class new file mode 100644 index 000000000..fe53fce16 --- /dev/null +++ b/src/nearest.class @@ -0,0 +1,34 @@ + +static void init_class (grib_nearest_class*); + +static int init (grib_nearest* nearest,grib_handle* h,grib_arguments* args); +static int find(grib_nearest* nearest, grib_handle* h,double inlat, double inlon, unsigned long flags, double* outlats,double* outlons, double *values,double *distances, int *indexes,size_t *len); +static int destroy (grib_nearest* nearest); + +typedef struct grib_nearest_NAME{ + grib_nearest nearest; + MEMBERS +} grib_nearest_NAME; + +extern grib_nearest_class* SUPER; + +static grib_nearest_class _grib_nearest_class_NAME = { + &SUPER, /* super */ + "NAME", /* name */ + sizeof(grib_nearest_NAME), /* size of instance */ + 0, /* inited */ + &init_class, /* init_class */ + &init, /* constructor */ + &destroy, /* destructor */ + &find, /* find nearest */ +}; + +grib_nearest_class* grib_nearest_class_NAME = &_grib_nearest_class_NAME; + +ADD_TO_FILE grib_nearest_class.h extern grib_nearest_class* grib_nearest_class_NAME; +ADD_TO_FILE grib_nearest_factory.h { "NAME", &grib_nearest_class_NAME, }, + +static void init_class(grib_nearest_class* c) +{ +INIT +}