head 1.4; access; symbols; locks; strict; comment @# @; 1.4 date 2002.09.07.01.50.36; author curt; state Exp; branches; next 1.3; 1.3 date 2002.08.31.19.01.50; author curt; state Exp; branches; next 1.2; 1.2 date 2002.08.31.18.53.58; author curt; state Exp; branches; next 1.1; 1.1 date 2002.02.15.17.21.54; author curt; state Exp; branches; next ; desc @@ 1.4 log @Updated doxygen docs. @ text @
Main Page Class Hierarchy Compound List File List Compound Members File Members

# SGFile Class Reference

A file I/O class based on SGIOChannel. More...

`#include <sg_file.hxx>`

Inheritance diagram for SGFile:

List of all members.

## Public Methods
| SGFile (const string &file)
| Create an instance of SGFile.
| ~SGFile ()
| Destructor.
bool | open (const SGProtocolDir dir)
| Open a channel.
int | read (char *buf, int length)
| The read() method is modeled after the read() Unix system call.
int | readline (char *buf, int length)
| The readline() method is similar to read() except that it will stop at the first end of line encountered in the input buffer.
int | write (const char *buf, const int length)
| The write() method is modeled after the write() Unix system call and is analogous to the read() method.
int | writestring (const char *str)
| The writestring() method is a simple wrapper that will calculate the length of a null terminated character array and write it to the output channel.
bool | close ()
| The close() method is modeled after the close() Unix system call and will close an open device.
string | get_file_name () const

## Detailed Description

A file I/O class based on SGIOChannel.

Definition at line 53 of file sg_file.hxx.

## Constructor & Destructor Documentation

SGFile::SGFile | ( | const string & | file | ) |

  | Create an instance of SGFile. When calling the constructor you need to provide a file name. This file is not opened immediately, but instead will be opened when the open() method is called. Parameters:
  file | name of file to open
Definition at line 39 of file sg_file.cxx.

## Member Function Documentation

bool SGFile::close | ( |  | ) | `[virtual]`

| The close() method is modeled after the close() Unix system call and will close an open device. You should call this method when you are done using your IO class, before it is destructed. Returns: result of close Reimplemented from SGIOChannel. Definition at line 128 of file sg_file.cxx.

string SGFile::get_file_name | ( |  | ) | const`[inline]`

| Returns: the name of the file being manipulated. Definition at line 91 of file sg_file.hxx.

bool SGFile::open | ( | const SGProtocolDir | dir | ) | `[virtual]`

  | Open a channel. Parameters:
  d | channel communication "direction" Direction can be one of: SG_IO_IN - data will be flowing into this object to the application. SG_IO_OUT - data will be flowing out of this object from the application. SG_IO_BI - data will be flowing in both directions. SG_IO_NONE - data will not be flowing in either direction. This is here for the sake of completeness.
Returns: result of open Reimplemented from SGIOChannel. Definition at line 50 of file sg_file.cxx. References SG_LOG, and SGProtocolDir.

int SGFile::read | ( | char * | buf,
|  | int | length
| ) | `[virtual]`

  | The read() method is modeled after the read() Unix system call. You must provide a pointer to a character buffer that has enough allocated space for your potential read. You can also specify the maximum number of bytes allowed for this particular read. The actual number of bytes read is returned. You are responsible to ensure that the size of buf is large enough to accomodate your input message Parameters:
  buf | a char pointer to your input buffer
  length | max number of bytes to read
Returns: number of bytes read Reimplemented from SGIOChannel. Definition at line 78 of file sg_file.cxx.

int SGFile::readline | ( | char * | buf,
|  | int | length
| ) | `[virtual]`

  | The readline() method is similar to read() except that it will stop at the first end of line encountered in the input buffer. Parameters:
  buf | a char pointer to your input buffer
  length | max number of bytes to read
Returns: number of bytes read Reimplemented from SGIOChannel. Definition at line 85 of file sg_file.cxx.

int SGFile::write | ( | const char * | buf,
|  | const int | length
| ) | `[virtual]`

  | The write() method is modeled after the write() Unix system call and is analogous to the read() method. You provide a pointer to a buffer of data, and then length of that data to be written out. The number of bytes written is returned. Parameters:
  buf | a char pointer to your output buffer
  length | number of bytes to write
Returns: number of bytes written Reimplemented from SGIOChannel. Definition at line 110 of file sg_file.cxx. References SG_LOG. Referenced by writestring().

int SGFile::writestring | ( | const char * | str | ) | `[virtual]`

  | The writestring() method is a simple wrapper that will calculate the length of a null terminated character array and write it to the output channel. Parameters:
  buf | a char pointer to your output buffer
Returns: number of bytes written Reimplemented from SGIOChannel. Definition at line 121 of file sg_file.cxx. References write().

The documentation for this class was generated from the following files:

- sg_file.hxx
- sg_file.cxx

@ 1.3 log @Oops, try again. @ text @d414 1 a414 1