BEAST/BSE - Better Audio System and Sound Engine  0.8.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Classes | Functions
gslfilehash.hh File Reference
#include <bse/gsldefs.hh>
#include <bse/gslcommon.hh>

Go to the source code of this file.

Classes

struct  GslHFile
struct  GslRFile

Functions

GslHFilegsl_hfile_open (const gchar *file_name)
GslLong gsl_hfile_pread (GslHFile *hfile, GslLong offset, GslLong n_bytes, gpointer bytes)
GslLong gsl_hfile_zoffset (GslHFile *hfile)
void gsl_hfile_close (GslHFile *hfile)
GslRFilegsl_rfile_open (const gchar *file_name)
gchar * gsl_rfile_name (GslRFile *rfile)
GslLong gsl_rfile_pread (GslRFile *rfile, GslLong offset, GslLong n_bytes, gpointer bytes)
GslLong gsl_rfile_read (GslRFile *rfile, GslLong n_bytes, gpointer bytes)
GslLong gsl_rfile_seek_set (GslRFile *rfile, GslLong offset)
GslLong gsl_rfile_position (GslRFile *rfile)
GslLong gsl_rfile_length (GslRFile *rfile)
void gsl_rfile_close (GslRFile *rfile)

Detailed Description


Function Documentation

void gsl_hfile_close ( GslHFile hfile)
Parameters:
hfilevalid GslHFile

Close and destroy a GslHFile. This function is MT-safe and may be called from any thread.

GslHFile* gsl_hfile_open ( const gchar *  file_name)
Parameters:
file_namename of the file to open
Returns:
a new opened GslHFile or NULL if an error occoured (errno set)

Open a file for reading and return the associated GSL hashed file. The motivation for using a GslHFile over normal unix file descriptors is to reduce the amount of opened unix file descriptors and to ensure thread safety upon reading offset relative byte blocks. Multiple open GslHFiles with equal file names will share a single unix file descriptor as long as the file wasn't modified meanwhile. This function is MT-safe and may be called from any thread.

GslLong gsl_hfile_pread ( GslHFile hfile,
GslLong  offset,
GslLong  n_bytes,
gpointer  bytes 
)
Parameters:
hfilevalid GslHFile
offsetoffset in bytes within 0 and file end
n_bytesnumber of bytes to read
bytesbuffer to store read bytes
Returns:
amount of bytes read or -1 if an error occoured (errno set)

Read a block of bytes from a GslHFile. This function is MT-safe and may be called from any thread.

GslLong gsl_hfile_zoffset ( GslHFile hfile)
Parameters:
hfilevalid GslHFile
Returns:
offset of first zero byte or -1

Find the offset of the first zero byte in a GslHFile. This function is MT-safe and may be called from any thread.

void gsl_rfile_close ( GslRFile rfile)
Parameters:
rfilevalid GslRFile

Close and destroy a GslRFile.

GslLong gsl_rfile_length ( GslRFile rfile)
Parameters:
rfilevalid GslRFile
Returns:
total length of the GslRFile in bytes

Retrieve the file length of rfile in bytes.

gchar* gsl_rfile_name ( GslRFile rfile)
Parameters:
rfilevalid GslRFile
Returns:
the file name used to open this file

Retrieve the file name used to open rfile.

GslRFile* gsl_rfile_open ( const gchar *  file_name)
Parameters:
file_namename of the file to open
Returns:
a new opened GslRFile or NULL if an error occoured (errno set)

Open a file for reading and create a GSL read only file handle for it. The motivation for using a GslRFile over normal unix files is to reduce the amount of opened unix file descriptors by using a GslHFile for the actual IO.

GslLong gsl_rfile_position ( GslRFile rfile)
Parameters:
rfilevalid GslRFile
Returns:
current position within 0 and gsl_rfile_length()

Retrieve the current GslRFile seek position.

GslLong gsl_rfile_pread ( GslRFile rfile,
GslLong  offset,
GslLong  n_bytes,
gpointer  bytes 
)
Parameters:
rfilevalid GslRFile
offsetoffset in bytes within 0 and gsl_rfile_length()
n_bytesnumber of bytes to read
bytesbuffer to store read bytes
Returns:
amount of bytes read or -1 if an error occoured (errno set)

Read a block of bytes from a GslRFile at a specified position.

GslLong gsl_rfile_read ( GslRFile rfile,
GslLong  n_bytes,
gpointer  bytes 
)
Parameters:
rfilevalid GslRFile
n_bytesnumber of bytes to read
bytesbuffer to store read bytes
Returns:
amount of bytes read or -1 if an error occoured (errno set)

Read a block of bytes from a GslRFile from the current seek position and advance the seek position.

GslLong gsl_rfile_seek_set ( GslRFile rfile,
GslLong  offset 
)
Parameters:
rfilevalid GslRFile
offsetnew seek position within 0 and gsl_rfile_length()+1
Returns:
resulting position within 0 and gsl_rfile_length()+1

Set the current GslRFile seek position.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines