summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac26
-rwxr-xr-x[-rw-r--r--]conversion/convfactory.cc278
-rwxr-xr-x[-rw-r--r--]conversion/hdf.cc555
-rw-r--r--new_functionality_on_rasdaman_doc.txt112
4 files changed, 553 insertions, 418 deletions
diff --git a/configure.ac b/configure.ac
index f3174dc..53aa17e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,7 +34,7 @@ AC_CHECK_PROGS(YACC, bison, [${am_missing_run} bison])
AC_CHECK_LIB([crypt], [main], , [AC_MSG_FAILURE([libcrypt.a not found! Please install.])])
AC_CHECK_LIB([crypto], [EVP_DigestFinal], , [AC_MSG_FAILURE([libcrypto.a not found! Please install.])])
# FIXME: Replace `main' with a function in `-ldf':
-AC_CHECK_LIB([df], [main], , [AC_MSG_FAILURE([libdf.a not found! Please install.])])
+#AC_CHECK_LIB([df], [main], , [AC_MSG_FAILURE([libdf.a not found! Please install.])])
# FIXME: Replace `main' with a function in `-ldl':
AC_CHECK_LIB([dl], [main], , [AC_MSG_FAILURE([libdl.a not found! Please install.])])
# FIXME: Replace `main' with a function in `-lfl':
@@ -42,9 +42,9 @@ AC_CHECK_LIB([fl], [main], , [AC_MSG_FAILURE([libfl.a not found! Please install.
# FIXME: Replace `main' with a function in `-ljpeg':
AC_CHECK_LIB([jpeg], [main], , [AC_MSG_FAILURE([libjpeg.a not found! Please install.])])
# FIXME: Replace `main' with a function in `-lm':
-AC_CHECK_LIB([m], [main], , [AC_MSG_FAILURE([libm.a not found! Please install.])])
+#AC_CHECK_LIB([m], [main], , [AC_MSG_FAILURE([libm.a not found! Please install.])])
# FIXME: Replace `main' with a function in `-lmfhdf':
-AC_CHECK_LIB([mfhdf], [main], , [AC_MSG_FAILURE([libmfhdf.a not found! Please install.])])
+#AC_CHECK_LIB([mfhdf], [main], , [AC_MSG_FAILURE([libmfhdf.a not found! Please install.])])
# FIXME: Replace `main' with a function in `-lncurses':
AC_CHECK_LIB([ncurses], [main], , [AC_MSG_FAILURE([libncurses.a not found! Please install.])])
AC_CHECK_LIB([png], [png_write_row], , [AC_MSG_FAILURE([libpng.a not found! Please install.])])
@@ -140,6 +140,7 @@ AC_CONFIG_FILES([Makefile
####################################################################
AH_TEMPLATE([DEBUG], [Enables debug functionality])
AH_TEMPLATE([RMANDEBUG], [Enables debug functionality])
+AH_TEMPLATE([HAVE_HDF], [Checks whether HDF is installed])
AH_TEMPLATE([RMANVERSION], [The version of Rasdaman currently compiled])
AH_TEMPLATE([BASEDB_PGSQL], [If defined we are compiling over PostgreSQL])
AH_TEMPLATE([__NO_MATH_INLINES], [Used by some performance implementaion of math libraries.])
@@ -157,6 +158,21 @@ AH_TEMPLATE([CONFDIR], [The directory where the installed programs will find the
# --------------- Parameter Definition -----------------------------
####################################################################
AC_PRESERVE_HELP_ORDER
+AC_ARG_WITH([hdf],
+ [AS_HELP_STRING([--with-hdf],
+ [this feature enables the inclusion of hdf library during installation.])],
+ [],
+ [with_hdf=no])
+
+AC_MSG_NOTICE(using hdf library...$with_hdf)
+
+if test "$with_hdf" == yes; then
+ AC_CHECK_LIB([df], [main], ,[AC_MSG_FAILURE([--with-hdf was given but libdf.a was not found! Please install.])])
+ AC_CHECK_LIB([mfhdf], [main], ,[AC_MSG_FAILURE([--with-hdf was given but libmfhdf.a was not found! Please install.])])
+ AC_DEFINE([HAVE_HDF], [1])
+fi
+
+
AC_ARG_WITH([default-rasmgr-port],
[AS_HELP_STRING([--with-default-rasmgr-port],
[change the default RasMgr port (7001)])],
@@ -341,4 +357,8 @@ CXXFLAGS="$CXXFLAGS -DLOGDIR=\\\"\$(logdir)/\\\""
AC_OUTPUT
+if test "$with_hdf" == no; then
+AC_MSG_NOTICE(Warning: presence of hdf libraries not checked. To run rasdaman you will need to have them installed!)
+fi
+
AC_MSG_NOTICE([Rasdaman successfully configured, installation path is '${prefix}'.])
diff --git a/conversion/convfactory.cc b/conversion/convfactory.cc
index 31f27ae..6f12957 100644..100755
--- a/conversion/convfactory.cc
+++ b/conversion/convfactory.cc
@@ -1,24 +1,24 @@
/*
-* This file is part of rasdaman community.
-*
-* Rasdaman community is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* Rasdaman community is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
-*
-* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
+ * This file is part of rasdaman community.
+ *
+ * Rasdaman community is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Rasdaman community is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
rasdaman GmbH.
-*
-* For more information please see <http://www.rasdaman.org>
-* or contact Peter Baumann via <baumann@rasdaman.com>.
+ *
+ * For more information please see <http://www.rasdaman.org>
+ * or contact Peter Baumann via <baumann@rasdaman.com>.
/
/**
* SOURCE: convertor.cc
@@ -30,7 +30,7 @@ rasdaman GmbH.
*
* COMMENTS:
* - temporary, for debugging
-*/
+ */
#include "raslib/rminit.hh"
#include "debug.hh"
@@ -54,136 +54,136 @@ rasdaman GmbH.
bool r_Convertor_Factory::is_supported( r_Data_Format fmt )
{
- ENTER( "r_Convertor_Factory::is_supported( " << fmt << " )" );
-
- bool retval=false;
- switch (fmt)
- {
- case r_TIFF:
- case r_PNG:
- case r_JPEG:
- case r_BMP:
- case r_VFF:
- case r_TOR:
- case r_DEM:
- case r_ECW:
-#ifndef DISABLE_HDF
- case r_HDF:
+ ENTER( "r_Convertor_Factory::is_supported( " << fmt << " )" );
+
+ bool retval=false;
+ switch (fmt)
+ {
+ case r_TIFF:
+ case r_PNG:
+ case r_JPEG:
+ case r_BMP:
+ case r_VFF:
+ case r_TOR:
+ case r_DEM:
+ case r_ECW:
+#ifdef HAVE_HDF
+ case r_HDF:
#endif
- // case r_NTF:
- retval=true;
- break;
- default:
- retval=false;
- break;
- }
-
- LEAVE( "r_Convertor_Factory::is_supported() -> " << retval );
- return retval;
+ // case r_NTF:
+ retval=true;
+ break;
+ default:
+ retval=false;
+ break;
+ }
+
+ LEAVE( "r_Convertor_Factory::is_supported() -> " << retval );
+ return retval;
}
r_Convertor *r_Convertor_Factory::create( r_Data_Format fmt, const char *src, const r_Minterval &interv, const r_Type *tp) throw(r_Error)
{
- ENTER( "r_Convertor_Factory::create( fmt=" << fmt << ", &src=" << ((r_Ptr) src) << ", interval=" << interv << ", &type=" << ((r_Ptr) tp) << " )" );
- r_Convertor *result = NULL;
-
- switch (fmt)
- {
- case r_TIFF:
- result = new r_Conv_TIFF(src, interv, tp);
- break;
- case r_PNG:
- result = new r_Conv_PNG(src, interv, tp);
- break;
- case r_CSV:
- result = new r_Conv_CSV(src, interv, tp);
- break;
- case r_JPEG:
- result = new r_Conv_JPEG(src, interv, tp);
- break;
- case r_BMP:
- result = new r_Conv_BMP(src, interv, tp);
- break;
- case r_VFF:
- result = new r_Conv_VFF(src, interv, tp);
- break;
- case r_TOR:
- result = new r_Conv_TOR(src, interv, tp);
- break;
- case r_DEM:
- result = new r_Conv_DEM(src, interv, tp);
- break;
- case r_ECW:
- result = new r_Conv_ECW(src, interv, tp);
- break;
-#ifndef DISABLE_HDF
- case r_HDF:
- result = new r_Conv_HDF(src, interv, tp);
- break;
+ ENTER( "r_Convertor_Factory::create( fmt=" << fmt << ", &src=" << ((r_Ptr) src) << ", interval=" << interv << ", &type=" << ((r_Ptr) tp) << " )" );
+ r_Convertor *result = NULL;
+
+ switch (fmt)
+ {
+ case r_TIFF:
+ result = new r_Conv_TIFF(src, interv, tp);
+ break;
+ case r_PNG:
+ result = new r_Conv_PNG(src, interv, tp);
+ break;
+ case r_CSV:
+ result = new r_Conv_CSV(src, interv, tp);
+ break;
+ case r_JPEG:
+ result = new r_Conv_JPEG(src, interv, tp);
+ break;
+ case r_BMP:
+ result = new r_Conv_BMP(src, interv, tp);
+ break;
+ case r_VFF:
+ result = new r_Conv_VFF(src, interv, tp);
+ break;
+ case r_TOR:
+ result = new r_Conv_TOR(src, interv, tp);
+ break;
+ case r_DEM:
+ result = new r_Conv_DEM(src, interv, tp);
+ break;
+ case r_ECW:
+ result = new r_Conv_ECW(src, interv, tp);
+ break;
+#ifdef HAVE_HDF
+ case r_HDF:
+ result = new r_Conv_HDF(src, interv, tp);
+ break;
#endif
- // case r_NTF:
- // TALK( "creating NTF converter..." );
- // result = new r_Conv_NTF(src, interv, tp);
- // break;
- default:
- RMInit::logOut << "Error: in conversion factory during create: unsupported format: " << fmt << endl;
- r_Error err(CONVERSIONFORMATNOTSUPPORTED);
- throw(err);
- }
-
- LEAVE( "r_Convertor_Factory::create() -> " << result );
- return result;
+ // case r_NTF:
+ // TALK( "creating NTF converter..." );
+ // result = new r_Conv_NTF(src, interv, tp);
+ // break;
+ default:
+ RMInit::logOut << "Error: in conversion factory during create: unsupported format: " << fmt << endl;
+ r_Error err(CONVERSIONFORMATNOTSUPPORTED);
+ throw(err);
+ }
+
+ LEAVE( "r_Convertor_Factory::create() -> " << result );
+ return result;
}
r_Convertor *r_Convertor_Factory::create( r_Data_Format fmt, const char *src, const r_Minterval &interv, int type ) throw(r_Error)
{
- ENTER( "r_Convertor_Factory::create( fmt=" << fmt << ", &src=" << ((r_Ptr) src) << ", interval=" << interv << ", type=" << type << " )" );
-
- r_Convertor *result = NULL;
-
- switch (fmt)
- {
- case r_TIFF:
- result = new r_Conv_TIFF(src, interv, type);
- break;
- case r_PNG:
- result = new r_Conv_PNG(src, interv, type);
- break;
- case r_JPEG:
- result = new r_Conv_JPEG(src, interv, type);
- break;
- case r_BMP:
- result = new r_Conv_BMP(src, interv, type);
- break;
- case r_VFF:
- result = new r_Conv_VFF(src, interv, type);
- break;
- case r_TOR:
- result = new r_Conv_TOR(src, interv, type);
- break;
- case r_DEM:
- result = new r_Conv_DEM(src, interv, type);
- break;
- case r_ECW:
- result = new r_Conv_ECW(src, interv, type);
- break;
-#ifndef DISABLE_HDF
- case r_HDF:
- result = new r_Conv_HDF(src, interv, type);
- break;
+ ENTER( "r_Convertor_Factory::create( fmt=" << fmt << ", &src=" << ((r_Ptr) src) << ", interval=" << interv << ", type=" << type << " )" );
+
+ r_Convertor *result = NULL;
+
+ switch (fmt)
+ {
+ case r_TIFF:
+ result = new r_Conv_TIFF(src, interv, type);
+ break;
+ case r_PNG:
+ result = new r_Conv_PNG(src, interv, type);
+ break;
+ case r_JPEG:
+ result = new r_Conv_JPEG(src, interv, type);
+ break;
+ case r_BMP:
+ result = new r_Conv_BMP(src, interv, type);
+ break;
+ case r_VFF:
+ result = new r_Conv_VFF(src, interv, type);
+ break;
+ case r_TOR:
+ result = new r_Conv_TOR(src, interv, type);
+ break;
+ case r_DEM:
+ result = new r_Conv_DEM(src, interv, type);
+ break;
+ case r_ECW:
+ result = new r_Conv_ECW(src, interv, type);
+ break;
+#ifdef HAVE_HDF
+ case r_HDF:
+ result = new r_Conv_HDF(src, interv, type);
+ break;
#endif
- // case r_NTF:
- // TALK( "creating NTF converter..." );
- // result = new r_Conv_NTF(src, interv, type);
- // break;
- default:
- RMInit::logOut << "Error: in conversion factory during create: unsupported format: " << fmt << endl;
- r_Error err(CONVERSIONFORMATNOTSUPPORTED);
- throw(err);
- }
-
- LEAVE( "r_Convertor_Factory::create() -> " << result );
- return result;
+ // case r_NTF:
+ // TALK( "creating NTF converter..." );
+ // result = new r_Conv_NTF(src, interv, type);
+ // break;
+ default:
+ RMInit::logOut << "Error: in conversion factory during create: unsupported format: " << fmt << endl;
+ r_Error err(CONVERSIONFORMATNOTSUPPORTED);
+ throw(err);
+ }
+
+ LEAVE( "r_Convertor_Factory::create() -> " << result );
+ return result;
}
diff --git a/conversion/hdf.cc b/conversion/hdf.cc
index 3cf8bf7..adb4d56 100644..100755
--- a/conversion/hdf.cc
+++ b/conversion/hdf.cc
@@ -1,24 +1,24 @@
/*
-* This file is part of rasdaman community.
-*
-* Rasdaman community is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* Rasdaman community is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
-*
-* Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
+ * This file is part of rasdaman community.
+ *
+ * Rasdaman community is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Rasdaman community is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
rasdaman GmbH.
-*
-* For more information please see <http://www.rasdaman.org>
-* or contact Peter Baumann via <baumann@rasdaman.com>.
+ *
+ * For more information please see <http://www.rasdaman.org>
+ * or contact Peter Baumann via <baumann@rasdaman.com>.
/
/**
* SOURCE: hdf.cc
@@ -31,13 +31,16 @@ rasdaman GmbH.
*
* Provides functions to convert data to HDF SD and back.
*
-*/
+ */
/* Added by Sorin Stancu-Mara. Definition clashed for type int8, define in both
-* /usr/include/hdf.h and in /usr/include/tiff.h
-* This will supress the tiff.h definition.
-* Both definitions are similar
-*/
+ * /usr/include/hdf.h and in /usr/include/tiff.h
+ * This will supress the tiff.h definition.
+ * Both definitions are similar
+ */
+
+#ifdef HAVE_HDF
+
#define HAVE_INT8
#include "conversion/hdf.hh"
@@ -46,27 +49,26 @@ rasdaman GmbH.
#include "raslib/parseparams.hh"
#include "raslib/primitivetype.hh"
-
#ifdef HAVE_HDF_H
- #include "hdf.h"
+#include "hdf.h"
#elif HAVE_HDF_HDF_H
- #include "hdf/hdf.h"
+#include "hdf/hdf.h"
#else
- #error "No hdf.h header available."
+#error "No hdf.h header available."
#endif
#ifdef HAVE_MFHDF_H
- #include "mfhdf.h"
+#include "mfhdf.h"
#elif HAVE_HDF_MFHDF_H
- #include "hdf/mfhdf.h"
+#include "hdf/mfhdf.h"
#else
- #error "No mfhdf.h header available."
+#error "No mfhdf.h header available."
#endif
// HDF changed from MAX_VAR_DIMS to H4_MAX_VAR_DIMS around 9/5/2007
// to avoid potential conflicts with NetCDF-3 library
#ifndef H4_MAX_VAR_DIMS
- #define H4_MAX_VAR_DIMS MAX_VAR_DIMS
+#define H4_MAX_VAR_DIMS MAX_VAR_DIMS
#endif
#include <stdio.h>
@@ -74,15 +76,15 @@ rasdaman GmbH.
// make this code robust against different HDF versions and trouble:
#ifndef MAX_VAR_DIMS
- #define MAX_VAR_DIMS 32
+#define MAX_VAR_DIMS 32
#endif
const r_Convertor::convert_string_t r_Conv_HDF::compNames[] = {
- {"none", COMP_CODE_NONE},
- {"rle", COMP_CODE_RLE},
- {"huffman", COMP_CODE_SKPHUFF},
- {"deflate", COMP_CODE_DEFLATE},
- {NULL, COMP_CODE_NONE}
+ {"none", COMP_CODE_NONE},
+ {"rle", COMP_CODE_RLE},
+ {"huffman", COMP_CODE_SKPHUFF},
+ {"deflate", COMP_CODE_DEFLATE},
+ {NULL, COMP_CODE_NONE}
};
// Buffer used for switching the majorness (column <--> row) of the array data
@@ -93,62 +95,62 @@ const int r_Conv_HDF::MaxSwapBufferSize = 0x10000;
void r_Conv_HDF::initHDF( void )
{
- compType = NULL;
- quality = 80;
- skiphuff = 0;
+ compType = NULL;
+ quality = 80;
+ skiphuff = 0;
- if (params == NULL)
- params = new r_Parse_Params;
+ if (params == NULL)
+ params = new r_Parse_Params;
- params->add("comptype", &compType, r_Parse_Params::param_type_string);
- params->add("quality", &quality, r_Parse_Params::param_type_int);
- params->add("skiphuff", &skiphuff, r_Parse_Params::param_type_int);
+ params->add("comptype", &compType, r_Parse_Params::param_type_string);
+ params->add("quality", &quality, r_Parse_Params::param_type_int);
+ params->add("skiphuff", &skiphuff, r_Parse_Params::param_type_int);
}
int r_Conv_HDF::getHDFtype(int intType, int &size)
{
- int result=0;
-
- switch (intType)
- {
- case ctype_int8: result = DFNT_CHAR8; size = 1; break;
- case ctype_uint8:
- case ctype_char:
- case ctype_bool: result = DFNT_UCHAR8; size = 1; break;
- case ctype_int16: result = DFNT_INT16; size = 2; break;
- case ctype_uint16: result = DFNT_UINT16; size = 2; break;
- case ctype_int32: result = DFNT_INT32; size = 4; break;
- case ctype_uint32: result = DFNT_UINT32; size = 4; break;
- case ctype_int64: result = DFNT_INT64; size = 8; break;
- case ctype_uint64: result = DFNT_UINT64; size = 8; break;
- case ctype_float32: result = DFNT_FLOAT32; size = 4; break;
- case ctype_float64: result = DFNT_FLOAT64; size = 8; break;
- default: result = 0; size = 1; break;
- }
- return result;
+ int result=0;
+
+ switch (intType)
+ {
+ case ctype_int8: result = DFNT_CHAR8; size = 1; break;
+ case ctype_uint8:
+ case ctype_char:
+ case ctype_bool: result = DFNT_UCHAR8; size = 1; break;
+ case ctype_int16: result = DFNT_INT16; size = 2; break;
+ case ctype_uint16: result = DFNT_UINT16; size = 2; break;
+ case ctype_int32: result = DFNT_INT32; size = 4; break;
+ case ctype_uint32: result = DFNT_UINT32; size = 4; break;
+ case ctype_int64: result = DFNT_INT64; size = 8; break;
+ case ctype_uint64: result = DFNT_UINT64; size = 8; break;
+ case ctype_float32: result = DFNT_FLOAT32; size = 4; break;
+ case ctype_float64: result = DFNT_FLOAT64; size = 8; break;
+ default: result = 0; size = 1; break;
+ }
+ return result;
}
int r_Conv_HDF::getIntType( int hdfType, int &size )
{
- int result=0;
-
- switch (hdfType)
- {
- case DFNT_CHAR8: result = ctype_int8; size = 1; break;
- case DFNT_UCHAR8: result = ctype_uint8; size = 1; break;
- case DFNT_INT16: result = ctype_int16; size = 2; break;
- case DFNT_UINT16: result = ctype_uint16; size = 2; break;
- case DFNT_INT32: result = ctype_int32; size = 4; break;
- case DFNT_UINT32: result = ctype_uint32; size = 4; break;
- case DFNT_INT64: result = ctype_int64; size = 8; break;
- case DFNT_UINT64: result = ctype_uint64; size = 8; break;
- case DFNT_FLOAT32: result = ctype_float32; size = 4; break;
- case DFNT_FLOAT64: result = ctype_float64; size = 8; break;
- default: result = ctype_void; size = 1; break;
- }
- return result;
+ int result=0;
+
+ switch (hdfType)
+ {
+ case DFNT_CHAR8: result = ctype_int8; size = 1; break;
+ case DFNT_UCHAR8: result = ctype_uint8; size = 1; break;
+ case DFNT_INT16: result = ctype_int16; size = 2; break;
+ case DFNT_UINT16: result = ctype_uint16; size = 2; break;
+ case DFNT_INT32: result = ctype_int32; size = 4; break;
+ case DFNT_UINT32: result = ctype_uint32; size = 4; break;
+ case DFNT_INT64: result = ctype_int64; size = 8; break;
+ case DFNT_UINT64: result = ctype_uint64; size = 8; break;
+ case DFNT_FLOAT32: result = ctype_float32; size = 4; break;
+ case DFNT_FLOAT64: result = ctype_float64; size = 8; break;
+ default: result = ctype_void; size = 1; break;
+ }
+ return result;
}
@@ -156,13 +158,13 @@ int r_Conv_HDF::getIntType( int hdfType, int &size )
r_Conv_HDF::r_Conv_HDF(const char *src, const r_Minterval &interv, const r_Type *tp) throw(r_Error)
: r_Convertor(src, interv, tp, true)
{
- initHDF();
+ initHDF();
- if (tp->isStructType())
- {
- RMInit::logOut << "r_Conv_HDF::r_Conv_HDF(): structured types not supported." << endl;
- throw r_Error(r_Error::r_Error_General);
- }
+ if (tp->isStructType())
+ {
+ RMInit::logOut << "r_Conv_HDF::r_Conv_HDF(): structured types not supported." << endl;
+ throw r_Error(r_Error::r_Error_General);
+ }
}
@@ -170,226 +172,227 @@ r_Conv_HDF::r_Conv_HDF(const char *src, const r_Minterval &interv, const r_Type
r_Conv_HDF::r_Conv_HDF(const char *src, const r_Minterval &interv, int tp) throw(r_Error)
: r_Convertor(src, interv, tp)
{
- initHDF();
+ initHDF();
}
r_Conv_HDF::~r_Conv_HDF(void)
{
- if (compType != NULL)
- {
- delete [] compType;
- compType = NULL;
- }
+ if (compType != NULL)
+ {
+ delete [] compType;
+ compType = NULL;
+ }
}
r_convDesc &r_Conv_HDF::convertTo( const char *options ) throw(r_Error)
{
- char name[256];
- int32 handle=0, sds_id=0, rank=0;
- comp_coder_t comp_type=COMP_CODE_NONE;
- int32 *dimsizes=NULL, *start=NULL;
- size_t filesize=0;
- int i=0, j=0;
- FILE *fp=NULL;
- comp_info c_info;
-
- strncpy(name, tmpnam(NULL), 256);
- //name = "testfile.hdf";
-
- if ((handle = SDstart(name, DFACC_CREATE)) == FAIL)
- {
- RMInit::logOut << "r_Conv_HDF::convertTo(): unable to open output file." << endl;
- throw r_Error(r_Error::r_Error_General);
- }
- rank = desc.srcInterv.dimension();
-
- dimsizes = new int32[rank]; start = new int32[rank];
- datatype = getHDFtype(desc.baseType, datasize);
-
- for (i=0; i<rank; i++)
- {
- dimsizes[i] = desc.srcInterv[i].high() - desc.srcInterv[i].low() + 1;
- start[i] = 0;
- }
-
- if ((sds_id = SDcreate(handle, "RasDaMan object", datatype, rank, dimsizes)) == FAIL)
- {
- RMInit::logOut << "r_Conv_HDF::convertTo(): unable to create object." << endl;
- SDend(handle); remove(name);
- throw r_Error(r_Error::r_Error_General);
- }
- SDsetfillmode(sds_id, SD_NOFILL);
-
- params->process(options);
-
- comp_type = COMP_CODE_DEFLATE;
- if (compType != NULL)
- {
- for (i=0; compNames[i].key != NULL; i++)
- {
- if (strcasecmp(compNames[i].key, compType) == 0)
- {
- comp_type = (comp_coder_t)compNames[i].id;
- break;
- }
- }
- if (compNames[i].key == NULL)
- {
- RMInit::logOut << "r_Conv_HDF::convertTo(): unsupported compression type " << compType << endl;
- }
- }
- c_info.skphuff.skp_size = skiphuff;
- c_info.deflate.level = quality;
-
- SDsetcompress(sds_id, comp_type, &c_info);
-
- SDwritedata(sds_id, start, NULL, dimsizes, (VOIDP)(desc.src));
-
- delete [] dimsizes; dimsizes=NULL;
- delete [] start; start=NULL;
-
- SDendaccess(sds_id);
-
- SDend(handle);
-
- if ((fp = fopen(name, "rb")) == NULL)
- {
- RMInit::logOut << "r_Conv_HDF::convertTo(): unable to read back file." << endl;
- throw r_Error(r_Error::r_Error_General);
- }
- fseek(fp, 0, SEEK_END);
- filesize = ftell(fp);
-
- desc.destInterv = r_Minterval(1);
- desc.destInterv << r_Sinterval((r_Range)0, (r_Range)filesize - 1);
-
- if ((desc.dest = (char*)mystore.storage_alloc(filesize)) == NULL)
- {
- RMInit::logOut << "r_Conv_HDF::convertTo(): out of memory error" << endl;
- fclose(fp);
- throw r_Error(MEMMORYALLOCATIONERROR);
- }
- fseek(fp, 0, SEEK_SET);
- fread(desc.dest, 1, filesize, fp);
-
- fclose(fp);
-
- remove(name);
-
- // Result is just a bytestream
- desc.destType = r_Type::get_any_type("char");
-
- return desc;
+ char name[256];
+ int32 handle=0, sds_id=0, rank=0;
+ comp_coder_t comp_type=COMP_CODE_NONE;
+ int32 *dimsizes=NULL, *start=NULL;
+ size_t filesize=0;
+ int i=0, j=0;
+ FILE *fp=NULL;
+ comp_info c_info;
+
+ strncpy(name, tmpnam(NULL), 256);
+ //name = "testfile.hdf";
+
+ if ((handle = SDstart(name, DFACC_CREATE)) == FAIL)
+ {
+ RMInit::logOut << "r_Conv_HDF::convertTo(): unable to open output file." << endl;
+ throw r_Error(r_Error::r_Error_General);
+ }
+ rank = desc.srcInterv.dimension();
+
+ dimsizes = new int32[rank]; start = new int32[rank];
+ datatype = getHDFtype(desc.baseType, datasize);
+
+ for (i=0; i<rank; i++)
+ {
+ dimsizes[i] = desc.srcInterv[i].high() - desc.srcInterv[i].low() + 1;
+ start[i] = 0;
+ }
+
+ if ((sds_id = SDcreate(handle, "RasDaMan object", datatype, rank, dimsizes)) == FAIL)
+ {
+ RMInit::logOut << "r_Conv_HDF::convertTo(): unable to create object." << endl;
+ SDend(handle); remove(name);
+ throw r_Error(r_Error::r_Error_General);
+ }
+ SDsetfillmode(sds_id, SD_NOFILL);
+
+ params->process(options);
+
+ comp_type = COMP_CODE_DEFLATE;
+ if (compType != NULL)
+ {
+ for (i=0; compNames[i].key != NULL; i++)
+ {
+ if (strcasecmp(compNames[i].key, compType) == 0)
+ {
+ comp_type = (comp_coder_t)compNames[i].id;
+ break;
+ }
+ }
+ if (compNames[i].key == NULL)
+ {
+ RMInit::logOut << "r_Conv_HDF::convertTo(): unsupported compression type " << compType << endl;
+ }
+ }
+ c_info.skphuff.skp_size = skiphuff;
+ c_info.deflate.level = quality;
+
+ SDsetcompress(sds_id, comp_type, &c_info);
+
+ SDwritedata(sds_id, start, NULL, dimsizes, (VOIDP)(desc.src));
+
+ delete [] dimsizes; dimsizes=NULL;
+ delete [] start; start=NULL;
+
+ SDendaccess(sds_id);
+
+ SDend(handle);
+
+ if ((fp = fopen(name, "rb")) == NULL)
+ {
+ RMInit::logOut << "r_Conv_HDF::convertTo(): unable to read back file." << endl;
+ throw r_Error(r_Error::r_Error_General);
+ }
+ fseek(fp, 0, SEEK_END);
+ filesize = ftell(fp);
+
+ desc.destInterv = r_Minterval(1);
+ desc.destInterv << r_Sinterval((r_Range)0, (r_Range)filesize - 1);
+
+ if ((desc.dest = (char*)mystore.storage_alloc(filesize)) == NULL)
+ {
+ RMInit::logOut << "r_Conv_HDF::convertTo(): out of memory error" << endl;
+ fclose(fp);
+ throw r_Error(MEMMORYALLOCATIONERROR);
+ }
+ fseek(fp, 0, SEEK_SET);
+ fread(desc.dest, 1, filesize, fp);
+
+ fclose(fp);
+
+ remove(name);
+
+ // Result is just a bytestream
+ desc.destType = r_Type::get_any_type("char");
+
+ return desc;
}
r_convDesc &r_Conv_HDF::convertFrom(const char *options) throw(r_Error)
{
- char name[256];
- int32 handle=0, sds_id=0, rank=0, dtype=0, numattr=0, array_size=0;
- int32 dimsizes[H4_MAX_VAR_DIMS];
- int32 *start=NULL;
- int dsize=0;
- size_t filesize=0;
- FILE *fp=NULL;
- int i=0;
-
- if (desc.srcInterv.dimension() != 1)
- {
- RMInit::logOut << "r_Conv_HDF::convertFrom(): source data must be a bytestream!" << endl;
- throw r_Error(r_Error::r_Error_General);
- }
-
- strncpy(name, tmpnam(NULL), 256);
- if ((fp = fopen(name, "wb")) == NULL)
- {
- RMInit::logOut << "r_Conv_HDF::convertFrom(): unable to write temporary file!" << endl;
- throw r_Error(r_Error::r_Error_General);
- }
- filesize = desc.srcInterv[0].high() - desc.srcInterv[0].low() + 1;
- if ((i = fwrite(desc.src, 1, filesize, fp)) != filesize)
- {
- RMInit::logOut << "r_Conv_HDF::convertFrom(): error writing to temporary file ("
- << i << " / " << filesize << ')' << endl;
- throw r_Error(r_Error::r_Error_General);
- }
- fclose(fp);
-
- if ((handle = SDstart(name, DFACC_READ)) == FAIL)
- {
- RMInit::logOut << "r_Conv_HDF::convertFrom(): can't read temporary file!" << endl;
- throw r_Error(r_Error::r_Error_General);
- }
- // Only read the first object in the file
- if ((sds_id = SDselect(handle, 0)) == FAIL)
- {
- RMInit::logOut << "r_Conv_HDF::convertFrom(): unable to open first object" << endl;
- SDend(handle); remove(name);
- throw r_Error(r_Error::r_Error_General);
- }
-
- SDgetinfo(sds_id, NULL, &rank, dimsizes, &dtype, &numattr);
-
- // Ignore native datatype flag
- dtype &= ~DFNT_NATIVE;
-
- desc.destType = get_external_type(getIntType(dtype, dsize));
-
- start = new int32[rank];
- desc.destInterv = r_Minterval(rank);
- array_size = (int32)dsize;
- for (i=0; i<rank; i++)
- {
- desc.destInterv << r_Sinterval(r_Range(0), r_Range(dimsizes[i]-1));
- array_size *= dimsizes[i];
- start[i] = 0;
- }
-
- if ((desc.dest = (char*)mystore.storage_alloc(array_size)) == NULL)
- {
- RMInit::logOut << "r_Conv_HDF::convertFrom(): out of memory error!" << endl;
- SDend(handle); remove(name);
- throw r_Error(MEMMORYALLOCATIONERROR);
- }
-
- if (SDreaddata(sds_id, start, NULL, dimsizes, (VOIDP)desc.dest) == FAIL)
- {
- RMInit::logOut << "r_Conv_HDF::convertFrom(): error reading data" << endl;
- SDend(handle); remove(name);
- throw r_Error(r_Error::r_Error_General);
- }
-
- delete [] start; start=NULL;
-
- SDendaccess(sds_id);
-
- SDend(handle);
-
- remove(name);
-
- return desc;
+ char name[256];
+ int32 handle=0, sds_id=0, rank=0, dtype=0, numattr=0, array_size=0;
+ int32 dimsizes[H4_MAX_VAR_DIMS];
+ int32 *start=NULL;
+ int dsize=0;
+ size_t filesize=0;
+ FILE *fp=NULL;
+ int i=0;
+
+ if (desc.srcInterv.dimension() != 1)
+ {
+ RMInit::logOut << "r_Conv_HDF::convertFrom(): source data must be a bytestream!" << endl;
+ throw r_Error(r_Error::r_Error_General);
+ }
+
+ strncpy(name, tmpnam(NULL), 256);
+ if ((fp = fopen(name, "wb")) == NULL)
+ {
+ RMInit::logOut << "r_Conv_HDF::convertFrom(): unable to write temporary file!" << endl;
+ throw r_Error(r_Error::r_Error_General);
+ }
+ filesize = desc.srcInterv[0].high() - desc.srcInterv[0].low() + 1;
+ if ((i = fwrite(desc.src, 1, filesize, fp)) != filesize)
+ {
+ RMInit::logOut << "r_Conv_HDF::convertFrom(): error writing to temporary file ("
+ << i << " / " << filesize << ')' << endl;
+ throw r_Error(r_Error::r_Error_General);
+ }
+ fclose(fp);
+
+ if ((handle = SDstart(name, DFACC_READ)) == FAIL)
+ {
+ RMInit::logOut << "r_Conv_HDF::convertFrom(): can't read temporary file!" << endl;
+ throw r_Error(r_Error::r_Error_General);
+ }
+ // Only read the first object in the file
+ if ((sds_id = SDselect(handle, 0)) == FAIL)
+ {
+ RMInit::logOut << "r_Conv_HDF::convertFrom(): unable to open first object" << endl;
+ SDend(handle); remove(name);
+ throw r_Error(r_Error::r_Error_General);
+ }
+
+ SDgetinfo(sds_id, NULL, &rank, dimsizes, &dtype, &numattr);
+
+ // Ignore native datatype flag
+ dtype &= ~DFNT_NATIVE;
+
+ desc.destType = get_external_type(getIntType(dtype, dsize));
+
+ start = new int32[rank];
+ desc.destInterv = r_Minterval(rank);
+ array_size = (int32)dsize;
+ for (i=0; i<rank; i++)
+ {
+ desc.destInterv << r_Sinterval(r_Range(0), r_Range(dimsizes[i]-1));
+ array_size *= dimsizes[i];
+ start[i] = 0;
+ }
+
+ if ((desc.dest = (char*)mystore.storage_alloc(array_size)) == NULL)
+ {
+ RMInit::logOut << "r_Conv_HDF::convertFrom(): out of memory error!" << endl;
+ SDend(handle); remove(name);
+ throw r_Error(MEMMORYALLOCATIONERROR);
+ }
+
+ if (SDreaddata(sds_id, start, NULL, dimsizes, (VOIDP)desc.dest) == FAIL)
+ {
+ RMInit::logOut << "r_Conv_HDF::convertFrom(): error reading data" << endl;
+ SDend(handle); remove(name);
+ throw r_Error(r_Error::r_Error_General);
+ }
+
+ delete [] start; start=NULL;
+
+ SDendaccess(sds_id);
+
+ SDend(handle);
+
+ remove(name);
+
+ return desc;
}
const char *r_Conv_HDF::get_name( void ) const
{
- return format_name_hdf;
+ return format_name_hdf;
}
r_Data_Format r_Conv_HDF::get_data_format( void ) const
{
- return r_HDF;
+ return r_HDF;
}
r_Convertor *r_Conv_HDF::clone( void ) const
{
- return new r_Conv_HDF(desc.src, desc.srcInterv, desc.baseType);
+ return new r_Conv_HDF(desc.src, desc.srcInterv, desc.baseType);
}
+#endif
diff --git a/new_functionality_on_rasdaman_doc.txt b/new_functionality_on_rasdaman_doc.txt
new file mode 100644
index 0000000..8045328
--- /dev/null
+++ b/new_functionality_on_rasdaman_doc.txt
@@ -0,0 +1,112 @@
+
+*****************************************************************
+
+ Addition of optional hdf functionality on rasdaman
+ Author: Bihemo Kimasa
+******************************************************************
+
+
+1. Making hdf4 optional for installing rasdaman
+
+ Getting and installing hdf libraries can be a daunting
+ task. Previous versions of rasdaman required by default
+ that these libraries be found on the system before it
+ could be configured and hence successfully installed.
+
+ It is now possible to install rasdaman with/out hdf
+ libraries. A new functionality --with-hdf that can be
+ passed when configuring rasdaman has been added. The
+ functionality works by checking whether libdf.a and
+ libmhdf.a are installed. If these libraries are found a
+ new variable HAVE_HDF with value 1 is passed to the
+ compiler. This variable is included in conversion/hdf.cc
+ and conversion/convfactory.cc sources for conditional
+ compilation. An error message is printed otherwise.
+
+ If the user choses to configure rasdaman without invoking
+ --with-hdf functionality, rasdaman will provide a warning
+ message that hdf presence was not checked but that the user
+ would need them in order to use rasdaman. These libraries
+ are particularly needed for work with rascontrol and hence
+ interact with the servers/database.
+
+ Until the time I was writing this report rasdaman supported
+ hdf version 4 libraries. Earlier or later versions were
+ incompatible. For a successful work with rasdaman the
+ user must ensure that the right version is installed.
+
+ The following is the piece of code that has been added in
+ the configure.ac script. It should be easy to find it.
+
+ AC_ARG_WITH([hdf],
+ [AS_HELP_STRING([--with-hdf],
+ [this feature enables the inclusion of hdf library during installation.])],
+ [],
+ [with_hdf=no])
+
+ AC_MSG_NOTICE(using hdf library...$with_hdf)
+
+ if test "$with_hdf" == yes; then
+ AC_CHECK_LIB([df], [main], ,[AC_MSG_FAILURE([--with-hdf was given but libdf.a was not found! Please install.])])
+ AC_CHECK_LIB([mfhdf], [main], ,[AC_MSG_FAILURE([--with-hdf was given but libmfhdf.a was not found! Please install.])])
+ AC_DEFINE([HAVE_HDF], [1])
+ fi
+
+ if test "\$with_hdf" == no; then ## the '\' is not part of the code
+ AC_MSG_NOTICE(Warning: presence of hdf libraries not checked. To run rasdaman you will need to have them installed!)
+ fi
+
+ Also in the conversion/hdf.cc and conversion/convfactory.cc
+ the conditional compilation variable HAVE_HDF has been included.
+ This again is easy to find when one looks at the source codes.
+
+
+
+ 2. "How to install" instructions
+
+ An updated list of packages needed should look like the following:
+
+ Rasdaman requires a Linux kernel 2.6.18 or higher. Successful
+ installations are reported for Kubuntu, SuSE, Red Hat, Mandrake
+ distributions. (Let us know about further ones!)
+
+ Aside from the standard packages which should be available on any
+ vanilla Linux, the following list has to be installed:
+
+
+ -tools:
+ git-core, make, autoconf, automake, libtool, gawk, flex, bison,
+ ant, gcc-c++, libstdc++, sun-java6-jdk, Tomcat (or another suitable
+ servlet container).
+
+ -general libraries:
+ libreadline-dev, libopenssl-devel, libncurses5-dev database stuff:
+ PostgreSQL 8.x, libecpg-dev; Warning: do not use versions PG 8.3.0
+ to 8.3.6 inclusive, it won't work.
+
+ -image formats:
+ libtiff-dev, libjpeg-dev, libpng12-dev, libnetpbm10-dev
+
+ -Optionally, the performance boosters and additional service components
+ offered by rasdaman GmbH can be installed. Also to use rasdaman you
+ will need to ensure that libhdf4g-dev (note the version) is installed.
+
+
+
+ 3. Recommendations
+
+
+ The following should be kept in mind for the people working on rasdaman:
+
+ Although it is now possible to install rasdaman without hdf libraries, it
+ is not to be expected that one would be able to interact with it via the
+ servers/database successfully. This is because the source codes
+ conversion/hdf.* and conversion/convfactory.cc have all or part of their
+ code section compiled only when hdf libraries are installed. For instance,
+ conversion/hdf.cc is not used whenever hdf is not included when configuring.
+ This means all makefiles lack the HAVE_HDF conditional compilational variable
+ necessary for their inclusion on installing rasdaman. I feel that this could
+ limit how one interacts with rasdaman servers. It is necessary to understand
+ that conversion/hdf.* are important files for rasdaman to work.
+
+ I recommend that for now rasdaman should only be configured --with-hdf.