rasdaman complete source
tilecompression.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 /
39 #ifndef _R_TILE_COMPRESSION_HH_
40 #define _R_TILE_COMPRESSION_HH_
41 
42 
43 #include <stdio.h>
44 
45 #include "raslib/error.hh"
46 #include "raslib/minterval.hh"
47 #include "raslib/mddtypes.hh"
48 #include "raslib/odmgtypes.hh"
49 #include "raslib/storageman.hh"
50 
51 
52 class r_Base_Type;
53 class r_Parse_Params;
54 class RMTimer;
55 
56 
57 //@ManMemo: Module: {\bf compression}
58 
59 /*@Doc:
60  Abstract base class for compression / decompression functionality
61  of tiles, to be executed on client or server. r_Tile_Compression is
62  used by both compressing and uncompressing classes.
63  */
64 
66 {
67 public:
70 
71  r_Tile_Compression( const r_Minterval &dom, const r_Base_Type *type );
73  virtual ~r_Tile_Compression( void );
74 
76  static r_Tile_Compression *create( r_Data_Format fmt, const r_Minterval &dom, const r_Base_Type *type ) throw(r_Error);
77  static r_Tile_Compression *create( const char *name, const r_Minterval &dom, const r_Base_Type *type ) throw(r_Error);
78  static r_Data_Format get_format_from_name( const char *name ) throw(r_Error);
79  static const char *get_format_info( unsigned int number, r_Data_Format &fmt );
80  virtual void *compress( const void *data, r_ULong &size, const char *options = NULL ) = 0;
81  virtual void *decompress( const void *data, r_ULong size, const char *options = NULL ) = 0;
82  virtual r_Data_Format get_decomp_format( void ) const;
83  virtual bool converts_endianness( void ) const;
84  virtual const char *get_name( void ) const = 0;
85  virtual r_Data_Format get_data_format( void ) const = 0;
86  virtual r_Tile_Compression *clone( void ) const = 0;
87  r_Bytes get_type_size( void ) const;
88  r_ULong get_tile_size( void ) const;
89  const r_Minterval &get_domain( void ) const;
90  const r_Base_Type *get_base_type( void ) const;
91  void resume_timer( void );
92  void pause_timer( void );
93  virtual void set_storage_handler( const r_Storage_Man &newStore );
94  static void write_short( void *dest, r_Short val );
95  static void write_long( void *dest, r_Long val );
96  static void read_short( const void *src, r_Short &val );
97  static void read_long( const void *src, r_Long &val );
98  typedef struct tile_comp_format_s
99  {
101  const char *name;
103 
104 protected:
105  static unsigned int get_atom_info( const r_Base_Type* baseType, unsigned int* sizes=NULL,
106  unsigned int *idxptr=NULL );
107  void instantiate_timer( const char *func, int level=0 );
115 };
116 
117 
118 #endif
Definition: tilecompression.hh:98
r_Bytes get_type_size(void) const
static unsigned int get_atom_info(const r_Base_Type *baseType, unsigned int *sizes=NULL, unsigned int *idxptr=NULL)
Definition: raslib/basetype.hh:47
unsigned int r_ULong
Definition: odmgtypes.hh:114
static r_Tile_Compression * create(r_Data_Format fmt, const r_Minterval &dom, const r_Base_Type *type)
r_Base_Type * mytype
Definition: tilecompression.hh:110
Support_Format
Definition: tilecompression.hh:68
static void read_long(const void *src, r_Long &val)
Definition: error.hh:88
const char * name
Definition: tilecompression.hh:101
Definition: storageman.hh:56
virtual ~r_Tile_Compression(void)
r_Storage_Man mystore
Definition: tilecompression.hh:108
RMTimer * myTimer
Definition: tilecompression.hh:113
static void write_short(void *dest, r_Short val)
Definition: tilecompression.hh:65
r_ULong get_tile_size(void) const
Definition: tilecompression.hh:69
static void read_short(const void *src, r_Short &val)
virtual void * decompress(const void *data, r_ULong size, const char *options=NULL)=0
void instantiate_timer(const char *func, int level=0)
virtual r_Data_Format get_data_format(void) const =0
static r_Data_Format get_format_from_name(const char *name)
static void write_long(void *dest, r_Long val)
Definition: tilecompression.hh:69
r_Tile_Compression(const r_Minterval &dom, const r_Base_Type *type)
static const char * get_format_info(unsigned int number, r_Data_Format &fmt)
r_Data_Format
Definition: mddtypes.hh:133
r_Minterval mydomain
Definition: tilecompression.hh:109
virtual void set_storage_handler(const r_Storage_Man &newStore)
Definition: parseparams.hh:44
unsigned int r_Bytes
Definition: mddtypes.hh:56
Definition: tilecompression.hh:69
virtual const char * get_name(void) const =0
r_Parse_Params * decompParams
Definition: tilecompression.hh:112
void resume_timer(void)
Module: { raslib}.
Definition: rmdebug.hh:298
int r_Long
Definition: odmgtypes.hh:100
r_Parse_Params * compParams
Definition: tilecompression.hh:111
const r_Minterval & get_domain(void) const
virtual r_Data_Format get_decomp_format(void) const
static const tile_comp_format_t all_formats[]
Definition: tilecompression.hh:114
short r_Short
Definition: odmgtypes.hh:74
struct r_Tile_Compression::tile_comp_format_s tile_comp_format_t
r_Data_Format format
Definition: tilecompression.hh:100
void pause_timer(void)
static Support_Format check_data_format(r_Data_Format fmt)
virtual r_Tile_Compression * clone(void) const =0
virtual bool converts_endianness(void) const
Definition: minterval.hh:249
const r_Base_Type * get_base_type(void) const
virtual void * compress(const void *data, r_ULong &size, const char *options=NULL)=0