Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
file-handle.c File Reference
#include <stdlib.h>
#include <string.h>
#include <H5Ipublic.h>
#include <H5Tpublic.h>
#include "file-handle.h"
#include "status.h"
#include "util.h"
+ Include dependency graph for file-handle.c:

Go to the source code of this file.

Macros

#define FILE_HANDLE_MAGIC   0xFEEDFEED
 

Functions

int mhdf_check_valid_file (FileHandle *handle, mhdf_Status *status)
 
FileHandlemhdf_alloc_FileHandle (hid_t hdf_table, hid_t id_type, mhdf_Status *status)
 

Macro Definition Documentation

◆ FILE_HANDLE_MAGIC

#define FILE_HANDLE_MAGIC   0xFEEDFEED

MOAB, a Mesh-Oriented datABase, is a software component for creating, storing and accessing finite element mesh data.

Copyright 2004 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software.

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

Definition at line 24 of file file-handle.c.

Function Documentation

◆ mhdf_alloc_FileHandle()

FileHandle* mhdf_alloc_FileHandle ( hid_t  hdf_table,
hid_t  id_type,
mhdf_Status status 
)

Definition at line 43 of file file-handle.c.

44 {
45  FileHandle* rval;
46 
47  /* check that id_type is sane */
48  if( id_type == -1 )
49  {
50  id_type = H5T_NATIVE_ULONG;
51  }
52  else if( H5T_INTEGER != H5Tget_class( id_type ) )
53  {
54  mhdf_setFail( status, "Invalid ID type: not integer class" );
55  return 0;
56  }
57 
58  rval = (FileHandle*)mhdf_malloc( sizeof( FileHandle ), status );
59  if( !rval ) return NULL;
60 
61  rval->magic = FILE_HANDLE_MAGIC;
62  rval->hdf_handle = hdf_table;
63  rval->open_handle_count = 0;
64  rval->id_type = id_type;
65  rval->max_id = 0L;
66  return rval;
67 }

References FILE_HANDLE_MAGIC, struct_FileHandle::hdf_handle, struct_FileHandle::id_type, struct_FileHandle::magic, struct_FileHandle::max_id, mhdf_malloc(), mhdf_setFail(), and struct_FileHandle::open_handle_count.

Referenced by mhdf_createFile(), and mhdf_openFileWithOpt().

◆ mhdf_check_valid_file()