NCBI C++ ToolKit
|
Search Toolkit Book for CPrimeCacheApplication
Classes | |
class | CCacheBioseq |
struct | SOrgData |
Public Member Functions | |
CPrimeCacheApplication () | |
Public Member Functions inherited from CNcbiApplication | |
virtual | ~CNcbiApplication (void) |
Destructor. More... | |
CNcbiApplication (const SBuildInfo &build_info=NCBI_SBUILDINFO_DEFAULT()) | |
Constructor. More... | |
Public Member Functions inherited from CNcbiApplicationAPI | |
CNcbiApplicationAPI (const SBuildInfo &build_info) | |
Constructor. More... | |
virtual | ~CNcbiApplicationAPI (void) |
Destructor. More... | |
int | AppMain (int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString) |
Main function (entry point) for the NCBI application. More... | |
virtual int | DryRun (void) |
Test run the application. More... | |
const CNcbiArguments & | GetArguments (void) const |
Get the application's cached unprocessed command-line arguments. More... | |
virtual const CArgs & | GetArgs (void) const |
Get parsed command line arguments. More... | |
const CNcbiEnvironment & | GetEnvironment (void) const |
Get the application's cached environment. More... | |
CNcbiEnvironment & | SetEnvironment (void) |
Get a non-const copy of the application's cached environment. More... | |
void | SetEnvironment (const string &name, const string &value) |
Set a specified environment variable by name. More... | |
bool | HasLoadedConfig (void) const |
Check if the config file has been loaded. More... | |
bool | FinishedLoadingConfig (void) const |
Check if the application has finished loading config file (successfully or not). More... | |
const CNcbiRegistry & | GetConfig (void) const |
Get the application's cached configuration parameters (read-only). More... | |
CNcbiRegistry & | GetConfig (void) |
const string & | GetConfigPath (void) const |
Get the full path to the configuration file (if any) we ended up using. More... | |
bool | ReloadConfig (CMetaRegistry::TFlags flags=CMetaRegistry::fReloadIfChanged, IRegistry::TFlags reg_flags=IRegistry::fWithNcbirc) |
Reload the configuration file. More... | |
SIZE_TYPE | FlushDiag (CNcbiOstream *os, bool close_diag=false) |
Flush the in-memory diagnostic stream (for "eDS_ToMemory" case only). More... | |
const string & | GetProgramDisplayName (void) const |
Get the application's "display" name. More... | |
const string & | GetProgramExecutablePath (EFollowLinks follow_links=eIgnoreLinks) const |
Get the application's executable path. More... | |
CVersionInfo | GetVersion (void) const |
Get the program version information. More... | |
const CVersionAPI & | GetFullVersion (void) const |
Get the program version information. More... | |
bool | IsDryRun (void) const |
Check if it is a test run. More... | |
virtual bool | SetupDiag_AppSpecific (void) |
Setup application specific diagnostic stream. More... | |
template<class TFunc > | |
void | AddOnExitAction (TFunc func) |
Add callback to be executed from CNcbiApplicationAPI destructor. More... | |
Friends | |
class | CCacheBioseq |
Additional Inherited Members | |
Public Types inherited from CNcbiApplicationAPI | |
enum | EAppNameType { eBaseName , eFullName , eRealName } |
Static Public Member Functions inherited from CNcbiApplication | |
static CNcbiApplication * | Instance (void) |
Singleton method. More... | |
Static Public Member Functions inherited from CNcbiApplicationAPI | |
static CNcbiApplicationAPI * | Instance (void) |
Singleton method. More... | |
static CNcbiApplicationGuard | InstanceGuard (void) |
Singleton method. More... | |
static SSystemMutex & | GetInstanceMutex (void) |
Mutex for application singleton object. More... | |
static string | GetAppName (EAppNameType name_type=eBaseName, int argc=0, const char *const *argv=NULL) |
Protected Types inherited from CNcbiApplicationAPI | |
enum | EPreparseArgs { ePreparse_Continue , ePreparse_Exit } |
Result of PreparseArgs() More... | |
enum | EDisableArgDesc { fDisableStdArgs = 0x01 } |
Disable argument descriptions. More... | |
enum | EHideStdArgs { fHideLogfile = CArgDescriptions::fHideLogfile , fHideConffile = CArgDescriptions::fHideConffile , fHideVersion = CArgDescriptions::fHideVersion , fHideFullVersion = CArgDescriptions::fHideFullVersion , fHideDryRun = CArgDescriptions::fHideDryRun , fHideHelp = CArgDescriptions::fHideHelp , fHideFullHelp = CArgDescriptions::fHideFullHelp , fHideXmlHelp = CArgDescriptions::fHideXmlHelp , fHideAll = CArgDescriptions::fHideAll } |
Which standard flag's descriptions should not be displayed in the usage message. More... | |
enum | EStdioSetup { fNoSyncWithStdio = 0x01 , fDefault_CinBufferSize = 0x02 , fBinaryCin = 0x04 , fBinaryCout = 0x08 , fDefault_SyncWithStdio = 0x00 } |
Flags to adjust standard I/O streams' behaviour. More... | |
enum | EExitMode { eNoExits , eExceptionalExits , eAllExits } |
When to return a user-set exit code. More... | |
enum | EAppFlags { fSkipSafeStaticDestroy = 1 << 0 } |
typedef int | TDisableArgDesc |
Binary OR of "EDisableArgDesc". More... | |
typedef int | THideStdArgs |
Binary OR of "EHideStdArgs". More... | |
typedef int | TStdioSetupFlags |
Binary OR of "EStdioSetup". More... | |
typedef int | TAppFlags |
Protected Member Functions inherited from CNcbiApplicationAPI | |
virtual EPreparseArgs | PreparseArgs (int argc, const char *const *argv) |
Check the command line arguments before parsing them. More... | |
void | DisableArgDescriptions (TDisableArgDesc disable=fDisableStdArgs) |
void | HideStdArgs (THideStdArgs hide_mask) |
Set the hide mask for the Hide Std Flags. More... | |
void | SetStdioFlags (TStdioSetupFlags stdio_flags) |
Adjust the behavior of standard I/O streams. More... | |
void | SetVersion (const CVersionInfo &version) |
Set the version number for the program. More... | |
void | SetVersion (const CVersionInfo &version, const SBuildInfo &build_info) |
void | SetVersionByBuild (int major) |
void | SetFullVersion (CRef< CVersionAPI > version) |
Set version data for the program. More... | |
virtual void | SetupArgDescriptions (CArgDescriptions *arg_desc) |
Setup the command line argument descriptions. More... | |
const CArgDescriptions * | GetArgDescriptions (void) const |
Get argument descriptions (set by SetupArgDescriptions) More... | |
bool | SetupDiag (EAppDiagStream diag) |
Setup the application diagnostic stream. More... | |
virtual bool | LoadConfig (CNcbiRegistry ®, const string *conf, CNcbiRegistry::TFlags reg_flags) |
Load settings from the configuration file to the registry. More... | |
virtual bool | LoadConfig (CNcbiRegistry ®, const string *conf) |
Load settings from the configuration file to the registry. More... | |
CNcbiRegistry & | GetRWConfig (void) |
Get the application's cached configuration parameters, accessible for read-write for an application's internal use only. More... | |
void | SetProgramDisplayName (const string &app_name) |
Set program's display name. More... | |
virtual void | AppStart (void) |
Method to be called before application start. More... | |
virtual void | AppStop (int exit_code) |
Method to be called before application exit. More... | |
void | SetExitCode (int exit_code, EExitMode when=eExceptionalExits) |
Force the program to return a specific exit code later, either when it exits due to an exception or unconditionally. More... | |
void | SetAppFlags (TAppFlags flags) |
void | ExecuteOnExitActions () |
Should only be called from the destructors of classes derived from CNcbiApplicationAPI - if it is necessary to access their data members and virtual methods; or to dynamic_cast<> from the base app class. More... | |
void | SetPhoneHomePolicy (IPhoneHomePolicy *policy, ENcbiOwnership ownership=eNoOwnership) |
Set Phone Home Policy. More... | |
IPhoneHomePolicy * | GetPhoneHomePolicy () const |
Return pointer to current Phone Home Policy or NULL. More... | |
Static Protected Member Functions inherited from CNcbiApplicationAPI | |
static CRWLock & | GetInstanceLock (void) |
static string | FindProgramExecutablePath (int argc, const char *const *argv, string *real_path=0) |
Find the application's executable file. More... | |
Definition at line 145 of file prime_cache.cpp.
|
inline |
Definition at line 148 of file prime_cache.cpp.
Referenced by main().
|
privatevirtual |
Cleanup on application exit.
Perform cleanup before exiting. The default behavior of this is "do nothing". If you have special cleanup logic that needs to be performed, then you must override this method with your own logic.
Reimplemented from CNcbiApplicationAPI.
Definition at line 1398 of file prime_cache.cpp.
References SetDiagStream().
|
privatevirtual |
Initialize the application.
The default behavior of this is "do nothing". If you have special initialization logic that needs to be peformed, then you must override this method with your own logic.
Reimplemented from CNcbiApplicationAPI.
Definition at line 281 of file prime_cache.cpp.
References CLocalTaxon::AddArguments(), CArgAllow_Strings::Allow(), CArgDescriptions::eExcludes, CArgDescriptions::eInputFile, CArgDescriptions::eInteger, CArgDescriptions::eOutputFile, CArgDescriptions::eRequires, CArgDescriptions::eString, CNcbiApplicationAPI::GetArguments(), ITERATE, and CNcbiApplicationAPI::SetupArgDescriptions().
|
privatevirtual |
Run the application.
It is defined as a pure virtual method – so you must(!) supply the Run() method to implement the application-specific logic.
Implements CNcbiApplicationAPI.
Definition at line 1039 of file prime_cache.cpp.
References CSerialObject::Assign(), CSeq_id_Handle::AsString(), CPrimeCacheApplication::SOrgData::biosource, count, CDir::CreatePath(), CSeq_id_Base::e_General, CAsnIndex::e_main, CSeqdesc_Base::e_Molinfo, CAsnIndex::e_seq_id, CSeqdesc_Base::e_Source, eGetId_Best, eGetId_Canonical, set< Key, Compare >::empty(), CBDB_RawFile::eReadWriteCreate, eSerial_AsnBinary, eSerial_AsnText, CSignal::eSignal_HUP, CSignal::eSignal_INT, CSignal::eSignal_QUIT, CSignal::eSignal_TERM, eUnknown, CFile::Exists(), CDir::Exists(), CArgValue::fAppend, CNcbiApplicationAPI::GetArgs(), NASNCacheFileName::GetBDBIndex(), GetDiagContext(), CSeq_id_Handle::GetHandle(), CObjectManager::GetInstance(), CBioSource_Base::GetOrg(), CLocalTaxon::GetOrgRef(), CDirEntry::GetPath(), CDiagContext::GetRequestContext(), CRequestContext::GetRequestTimer(), GetSeqId(), CSeqdesc_Base::GetSource(), i, CInputStreamSource::InitManifest(), CInputStreamSource::InitStream(), set< Key, Compare >::insert(), ncbi::grid::netcache::search::fields::key, m_CachePath, m_ExtractDelta, m_Genome, m_id_type, m_InstMol, m_MainIndex, m_MaxDeltaLevel, m_MolInfo, m_Orgs, m_other_descs, m_PreviousExecutionIds, m_PreviousExecutionRuns, m_SeqIdChunk, m_SeqIdIndex, m_SequenceTaxids, m_SequenceUniprotSources, m_StripInstMol, NCBI_THROW, NcbiGetlineEOL(), NStr::NumericToString(), om, CBDB_File::Open(), CObjectIStream::Open(), CSeqIdChunkFile::OpenForWrite(), CPrimeCacheApplication::SOrgData::orgref, CDiagContext::PrintRequestStart(), CDiagContext::PrintRequestStop(), CRef< C, Locker >::Reset(), CMolInfo_Base::SetBiomol(), CBDB_RawFile::SetCacheSize(), CSeqdesc_Base::SetMolinfo(), CRequestContext::SetRequestStatus(), NStr::Split(), CStopWatch::Start(), NStr::StartsWith(), NStr::StringToInt(), tag, TAX_ID_FROM, CSignal::TrapSignals(), NStr::TruncateSpaces(), NStr::TruncateSpacesInPlace(), CSeqdesc_Base::Which(), x_Process_Fasta(), x_Process_Ids(), x_Process_SeqEntry(), x_Read_Ids(), and ZERO_TAX_ID.
|
private |
Definition at line 788 of file prime_cache.cpp.
References CScope::AddTopLevelSeqEntry(), count, CTime::eCurrent, set< Key, Compare >::empty(), Error(), eUnknown, CChunkFile::GetChunkSerialNum(), GetId(), CObjectManager::GetInstance(), CChunkFile::GetOffset(), CTime::GetTimeT(), CSignal::IsSignaled(), LOG_POST, m_CachePath, m_ExtractDelta, m_id_type, m_MainChunk, m_StripInstMol, NCBI_THROW, offset, om, CObjectIStream::Open(), CChunkFile::OpenForWrite(), CCache_blob::Pack(), CSeq_entry::Parentize(), CCache_blob_Base::SetTimestamp(), ncbi::grid::netcache::search::fields::size, CStopWatch::Start(), sw, CChunkFile::Write(), x_ExtractAndIndex(), x_ExtractDelta(), and x_StripSeqEntry().
Referenced by x_Process_SeqEntry().
|
private |
Definition at line 451 of file prime_cache.cpp.
References CSeq_id_Handle::GetHandle(), CSeqIdChunkFile::GetOffset(), CSeq_entry_Base::GetSeq(), CBioseq_set_Base::GetSeq_set(), CSeq_entry_Base::GetSet(), IndexABioseq(), CSeq_entry_Base::IsSeq(), CSeq_entry_Base::IsSet(), ITERATE, m_CachedIds, m_MainIndex, m_SeqIdChunk, m_SeqIdIndex, offset, ncbi::grid::netcache::search::fields::size, and CSeqIdChunkFile::Write().
Referenced by x_CacheSeqEntry(), x_Process_Fasta(), and x_Process_Ids().
|
private |
Definition at line 1374 of file prime_cache.cpp.
References CDelta_ext_Base::Get(), CSeq_ext_Base::GetDelta(), CSeq_inst_Base::GetExt(), CSeq_id_Handle::GetHandle(), CBioseq_Handle::GetInst(), set< Key, Compare >::insert(), CSeq_ext_Base::IsDelta(), CSeq_inst_Base::IsSetExt(), and ITERATE.
Referenced by x_CacheSeqEntry(), and x_Process_Ids().
|
private |
Definition at line 506 of file prime_cache.cpp.
References CSeq_id_Handle::AsString(), CFastaReader::AtEOF(), CPrimeCacheApplication::SOrgData::biosource, count, CSeqdesc_Base::e_Molinfo, CSeqdesc_Base::e_Source, CTime::eCurrent, CBioSource_Base::eGenome_unknown, CSeq_inst_Base::eMol_aa, Error(), eUnknown, CFastaReader::fAddMods, CFastaReader::fAssumeNuc, CFastaReader::fAssumeProt, CFastaReader::fDisableParseRange, CFastaReader::fForceType, flags, CFastaReader::fNoUserObjs, CFastaReader::fRequireID, CSeq_descr_Base::Get(), CNcbiApplicationAPI::GetArgs(), CMolInfo_Base::GetBiomol(), CChunkFile::GetChunkSerialNum(), CMolInfo_Base::GetCompleteness(), CSeq_entry::GetDescr(), GetId(), CObjectManager::GetInstance(), CSeqdesc_Base::GetMolinfo(), CChunkFile::GetOffset(), CSeq_entry_Base::GetSeq(), CTime::GetTimeT(), CMolInfo_Base::IsSetBiomol(), CMolInfo_Base::IsSetCompleteness(), CSeq_entry::IsSetDescr(), CSignal::IsSignaled(), LOG_POST, m_CachePath, m_Genome, m_id_type, m_InstMol, m_MainChunk, m_MolInfo, m_Orgs, m_other_descs, m_PreviousExecutionIds, m_SequenceTaxids, m_SequenceUniprotSources, NCBI_THROW, NON_CONST_ITERATE, NStr::NumericToString(), offset, om, CChunkFile::OpenForWrite(), CPrimeCacheApplication::SOrgData::orgref, CCache_blob::Pack(), CSeq_entry::Parentize(), CFastaReader::ReadOneSeq(), CBioseq_Base::ResetDescr(), CSeqdesc_Base::SetComment(), CBioseq_Base::SetDescr(), CBioseq_Base::SetId(), CBioseq_Base::SetInst(), CFastaReader::SetMaxIDLength(), CSeq_entry_Base::SetSeq(), CCache_blob_Base::SetTimestamp(), ncbi::grid::netcache::search::fields::size, CStopWatch::Start(), sw, CChunkFile::Write(), x_ExtractAndIndex(), x_UpsertDescriptor(), and ZERO_TAX_ID.
Referenced by Run().
|
private |
Definition at line 871 of file prime_cache.cpp.
References CScope::AddDefaults(), CSeq_id_Handle::AsString(), count, CTime::eCurrent, set< Key, Compare >::empty(), Error(), eUnknown, CScope::GetBioseqHandle(), CChunkFile::GetChunkSerialNum(), CSeq_entry_Handle::GetCompleteSeq_entry(), GetId(), CObjectManager::GetInstance(), CChunkFile::GetOffset(), CTime::GetTimeT(), CBioseq_Handle::GetTopLevelEntry(), ITERATE, LOG_POST, m_CachedIds, m_CachePath, m_ExtractDelta, m_id_type, m_MainChunk, m_MaxDeltaLevel, m_StripInstMol, NCBI_THROW, offset, CChunkFile::OpenForWrite(), CCache_blob::Pack(), CGBDataLoader::RegisterInObjectManager(), CCache_blob_Base::SetTimestamp(), ncbi::grid::netcache::search::fields::size, CStopWatch::Start(), sw, CChunkFile::Write(), x_ExtractAndIndex(), x_ExtractDelta(), and x_StripSeqEntry().
Referenced by Run().
|
private |
Definition at line 753 of file prime_cache.cpp.
References count, CNcbiApplicationAPI::GetArgs(), x_CacheSeqEntry(), and x_SplitAndCacheSeqEntry().
Referenced by Run().
|
private |
Definition at line 858 of file prime_cache.cpp.
References CSeq_id_Handle::GetHandle(), set< Key, Compare >::insert(), NcbiGetlineEOL(), and NStr::TruncateSpacesInPlace().
Referenced by Run().
|
private |
Definition at line 768 of file prime_cache.cpp.
References eUnknown, CSignal::IsSignaled(), NCBI_THROW, CObjectIStream::Open(), and CObjectTypeInfo::SetLocalSkipHook().
Referenced by x_Process_SeqEntry().
|
private |
Definition at line 946 of file prime_cache.cpp.
References CBioseq_Base::CanGetInst(), CScope::GetBioseqHandle(), CBioseq::GetFirstId(), GetId(), CBioseq_Base::GetInst(), CSeq_inst_Base::GetMol(), CSeq_entry_Base::GetSeq(), CBioseq_set_Base::GetSeq_set(), i, set< Key, Compare >::insert(), CSeq_entry_Base::IsSeq(), CSeq_entry_Base::IsSet(), m_id_type, m_StripInstMol, CBioseq_Base::ResetAnnot(), CBioseq_set_Base::ResetAnnot(), CBioseq_Base::ResetDescr(), CBioseq_set_Base::ResetDescr(), CSeq_entry_Base::SetSeq(), CBioseq_set_Base::SetSeq_set(), and CSeq_entry_Base::SetSet().
Referenced by x_CacheSeqEntry(), and x_Process_Ids().
|
private |
Definition at line 475 of file prime_cache.cpp.
References CSeqdesc_Base::e_Create_date, CSeqdesc_Base::e_Embl, CSeqdesc_Base::e_Genbank, CSeqdesc_Base::e_Molinfo, CSeqdesc_Base::e_Name, CSeqdesc_Base::e_Pdb, CSeqdesc_Base::e_Pir, CSeqdesc_Base::e_Prf, CSeqdesc_Base::e_Source, CSeqdesc_Base::e_Sp, CSeqdesc_Base::e_Title, CSeqdesc_Base::e_Update_date, and CSeqdesc_Base::Which().
Referenced by x_Process_Fasta().
|
friend |
Definition at line 222 of file prime_cache.cpp.
|
private |
Definition at line 246 of file prime_cache.cpp.
Referenced by x_ExtractAndIndex(), and x_Process_Ids().
|
private |
Definition at line 230 of file prime_cache.cpp.
Referenced by Run(), x_CacheSeqEntry(), x_Process_Fasta(), and x_Process_Ids().
|
private |
Definition at line 244 of file prime_cache.cpp.
Referenced by Run(), x_CacheSeqEntry(), and x_Process_Ids().
|
private |
Definition at line 240 of file prime_cache.cpp.
Referenced by Run(), and x_Process_Fasta().
|
private |
Definition at line 242 of file prime_cache.cpp.
Referenced by Run(), x_CacheSeqEntry(), x_Process_Fasta(), x_Process_Ids(), and x_StripSeqEntry().
|
private |
Definition at line 235 of file prime_cache.cpp.
Referenced by Run(), and x_Process_Fasta().
|
private |
Definition at line 231 of file prime_cache.cpp.
Referenced by x_CacheSeqEntry(), x_Process_Fasta(), and x_Process_Ids().
|
private |
Definition at line 233 of file prime_cache.cpp.
Referenced by Run(), and x_ExtractAndIndex().
|
private |
Definition at line 245 of file prime_cache.cpp.
Referenced by Run(), and x_Process_Ids().
Definition at line 236 of file prime_cache.cpp.
Referenced by Run(), and x_Process_Fasta().
Definition at line 237 of file prime_cache.cpp.
Referenced by Run(), and x_Process_Fasta().
Definition at line 241 of file prime_cache.cpp.
Referenced by Run(), and x_Process_Fasta().
|
private |
Definition at line 247 of file prime_cache.cpp.
Referenced by Run(), and x_Process_Fasta().
Definition at line 248 of file prime_cache.cpp.
Referenced by Run().
|
private |
Definition at line 232 of file prime_cache.cpp.
Referenced by Run(), and x_ExtractAndIndex().
|
private |
Definition at line 234 of file prime_cache.cpp.
Referenced by Run(), and x_ExtractAndIndex().
Definition at line 238 of file prime_cache.cpp.
Referenced by Run(), and x_Process_Fasta().
Definition at line 239 of file prime_cache.cpp.
Referenced by Run(), and x_Process_Fasta().
|
private |
Definition at line 243 of file prime_cache.cpp.
Referenced by Run(), x_CacheSeqEntry(), x_Process_Ids(), and x_StripSeqEntry().