OpendTect-6_4  6.4
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
StreamProvider Class Reference

Provides I/O stream for file or system command. More...

Public Member Functions

 StreamProvider (const char *nm=0)
 
void set (const char *)
 
bool isBad () const
 
bool exists (bool forread) const
 
bool remove (bool recursive=true) const
 
bool setReadOnly (bool yn) const
 
bool isReadOnly () const
 
bool rename (const char *, const CallBack *cb=0)
 
StreamData makeOStream (bool binary=true, bool editmode=false) const
 
StreamData makeIStream (bool binary=true, bool allowpreloaded=true) const
 see makeOStream remark More...
 
const char * fullName () const
 
const char * fileName () const
 
const char * command () const
 
const char * hostName () const
 
void setFileName (const char *fn)
 
void setCommand (const char *cmd, const char *hostnm=0)
 
void addPathIfNecessary (const char *)
 adds given path if stored filename is relative More...
 
bool isFile () const
 
bool isCommand () 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. More...
 
static bool preLoad (const char *, TaskRunner &, const char *id)
 id can be anything, usually MultiID though More...
 
static bool preLoad (const BufferStringSet &, TaskRunner &, const char *id)
 id can be anything, usually MultiID though More...
 
static void getPreLoadedIDs (BufferStringSet &)
 
static void getPreLoadedFileNames (const char *id, BufferStringSet &)
 pass null id for all files More...
 
static int getPreLoadedDataPackID (const char *)
 
static void unLoad (const char *, bool isid=false)
 If isid, unload all with this id. More...
 
static void unLoadAll ()
 

Protected Member Functions

void mkOSCmd (BufferString &) const
 

Static Protected Member Functions

static StreamData makePLIStream (int)
 
static void sendCBMsg (const CallBack *, const char *)
 

Protected Attributes

BufferString fname_
 
bool iscomm_
 
BufferString hostname_
 

Detailed Description

Provides I/O stream for file or system command.

To specify a command, start with '@'. Hostname may be added as in OSCommand.

Examples:

Constructor & Destructor Documentation

StreamProvider::StreamProvider ( const char *  nm = 0)

Member Function Documentation

void StreamProvider::addPathIfNecessary ( const char *  )

adds given path if stored filename is relative

const char* StreamProvider::command ( ) const
inline
bool StreamProvider::exists ( bool  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::isBad ( ) const
inline
bool StreamProvider::isCommand ( ) const
inline
bool StreamProvider::isFile ( ) const
inline
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,
bool  editmode = false 
) const

On win32, binary mode differs from text mode. Use binary=false when explicitly reading txt files. Use editmode=true when want to edit/modify existing data in a file.

static StreamData StreamProvider::makePLIStream ( int  )
staticprotected
void StreamProvider::mkOSCmd ( BufferString ) const
protected
static bool StreamProvider::preLoad ( const char *  ,
TaskRunner ,
const char *  id 
)
static

id can be anything, usually MultiID though

static bool StreamProvider::preLoad ( const BufferStringSet ,
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() The callback will be called with a const char* capsule

static void StreamProvider::sendCBMsg ( const CallBack ,
const char *   
)
staticprotected
void StreamProvider::set ( const char *  )
void StreamProvider::setCommand ( const char *  cmd,
const char *  hostnm = 0 
)
void StreamProvider::setFileName ( const char *  fn)
bool StreamProvider::setReadOnly ( bool  yn) const
static const char* StreamProvider::sStdErr ( )
static
static const char* StreamProvider::sStdIO ( )
static
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

BufferString StreamProvider::fname_
protected
BufferString StreamProvider::hostname_
protected
bool StreamProvider::iscomm_
protected

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019