Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::FilesIntStream Class Reference

#include <IntStream.h>

Inheritance diagram for PLearn::FilesIntStream:

Inheritance graph
[legend]
Collaboration diagram for PLearn::FilesIntStream:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 FilesIntStream (int nfiles, const char *files[])
virtual void seek (long position)
 move to given position

virtual int next ()
 return next available int from the stream and increment position

virtual int current ()
 return next available int from the stream

virtual long size ()
 total length of the stream

virtual void reopen ()
virtual ~FilesIntStream ()

Protected Member Functions

 FilesIntStream (FilesIntStream &x)
 disallow a copy

void read_current ()
 read from current current_file at next_pos_in_current_file into current_value


Protected Attributes

int n_files
 number of files

const char ** file_names
 names of each of the files;

FILE ** fp
 pointers to each of the files;

int current_file
 between 0 and n_files-1

int next_pos_in_current_file
 position within current file

intsizes
int total_size
 sum_i sizes[i]

int current_value
 just read at current position


Constructor & Destructor Documentation

PLearn::FilesIntStream::FilesIntStream FilesIntStream x  )  [inline, protected]
 

disallow a copy

Definition at line 133 of file IntStream.h.

References PLERROR.

PLearn::FilesIntStream::FilesIntStream int  nfiles,
const char *  files[]
 

Definition at line 123 of file IntStream.cc.

References file_names, fp, n_files, PLERROR, read_current(), sizes, and total_size.

PLearn::FilesIntStream::~FilesIntStream  )  [virtual]
 

Definition at line 237 of file IntStream.cc.

References fp, n_files, and sizes.


Member Function Documentation

int PLearn::FilesIntStream::current  )  [virtual]
 

return next available int from the stream

Reimplemented from PLearn::IntStream.

Definition at line 226 of file IntStream.cc.

References current_value.

int PLearn::FilesIntStream::next  )  [virtual]
 

return next available int from the stream and increment position

Reimplemented from PLearn::IntStream.

Definition at line 218 of file IntStream.cc.

References current_value, and read_current().

void PLearn::FilesIntStream::read_current  )  [protected]
 

read from current current_file at next_pos_in_current_file into current_value

Definition at line 157 of file IntStream.cc.

References current_file, current_value, file_names, fp, n_files, next_pos_in_current_file, PLERROR, PLearn::reverse_int(), seek(), sizes, and total_size.

Referenced by FilesIntStream(), next(), and seek().

void PLearn::FilesIntStream::reopen  )  [virtual]
 

re-open all the file pointers and seek(position()) this is useful when a forked child process wants access to the same stream without interfering with parent

Reimplemented from PLearn::IntStream.

Definition at line 142 of file IntStream.cc.

References file_names, fp, n_files, PLERROR, and seek().

void PLearn::FilesIntStream::seek long  position  )  [virtual]
 

move to given position

Reimplemented from PLearn::IntStream.

Definition at line 195 of file IntStream.cc.

References current_file, file_names, fp, n_files, next_pos_in_current_file, PLERROR, read_current(), sizes, and total_size.

Referenced by read_current(), and reopen().

long PLearn::FilesIntStream::size  )  [virtual]
 

total length of the stream

Reimplemented from PLearn::IntStream.

Definition at line 232 of file IntStream.cc.

References total_size.


Member Data Documentation

int PLearn::FilesIntStream::current_file [protected]
 

between 0 and n_files-1

Definition at line 127 of file IntStream.h.

Referenced by read_current(), and seek().

int PLearn::FilesIntStream::current_value [protected]
 

just read at current position

Definition at line 131 of file IntStream.h.

Referenced by current(), next(), and read_current().

const char* * PLearn::FilesIntStream::file_names [protected]
 

names of each of the files;

Definition at line 125 of file IntStream.h.

Referenced by FilesIntStream(), read_current(), reopen(), and seek().

FILE** PLearn::FilesIntStream::fp [protected]
 

pointers to each of the files;

Definition at line 126 of file IntStream.h.

Referenced by FilesIntStream(), read_current(), reopen(), seek(), and ~FilesIntStream().

int PLearn::FilesIntStream::n_files [protected]
 

number of files

Definition at line 124 of file IntStream.h.

Referenced by FilesIntStream(), read_current(), reopen(), seek(), and ~FilesIntStream().

int PLearn::FilesIntStream::next_pos_in_current_file [protected]
 

position within current file

Definition at line 128 of file IntStream.h.

Referenced by read_current(), and seek().

int* PLearn::FilesIntStream::sizes [protected]
 

Definition at line 129 of file IntStream.h.

Referenced by FilesIntStream(), read_current(), seek(), and ~FilesIntStream().

int PLearn::FilesIntStream::total_size [protected]
 

sum_i sizes[i]

Definition at line 130 of file IntStream.h.

Referenced by FilesIntStream(), read_current(), seek(), and size().


The documentation for this class was generated from the following files:
Generated on Tue Aug 17 16:23:10 2004 for PLearn by doxygen 1.3.7