library_file.h

Go to the documentation of this file.
00001 /*
00002      library_file.h: header file for library_file.c
00003      Copyright (C) 2001  CCLRC, Charles Ballard
00004 
00005      This library is free software; you can redistribute it and/or
00006      modify it under the terms of the GNU Lesser General Public
00007      License as published by the Free Software Foundation; either
00008      version 2.1 of the License, or (at your option) any later
00009      version.
00010 
00011      This library is distributed in the hope that it will be useful,
00012      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014      Lesser General Public License for more details.
00015 
00016      You should have received a copy of the GNU Lesser General Public
00017      License along with this library; if not, write to the Free
00018      Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019      Boston, MA 02110-1301 USA
00020 
00021 */
00022 
00028 #ifndef __CCP4_LIB_FILE
00029 #define __CCP4_LIB_FILE
00030 
00031 #include "ccp4_sysdep.h"
00032 #include "ccp4_types.h"
00033 
00034 #ifdef __cplusplus
00035 namespace CCP4 {
00036 extern "C" {
00037 #endif
00038 
00040 typedef struct _CFileStruct CCP4File;
00041 
00042 struct _CFileStruct {
00043   char *name;
00044   FILE *stream;
00045   int fd;
00046   unsigned int read : 1;
00047   unsigned int write : 1;
00048   unsigned int append : 1;
00049   unsigned int binary : 1;
00050   unsigned int scratch : 1 , : 3;
00051   unsigned int buffered : 1;
00052   unsigned int sync : 1, : 6;
00053   unsigned int direct : 1, : 7;
00054   unsigned int open : 1;
00055   unsigned int own : 1;
00056   unsigned int last_op : 2;
00057   unsigned int getbuff : 1, : 4;
00058   int iostat;
00059   unsigned int mode : 8;
00060   unsigned int itemsize : 8;
00061   unsigned int iconvert : 8;
00062   unsigned int fconvert: 8;
00063   off_t length;
00064   off_t loc;
00065   size_t stamp_loc;
00066   int (*_read) (CCP4File *, uint8 *, size_t);
00067   int (*_write) (CCP4File *, const uint8 *, size_t);
00068   char buff[8];
00069   void *priv;
00070 };
00071 
00072 
00073 CCP4File *ccp4_file_open (const char *, const int);
00074 
00075 CCP4File *ccp4_file_open_file (const FILE *, const int);
00076 
00077 CCP4File *ccp4_file_open_fd (const int, const int);
00078 
00079 int ccp4_file_rarch ( CCP4File*);
00080 
00081 int ccp4_file_warch ( CCP4File*);
00082 
00083 int ccp4_file_close ( CCP4File*);
00084 
00085 int ccp4_file_mode ( const CCP4File*);
00086 
00087 int ccp4_file_setmode ( CCP4File*, const int);
00088 
00089 int ccp4_file_setstamp( CCP4File *, const size_t);
00090 
00091 int ccp4_file_itemsize( const CCP4File*);
00092 
00093 int ccp4_file_setbyte( CCP4File *, const int);
00094 
00095   /* int ccp4_file_byteorder( CCP4File *); */
00096 
00097 int ccp4_file_is_write(const CCP4File *);
00098 
00099 int ccp4_file_is_read(const CCP4File *);
00100 
00101 int ccp4_file_is_append(const CCP4File *);
00102 
00103 int ccp4_file_is_scratch(const CCP4File *);
00104 
00105 int ccp4_file_is_buffered(const CCP4File *);
00106 
00107 int ccp4_file_status(const CCP4File *);
00108 
00109 const char *ccp4_file_name( CCP4File *);
00110 
00111 int ccp4_file_read ( CCP4File*, uint8 *, size_t);
00112 
00113 int ccp4_file_readcomp ( CCP4File*, uint8 *, size_t);
00114 
00115 int ccp4_file_readshortcomp ( CCP4File*, uint8 *, size_t);
00116 
00117 int ccp4_file_readfloat ( CCP4File*, uint8 *, size_t);
00118 
00119 int ccp4_file_readint ( CCP4File*, uint8 *, size_t);
00120 
00121 int ccp4_file_readshort ( CCP4File*, uint8 *, size_t);
00122 
00123 int ccp4_file_readchar ( CCP4File*, uint8 *, size_t);
00124 
00125 int ccp4_file_write ( CCP4File*, const uint8 *, size_t);
00126 
00127 int ccp4_file_writecomp ( CCP4File*, const uint8 *, size_t);
00128 
00129 int ccp4_file_writeshortcomp ( CCP4File*, const uint8 *, size_t);
00130 
00131 int ccp4_file_writefloat ( CCP4File*, const uint8 *, size_t);
00132 
00133 int ccp4_file_writeint ( CCP4File*, const uint8 *, size_t);
00134 
00135 int ccp4_file_writeshort ( CCP4File*, const uint8 *, size_t);
00136 
00137 int ccp4_file_writechar ( CCP4File*, const uint8 *, size_t);
00138 
00139 int ccp4_file_seek ( CCP4File*, long, int);
00140 
00141 void ccp4_file_rewind ( CCP4File*);
00142 
00143 void ccp4_file_flush (CCP4File *);
00144 
00145 long ccp4_file_length ( CCP4File*);
00146 
00147 long ccp4_file_tell ( CCP4File*);
00148 
00149 int ccp4_file_feof(CCP4File *);
00150 
00151 void ccp4_file_clearerr(CCP4File *);
00152 
00153 void ccp4_file_fatal (CCP4File *, char *);
00154 
00155 char *ccp4_file_print(CCP4File *, char *, char *);
00156 
00157 int ccp4_file_raw_seek( CCP4File *, long, int);
00158 int ccp4_file_raw_read ( CCP4File*, char *, size_t);
00159 int ccp4_file_raw_write ( CCP4File*, const char *, size_t);
00160 int ccp4_file_raw_setstamp( CCP4File *, const size_t);
00161 #ifdef __cplusplus
00162 }
00163 }
00164 #endif
00165 
00166 #endif  /* __CCP4_LIB_FILE */
00167 
00168 /*
00169   Local variables:
00170   mode: font-lock
00171   End:
00172 */

Generated on Wed Oct 29 21:14:24 2008 for gpp4 by  doxygen 1.4.7