MOAB: Mesh Oriented datABase  (version 5.2.1)
util.h
Go to the documentation of this file.
00001 /**
00002  * MOAB, a Mesh-Oriented datABase, is a software component for creating,
00003  * storing and accessing finite element mesh data.
00004  * 
00005  * Copyright 2004 Sandia Corporation.  Under the terms of Contract
00006  * DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
00007  * retains certain rights in this software.
00008  * 
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2.1 of the License, or (at your option) any later version.
00013  * 
00014  */
00015 
00016 #ifndef mhdf_FILE_UTIL_H
00017 #define mhdf_FILE_UTIL_H
00018 
00019 #include <sys/types.h>
00020 #include <H5Ipublic.h>
00021 #include "status.h"
00022 #include "file-handle.h"
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 
00029 void* mhdf_malloc( size_t size, mhdf_Status* status );
00030 void* mhdf_realloc( void* ptr, size_t size, mhdf_Status* status );
00031 
00032 size_t mhdf_name_to_path( const char* name, char* path, size_t path_len );
00033 
00034 int mhdf_path_to_name( const char* path, char* name );
00035 
00036 char* mhdf_name_to_path_copy( const char* name, mhdf_Status* status );
00037 
00038 char* mhdf_name_to_path_cat( const char* prefix, const char* name, mhdf_Status* status );
00039 
00040 hid_t mhdf_elem_group_from_handle( FileHandle* file_ptr,
00041                                    const char* elem_handle,
00042                                    mhdf_Status* status );
00043 
00044 int mhdf_create_scalar_attrib( hid_t object,
00045                                const char* name,
00046                                hid_t type,
00047                                const void* value,
00048                                mhdf_Status* status );
00049 
00050 /* If type is zero, assumes opaque type.
00051    On error, sets status and returns zero.
00052    On success, returns non-zero and does not modify status */
00053 int mhdf_read_scalar_attrib( hid_t object,
00054                              const char* name,
00055                              hid_t type,
00056                              void* value,
00057                              mhdf_Status* status );
00058 
00059 /* Search the specified object to see if it contains an 
00060    an attribute with passed name.  Returns -1 on error, 1 
00061    if attribute was found, and zero if attribute was not 
00062    found.
00063 */
00064 int mhdf_find_attribute( hid_t object, 
00065                          const char* attrib_name,
00066                          unsigned int* index_out,
00067                          mhdf_Status* status );
00068 
00069 int mhdf_is_in_group( hid_t group, const char* name, mhdf_Status* status );
00070 
00071 int
00072 mhdf_read_data( hid_t data_table,
00073                 long offset,
00074                 long count,
00075                 hid_t type,
00076                 void* array,
00077                 hid_t read_prop,
00078                 mhdf_Status* status );
00079 
00080 
00081 int
00082 mhdf_write_data( hid_t data_table,
00083                  long offset,
00084                  long count,
00085                  hid_t type,
00086                  const void* array,
00087                  hid_t write_prop,
00088                  mhdf_Status* status );
00089 
00090 int
00091 mhdf_read_column( hid_t data_table,
00092                   int column,
00093                   long offset,
00094                   long count,
00095                   hid_t type,
00096                   void* array,
00097                   hid_t read_prop,
00098                   mhdf_Status* status );
00099 
00100 
00101 int
00102 mhdf_write_column( hid_t data_table,
00103                    int column,
00104                    long offset,
00105                    long count,
00106                    hid_t type,
00107                    const void* array,
00108                    hid_t write_prop,
00109                    mhdf_Status* status );
00110 
00111 hid_t 
00112 mhdf_create_table( hid_t group,
00113                    const char* path,
00114                    hid_t type,
00115                    int rank,
00116                    hsize_t* dims,
00117                    mhdf_Status* status );
00118 
00119 hid_t 
00120 mhdf_create_table_with_prop( hid_t group,
00121                    const char* path,
00122                    hid_t type,
00123                    int rank,
00124                    hsize_t* dims,
00125                    hid_t dataset_creation_prop,
00126                    mhdf_Status* status );
00127 
00128 hid_t
00129 mhdf_open_table( hid_t group,
00130                  const char* path,
00131                  int columns,
00132                  hsize_t* rows_out,
00133                  mhdf_Status* status );
00134 
00135 hid_t
00136 mhdf_open_table2( hid_t group,
00137                   const char* path,
00138                   int rank,
00139                   hsize_t* dims_out,
00140                   long* start_id_out,
00141                   mhdf_Status* status );
00142 
00143 hid_t
00144 mhdf_open_table_simple( hid_t group, const char* path, mhdf_Status* status );
00145 
00146 int
00147 mhdf_compact_to_ranges( int* length_in_out, int* ids_in, int ordered );
00148 
00149 hid_t 
00150 get_elem_type_enum( FileHandle* file_ptr, mhdf_Status* status );
00151 
00152 void mhdf_api_begin_internal( void );
00153 void mhdf_api_end_internal( int expected_diff,
00154                             const char* filename,
00155                             int linenumber );
00156 
00157 int mhdf_write_max_id( FileHandle* file_ptr, mhdf_Status* status );
00158                             
00159                             
00160 #ifndef DEBUG_OPEN_HANDLES
00161 #  define API_BEGIN
00162 #  define API_END_H(n)
00163 #else
00164 #  define API_BEGIN mhdf_api_begin_internal()
00165 #  define API_END_H(n) mhdf_api_end_internal(n, __FILE__, __LINE__)
00166 #endif
00167 #define API_END API_END_H(0)
00168 
00169 
00170 #ifdef __cplusplus
00171 } /* extern "C" */
00172 #endif
00173 
00174 #endif
00175  
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines