Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes

StreamProvider Class Reference

provides I/O stream for disk or tape file or system command. More...

List of all members.

Public Member Functions

 StreamProvider (const char *nm=0)
 StreamProvider (const char *, const char *, StreamConn::Type)
void set (const char *)
bool rename (const char *, const CallBack *cb=0)
 renames if file. if successful, does a set()
bool skipFiles (int) const
 Skips files if tape.
bool rewind () const
 Rewinds if tape.
bool offline () const
 Checks whether tape is offline.
bool bad () const
bool exists (int forread) const
bool remove (bool recursive=true) const
bool setReadOnly (bool yn) const
bool isReadOnly () const
StreamData makeOStream (bool binary=true) const
StreamData makeIStream (bool binary=true, bool allowpreloaded=true) const
 see makeOStream remark
bool executeCommand (bool inbg=false, bool inconsole=false) const
void mkBatchCmd (BufferString &comm) const
const char * fullName () const
const char * hostName () const
const char * fileName () const
const char * command () const
long blockSize () const
void setHostName (const char *hname)
void setFileName (const char *fn)
void setCommand (const char *fn)
void setBlockSize (long bs)
void addPathIfNecessary (const char *)
 adds given path if stored filename is relative
void setRemExec (const char *s)
StreamConn::Type type ()
bool isNormalFile () const

Static Public Member Functions

static const char * sStdIO ()
static const char * sStdErr ()
static bool isPreLoaded (const char *, bool isid)
 If isid, a single hit will return true.
static bool preLoad (const char *, TaskRunner &, const char *id)
 id can be anything, usually MultiID though
static bool preLoad (const BufferStringSet &, TaskRunner &, const char *id)
 id can be anything, usually MultiID though
static void getPreLoadedIDs (BufferStringSet &)
static void getPreLoadedFileNames (const char *id, BufferStringSet &)
 pass null id for all files
static int getPreLoadedDataPackID (const char *)
static void unLoad (const char *, bool isid=false)
 If isid, unload all with this id.
static void unLoadAll ()

Protected Member Functions

void mkOSCmd (bool) const

Static Protected Member Functions

static StreamData makePLIStream (int)
static void sendCBMsg (const CallBack *, const char *)
 The callback will be called with a const char* capsule.

Protected Attributes

BufferString fname_
BufferString hostname_
BufferString rshcomm_
long blocksize_
bool isbad_
StreamConn::Type type_

Detailed Description

provides I/O stream for disk or tape file or system command.

StreamProvider provides a stream with requested source attached:

A null string or StreamProvider::sStdIO will select std input and output.


Constructor & Destructor Documentation

StreamProvider::StreamProvider ( const char *  nm = 0  ) 
StreamProvider::StreamProvider ( const char *  ,
const char *  ,
StreamConn::Type   
)

Member Function Documentation

void StreamProvider::addPathIfNecessary ( const char *   ) 

adds given path if stored filename is relative

bool StreamProvider::bad (  )  const [inline]
long StreamProvider::blockSize (  )  const [inline]
const char* StreamProvider::command (  )  const [inline]
bool StreamProvider::executeCommand ( bool  inbg = false,
bool  inconsole = false 
) const

If type is Command, execute command without opening pipe 'inbg' will execute in background if remote

bool StreamProvider::exists ( int  forread  )  const
const char* StreamProvider::fileName (  )  const [inline]
const char* StreamProvider::fullName (  )  const
static int StreamProvider::getPreLoadedDataPackID ( const char *   )  [static]
static void StreamProvider::getPreLoadedFileNames ( const char *  id,
BufferStringSet  
) [static]

pass null id for all files

static void StreamProvider::getPreLoadedIDs ( BufferStringSet  )  [static]
const char* StreamProvider::hostName (  )  const [inline]
bool StreamProvider::isNormalFile (  )  const
static bool StreamProvider::isPreLoaded ( const char *  ,
bool  isid 
) [static]

If isid, a single hit will return true.

bool StreamProvider::isReadOnly (  )  const
StreamData StreamProvider::makeIStream ( bool  binary = true,
bool  allowpreloaded = true 
) const

see makeOStream remark

StreamData StreamProvider::makeOStream ( bool  binary = true  )  const

On win32, binary mode differs from text mode. Use binary=false when explicitly reading txt files.

static StreamData StreamProvider::makePLIStream ( int   )  [static, protected]
void StreamProvider::mkBatchCmd ( BufferString comm  )  const
void StreamProvider::mkOSCmd ( bool   )  const [protected]
bool StreamProvider::offline (  )  const

Checks whether tape is offline.

static bool StreamProvider::preLoad ( const BufferStringSet ,
TaskRunner ,
const char *  id 
) [static]

id can be anything, usually MultiID though

static bool StreamProvider::preLoad ( const char *  ,
TaskRunner ,
const char *  id 
) [static]

id can be anything, usually MultiID though

bool StreamProvider::remove ( bool  recursive = true  )  const
bool StreamProvider::rename ( const char *  ,
const CallBack cb = 0 
)

renames if file. if successful, does a set()

bool StreamProvider::rewind (  )  const

Rewinds if tape.

static void StreamProvider::sendCBMsg ( const CallBack ,
const char *   
) [static, protected]

The callback will be called with a const char* capsule.

void StreamProvider::set ( const char *   ) 
void StreamProvider::setBlockSize ( long  bs  )  [inline]
void StreamProvider::setCommand ( const char *  fn  )  [inline]
void StreamProvider::setFileName ( const char *  fn  )  [inline]
void StreamProvider::setHostName ( const char *  hname  )  [inline]
bool StreamProvider::setReadOnly ( bool  yn  )  const
void StreamProvider::setRemExec ( const char *  s  )  [inline]
bool StreamProvider::skipFiles ( int   )  const

Skips files if tape.

static const char* StreamProvider::sStdErr (  )  [static]
static const char* StreamProvider::sStdIO (  )  [static]
StreamConn::Type StreamProvider::type (  )  [inline]
static void StreamProvider::unLoad ( const char *  ,
bool  isid = false 
) [static]

If isid, unload all with this id.

static void StreamProvider::unLoadAll (  )  [static]

Member Data Documentation

long StreamProvider::blocksize_ [protected]
bool StreamProvider::isbad_ [protected]