A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/classCInputStreamSource.html below:

NCBI C++ ToolKit: CInputStreamSource Class Reference

Search Toolkit Book for CInputStreamSource

class CInputStreamSource encapsulates details of how we supply applications with input data through sets of command-line options, and permits code to work with a standard API for accepting input data from the command-line. More...

#include <util/stream_source.hpp>

class CInputStreamSource encapsulates details of how we supply applications with input data through sets of command-line options, and permits code to work with a standard API for accepting input data from the command-line.

This class offers many variants for accepting and managing input data. Currently supported modes are:

Once instantiated, this class supports the ability to iterate a set of input streams using the code metaphor:

...

}

class CInputStreamSource encapsulates details of how we supply applications with input data through s...

IO_PREFIX::istream CNcbiIstream

Portable alias for istream.

const CharType(& source)[N]

#define GetArgs

Avoid preprocessor name clash with the NCBI C Toolkit.

Streams are checked for error conditions at the start (badbit or failbit before being returned from the iterator) and end (badbit after use, prior to iterating to the next stream), throwing an exception in such case. The former handles cases of files which don't exist, and the latter handles cases of disk read errors without preventing operations line getline (which sets failbit on reading the last line of input, with a terminator).

Definition at line 74 of file stream_source.hpp.

◆ CInputStreamSource() [1/3] CInputStreamSource::CInputStreamSource ( )

Default ctor This ctor leaves the stream source empty.

Definition at line 126 of file stream_source.cpp.

◆ CInputStreamSource() [2/3]

Initialize our stream source through the arguments provided on a command-line.

This constructor will interpret the commands supplied via SetStandardInputArgs()

Parameters
args Argument class for interpretation

Definition at line 132 of file stream_source.cpp.

References InitArgs().

◆ ~CInputStreamSource() CInputStreamSource::~CInputStreamSource ( ) virtual

Definition at line 139 of file stream_source.cpp.

◆ CInputStreamSource() [3/3] ◆ GetCurrentFileName() string CInputStreamSource::GetCurrentFileName ( void  ) const ◆ GetCurrentStreamIndex() size_t CInputStreamSource::GetCurrentStreamIndex ( size_t *  count = nullptr ) const

Returns the current file index and the total number of files.

Parameters
count address of variable which receives the total number of files
Returns
the current file index

Definition at line 401 of file stream_source.cpp.

References count, m_CurrIndex, and m_Files.

◆ GetStream() [1/2] ◆ GetStream() [2/2] ◆ HaveArgsForPrefix() bool CInputStreamSource::HaveArgsForPrefix ( const stringprefix = "input" ) static ◆ InitArgs() ◆ InitFile() void CInputStreamSource::InitFile ( const stringfile_path ) ◆ InitFilesInDirSubtree()

Initialize from a file search path.

Definition at line 242 of file stream_source.cpp.

References _TRACE, eUnknown, CDir::Exists(), fFF_File, fFF_Recursive, FindFiles(), m_CurrIndex, m_Files, m_Istr, NCBI_THROW, and Rewind().

Referenced by InitArgs().

◆ InitManifest() void CInputStreamSource::InitManifest ( const stringmanifest )

Initialize from a manifest file.

See also
CFileManifest

Definition at line 221 of file stream_source.cpp.

References _TRACE, all, copy(), eUnknown, CFileManifest::GetAllFilePaths(), m_CurrIndex, m_Files, m_Istr, NCBI_THROW, and Rewind().

Referenced by InitArgs(), and CPrimeCacheApplication::Run().

◆ InitStream()

Initialize from a stream No ownership is claimed by this class - lifetime management of the stream is the responsibility of the caller.

Initialize from a given stream which is the sole content.

Precondition
The stream is in a good condition, else throws an exception.
Parameters
fname (optional) file name from whence the stream was created, for use in output and debug messages.

As precondition, expect that the stream is in a good condition prior to being handed off to consumers.

Definition at line 175 of file stream_source.cpp.

References eUnknown, m_CurrFile, m_CurrIndex, m_Files, m_Istr, and NCBI_THROW.

Referenced by InitArgs(), and CPrimeCacheApplication::Run().

◆ JumpToFile() ◆ operator bool() CInputStreamSource::operator bool ( void  ) const

Determine if there are any more streams to be processed.

Returns
boolean, true if there are more streams

Definition at line 409 of file stream_source.cpp.

◆ operator*()

Dereferencing the stream class returns the current stream.

Returns
The current stream

Definition at line 311 of file stream_source.cpp.

References GetStream().

◆ operator++()

Advance to the next stream in the class.

Returns
self, satisfying chainability of commands
Postcondition
The old stream, if there was one, is not in a bad condition (badbit set as may occur if there was a disk read error; the failbit is ignored, since operations like geline will set it to indicate the last line with a line terminator).

The current stream, if it exists, is in a good condition (badbit or failbit set).

If these conditions aren't met, throws an exception.

Definition at line 373 of file stream_source.cpp.

References x_OpenNextFile(), and x_Reset().

◆ operator=() ◆ RecreateInputArgs() ◆ Rewind() ◆ SetStandardInputArgs()

Supply a standard set of arguments via argument descriptions to an application.

Currently supported arguments are:

Any or all of these arguments may be supplied by an application

Parameters
arg_desc Argument description class into which arguments will be added prefix The base prefix to use. Providing a different value here can be used to add a standard panel of additional arguments to control input sources. description The description that will appear in -help is_mandatory A flag to indicate whether one of the configured arguments must be provided.

Definition at line 41 of file stream_source.cpp.

References CArgDescriptions::AddAlias(), CArgDescriptions::AddDefaultKey(), CArgDescriptions::AddKey(), CArgDescriptions::AddOptionalKey(), CArgDescriptions::eExcludes, CArgDescriptions::eInputFile, CArgDescriptions::eRequires, CArgDescriptions::eString, set< Key, Compare >::insert(), s_InputStreamSourcePrefixes, CArgDescriptions::SetCurrentGroup(), and CArgDescriptions::SetDependency().

Referenced by CAlignCleanupApplication::Init(), and CAdvancedAlignCleanup::SetupArgDescriptions().

◆ x_OpenNextFile() void CInputStreamSource::x_OpenNextFile ( ) protectedvirtual ◆ x_OpenOwnedStream() void CInputStreamSource::x_OpenOwnedStream ( CNcbiIstreamis ) protected ◆ x_Reset() void CInputStreamSource::x_Reset ( void  ) protected ◆ m_Args CArgs CInputStreamSource::m_Args protected ◆ m_CurrFile string CInputStreamSource::m_CurrFile protected ◆ m_CurrIndex size_t CInputStreamSource::m_CurrIndex protected ◆ m_Files vector<string> CInputStreamSource::m_Files protected ◆ m_Istr ◆ m_IstrOwned ◆ m_Prefix string CInputStreamSource::m_Prefix protected

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4