OpendTect  6.6
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
StreamProvider Class Reference

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

Public Member Functions

 StreamProvider (const char *filenm=nullptr)
 
 StreamProvider (const OS::MachineCommand &, const char *workdir)
 
 ~StreamProvider ()
 
void addPathIfNecessary (const char *)
 adds given path if stored filename is relative More...
 
bool exists (bool forread) const
 
const char * fileName () const
 
bool isBad () const
 
bool isCommand () const
 
bool isFile () const
 
bool isReadOnly () const
 
StreamData makeIStream (bool binary=true, bool allowpreloaded=true) const
 see makeOStream remark More...
 
StreamData makeOStream (bool binary=true, bool editmode=false) const
 
bool remove (bool recursive=true) const
 
bool rename (const char *, const CallBack *cb=0)
 
void set (const char *inp)
 
void setCommand (const OS::MachineCommand &, const char *workdir)
 
void setFileName (const char *)
 
bool setReadOnly (bool yn) const
 

Static Public Member Functions

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

Static Protected Member Functions

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

Protected Attributes

BufferString fname_
 
OS::MachineCommandmc_ = nullptr
 
BufferString workingdir_
 

Private Member Functions

 StreamProvider (const StreamProvider &)=delete
 
StreamProvideroperator= (const StreamProvider &)=delete
 

Detailed Description

Provides I/O stream for file or system command.

Examples:

Constructor & Destructor Documentation

◆ StreamProvider() [1/3]

StreamProvider::StreamProvider ( const char *  filenm = nullptr)

◆ StreamProvider() [2/3]

StreamProvider::StreamProvider ( const OS::MachineCommand ,
const char *  workdir 
)

◆ ~StreamProvider()

StreamProvider::~StreamProvider ( )

◆ StreamProvider() [3/3]

StreamProvider::StreamProvider ( const StreamProvider )
privatedelete

Member Function Documentation

◆ addPathIfNecessary()

void StreamProvider::addPathIfNecessary ( const char *  )

adds given path if stored filename is relative

◆ createIStream()

static StreamData StreamProvider::createIStream ( const char *  ,
bool  binary = true 
)
static

keep binary==true also for text files unless you know what you are doing. win32 thing only.

◆ createOStream()

static StreamData StreamProvider::createOStream ( const char *  ,
bool  binary = true,
bool  inplaceedit = false 
)
static

keep binary==true also for text files unless you know what you are doing. win32 thing only.

◆ exists()

bool StreamProvider::exists ( bool  forread) const

◆ fileName()

const char* StreamProvider::fileName ( ) const
inline

◆ getPreLoadedDataPackID()

static int StreamProvider::getPreLoadedDataPackID ( const char *  )
static

◆ getPreLoadedFileNames()

static void StreamProvider::getPreLoadedFileNames ( const char *  id,
BufferStringSet  
)
static

pass null id for all files

◆ getPreLoadedIDs()

static void StreamProvider::getPreLoadedIDs ( BufferStringSet )
static

◆ isBad()

bool StreamProvider::isBad ( ) const

◆ isCommand()

bool StreamProvider::isCommand ( ) const
inline

◆ isFile()

bool StreamProvider::isFile ( ) const
inline

◆ isPreLoaded()

static bool StreamProvider::isPreLoaded ( const char *  ,
bool  isid 
)
static

If isid, a single hit will return true.

◆ isReadOnly()

bool StreamProvider::isReadOnly ( ) const

◆ makeIStream()

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

see makeOStream remark

◆ makeOStream()

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.

◆ makePLIStream()

static StreamData StreamProvider::makePLIStream ( int  )
staticprotected

◆ operator=()

StreamProvider& StreamProvider::operator= ( const StreamProvider )
privatedelete

◆ preLoad() [1/2]

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

id can be anything, usually MultiID though

◆ preLoad() [2/2]

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

id can be anything, usually MultiID though

◆ remove()

bool StreamProvider::remove ( bool  recursive = true) const

◆ rename()

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

◆ sendCBMsg()

static void StreamProvider::sendCBMsg ( const CallBack ,
const char *   
)
staticprotected

◆ set()

void StreamProvider::set ( const char *  inp)

◆ setCommand()

void StreamProvider::setCommand ( const OS::MachineCommand ,
const char *  workdir 
)

◆ setFileName()

void StreamProvider::setFileName ( const char *  )

◆ setReadOnly()

bool StreamProvider::setReadOnly ( bool  yn) const

◆ sStdErr()

static const char* StreamProvider::sStdErr ( )
static

◆ sStdIO()

static const char* StreamProvider::sStdIO ( )
static

◆ unLoad()

static void StreamProvider::unLoad ( const char *  ,
bool  isid = false 
)
static

If isid, unload all with this id.

◆ unLoadAll()

static void StreamProvider::unLoadAll ( )
static

Member Data Documentation

◆ fname_

BufferString StreamProvider::fname_
protected

◆ mc_

OS::MachineCommand* StreamProvider::mc_ = nullptr
protected

◆ workingdir_

BufferString StreamProvider::workingdir_
protected

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