&description,
47 if(prefix ==
"input") {
49 "Stream of "+ description,
52arg_desc.
AddAlias(
"i",
"input");
55arg_desc.
AddKey(prefix,
"InputFile",
56 "Stream of "+ description,
61 "Stream of "+ description,
67 "Path to "+ description,
70 "File pattern to search for "+ description,
77 "File containing a list of files containing "+ description,
82prefix +
"-manifest");
92 if(prefix ==
"input") {
93arg_desc.
AddAlias(
"I",
"input-manifest");
102 if(args[prefix +
"-path"].
HasValue()) {
103 result.push_back(
"-"+ prefix +
"-path");
104 result.push_back(args[prefix +
"-path"].AsString());
105 if(args[prefix +
"-mask"]) {
106 result.push_back(
"-"+ prefix +
"-mask");
107 result.push_back(args[prefix +
"-mask"].AsString());
110 else if(args[prefix +
"-manifest"].
HasValue()) {
111 result.push_back(
"-"+ prefix +
"-manifest");
112 result.push_back(args[prefix +
"-manifest"].AsString());
115 result.push_back(
"-"+ prefix);
116 result.push_back(args[prefix].AsString());
127: m_Istr(
NULL), m_CurrIndex(0)
133: m_Istr(
NULL), m_CurrIndex(0)
149 stringpath =
m_Args[prefix +
"-path"].AsString();
151 if(
m_Args[prefix +
"-mask"]) {
179 "CInputStreamSource::InitManifest(): " 180 "attempt to init already initted class");
184 "CInputStreamSource::InitStream(): " 200 "CInputStreamSource::InitFile(): " 201 "attempt to init already initted class");
225 "CInputStreamSource::InitManifest(): " 226 "attempt to init already initted class");
234 _TRACE(
"Added "<<
m_Files.size() <<
" files from input manifest");
243 const string& file_mask)
247 "CInputStreamSource::InitFilesInDirSubtree(): " 248 "atemmpt to init already initted class");
254 "input directory "+ file_path +
" does not exist");
257vector<string> paths;
258paths.push_back(file_path);
260vector<string> masks;
261 if( !file_mask.empty() ) {
262masks.push_back(file_mask);
264masks.push_back(
"*");
269paths.begin(), paths.end(),
270masks.begin(), masks.end(),
272 _TRACE(
"Added "<<
m_Files.size() <<
" files from input path");
329 "CInputStreamSource::operator++(): " 330 "Unknown error in input stream, " 331 "which is in a bad state after use");
340 string msg(
"CInputStreamSource::operator++(): " 341 "Unknown error reading file, " 342 "which is in a bad state after use: ");
367 string msg(
"CInputStreamSource: File is not accessible: ");
409CInputStreamSource::operator
bool()
const 414 return(m_Istr || m_IstrOwned.get() || m_CurrIndex < m_Files.size());
ncbi::TMaskedQueryRegions mask
vector< string > GetAllFilePaths() const
Returns all the file paths referenced by the manifest.
class CInputStreamSource encapsulates details of how we supply applications with input data through s...
void InitManifest(const string &manifest)
Initialize from a manifest file.
CInputStreamSource & operator++()
Advance to the next stream in the class.
CInputStreamSource & JumpToFile(unsigned index)
Jump to specified file in input list.
virtual void x_OpenNextFile()
static bool HaveArgsForPrefix(const string &prefix="input")
Check whether the arguments for a specific prefix have been set up in this application.
size_t GetCurrentStreamIndex(size_t *count=nullptr) const
Returns the current file index and the total number of files.
string GetCurrentFileName(void) const
Returns the current file name.
virtual ~CInputStreamSource()
void x_OpenOwnedStream(CNcbiIstream *is)
static vector< string > RecreateInputArgs(const CArgs &args, const string &prefix="input")
Get the standard input arguments that are present in args so we can pass them on to some other progra...
CNcbiIstream & operator*()
Dereferencing the stream class returns the current stream.
CInputStreamSource()
Default ctor This ctor leaves the stream source empty.
CNcbiIstream & GetStream(void)
Access the current stream.
CInputStreamSource & Rewind(void)
Resets the iterator to the first stream in the class.
static void SetStandardInputArgs(CArgDescriptions &arg_desc, const string &prefix="input", const string &description="data to process", bool is_mandatory=false)
Supply a standard set of arguments via argument descriptions to an application.
void InitFilesInDirSubtree(const string &file_path, const string &file_mask=kEmptyStr)
Initialize from a file search path.
unique_ptr< CNcbiIstream > m_IstrOwned
virtual void InitArgs(const CArgs &args, const string &prefix="input")
Initialize from a set of arguments.
void InitStream(CNcbiIstream &istr, const string &fname=kEmptyStr)
Initialize from a stream No ownership is claimed by this class - lifetime management of the stream is...
void InitFile(const string &file_path)
Initialize from a single file path.
iterator_bool insert(const value_type &val)
void SetDependency(const string &arg1, EDependency dep, const string &arg2)
Define a dependency.
void AddKey(const string &name, const string &synopsis, const string &comment, EType type, TFlags flags=0)
Add description for mandatory key.
void AddAlias(const string &alias, const string &arg_name)
Add argument alias.
CArgs & Assign(const CArgs &other)
Copy contents of another object into this one.
void AddOptionalKey(const string &name, const string &synopsis, const string &comment, EType type, TFlags flags=0)
Add description for optional key without default value.
void SetCurrentGroup(const string &group)
Set current arguments group name.
void AddDefaultKey(const string &name, const string &synopsis, const string &comment, EType type, const string &default_value, TFlags flags=0, const string &env_var=kEmptyStr, const char *display_value=nullptr)
Add description for optional key with default value.
@ eRequires
One argument requires another.
@ eExcludes
One argument excludes another.
@ eInputFile
Name of file (must exist and be readable)
@ eString
An arbitrary string.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void FindFiles(TPathIterator path_begin, TPathIterator path_end, const vector< string > &masks, TFindFunc &find_func, TFindFiles flags=fFF_Default)
Generic algorithm for file search.
virtual bool Exists(void) const
Check if directory "dirname" exists.
@ fFF_Recursive
descend into sub-dirs
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static set< string > s_InputStreamSourcePrefixes
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