Main Page | Class List | Directories | File List | Class Members | File Members

ObitFile.h File Reference

ObitFile class definition for disk file access. More...

#include <sys/types.h>
#include "Obit.h"
#include "ObitErr.h"
#include "ObitThread.h"
#include "ObitInfoList.h"
#include "ObitDef.h"
#include "ObitClassDef.h"

Go to the source code of this file.

Classes

struct  ObitFile
 ObitFile Class. More...
struct  ObitFileClassInfo
 ClassInfo Structure. More...

Defines

#define ObitFileUnref(in)   ObitUnref (in)
 Macro to unreference (and possibly destroy) an ObitFile returns a ObitFile*.
#define ObitFileRef(in)   ObitRef (in)
 Macro to reference (update reference count) an ObitFile.
#define ObitFileIsA(in)   ObitIsA (in, ObitFileGetClass())
 Macro to determine if an object is the member of this or a derived class.

Typedefs

typedef off_t ObitFilePos
 Type for file position.
typedef ObitFile *(* ObitFileZapFP )(ObitFile *in, ObitErr *err)
typedef void(* ObitFileRenameFP )(gchar *oldName, gchar *newName, ObitErr *err)
typedef ObitIOCode(* ObitFileOpenFP )(ObitFile *in, gchar *fileName, ObitIOAccess access, ObitIOType type, glong blockSize, ObitErr *err)
typedef ObitIOCode(* ObitFileCloseFP )(ObitFile *in, ObitErr *err)
typedef ObitIOCode(* ObitFileSetPosFP )(ObitFile *in, ObitFilePos filePos, ObitErr *err)
typedef ObitIOCode(* ObitFileEndFP )(ObitFile *in, ObitErr *err)
typedef ObitIOCode(* ObitFileReadFP )(ObitFile *in, ObitFilePos filePos, glong size, gchar *buffer, ObitErr *err)
typedef ObitIOCode(* ObitFileReadLineFP )(ObitFile *in, gchar *line, gint lineMax, ObitErr *err)
typedef ObitIOCode(* ObitFileWriteFP )(ObitFile *in, ObitFilePos filePos, glong size, gchar *buffer, ObitErr *err)
typedef ObitIOCode(* ObitFileWriteLineFP )(ObitFile *in, gchar *line, ObitErr *err)
typedef ObitIOCode(* ObitFilePadFP )(ObitFile *in, glong padTo, gchar *buffer, glong bsize, ObitErr *err)
typedef ObitIOCode(* ObitFilePadFileFP )(ObitFile *in, glong blksize, ObitErr *err)
typedef ObitIOCode(* ObitFileFlushFP )(ObitFile *in, ObitErr *err)
typedef gboolean(* ObitFileExistFP )(gchar *fileName, ObitErr *err)
typedef ObitFilePos(* ObitFileSizeFP )(ObitFile *in, ObitErr *err)
typedef gchar *(* ObitFileNameFP )(ObitFile *in)
typedef gboolean(* ObitFileErrMsgFP )(ObitErr *err)

Functions

void ObitFileClassInit (void)
 Public: Class initializer.
ObitFilenewObitFile (gchar *name)
 Public: Constructor.
gconstpointer ObitFileGetClass (void)
 Public: ClassInfo pointer.
ObitFileObitFileZap (ObitFile *in, ObitErr *err)
 Public: destroy.
void ObitFileRename (gchar *oldName, gchar *newName, ObitErr *err)
 Public: rename.
ObitFileObitFileCopy (ObitFile *in, ObitFile *out, ObitErr *err)
 Public: Copy constructor.
ObitIOCode ObitFileOpen (ObitFile *in, gchar *fileName, ObitIOAccess access, ObitIOType type, glong blockSize, ObitErr *err)
 Public: Open.
ObitIOCode ObitFileClose (ObitFile *in, ObitErr *err)
 Public: Close.
ObitIOCode ObitFileSetPos (ObitFile *in, ObitFilePos filePos, ObitErr *err)
 Public: Position file.
ObitIOCode ObitFileEnd (ObitFile *in, ObitErr *err)
 Public: Position at end of file.
ObitIOCode ObitFileRead (ObitFile *in, ObitFilePos filePos, glong size, gchar *buffer, ObitErr *err)
 Public: Read.
ObitIOCode ObitFileReadLine (ObitFile *in, gchar *line, gint lineMax, ObitErr *err)
 Public: Read next line of text file.
ObitIOCode ObitFileWrite (ObitFile *in, ObitFilePos filePos, glong size, gchar *buffer, ObitErr *err)
 Public: Write.
ObitIOCode ObitFileWriteLine (ObitFile *in, gchar *line, ObitErr *err)
 Public: Write next line to text file.
ObitIOCode ObitFilePad (ObitFile *in, glong padTo, gchar *buffer, glong bsize, ObitErr *err)
 Public: Pad remainder of a block.
ObitIOCode ObitFilePadFile (ObitFile *in, glong blksize, ObitErr *err)
 Public: Pad end of file to an integral of a given size.
ObitIOCode ObitFileFlush (ObitFile *in, ObitErr *err)
 Public: Flush Buffer.
gboolean ObitFileExist (gchar *fileName, ObitErr *err)
 Public: Does a given file exist?
ObitFilePos ObitFileSize (gchar *fileName, ObitErr *err)
 Public: What is the current size of a file.
gchar * ObitFileName (gchar *fileName)
 Public: What is the name (without path) if a file.
gboolean ObitFileErrMsg (ObitErr *err)
 Public: Utility, Error message for errno.


Detailed Description

ObitFile class definition for disk file access.

This class is derived from the Obit class.

This class provides an I/O interface to disk files.

Usage

Instances of this class are for access to disk files and is used for access to AIPS data files. Instances can be made using the newObitFile constructor, or the ObitFileCopy copy constructor and pointers copied (with reference pointer update) using ObitFileRef. The destructor (when reference count goes to zero) is ObitIOUnref.

Define Documentation

#define ObitFileIsA in   )     ObitIsA (in, ObitFileGetClass())
 

Macro to determine if an object is the member of this or a derived class.

Returns TRUE if a member, else FALSE in = object to reference

#define ObitFileRef in   )     ObitRef (in)
 

Macro to reference (update reference count) an ObitFile.

returns a ObitFile*. in = object to reference

#define ObitFileUnref in   )     ObitUnref (in)
 

Macro to unreference (and possibly destroy) an ObitFile returns a ObitFile*.

in = object to unreference


Typedef Documentation

typedef ObitIOCode(* ObitFileCloseFP)(ObitFile *in, ObitErr *err)
 

typedef ObitIOCode(* ObitFileEndFP)(ObitFile *in, ObitErr *err)
 

typedef gboolean(* ObitFileErrMsgFP)(ObitErr *err)
 

typedef gboolean(* ObitFileExistFP)(gchar *fileName, ObitErr *err)
 

typedef ObitIOCode(* ObitFileFlushFP)(ObitFile *in, ObitErr *err)
 

typedef gchar*(* ObitFileNameFP)(ObitFile *in)
 

typedef ObitIOCode(* ObitFileOpenFP)(ObitFile *in, gchar *fileName, ObitIOAccess access, ObitIOType type, glong blockSize, ObitErr *err)
 

typedef ObitIOCode(* ObitFilePadFileFP)(ObitFile *in, glong blksize, ObitErr *err)
 

typedef ObitIOCode(* ObitFilePadFP)(ObitFile *in, glong padTo, gchar *buffer, glong bsize, ObitErr *err)
 

typedef off_t ObitFilePos
 

Type for file position.

typedef ObitIOCode(* ObitFileReadFP)(ObitFile *in, ObitFilePos filePos, glong size, gchar *buffer, ObitErr *err)
 

typedef ObitIOCode(* ObitFileReadLineFP)(ObitFile *in, gchar *line, gint lineMax, ObitErr *err)
 

typedef void(* ObitFileRenameFP)(gchar *oldName, gchar *newName, ObitErr *err)
 

typedef ObitIOCode(* ObitFileSetPosFP)(ObitFile *in, ObitFilePos filePos, ObitErr *err)
 

typedef ObitFilePos(* ObitFileSizeFP)(ObitFile *in, ObitErr *err)
 

typedef ObitIOCode(* ObitFileWriteFP)(ObitFile *in, ObitFilePos filePos, glong size, gchar *buffer, ObitErr *err)
 

typedef ObitIOCode(* ObitFileWriteLineFP)(ObitFile *in, gchar *line, ObitErr *err)
 

typedef ObitFile*(* ObitFileZapFP)(ObitFile *in, ObitErr *err)
 


Function Documentation

ObitFile* newObitFile gchar *  name  ) 
 

Public: Constructor.

Initializes class if needed on first call.

Returns:
the new object.

void ObitFileClassInit void   ) 
 

Public: Class initializer.

ObitIOCode ObitFileClose ObitFile in,
ObitErr err
 

Public: Close.

Parameters:
in Pointer to object to be closed.
err ObitErr for reporting errors.
Returns:
error code, 0=> OK

ObitFile* ObitFileCopy ObitFile in,
ObitFile out,
ObitErr err
 

Public: Copy constructor.

The result will have pointers to the more complex members. Parent class members are included but any derived class info is ignored. The contents of any files are not modified.

Parameters:
in The object to copy
out An existing object pointer for output or NULL if none exists.
err Obit error stack object.
Returns:
pointer to the new object.

ObitIOCode ObitFileEnd ObitFile in,
ObitErr err
 

Public: Position at end of file.

Parameters:
in Pointer to object to be positioned.
err ObitErr for reporting errors.
Returns:
error code, 0=> OK

gboolean ObitFileErrMsg ObitErr err  ) 
 

Public: Utility, Error message for errno.

errno is reset to 0.

Parameters:
err ObitErr for reporting errors.
Returns:
True if error

gboolean ObitFileExist gchar *  fileName,
ObitErr err
 

Public: Does a given file exist?

Parameters:
fileName Name of file to test.
err ObitErr for reporting errors.
Returns:
TRUE if exists, else FALSE.

ObitIOCode ObitFileFlush ObitFile in,
ObitErr err
 

Public: Flush Buffer.

Note: this is done automatically on Close.

Parameters:
in Pointer to object to flush.
err ObitErr for reporting errors.
Returns:
return code, 0=> OK

gconstpointer ObitFileGetClass void   ) 
 

Public: ClassInfo pointer.

Initializes class if needed on first call.

Returns:
pointer to the class structure.

gchar* ObitFileName gchar *  fileName  ) 
 

Public: What is the name (without path) if a file.

Parameters:
fileName Name of file
Returns:
File size in bytes, g_free when done

ObitIOCode ObitFileOpen ObitFile in,
gchar *  fileName,
ObitIOAccess  access,
ObitIOType  type,
glong  blockSize,
ObitErr err
 

Public: Open.

The file will be positioned at the beginning.

Parameters:
in Pointer to object to be opened.
fileName Name of file to open.
access access (OBIT_IO_ReadOnly,OBIT_IO_ReadWrite)
type type of file (OBIT_IO_Binary, OBIT_IO_Text).
blockSize Size of any blocking (used for AIPS files) 0->none.
err ObitErr for reporting errors.
Returns:
return code, OBIT_IO_OK => OK

ObitIOCode ObitFilePad ObitFile in,
glong  padTo,
gchar *  buffer,
glong  bsize,
ObitErr err
 

Public: Pad remainder of a block.

This is mostly useful for AIPS files for which ancient concepts of file blocking are enforced.

Parameters:
in Pointer to object to be written.
padTo Final (0-rel) file position to be written.
buffer buffer whose contents are to be used to pad the file.
bsize Size in bytes of buffer.
err ObitErr for reporting errors.
Returns:
return code, 0=> OK

ObitIOCode ObitFilePadFile ObitFile in,
glong  blksize,
ObitErr err
 

Public: Pad end of file to an integral of a given size.

Any unwritten bytes are zero filled. This is mostly useful for AIPS files for which ancient concepts of file blocking are enforced.

Parameters:
in Pointer to object to be padded.
blksize Size in bytes of blocking size.
err ObitErr for reporting errors.
Returns:
return code, 0=> OK

ObitIOCode ObitFileRead ObitFile in,
ObitFilePos  filePos,
glong  size,
gchar *  buffer,
ObitErr err
 

Public: Read.

Parameters:
in Pointer to object to be read.
filePos File position in bytes of beginning of read <0 => start at current position.
size number of bytes to read.
buffer pointer to buffer to accept results.
err ObitErr for reporting errors.
Returns:
return code, 0=> OK

ObitIOCode ObitFileReadLine ObitFile in,
gchar *  line,
gint  lineMax,
ObitErr err
 

Public: Read next line of text file.

Parameters:
in Pointer to object to be read.
line pointer to memory to accept the text may be newline terminated.
lineMax size in characters of line
err ObitErr for reporting errors.
Returns:
return code, OBIT_IO_OK => OK

void ObitFileRename gchar *  oldName,
gchar *  newName,
ObitErr err
 

Public: rename.

Parameters:
oldName Current name for file
newName New name for file
err ObitErr for reporting errors.

ObitIOCode ObitFileSetPos ObitFile in,
ObitFilePos  filePos,
ObitErr err
 

Public: Position file.

Parameters:
in Pointer to object to be positioned.
filePos File position in bytes of beginning of file
err ObitErr for reporting errors.
Returns:
error code, 0=> OK

ObitFilePos ObitFileSize gchar *  fileName,
ObitErr err
 

Public: What is the current size of a file.

Parameters:
fileName Name of file to test.
err ObitErr for reporting errors.
Returns:
File size in bytes

ObitIOCode ObitFileWrite ObitFile in,
ObitFilePos  filePos,
glong  size,
gchar *  buffer,
ObitErr err
 

Public: Write.

Parameters:
in Pointer to object to be written.
filePos File position in bytes of beginning of write <0 => start at current position.
size number of bytes to write.
buffer Pointer to buffer to receive output data.
err ObitErr for reporting errors.
Returns:
return code, 0=> OK

ObitIOCode ObitFileWriteLine ObitFile in,
gchar *  line,
ObitErr err
 

Public: Write next line to text file.

Parameters:
in Pointer to object to be written
line pointer to memory to text to be written, should be newline terminated.
err ObitErr for reporting errors.
Returns:
return code, OBIT_IO_OK => OK

ObitFile* ObitFileZap ObitFile in,
ObitErr err
 

Public: destroy.

Parameters:
in Pointer to object to be zapped.
err ObitErr for reporting errors.
Returns:
NULL as value of pointer to in, on failure returns in.


Generated on Fri Aug 31 22:13:05 2007 for Obit by  doxygen 1.3.9.1