CNcbiApplication Class Reference
[Application Framework]

Search Toolkit Book for CNcbiApplication

#include <ncbiapp.hpp>

Inheritance diagram for CNcbiApplication:

Inheritance graph
[legend]
Collaboration diagram for CNcbiApplication:

Collaboration graph
[legend]
List of all members.

Detailed Description

CNcbiApplication --.

Basic (abstract) NCBI application class.

Defines the high level behavior of an NCBI application. A new application is written by deriving a class from the CNcbiApplication and writing an implementation of the Run() and maybe some other (like Init(), Exit(), etc.) methods.

Definition at line 115 of file ncbiapp.hpp.

Public Member Functions

 CNcbiApplication (void)
 Constructor.
virtual ~CNcbiApplication (void)
 Destructor.
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.
virtual void Init (void)
 Initialize the application.
virtual int Run (void)=0
 Run the application.
virtual int DryRun (void)
 Test run the application.
virtual void Exit (void)
 Cleanup on application exit.
const CNcbiArgumentsGetArguments (void) const
 Get the application's cached unprocessed command-line arguments.
virtual const CArgsGetArgs (void) const
 Get parsed command line arguments.
const CNcbiEnvironmentGetEnvironment (void) const
 Get the application's cached environment.
CNcbiEnvironmentSetEnvironment (void)
 Get a non-const copy of the application's cached environment.
void SetEnvironment (const string &name, const string &value)
 Set a specified environment variable by name.
bool HasLoadedConfig (void) const
 Check if the config file has been loaded.
const CNcbiRegistryGetConfig (void) const
 Get the application's cached configuration parameters.
CNcbiRegistryGetConfig (void)
const string & GetConfigPath (void) const
 Get the full path to the configuration file (if any) we ended up using.
bool ReloadConfig (CMetaRegistry::TFlags flags=CMetaRegistry::fReloadIfChanged, IRegistry::TFlags reg_flags=IRegistry::fWithNcbirc)
 Reload the configuration file.
SIZE_TYPE FlushDiag (CNcbiOstream *os, bool close_diag=false)
 Flush the in-memory diagnostic stream (for "eDS_ToMemory" case only).
const string & GetProgramDisplayName (void) const
 Get the application's "display" name.
const string & GetProgramExecutablePath (EFollowLinks follow_links=eIgnoreLinks) const
 Get the application's executable path.
CVersionInfo GetVersion (void) const
 Get the program version information.
const CVersionGetFullVersion (void) const
 Get the program version information.
bool IsDryRun (void) const
 Check if it is a test run.
virtual NCBI_DEPRECATED bool SetupDiag_AppSpecific (void)
 Setup application specific diagnostic stream.

Static Public Member Functions

static CNcbiApplicationInstance (void)
 Singleton method.

Protected Types

typedef int TDisableArgDesc
 Binary OR of "EDisableArgDesc".
typedef int THideStdArgs
 Binary OR of "EHideStdArgs".
typedef int TStdioSetupFlags
 Binary OR of "EStdioSetup".
enum  EPreparseArgs { ePreparse_Continue, ePreparse_Exit }
 Result of PreparseArgs(). More...
enum  EDisableArgDesc { fDisableStdArgs = 0x01 }
 Disable argument descriptions. More...
enum  EHideStdArgs {
  fHideLogfile = 0x01, fHideConffile = 0x02, fHideVersion = 0x04, fHideFullVersion = 0x08,
  fHideDryRun = 0x10, fHideHelp = 0x20, fHideFullHelp = 0x40, fHideXmlHelp = 0x80,
  fHideAll = 0xFF
}
 Which standard flag's descriptions should not be displayed in the usage message. More...
enum  EStdioSetup { fDefault_SyncWithStdio = 0x01, fDefault_CinBufferSize = 0x02, fBinaryCin = 0x04, fBinaryCout = 0x08 }
 Flags to adjust standard I/O streams' behaviour. More...
enum  EExitMode { eNoExits, eExceptionalExits, eAllExits }
 When to return a user-set exit code. More...

Protected Member Functions

virtual EPreparseArgs PreparseArgs (int argc, const char *const *argv)
 Check the command line arguments before parsing them.
void DisableArgDescriptions (TDisableArgDesc disable=fDisableStdArgs)
void HideStdArgs (THideStdArgs hide_mask)
 Set the hide mask for the Hide Std Flags.
void SetStdioFlags (TStdioSetupFlags stdio_flags)
 Adjust the behavior of standard I/O streams.
void SetVersion (const CVersionInfo &version)
 Set the version number for the program.
void SetFullVersion (CRef< CVersion > version)
 Set version data for the program.
virtual void SetupArgDescriptions (CArgDescriptions *arg_desc)
 Setup the command line argument descriptions.
const CArgDescriptionsGetArgDescriptions (void) const
 Get argument descriptions (set by SetupArgDescriptions).
NCBI_DEPRECATED bool SetupDiag (EAppDiagStream diag)
 Setup the application diagnostic stream.
virtual bool LoadConfig (CNcbiRegistry &reg, const string *conf, CNcbiRegistry::TFlags reg_flags)
 Load settings from the configuration file to the registry.
virtual bool LoadConfig (CNcbiRegistry &reg, const string *conf)
 Load settings from the configuration file to the registry.
void SetProgramDisplayName (const string &app_name)
 Set program's display name.
string FindProgramExecutablePath (int argc, const char *const *argv, string *real_path=0)
 Find the application's executable file.
virtual void AppStart (void)
 Method to be called before application start.
virtual void AppStop (int exit_code)
 Method to be called before application exit.
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.

Private Member Functions

void x_HonorStandardSettings (IRegistry *reg=0)
 Read standard NCBI application configuration settings.
void x_SetupStdio (void)
 Setup C++ standard I/O streams' behaviour.
void x_AddDefaultArgs (void)
void x_TryInit (EAppDiagStream diag, const char *conf)
void x_TryMain (EAppDiagStream diag, const char *conf, int *exit_code, bool *got_exception)

Private Attributes

CRef< CVersionm_Version
 Program version.
auto_ptr< CNcbiEnvironmentm_Environ
 Cached application env.
CRef< CNcbiRegistrym_Config
 Guaranteed to be non-NULL.
auto_ptr< CNcbiOstreamm_DiagStream
 Opt., aux., see eDS_ToMemory.
auto_ptr< CNcbiArgumentsm_Arguments
 Command-line arguments.
auto_ptr< CArgDescriptionsm_ArgDesc
 Cmd.-line arg descriptions.
auto_ptr< CArgsm_Args
 Parsed cmd.-line args.
TDisableArgDesc m_DisableArgDesc
 Arg desc. disabled.
THideStdArgs m_HideArgs
 Std cmd.-line flags to hide.
TStdioSetupFlags m_StdioFlags
 Std C++ I/O adjustments.
char * m_CinBuffer
 Cin buffer if changed.
string m_ProgramDisplayName
 Display name of app.
string m_ExePath
 Program executable path.
string m_RealExePath
 Symlink-free executable path.
string m_LogFileName
 Log file name.
string m_ConfigPath
 Path to .ini file used.
int m_ExitCode
 Exit code to force.
EExitMode m_ExitCodeCond
 When to force it (if ever).
bool m_DryRun
 Dry run.
string m_DefaultConfig
 conf parameter to AppMain

Static Private Attributes

static CNcbiApplicationm_Instance
 Current app. instance.


Member Typedef Documentation

typedef int CNcbiApplication::TDisableArgDesc [protected]
 

Binary OR of "EDisableArgDesc".

Definition at line 319 of file ncbiapp.hpp.

typedef int CNcbiApplication::THideStdArgs [protected]
 

Binary OR of "EHideStdArgs".

Definition at line 340 of file ncbiapp.hpp.

typedef int CNcbiApplication::TStdioSetupFlags [protected]
 

Binary OR of "EStdioSetup".

Definition at line 356 of file ncbiapp.hpp.


Member Enumeration Documentation

enum CNcbiApplication::EDisableArgDesc [protected]
 

Disable argument descriptions.

Call with a bit flag set if you do not want std AND user cmd.line args to be parsed. Note that by default the parsing of cmd.line args are enabled.

Enumerator:
fDisableStdArgs  (-logfile, -conffile, -version etc)

Definition at line 316 of file ncbiapp.hpp.

enum CNcbiApplication::EExitMode [protected]
 

When to return a user-set exit code.

Enumerator:
eNoExits  never (stick to existing logic)
eExceptionalExits  when an (uncaught) exception occurs
eAllExits  always (ignoring Run's return value)

Definition at line 480 of file ncbiapp.hpp.

enum CNcbiApplication::EHideStdArgs [protected]
 

Which standard flag's descriptions should not be displayed in the usage message.

Do not display descriptions of the standard flags such as the -h, -logfile, -conffile, -version flags in the usage message. Note that you still can pass them in the command line.

Enumerator:
fHideLogfile  Hide log file description.
fHideConffile  Hide configuration file description.
fHideVersion  Hide version description.
fHideFullVersion  Hide full version description.
fHideDryRun  Hide dryrun description.
fHideHelp  Hide help description.
fHideFullHelp  Hide full help description.
fHideXmlHelp  Hide XML help description.
fHideAll  Hide all standard argument descriptions.

Definition at line 329 of file ncbiapp.hpp.

enum CNcbiApplication::EPreparseArgs [protected]
 

Result of PreparseArgs().

Enumerator:
ePreparse_Continue  Continue application execution.
ePreparse_Exit  Exit the application with zero exit code.

Definition at line 301 of file ncbiapp.hpp.

enum CNcbiApplication::EStdioSetup [protected]
 

Flags to adjust standard I/O streams' behaviour.

Enumerator:
fDefault_SyncWithStdio  Use compiler-specific default as pertains to the synchronizing of "C++" Cin/Cout/Cerr streams with their "C" counterparts.
fDefault_CinBufferSize  Use compiler-specific default of Cin buffer size.
fBinaryCin  treat standard input as binary
fBinaryCout  treat standard output as binary

Definition at line 346 of file ncbiapp.hpp.


Constructor & Destructor Documentation

CNcbiApplication::CNcbiApplication void   ) 
 

Constructor.

Register the application instance, and reset important application-specific settings to empty values that will be set later.

Definition at line 92 of file ncbiapp.cpp.

References eDiagAppState_AppBegin, eNoExits, GetDiagContext(), CDiagContext::GetUID(), CDiagContext::InitMessages(), m_Arguments, m_CinBuffer, m_Config, m_DisableArgDesc, m_DryRun, m_Environ, m_ExitCodeCond, m_HideArgs, m_Instance, m_StdioFlags, m_Version, NCBI_THROW, auto_ptr< X >::reset(), CRef< C, Locker >::Reset(), and CDiagContext::SetGlobalAppState().

CNcbiApplication::~CNcbiApplication void   )  [virtual]
 

Destructor.

Clean up the application settings, flush the diagnostic stream.

Definition at line 128 of file ncbiapp.cpp.

References FlushDiag(), m_CinBuffer, m_Instance, and NcbiCout.


Member Function Documentation

int CNcbiApplication::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.

You can specify where to write the diagnostics to (EAppDiagStream), and where to get the configuration file (LoadConfig()) to load to the application registry (accessible via GetConfig()).

Throw exception if:

If application name is not specified a default of "ncbi" is used. Certain flags such as -logfile, -conffile and -version are special so AppMain() processes them separately.

Returns:
Exit code from Run(). Can also return non-zero value if application threw an exception.
See also:
LoadConfig(), Init(), Run(), Exit()
Parameters:
argc  argc in a regular main(argc, argv, envp)
argv  argv in a regular main(argc, argv, envp)
envp  envp in a regular main(argc, argv, envp)
diag  Specify diagnostic stream
conf  Specify registry to load
name  Specify application name

Definition at line 410 of file ncbiapp.cpp.

References CDirEntry::SplitPath().

Referenced by main().

void CNcbiApplication::AppStart void   )  [protected, virtual]
 

Method to be called before application start.

Can be used to set DiagContext properties to be printed in the application start message (e.g. host|host_ip_addr, client_ip and session_id for CGI applications).

Reimplemented in CCgiApplication.

Definition at line 1133 of file ncbiapp.cpp.

References auto_ptr< X >::get(), GetProgramExecutablePath(), and m_Arguments.

Referenced by x_TryInit().

void CNcbiApplication::AppStop int  exit_code  )  [protected, virtual]
 

Method to be called before application exit.

Can be used to set DiagContext properties to be printed in the application stop message (exit_status, exit_signal, exit_code).

Reimplemented in CCgiApplication.

Definition at line 1153 of file ncbiapp.cpp.

References GetDiagContext(), and CDiagContext::SetExitCode().

void CNcbiApplication::DisableArgDescriptions TDisableArgDesc  disable = fDisableStdArgs  )  [protected]
 

Definition at line 783 of file ncbiapp.cpp.

References m_DisableArgDesc.

Referenced by CCgiApplication::CCgiApplication(), CCpGDemoApp::CCpGDemoApp(), CEntrez2ClientApp::CEntrez2ClientApp(), CGeneModelDemoApp::CGeneModelDemoApp(), CRegexpLocApp::CRegexpLocApp(), CRemoteCgiApp::CRemoteCgiApp(), and CNcbiTestApplication::Init().

int CNcbiApplication::DryRun void   )  [virtual]
 

Test run the application.

It is only supposed to test if the Run() is possible, or makes sense: that is, test all preconditions etc.

Returns:
Exit code.

Reimplemented in CNcbiTestApplication.

Definition at line 157 of file ncbiapp.cpp.

References ERR_POST_X.

void CNcbiApplication::Exit void   )  [virtual]
 

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 in CCgiApplication, CNCBIwxApplication, CCompartApp, CAppHitFilter, CBlastInputDemoApplication, CMultiApplication, COmssa2pepxmlApplication, CAgpValidateApplication, CAgpconvertApplication, CBlastDbCheckApplication, CConvert2BlastMaskApplication, CGuideTreeApplication, Cn3DNoWin, CFormatGuessApp, CId1FetchApp, CId1FetchApp, CId2FetchApp, CMultiReaderApp, CNmer_repeatsApplication, CAppNWA, CObjExtractApp, SegMaskerApplication, CMytestApplication, CStreamTestApp, CProjBulderApp, CDbapiSampleApp, CGBenchMonitorApp, CAppJobTestApplication, CTestDispatchApp, CFontDemoApp, CGl3dDemoApp, CSplineDemoApp, CSystemTestApp, CTexDemoApp, CToolTipDemoApp, CWGLDemoApp, CReadFilesApp, CSampleBasicApplication, CBlastDemoApplication, CBlastSampleApplication, CBlastDemoApplication, CDbapiTest, CEUtilsApp, CConvImageApp, CImageTestApp, and CSubImageApp.

Definition at line 164 of file ncbiapp.cpp.

Referenced by CCgiApplication::Exit().

string CNcbiApplication::FindProgramExecutablePath int  argc,
const char *const *  argv,
string *  real_path = 0
[protected]
 

Find the application's executable file.

Find the path and name of the executable file that this application is running from. Will be accessible by GetArguments().GetProgramName().

Parameters:
argc Standard argument count "argc".
argv Standard argument vector "argv".
real_path If non-NULL, will get the fully resolved path to the executable.
Returns:
Name of application's executable file (may involve symlinks).

SIZE_TYPE CNcbiApplication::FlushDiag CNcbiOstream os,
bool  close_diag = false
 

Flush the in-memory diagnostic stream (for "eDS_ToMemory" case only).

In case of "eDS_ToMemory", the diagnostics is stored in the internal application memory buffer ("m_DiagStream"). Call this function to dump all the diagnostics to stream "os" and purge the buffer.

Parameters:
os Output stream to dump diagnostics to. If it is NULL, then nothing will be written to it (but the buffer will still be purged).
close_diag If "close_diag" is TRUE, then also destroy "m_DiagStream".
Returns:
Total number of bytes actually written to "os".

Definition at line 180 of file ncbiapp.cpp.

References CDiagContext::DiscardMessages(), CDiagContext::FlushMessages(), GetDiagContext(), GetDiagHandler(), and SetDiagStream().

Referenced by ~CNcbiApplication().

const CArgDescriptions * CNcbiApplication::GetArgDescriptions void   )  const [inline, protected]
 

Get argument descriptions (set by SetupArgDescriptions).

Definition at line 639 of file ncbiapp.hpp.

References auto_ptr< X >::get(), and m_ArgDesc.

Referenced by CCgiApplication::GetArgs(), and CMakeScoreMethodApp::Run().

const CArgs & CNcbiApplication::GetArgs void   )  const [virtual]
 

Get parsed command line arguments.

Get command line arguments parsed according to the arg descriptions set by SetupArgDescriptions(). Throw exception if no descriptions have been set.

Returns:
The CArgs object containing parsed cmd.-line arguments.
See also:
SetupArgDescriptions().

Reimplemented in CCgiApplication.

Definition at line 170 of file ncbiapp.cpp.

References auto_ptr< X >::get(), m_Args, and NCBI_THROW.

Referenced by CReadBlastApp::AnalyzeSeqs(), CMultiReaderApp::AppInitialize(), BOOST_AUTO_TEST_CASE(), CReadBlastApp::CollectFrameshiftedSeqs(), CBlastDBAliasApp::CreateAliasFile(), CTestArguments::CTestArguments(), CReadBlastApp::dump_fasta_for_pretty_blast(), CCgiApplication::GetArgs(), CDefaultWorkerNodeInitContext::GetArgs(), CMultiReaderApp::GetMapper(), CIdMapperApp::GetMapper(), CMytestApplication::GetSeqEntry(), CCleanupApp::HandleSeqEntry(), CAsn2FlatApp::HandleSeqEntry(), CAlnVwrApp::LoadDenseg(), CPairwiseAlnApp::LoadInputAlns(), CAlnMrgApp::LoadInputAlns(), CAlnTestApp::LoadInputAlns(), CAlnBuildApp::LoadInputAlns(), CId1FetchApp::LookUpGI(), NCBITEST_INIT_VARIABLES(), CProjBulderApp::ParseArguments(), CAlnBuildApp::PrintAnchoredAln(), CBlastFormatterApp::PrintFormattedOutput(), CAlnMrgApp::PrintMergedAln(), CSplitCacheApp::Process(), CBlastDemoApplication::ProcessCommandLineArgs(), CDataTool::ProcessData(), CDataTool::ProcessModules(), CAsnvalApp::ProcessSeqEntry(), CSubImageApp::Run(), CImageTestApp::Run(), CConvImageApp::Run(), CSampleLibtestApplication::Run(), CSampleObjmgrApplication::Run(), CEditBioseqSampleApp::Run(), CSampleObjectsApplication::Run(), CRemoteAppClientSampleApp::Run(), CSampleNetScheduleNode::Run(), CSampleNetScheduleClient::Run(), CGridClientSampleApp::Run(), CSampleNetCacheClient::Run(), CSampleLdsApplication::Run(), CEUtilsApp::Run(), CDbapiTest::Run(), CBlastSampleApplication::Run(), CBlastDemoApplication::Run(), CSampleBasicApplication::Run(), CSampleAsnApplication::Run(), CSampleAlnmgrApplication::Run(), CAce2AsnApp::Run(), CAutoDefDemo::Run(), CAVApp::Run(), CReadFilesApp::Run(), CPairwiseAlnApp::Run(), CAlnVwrApp::Run(), CAlnMrgApp::Run(), CAlnBuildApp::Run(), CEntrez2ClientApp::Run(), CMakeScoreMethodApp::Run(), CTestDispatchApp::Run(), CAppJobTestApplication::Run(), CGBProjectTool::Run(), CTestGuiRegistryApp::Run(), CGBenchMonitorApp::Run(), CDbapiSampleApp::Run(), CDbapiDriverSampleApp::Run(), CDBAPI_CacheAdmin::Run(), CBDB_FileDumperApp::Run(), CBDB_CacheVerifyApp::Run(), CThreadedApp::Run(), CGridWorkerNode::Run(), CWig2tableApplication::Run(), CStreamTestApp::Run(), CSplitCacheApp::Run(), CSplignApp::Run(), CMytestApplication::Run(), SegMaskerApplication::Run(), CReadBlastApp::Run(), CDemoApp::Run(), CObjExtractApp::Run(), CNmer_repeatsApplication::Run(), CNetScheduleDApp::Run(), CNetCacheDApp::Run(), CPkl2hdf5Application::Run(), CMzXML2hdf5Application::Run(), CHdf2mzXMLApplication::Run(), CFixMsHdf5Application::Run(), CLDSIndexerApplication::Run(), CIdMapperApp::Run(), CId2FetchApp::Run(), CId1FetchApp::Run(), CSaveToNetCacheApp::Run(), CNetScheduleControl::Run(), CNetScheduleCheck::Run(), CNetCacheControl::Run(), CNetCacheCheckApp::Run(), CNSSubmitRemoteJobApp::Run(), CNSRemoveJobControlApp::Run(), CGi2TaxIdApp::Run(), CFormatGuessApp::Run(), CDustMaskApplication::Run(), CConversionApp::Run(), Cn3DNoWin::Run(), CGuideTreeApplication::Run(), CBlastDBCmdApp::Run(), CBlastDbCheckApplication::Run(), CBlastDBAliasApp::Run(), CTblastxApp::Run(), CTblastnApp::Run(), CRPSTBlastnApp::Run(), CRPSBlastApp::Run(), CPsiBlastApp::Run(), CBlastxApp::Run(), CBlastpApp::Run(), CBlastnApp::Run(), CBlastFormatterApp::Run(), CAsnvalApp::Run(), CCleanupApp::Run(), CAsn2FlatApp::Run(), CAsn2FastaApp::Run(), CAsn2Asn::Run(), CAnnotWriterApp::Run(), CAgpconvertApplication::Run(), CAgpValidateApplication::Run(), CWinMaskApplication::Run(), CXcompareAnnotsApplication::Run(), CRegexpLocApp::Run(), CGeneModelDemoApp::Run(), CCpGDemoApp::Run(), CDemoSeqQaApp::Run(), COMSSAMerge::Run(), COMSSA::Run(), COmssa2pepxmlApplication::Run(), CReadresult::Run(), CUpdateOmssaModApplication::Run(), CUnimodApplication::Run(), CLocalFinderApp::Run(), CMultiApplication::Run(), CSRSearchApplication::Run(), CMkIndexApplication::Run(), CBlastInputDemoApplication::Run(), CAppHitFilter::Run(), CCompartApp::Run(), CProSplignApp::Run(), CDemoContigAssemblyApp::Run(), CLangQueryApp::RunSample(), CDbapiTestSpeedApp::RunSample(), CAlnMrgApp::SetOptions(), CSplitCacheApp::SetupCache(), CAlnMrgApp::ViewMergedAln(), CMakeBlastDBApp::x_BuildDatabase(), CDemoThemeDlgApp::x_CreateGUI(), CGBenchFeedbackAgent::x_CreateGUI(), CBlastSampleApplication::x_CreateSSeqLoc(), CAppHitFilter::x_DoMultiple(), CAppHitFilter::x_DoPairwise(), CAppHitFilter::x_DumpOutput(), CWig2tableApplication::x_Error(), CNetScheduleControl::x_GetConnectionArgs(), CBlastDBAliasApp::x_GetOperationMode(), CBlastDBCmdApp::x_GetQueries(), SegMaskerApplication::x_GetReader(), CDustMaskApplication::x_GetReader(), CConvert2BlastMaskApplication::x_GetReader(), SegMaskerApplication::x_GetWriter(), CDustMaskApplication::x_GetWriter(), CConvert2BlastMaskApplication::x_GetWriter(), CBlastDBCmdApp::x_InitApplicationData(), CBlastDBCmdApp::x_PrintBlastDatabaseInformation(), CMakeBlastDBApp::x_ProcessMaskData(), CBlastDBCmdApp::x_ProcessSearchRequest(), CBlastDBCmdApp::x_ProcessSingleQuery(), CAppHitFilter::x_ReadInputHits(), CGBenchApplication::x_Run(), CAppNWA::x_RunOnPair(), and CSplignApp::x_SetupBlastOptions().

const CNcbiArguments & CNcbiApplication::GetArguments void   )  const [inline]
 

Get the application's cached unprocessed command-line arguments.

Definition at line 585 of file ncbiapp.hpp.

References m_Arguments.

Referenced by COMSSA::AppInit(), CCgiStatistics::Compose_ProgramName(), GBenchBrowserConfig(), CSystemPath::GetStdPath(), CSubImageApp::Init(), CImageTestApp::Init(), CConvImageApp::Init(), CSampleLibtestApplication::Init(), CSampleSoapClientApplication::Init(), CSampleObjmgrApplication::Init(), CEditBioseqSampleApp::Init(), CSampleObjectsApplication::Init(), CRemoteAppClientSampleApp::Init(), CSampleNetScheduleNode::Init(), CSampleNetScheduleClient::Init(), CGridClientSampleApp::Init(), CSampleNetCacheClient::Init(), CSampleLdsApplication::Init(), CEUtilsApp::Init(), CDbapiTest::Init(), CBlastSampleApplication::Init(), CBlastDemoApplication::Init(), CSampleBasicApplication::Init(), CSampleAsnApplication::Init(), CSampleAlnmgrApplication::Init(), CAce2AsnApp::Init(), CAutoDefDemo::Init(), CAVApp::Init(), CReadFilesApp::Init(), CPairwiseAlnApp::Init(), CAlnVwrApp::Init(), CAlnMrgApp::Init(), CAlnTestApp::Init(), CAlnBuildApp::Init(), CEntrez2ClientApp::Init(), CRemoteCgiApp::Init(), CMakeScoreMethodApp::Init(), CToolTipDemoApp::Init(), CTexDemoApp::Init(), CSystemTestApp::Init(), CSplineDemoApp::Init(), CGl3dDemoApp::Init(), CFontDemoApp::Init(), CDemoThemeDlgApplication::Init(), CTestDispatchApp::Init(), CAppJobTestApplication::Init(), CGBenchMonitorApp::Init(), CDbapiSampleApp::Init(), CDbapiDriverSampleApp::Init(), CDBAPI_CacheAdmin::Init(), CBDB_FileDumperApp::Init(), CBDB_CacheVerifyApp::Init(), CThreadedApp::Init(), CGridWorkerApp::Init(), CProjBulderApp::Init(), CWig2tableApplication::Init(), CStreamTestApp::Init(), CSplitCacheApp::Init(), CSplignApp::Init(), CMytestApplication::Init(), SegMaskerApplication::Init(), CReadBlastApp::Init(), CDemoApp::Init(), CObjExtractApp::Init(), CAppNWA::Init(), CNmer_repeatsApplication::Init(), CNetScheduleDApp::Init(), CNetCacheDApp::Init(), CMultiReaderApp::Init(), CPkl2hdf5Application::Init(), CMzXML2hdf5Application::Init(), CHdf2mzXMLApplication::Init(), CFixMsHdf5Application::Init(), CLDSIndexerApplication::Init(), CIdMapperApp::Init(), CId2FetchApp::Init(), CId1FetchApp::Init(), CSaveToNetCacheApp::Init(), CNetScheduleControl::Init(), CNetScheduleCheck::Init(), CNetCacheControl::Init(), CNetCacheCheckApp::Init(), CNSSubmitRemoteJobApp::Init(), CNSRemoveJobControlApp::Init(), CFormatGuessApp::Init(), CDustMaskApplication::Init(), CConversionApp::Init(), Cn3DNoWin::Init(), CGuideTreeApplication::Init(), CMakeBlastDBApp::Init(), CConvert2BlastMaskApplication::Init(), CBlastDBCmdApp::Init(), CBlastDbCheckApplication::Init(), CBlastDBAliasApp::Init(), CBlastFormatterApp::Init(), CBDBEnvKeeperApp::Init(), CAsnvalApp::Init(), CCleanupApp::Init(), CAsn2FlatApp::Init(), CAsn2FastaApp::Init(), CAnnotWriterApp::Init(), CAgpconvertApplication::Init(), CAgpValidateApplication::Init(), CWinMaskApplication::Init(), CXcompareAnnotsApplication::Init(), CRegexpLocApp::Init(), CCpGDemoApp::Init(), CDemoSeqQaApp::Init(), COmssa2pepxmlApplication::Init(), CUpdateOmssaModApplication::Init(), CUnimodApplication::Init(), CMultiApplication::Init(), CSRSearchApplication::Init(), CMkIndexApplication::Init(), CBlastInputDemoApplication::Init(), CAppHitFilter::Init(), CCompartApp::Init(), CProSplignApp::Init(), CDemoContigAssemblyApp::Init(), Cn3DNoWin::Run(), CTest::Run(), CNCBIwxApplication::x_SetupArgDescriptions(), CGBenchFeedbackAgentApp::x_SetupArgDescriptions(), CGBenchApplication::x_SetupArgDescriptions(), CGridCgiSampleApplication::x_SetupArgs(), CCgiSampleApplication::x_SetupArgs(), CCgiTunnel2Grid::x_SetupArgs(), CCgi2RCgiApp::x_SetupArgs(), and x_TryInit().

CNcbiRegistry & CNcbiApplication::GetConfig void   )  [inline]
 

Definition at line 605 of file ncbiapp.hpp.

References m_Config.

const CNcbiRegistry & CNcbiApplication::GetConfig void   )  const [inline]
 

Get the application's cached configuration parameters.

Definition at line 600 of file ncbiapp.hpp.

References m_Config.

Referenced by CGI2GRID_ComposeHtmlPage(), CNetCacheServer::CNetCacheServer(), CCgiStatistics::Compose(), CCgiStatistics::Compose_Entries(), CGBenchSampleCgi::ConfigureDiagDestination(), CGBenchIndexCgi::ConfigureDiagDestination(), CDBUniversalMapper::ConfigureFromRegistry(), CDBUDPriorityMapper::ConfigureFromRegistry(), CDBUDRandomMapper::ConfigureFromRegistry(), CDBConnectionFactory::ConfigureFromRegistry(), CPluginManager< TClass >::CPluginManager(), CProjectsLstFileFilter::CProjectsLstFileFilter(), EnabledDelayBuffers(), CProjBulderApp::EnumOpt(), CDebugArgs::ExtractAlgorithmOptions(), g_GetConfigFlag(), g_GetConfigInt(), g_GetConfigString(), CProjBulderApp::GetBuildConfigs(), CCgiContext::GetConfig(), CDefaultWorkerNodeInitContext::GetConfig(), CProjBulderApp::GetDatatoolCommandLine(), CProjBulderApp::GetDatatoolId(), CProjBulderApp::GetDatatoolPathForApp(), CProjBulderApp::GetDatatoolPathForLib(), CCgiApplication::GetLogOpt(), CProjBulderApp::GetMetaDataFiles(), CProjBulderApp::GetProjectTreeInfo(), CNetCacheServer::GetRegistry(), CProjBulderApp::GetRegSettings(), CCgiSessionSampleApplication::GetSessionStorage(), CSysLog::HonorRegistrySettings(), CRemoteCgiApp::Init(), CCgiRedirectApplication::Init(), CSeqTextDemoDlg::Init(), CGlCgiImageApplication::Init(), CGridWorkerNode::Init(), CGridClientApp::Init(), CCgiApplicationCached::Init(), CDemoApp::Init(), CGridCgiApplication::InitGridClient(), CHelloApp::LoadResource(), NCBITEST_AUTO_INIT(), CRemoteAppClientSampleApp::PrintJobInfo(), CProjBulderApp::ProcessLocationMacros(), CNetScheduleHandler::ProcessReloadConfig(), CGBenchIndexCgi::ProcessRequest(), CRemoteAppDispatcher::ProcessRequest(), ReloadConfig(), CSampleObjmgrApplication::Run(), CEditBioseqSampleApp::Run(), CRemoteAppClientSampleApp::Run(), CRADispatcherClientSampleApp::Run(), CSampleAlnmgrApplication::Run(), CPairwiseAlnApp::Run(), CAlnTestApp::Run(), CAlnBuildApp::Run(), CNCBIwxApplication::Run(), CGridWorkerNode::Run(), CCgiApplication::Run(), CNetScheduleDApp::Run(), CLDSIndexerApplication::Run(), CId2FetchApp::Run(), CId1FetchApp::Run(), CNSSubmitRemoteJobApp::Run(), CNSRemoveJobControlApp::Run(), CBDBEnvKeeperApp::Run(), CCleanupApp::Run(), CAsn2FlatApp::Run(), CAsn2FastaApp::Run(), CAnnotWriterApp::Run(), CAgpValidateApplication::Run(), s_InitInternal(), CBrowserUtils::SendToBrowser(), CAsnvalApp::Setup(), CSplitCacheApp::SetupCache(), CRemoteAppClientSampleApp::ShowBlob(), SNetServiceImpl::SNetServiceImpl(), CNetworkOptionsPage::TransferDataFromWindow(), CNetworkOptionsPage::TransferDataToWindow(), CCgiApplication::x_AddLBCookie(), CNcbiTestApplication::x_CalcConfigValue(), CDebugDumpViewer::x_CheckLocation(), CCgiTunnel2Grid::x_Init(), CCgi2RCgiApp::x_Init(), CSampleLdsApplication::x_InitLDS(), CCgiSampleApplication::x_InitStorage(), CNcbiTestApplication::x_ReadConfiguration(), CGBenchApplication::x_SaveConfig(), CGBenchApplication::x_TestGuiRegistry(), CSequenceSearchForm::x_UpdateFileList(), and COrfSearchForm::x_UpdateKozak().

const string & CNcbiApplication::GetConfigPath void   )  const [inline]
 

Get the full path to the configuration file (if any) we ended up using.

Definition at line 610 of file ncbiapp.hpp.

References m_ConfigPath.

Referenced by CProjBulderApp::GetSite(), ReloadConfig(), CCgiSessionSampleApplication::x_ShowConfigFile(), and CGBenchApplication::x_TestGuiRegistry().

const CNcbiEnvironment & CNcbiApplication::GetEnvironment void   )  const [inline]
 

Get the application's cached environment.

Definition at line 590 of file ncbiapp.hpp.

References m_Environ.

Referenced by CSystemPath::AddToPath(), CMsvcConfigure::AnalyzeDefines(), BlastFindMatrixPath(), CCgiUserAgent::CCgiUserAgent(), FindBlastDbPath(), CSampleLibraryObject::FindInPath(), CProjBulderApp::GenerateMsvcProjects(), CArgDescDefault::GetDefaultValue(), CDefaultWorkerNodeInitContext::GetEnvironment(), CSystemPath::GetStdPath(), CSeqTestApplication::Init(), CQueryParseTree::Parse(), ASNIOTestApp::Run(), CCgiApplication::Run(), CGBenchPipe::x_GetPipeName(), and CGBenchApplication::x_SyncRegistryAndEnvironment().

const CVersion & CNcbiApplication::GetFullVersion void   )  const
 

Get the program version information.

Definition at line 656 of file ncbiapp.cpp.

References m_Version.

Referenced by CCgiApplication::PreparseArgs().

const string & CNcbiApplication::GetProgramDisplayName void   )  const [inline]
 

Get the application's "display" name.

Get name of this application, suitable for displaying or for using as the base name for other files. Will be the 'name' argument of AppMain if given. Otherwise will be taken from the actual name of the application file or argv[0].

Definition at line 627 of file ncbiapp.hpp.

References m_ProgramDisplayName.

Referenced by CCgiRequest::CalcChecksum(), CWindowsCmdErrorHandler::CWindowsCmdErrorHandler(), CRemoteCgiApp::GetJobVersion(), CCgiApplication::PreparseArgs(), CCgiTunnel2Grid::ProcessRequest(), impl::s_TransformLoginData(), CMultiReaderApp::SetFormat(), CNCBIwxApplication::x_Init_wxApplication(), CNCBIwxApplication::x_SetupArgDescriptions(), CGBenchApplication::x_SetupArgDescriptions(), and x_SetupUserAgent().

const string & CNcbiApplication::GetProgramExecutablePath EFollowLinks  follow_links = eIgnoreLinks  )  const [inline]
 

Get the application's executable path.

The path to executable file of this application. Return empty string if not possible to determine this path.

Definition at line 633 of file ncbiapp.hpp.

References eFollowLinks, m_ExePath, and m_RealExePath.

Referenced by AppStart(), createAnnot(), GetDefaultLogLocation(), CCgiApplication::GetDefaultLogPath(), CGetStatisticsProcessor::Process(), COMSSA::Run(), CDiagContext::SetupDiag(), CDllResolver::x_AddExtraDllPath(), and CGBenchMonitorApp::x_GetFeedbackAgentPath().

CVersionInfo CNcbiApplication::GetVersion void   )  const
 

Get the program version information.

See also:
SetVersion, SetFullVersion

Definition at line 651 of file ncbiapp.cpp.

References m_Version.

Referenced by CFileModules::GetRefInfo(), and CSampleSoapServerApplication::Init().

bool CNcbiApplication::HasLoadedConfig void   )  const [inline]
 

Check if the config file has been loaded.

Definition at line 615 of file ncbiapp.hpp.

References m_ConfigPath.

Referenced by g_GetConfigFlag(), g_GetConfigInt(), g_GetConfigString(), CParam< TDescription >::sx_GetDefault(), and CGBenchApplication::x_TestGuiRegistry().

void CNcbiApplication::HideStdArgs THideStdArgs  hide_mask  )  [protected]
 

Set the hide mask for the Hide Std Flags.

Definition at line 789 of file ncbiapp.cpp.

References m_HideArgs.

Referenced by CEntrez2ClientApp::CEntrez2ClientApp(), CBlastSampleApplication::Init(), CReadFilesApp::Init(), CSplignApp::Init(), SegMaskerApplication::Init(), CAppNWA::Init(), CNmer_repeatsApplication::Init(), CDustMaskApplication::Init(), CGuideTreeApplication::Init(), CMakeBlastDBApp::Init(), CConvert2BlastMaskApplication::Init(), CBlastDBCmdApp::Init(), CBlastDbCheckApplication::Init(), CBlastDBAliasApp::Init(), CTblastxApp::Init(), CTblastnApp::Init(), CRPSTBlastnApp::Init(), CRPSBlastApp::Init(), CPsiBlastApp::Init(), CBlastxApp::Init(), CBlastpApp::Init(), CBlastnApp::Init(), CBlastFormatterApp::Init(), CAgpconvertApplication::Init(), CMultiApplication::Init(), CBlastInputDemoApplication::Init(), CAppHitFilter::Init(), and CCompartApp::Init().

void CNcbiApplication::Init void   )  [virtual]
 

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 in CCgiApplication, CCgiApplicationCached, CGridClientApp, CGridWorkerApp, CThreadedApp, CGlCgiImageApplication, CNCBIwxApplication, CCgiRedirectApplication, CGridCgiApplication, CRemoteCgiApp, CAVApp, CDemoContigAssemblyApp, CProSplignApp, CCompartApp, CAppHitFilter, CBlastInputDemoApplication, CMkIndexApplication, CSRSearchApplication, CMultiApplication, CLocalFinderApp, CUnimodApplication, CUpdateOmssaModApplication, CReadresult, COmssa2pepxmlApplication, COMSSABase, COMSSAMerge, CDemoSeqQaApp, CCpGDemoApp, CGeneModelDemoApp, CRegexpLocApp, CXcompareAnnotsApplication, CWinMaskApplication, CAgpValidateApplication, CAgpconvertApplication, CAnnotWriterApp, CAsn2Asn, CAsn2FastaApp, CAsn2FlatApp, CCleanupApp, CAsnvalApp, CBDBEnvKeeperApp, CBlastFormatterApp, CBlastnApp, CBlastpApp, CBlastxApp, CPsiBlastApp, CRPSBlastApp, CRPSTBlastnApp, CTblastnApp, CTblastxApp, CBlastDBAliasApp, CBlastDbCheckApplication, CBlastDBCmdApp, CConvert2BlastMaskApplication, CMakeBlastDBApp, CGuideTreeApplication, Cn3DNoWin, CConversionApp, CDustMaskApplication, CFormatGuessApp, CGi2TaxIdApp, CCgi2RCgiApp, CCgiTunnel2Grid, CNSRemoveJobControlApp, CNSSubmitRemoteJobApp, CRemoteAppDispatcher, CNetCacheCheckApp, CNetCacheControl, CNetScheduleCheck, CNetScheduleControl, CSaveToNetCacheApp, CId1FetchApp, CId1FetchApp, CId2FetchApp, CIdMapperApp, CLDSIndexerApplication, CFixMsHdf5Application, CHdf2mzXMLApplication, CMzXML2hdf5Application, CPkl2hdf5Application, CHdf2mzXMLApplication, CMultiReaderApp, CNetCacheDApp, CNetScheduleDApp, CNmer_repeatsApplication, CAppNWA, CObjExtractApp, CDemoApp, CDemoApp, CReadBlastApp, SegMaskerApplication, CMytestApplication, CSplignApp, CSplitCacheApp, CStreamTestApp, CWig2tableApplication, CWinMaskApplication, CProjBulderApp, CNcbiTestApplication, CBDB_CacheVerifyApp, CBDB_PhoneBookDemo1, CBDB_PhoneBookDemo2, CBDB_PhoneBookDemo3, CBDB_BLobDemo1, CBDB_FileDumperApp, CBDB_SplitTest, CBDB_MergeTest, CDBAPI_CacheAdmin, CDbapiDriverSampleApp, CDemoApp, CDbapiSampleApp, CGBenchIndexCgi, CGBenchSampleCgi, CGBenchMonitorApp, CTestGuiRegistryApp, CGBProjectTool, CAppJobTestApplication, CTestDispatchApp, CDemoThemeDlgApplication, CFontDemoApp, CGl3dDemoApp, CSplineDemoApp, CSystemTestApp, CTexDemoApp, CToolTipDemoApp, CWGLDemoApp, CSeqTestApplication, CMakeScoreMethodApp, CApp, CEntrez2ClientApp, CAlnBuildApp, CAlnTestApp, CAlnMrgApp, CAlnVwrApp, CPairwiseAlnApp, CReadFilesApp, CAutoDefDemo, CAce2AsnApp, CSampleAlnmgrApplication, CSampleAsnApplication, CSampleBasicApplication, CBlastDemoApplication, CBlastSampleApplication, CBlastDemoApplication, CCgiSampleApplication, CDbapiTest, CEUtilsApp, CSampleLdsApplication, CCgiSampleApplication, CSampleNetCacheClient, CSampleNetCacheClient, CSampleNetCacheClient, CGridCgiSampleApplication, CGridClientSampleApp, CSampleNetScheduleClient, CSampleNetScheduleNode, CRADispatcherClientSampleApp, CCgiSampleApplication, CRemoteAppClientSampleApp, CSampleObjectsApplication, CEditBioseqSampleApp, CSampleObjmgrApplication, CSampleSoapClientApplication, CSampleSoapServerApplication, CSampleLibtestApplication, CDataTool, CCacheDemoApp, CConvImageApp, CImageTestApp, and CSubImageApp.

Definition at line 151 of file ncbiapp.cpp.

Referenced by CSampleSoapClientApplication::Init(), CGridWorkerApp::Init(), CGridClientApp::Init(), and x_TryInit().

CNcbiApplication * CNcbiApplication::Instance void   )  [static]
 

Singleton method.

Track the instance of CNcbiApplication, and throw an exception if an attempt is made to create another instance of the application.

Returns:
Current application instance.

Reimplemented in CCgiApplication.

Definition at line 86 of file ncbiapp.cpp.

References m_Instance.

Referenced by CSystemPath::AddToPath(), BlastFindMatrixPath(), BOOST_AUTO_TEST_CASE(), CCgiRequest::CalcChecksum(), CAutoEnvironmentVariable::CAutoEnvironmentVariable(), CCgiUserAgent::CCgiUserAgent(), CCountryLatLonMap::CCountryLatLonMap(), CNetCacheServer::CNetCacheServer(), CDBUniversalMapper::ConfigureFromRegistry(), CDBUDPriorityMapper::ConfigureFromRegistry(), CDBUDRandomMapper::ConfigureFromRegistry(), CDBConnectionFactory::ConfigureFromRegistry(), CParam< TDescription >::CParam(), CPluginManager< TClass >::CPluginManager(), createAnnot(), CTestArguments::CTestArguments(), CWindowsCmdErrorHandler::CWindowsCmdErrorHandler(), EnabledDelayBuffers(), CDebugArgs::ExtractAlgorithmOptions(), FindBlastDbPath(), CSampleLibraryObject::FindInPath(), g_GetConfigFlag(), g_GetConfigInt(), g_GetConfigString(), GBenchBrowserConfig(), CArgDescDefault::GetDefaultValue(), CFileModules::GetRefInfo(), CNetCacheServer::GetRegistry(), CSystemPath::GetStdPath(), CValidError_imp::GetStructuredCommentRules(), CSysLog::HonorRegistrySettings(), CSeqTextDemoDlg::Init(), CAsnvalApp::Init(), CCgiApplication::Instance(), NCBITEST_AUTO_INIT(), NCBITEST_INIT_VARIABLES(), CQueryParseTree::Parse(), CArgDescriptions::PrintUsageXml(), CGetStatisticsProcessor::Process(), CNetScheduleHandler::ProcessReloadConfig(), s_InitializeECNumberMaps(), s_InitializeInstitutionCollectionCodeMaps(), s_InitInternal(), s_LoadGuide(), impl::s_TransformLoginData(), CBrowserUtils::SendToBrowser(), CDiagContext::SetupDiag(), SNetServiceImpl::SNetServiceImpl(), CParam< TDescription >::sx_CanGetDefault(), CParam< TDescription >::sx_GetDefault(), CNetworkOptionsPage::TransferDataFromWindow(), CNetworkOptionsPage::TransferDataToWindow(), CDllResolver::x_AddExtraDllPath(), CDebugDumpViewer::x_CheckLocation(), CDemoThemeDlgApp::x_CreateGUI(), CGBenchFeedbackAgent::x_CreateGUI(), CGBenchPipe::x_GetPipeName(), CNcbiRegistry::x_Init(), x_SetupUserAgent(), CSequenceSearchForm::x_UpdateFileList(), and COrfSearchForm::x_UpdateKozak().

bool CNcbiApplication::IsDryRun void   )  const [inline]
 

Check if it is a test run.

Definition at line 645 of file ncbiapp.hpp.

References m_DryRun.

bool CNcbiApplication::LoadConfig CNcbiRegistry reg,
const string *  conf
[protected, virtual]
 

Load settings from the configuration file to the registry.

CNcbiApplication::LoadConfig(reg, conf) just calls LoadConfig(reg, conf, IRegistry::fWithNcbirc).

Definition at line 768 of file ncbiapp.cpp.

References IRegistry::fWithNcbirc, and LoadConfig().

bool CNcbiApplication::LoadConfig CNcbiRegistry reg,
const string *  conf,
CNcbiRegistry::TFlags  reg_flags
[protected, virtual]
 

Load settings from the configuration file to the registry.

This method is called from inside AppMain() to load (add) registry settings from the configuration file specified as the "conf" arg passed to AppMain(). The "conf" argument has the following special meanings:

  • NULL -- dont even try to load registry from any file at all;
  • non-empty -- if "conf" contains a path, then try to load from the conf.file of name "conf" (only!). Else - see NOTE. TIP: if the path is not fully qualified then: if it starts from "../" or "./" -- look starting from the current working dir.
  • empty -- compose conf.file name from the application name plus ".ini". If it does not match an existing file, then try to strip file extensions, e.g. for "my_app.cgi.exe" -- try subsequently: "my_app.cgi.exe.ini", "my_app.cgi.ini", "my_app.ini".

NOTE: If "conf" arg is empty or non-empty, but without path, then the Toolkit will try to look for it in several potentially relevant directories, as described in <corelib/metareg.hpp>.

Throw an exception if "conf" is non-empty, and cannot open file. Throw an exception if file exists, but contains invalid entries.

Parameters:
reg The loaded registry is returned via the reg parameter.
conf The configuration file to loaded the registry entries from.
reg_flags Flags for loading the registry
Returns:
TRUE only if the file was non-NULL, found and successfully read.
See also:
CMetaRegistry::GetDefaultSearchPath

Reimplemented in CGBenchApplication, and CGBenchFeedbackAgentApp.

Definition at line 713 of file ncbiapp.cpp.

References eFollowLinks, eIgnoreLinks, CMetaRegistry::eName_Ini, CMetaRegistry::Load(), m_Arguments, and m_DefaultConfig.

Referenced by LoadConfig(), and x_TryInit().

CNcbiApplication::EPreparseArgs CNcbiApplication::PreparseArgs int  argc,
const char *const *  argv
[protected, virtual]
 

Check the command line arguments before parsing them.

See also:
EPreparseArgs

Reimplemented in CCgiApplication.

Definition at line 776 of file ncbiapp.cpp.

References ePreparse_Continue.

bool CNcbiApplication::ReloadConfig CMetaRegistry::TFlags  flags = CMetaRegistry::fReloadIfChanged,
IRegistry::TFlags  reg_flags = IRegistry::fWithNcbirc
[inline]
 

Reload the configuration file.

By default, does nothing if the file has the same size and date as before.

Note that this may lose other data stored in the registry!

Parameters:
flags Controls how aggressively to reload.
reg_flags Flags to use when parsing the registry; ignored if the registry was already cached (as it should normally have been).
Returns:
TRUE if a reload actually occurred.

Definition at line 620 of file ncbiapp.hpp.

References GetConfig(), GetConfigPath(), and CMetaRegistry::Reload().

Referenced by BOOST_AUTO_TEST_CASE(), and CNetScheduleHandler::ProcessReloadConfig().

virtual int CNcbiApplication::Run void   )  [pure virtual]
 

Run the application.

It is defined as a pure virtual method -- so you must(!) supply the Run() method to implement the application-specific logic.

Returns:
Exit code.

Implemented in CCgiApplication, CGridWorkerApp, CThreadedApp, CNCBIwxApplication, CRemoteCgiApp, CAVApp, CDemoContigAssemblyApp, CProSplignApp, CCompartApp, CAppHitFilter, CBlastInputDemoApplication, CMkIndexApplication, CSRSearchApplication, CMultiApplication, CLocalFinderApp, CUnimodApplication, CUpdateOmssaModApplication, CReadresult, COmssa2pepxmlApplication, COMSSABase, COMSSA, COMSSAMerge, CDemoSeqQaApp, CCpGDemoApp, CGeneModelDemoApp, CRegexpLocApp, CXcompareAnnotsApplication, CWinMaskApplication, CAgpValidateApplication, CAgpconvertApplication, CAnnotWriterApp, CAsn2Asn, CTest, CAsn2FastaApp, CAsn2FlatApp, CCleanupApp, CAsnvalApp, CBDBEnvKeeperApp, CBlastFormatterApp, CBlastnApp, CBlastpApp, CBlastxApp, CPsiBlastApp, CRPSBlastApp, CRPSTBlastnApp, CTblastnApp, CTblastxApp, CBlastDBAliasApp, CBlastDbCheckApplication, CBlastDBCmdApp, CConvert2BlastMaskApplication, CMakeBlastDBApp, CGuideTreeApplication, Cn3DNoWin, CConversionApp, CDustMaskApplication, CFormatGuessApp, CGi2TaxIdApp, CNSRemoveJobControlApp, CNSSubmitRemoteJobApp, CNetCacheCheckApp, CNetCacheControl, CNetScheduleCheck, CNetScheduleControl, CSaveToNetCacheApp, CId1FetchApp, CId1FetchApp, CId2FetchApp, CIdMapperApp, CLDSIndexerApplication, CFixMsHdf5Application, CHdf2mzXMLApplication, CMzXML2hdf5Application, CPkl2hdf5Application, CHdf2mzXMLApplication, CMultiReaderApp, CNetCacheDApp, CNetScheduleDApp, CNmer_repeatsApplication, CAppNWA, CObjExtractApp, CDemoApp, CDemoApp, CReadBlastApp, SegMaskerApplication, CMytestApplication, CSplignApp, CSplitCacheApp, CStreamTestApp, CWig2tableApplication, CWinMaskApplication, CProjBulderApp, CNcbiTestApplication, CBDB_CacheVerifyApp, CBDB_PhoneBookDemo1, CBDB_PhoneBookDemo2, CBDB_PhoneBookDemo3, CBDB_BLobDemo1, CBDB_FileDumperApp, CBDB_SplitTest, CBDB_MergeTest, CDBAPI_CacheAdmin, CDbapiDriverSampleApp, CDemoApp, CDemoApp, CDemoApp, CDemoeApp, CDemoeApp, CDbapiSampleApp, CGBenchMonitorApp, CTestGuiRegistryApp, CGBProjectTool, CAppJobTestApplication, CTestDispatchApp, CFontDemoApp, CGl3dDemoApp, CSplineDemoApp, CSystemTestApp, CTexDemoApp, CToolTipDemoApp, CWGLDemoApp, CMakeScoreMethodApp, CDemoApplication, CEntrez2ClientApp, CAlnBuildApp, CAlnTestApp, CAlnMrgApp, CAlnVwrApp, CPairwiseAlnApp, ASNIOTestApp, CReadFilesApp, CAutoDefDemo, CAce2AsnApp, CSampleAlnmgrApplication, CSampleAsnApplication, CSampleBasicApplication, CBlastDemoApplication, CBlastSampleApplication, CBlastDemoApplication, CDbCopyApp, CDbapiTest, CEUtilsApp, CSampleLdsApplication, CSampleNetCacheClient, CSampleNetCacheClient, CSampleNetCacheClient, CGridClientSampleApp, CSampleNetScheduleClient, CSampleNetScheduleNode, CRADispatcherClientSampleApp, CRemoteAppClientSampleApp, CSampleObjectsApplication, CEditBioseqSampleApp, CSampleObjmgrApplication, CSampleSoapClientApplication, CSampleLibtestApplication, CDataTool, CCacheDemoApp, CConvImageApp, CImageTestApp, and CSubImageApp.

void CNcbiApplication::SetEnvironment const string &  name,
const string &  value
 

Set a specified environment variable by name.

Definition at line 626 of file ncbiapp.cpp.

References CNcbiEnvironment::Set(), and SetEnvironment().

CNcbiEnvironment & CNcbiApplication::SetEnvironment void   )  [inline]
 

Get a non-const copy of the application's cached environment.

Definition at line 595 of file ncbiapp.hpp.

References m_Environ.

Referenced by CAutoEnvironmentVariable::CAutoEnvironmentVariable(), SetEnvironment(), CNcbiRegistry::x_Init(), CAlnMultiCGIApplication::x_PreProcess(), and CGBenchApplication::x_SyncRegistryAndEnvironment().

void CNcbiApplication::SetExitCode int  exit_code,
EExitMode  when = eExceptionalExits
[protected]
 

Force the program to return a specific exit code later, either when it exits due to an exception or unconditionally.

In the latter case, Run's return value will be ignored.

Definition at line 1159 of file ncbiapp.cpp.

References m_ExitCode, and m_ExitCodeCond.

void CNcbiApplication::SetFullVersion CRef< CVersion version  )  [protected]
 

Set version data for the program.

Note:
This function should be used from constructor of CNcbiApplication derived class, otherwise command-like arguments "-version" and "-version-full" will not work as expected.
See also:
GetVersion

Definition at line 641 of file ncbiapp.cpp.

References ERR_POST_X, m_Version, CRef< C, Locker >::Reset(), and s_IsApplicationStarted.

Referenced by CBlastDBAliasApp::CBlastDBAliasApp(), CBlastDbCheckApplication::CBlastDbCheckApplication(), CBlastDBCmdApp::CBlastDBCmdApp(), CBlastFormatterApp::CBlastFormatterApp(), CBlastnApp::CBlastnApp(), CBlastpApp::CBlastpApp(), CBlastxApp::CBlastxApp(), CConvert2BlastMaskApplication::CConvert2BlastMaskApplication(), CDustMaskApplication::CDustMaskApplication(), CMakeBlastDBApp::CMakeBlastDBApp(), CMultiApplication::CMultiApplication(), CPsiBlastApp::CPsiBlastApp(), CRPSBlastApp::CRPSBlastApp(), CRPSTBlastnApp::CRPSTBlastnApp(), CTblastnApp::CTblastnApp(), CTblastxApp::CTblastxApp(), CWinMaskApplication::CWinMaskApplication(), and SegMaskerApplication::SegMaskerApplication().

void CNcbiApplication::SetProgramDisplayName const string &  app_name  )  [protected]
 

Set program's display name.

Set up application name suitable for display or as a basename for other files. It can also be set by the user when calling AppMain().

Definition at line 898 of file ncbiapp.cpp.

References GetDiagContext(), m_ProgramDisplayName, and CDiagContext::SetAppName().

void CNcbiApplication::SetStdioFlags TStdioSetupFlags  stdio_flags  )  [protected]
 

Adjust the behavior of standard I/O streams.

Unless this function is called, the behaviour of "C++" Cin/Cout/Cerr streams will be the same regardless of the compiler used.

IMPLEMENTATION NOTE: Do not call this function more than once and from places other than App's constructor.

Definition at line 795 of file ncbiapp.cpp.

References _ASSERT, and m_StdioFlags.

Referenced by CCgiApplication::CCgiApplication().

void CNcbiApplication::SetupArgDescriptions CArgDescriptions arg_desc  )  [protected, virtual]
 

Setup the command line argument descriptions.

Call from the Init() method. The passed "arg_desc" will be owned by this class, and it will be deleted by ~CNcbiApplication(), or if SetupArgDescriptions() is called again.

Reimplemented in CCgiApplication, CGridWorkerApp, and CRemoteCgiApp.

Definition at line 662 of file ncbiapp.cpp.

References CArgDescriptions::eInputFile, CArgDescriptions::eOutputFile, fHideConffile, fHideLogfile, m_ArgDesc, m_DefaultConfig, m_DisableArgDesc, m_HideArgs, auto_ptr< X >::reset(), s_ArgCfgFile, and s_ArgLogFile.

Referenced by CSubImageApp::Init(), CImageTestApp::Init(), CConvImageApp::Init(), CDataTool::Init(), CSampleLibtestApplication::Init(), CSampleSoapClientApplication::Init(), CSampleObjmgrApplication::Init(), CEditBioseqSampleApp::Init(), CSampleObjectsApplication::Init(), CRemoteAppClientSampleApp::Init(), CSampleNetScheduleNode::Init(), CSampleNetScheduleClient::Init(), CGridClientSampleApp::Init(), CSampleNetCacheClient::Init(), CSampleLdsApplication::Init(), CEUtilsApp::Init(), CDbapiTest::Init(), CBlastSampleApplication::Init(), CBlastDemoApplication::Init(), CSampleBasicApplication::Init(), CSampleAsnApplication::Init(), CSampleAlnmgrApplication::Init(), CAce2AsnApp::Init(), CAutoDefDemo::Init(), CAVApp::Init(), CReadFilesApp::Init(), CPairwiseAlnApp::Init(), CAlnVwrApp::Init(), CAlnMrgApp::Init(), CAlnTestApp::Init(), CAlnBuildApp::Init(), CEntrez2ClientApp::Init(), CMakeScoreMethodApp::Init(), CToolTipDemoApp::Init(), CTexDemoApp::Init(), CSystemTestApp::Init(), CSplineDemoApp::Init(), CGl3dDemoApp::Init(), CFontDemoApp::Init(), CDemoThemeDlgApplication::Init(), CTestDispatchApp::Init(), CAppJobTestApplication::Init(), CGBProjectTool::Init(), CTestGuiRegistryApp::Init(), CGBenchMonitorApp::Init(), CDbapiSampleApp::Init(), CDbapiDriverSampleApp::Init(), CDBAPI_CacheAdmin::Init(), CBDB_MergeTest::Init(), CBDB_SplitTest::Init(), CBDB_FileDumperApp::Init(), CBDB_BLobDemo1::Init(), CBDB_PhoneBookDemo3::Init(), CBDB_PhoneBookDemo2::Init(), CBDB_PhoneBookDemo1::Init(), CBDB_CacheVerifyApp::Init(), CThreadedApp::Init(), CNcbiTestApplication::Init(), CProjBulderApp::Init(), CWig2tableApplication::Init(), CStreamTestApp::Init(), CSplitCacheApp::Init(), CSplignApp::Init(), CMytestApplication::Init(), CReadBlastApp::Init(), CDemoApp::Init(), CObjExtractApp::Init(), CAppNWA::Init(), CNmer_repeatsApplication::Init(), CNetScheduleDApp::Init(), CNetCacheDApp::Init(), CMultiReaderApp::Init(), CPkl2hdf5Application::Init(), CMzXML2hdf5Application::Init(), CHdf2mzXMLApplication::Init(), CFixMsHdf5Application::Init(), CLDSIndexerApplication::Init(), CIdMapperApp::Init(), CId2FetchApp::Init(), CId1FetchApp::Init(), CSaveToNetCacheApp::Init(), CNetScheduleControl::Init(), CNetScheduleCheck::Init(), CNetCacheControl::Init(), CNetCacheCheckApp::Init(), CNSSubmitRemoteJobApp::Init(), CNSRemoveJobControlApp::Init(), CGi2TaxIdApp::Init(), CFormatGuessApp::Init(), CConversionApp::Init(), Cn3DNoWin::Init(), CGuideTreeApplication::Init(), CMakeBlastDBApp::Init(), CConvert2BlastMaskApplication::Init(), CBlastDbCheckApplication::Init(), CTblastxApp::Init(), CTblastnApp::Init(), CRPSTBlastnApp::Init(), CRPSBlastApp::Init(), CPsiBlastApp::Init(), CBlastxApp::Init(), CBlastpApp::Init(), CBlastnApp::Init(), CBlastFormatterApp::Init(), CBDBEnvKeeperApp::Init(), CAsnvalApp::Init(), CCleanupApp::Init(), CAsn2FlatApp::Init(), CAsn2FastaApp::Init(), CAsn2Asn::Init(), CAnnotWriterApp::Init(), CAgpconvertApplication::Init(), CAgpValidateApplication::Init(), CWinMaskApplication::Init(), CXcompareAnnotsApplication::Init(), CRegexpLocApp::Init(), CGeneModelDemoApp::Init(), CCpGDemoApp::Init(), CDemoSeqQaApp::Init(), COMSSAMerge::Init(), COMSSABase::Init(), COmssa2pepxmlApplication::Init(), CReadresult::Init(), CUpdateOmssaModApplication::Init(), CUnimodApplication::Init(), CLocalFinderApp::Init(), CMultiApplication::Init(), CSRSearchApplication::Init(), CMkIndexApplication::Init(), CBlastInputDemoApplication::Init(), CAppHitFilter::Init(), CCompartApp::Init(), CProSplignApp::Init(), CDemoContigAssemblyApp::Init(), CGridWorkerApp::SetupArgDescriptions(), CCgiApplication::SetupArgDescriptions(), CNCBIwxApplication::x_SetupArgDescriptions(), CGBenchFeedbackAgentApp::x_SetupArgDescriptions(), CGBenchApplication::x_SetupArgDescriptions(), and x_TryInit().

bool CNcbiApplication::SetupDiag EAppDiagStream  diag  )  [protected]
 

Setup the application diagnostic stream.

Returns:
TRUE if successful, FALSE otherwise.

Definition at line 699 of file ncbiapp.cpp.

References eDCM_Flush, and CDiagContext::SetupDiag().

bool CNcbiApplication::SetupDiag_AppSpecific void   )  [virtual]
 

Setup application specific diagnostic stream.

Called from SetupDiag when it is passed the eDS_AppSpecific parameter. Currently, this calls SetupDiag(eDS_ToStderr) to setup diagonistic stream to the std error channel.

Returns:
TRUE if successful, FALSE otherwise.

Definition at line 706 of file ncbiapp.cpp.

References eDCM_Flush, eDS_ToStderr, and CDiagContext::SetupDiag().

Referenced by CDiagContext::SetupDiag().

void CNcbiApplication::SetVersion const CVersionInfo version  )  [protected]
 

Set the version number for the program.

If not set, a default of 0.0.0 (unknown) is used.

Note:
This function should be used from constructor of CNcbiApplication derived class, otherwise command-like arguments "-version" and "-version-full" will not work as expected.
See also:
GetVersion

Definition at line 632 of file ncbiapp.cpp.

References ERR_POST_X, m_Version, and s_IsApplicationStarted.

Referenced by CCgi2RCgiApp::CCgi2RCgiApp(), CCgiTunnel2Grid::CCgiTunnel2Grid(), CDataTool::CDataTool(), CGridWorkerApp::CGridWorkerApp(), CNetCacheCheckApp::CNetCacheCheckApp(), CNetCacheControl::CNetCacheControl(), CNetScheduleCheck::CNetScheduleCheck(), CNetScheduleControl::CNetScheduleControl(), CNSRemoveJobControlApp::CNSRemoveJobControlApp(), CNSSubmitRemoteJobApp::CNSSubmitRemoteJobApp(), COmssa2pepxmlApplication::COmssa2pepxmlApplication(), COMSSABase::COMSSABase(), COMSSAMerge::COMSSAMerge(), CProjBulderApp::CProjBulderApp(), CRemoteAppDispatcher::CRemoteAppDispatcher(), CSaveToNetCacheApp::CSaveToNetCacheApp(), and CSplignApp::CSplignApp().

void CNcbiApplication::x_AddDefaultArgs void   )  [private]
 

Definition at line 843 of file ncbiapp.cpp.

References fHideHelp, m_ArgDesc, m_DisableArgDesc, and m_HideArgs.

Referenced by x_TryMain().

void CNcbiApplication::x_HonorStandardSettings IRegistry reg = 0  )  [private]
 

Read standard NCBI application configuration settings.

[NCBI]: HeapSizeLimit, CpuTimeLimit [DEBUG]: ABORT_ON_THROW, DIAG_POST_LEVEL, MessageFile

Parameters:
reg Registry to read from. If NULL, use the current registry setting.

Definition at line 1031 of file ncbiapp.cpp.

References DIAG_TRACE, eDT_Enable, IRegistry::Get(), GetDiagHandler(), CRef< C, Locker >::GetPointer(), CSysLog::HonorRegistrySettings(), m_Config, CObject::SetAllocFillMode(), and SetDiagTrace().

Referenced by x_TryInit().

void CNcbiApplication::x_SetupStdio void   )  [private]
 

Setup C++ standard I/O streams' behaviour.

Called from AppMain() to do compiler-specific optimization for C++ I/O streams. For example, since SUN WorkShop STL stream library has significant performance loss when sync_with_stdio is TRUE (default), so we turn it off. Another, for GCC version greater than 3.00 we forcibly set cin stream buffer size to 4096 bytes -- which boosts the performance dramatically.

Definition at line 804 of file ncbiapp.cpp.

References _ASSERT, endif, fBinaryCin, fBinaryCout, fDefault_CinBufferSize, fDefault_SyncWithStdio, m_CinBuffer, m_StdioFlags, and NCBI_OS_UNIX.

void CNcbiApplication::x_TryInit EAppDiagStream  diag,
const char *  conf
[private]
 

Definition at line 268 of file ncbiapp.cpp.

References AppStart(), eDCM_Flush, auto_ptr< X >::get(), GetArguments(), Init(), LoadConfig(), m_ArgDesc, m_Config, m_DisableArgDesc, SetupArgDescriptions(), CDiagContext::SetupDiag(), CDiagContext::x_FinalizeSetupDiag(), and x_HonorStandardSettings().

Referenced by x_TryMain().

void CNcbiApplication::x_TryMain EAppDiagStream  diag,
const char *  conf,
int *  exit_code,
bool got_exception
[private]
 

Definition at line 316 of file ncbiapp.cpp.

References CArgHelpException::eHelpFull, CArgHelpException::eHelpXml, ERR_POST_X, CCoreException::GetErrCode(), m_ArgDesc, NCBI_REPORT_EXCEPTION_X, NCBI_RETHROW_SAME, s_HandleExceptions(), x_AddDefaultArgs(), and x_TryInit().


Member Data Documentation

auto_ptr<CArgDescriptions> CNcbiApplication::m_ArgDesc [private]
 

Cmd.-line arg descriptions.

Definition at line 525 of file ncbiapp.hpp.

Referenced by GetArgDescriptions(), SetupArgDescriptions(), x_AddDefaultArgs(), x_TryInit(), and x_TryMain().

auto_ptr<CArgs> CNcbiApplication::m_Args [private]
 

Parsed cmd.-line args.

Definition at line 526 of file ncbiapp.hpp.

Referenced by GetArgs(), and CGBenchApplication::x_HandleArgs().

auto_ptr<CNcbiArguments> CNcbiApplication::m_Arguments [private]
 

Command-line arguments.

Definition at line 524 of file ncbiapp.hpp.

Referenced by AppStart(), CNcbiApplication(), GetArguments(), and LoadConfig().

char* CNcbiApplication::m_CinBuffer [private]
 

Cin buffer if changed.

Definition at line 530 of file ncbiapp.hpp.

Referenced by CNcbiApplication(), x_SetupStdio(), and ~CNcbiApplication().

CRef<CNcbiRegistry> CNcbiApplication::m_Config [private]
 

Guaranteed to be non-NULL.

Definition at line 522 of file ncbiapp.hpp.

Referenced by CNcbiApplication(), GetConfig(), x_HonorStandardSettings(), and x_TryInit().

string CNcbiApplication::m_ConfigPath [private]
 

Path to .ini file used.

Definition at line 535 of file ncbiapp.hpp.

Referenced by GetConfigPath(), and HasLoadedConfig().

string CNcbiApplication::m_DefaultConfig [private]
 

conf parameter to AppMain

Definition at line 539 of file ncbiapp.hpp.

Referenced by LoadConfig(), and SetupArgDescriptions().

auto_ptr<CNcbiOstream> CNcbiApplication::m_DiagStream [private]
 

Opt., aux., see eDS_ToMemory.

Definition at line 523 of file ncbiapp.hpp.

TDisableArgDesc CNcbiApplication::m_DisableArgDesc [private]
 

Arg desc. disabled.

Definition at line 527 of file ncbiapp.hpp.

Referenced by CNcbiApplication(), DisableArgDescriptions(), SetupArgDescriptions(), x_AddDefaultArgs(), and x_TryInit().

bool CNcbiApplication::m_DryRun [private]
 

Dry run.

Definition at line 538 of file ncbiapp.hpp.

Referenced by CNcbiApplication(), and IsDryRun().

auto_ptr<CNcbiEnvironment> CNcbiApplication::m_Environ [private]
 

Cached application env.

Definition at line 521 of file ncbiapp.hpp.

Referenced by CNcbiApplication(), GetEnvironment(), and SetEnvironment().

string CNcbiApplication::m_ExePath [private]
 

Program executable path.

Definition at line 532 of file ncbiapp.hpp.

Referenced by GetProgramExecutablePath().

int CNcbiApplication::m_ExitCode [private]
 

Exit code to force.

Reimplemented in CProjBulderApp.

Definition at line 536 of file ncbiapp.hpp.

Referenced by SetExitCode().

EExitMode CNcbiApplication::m_ExitCodeCond [private]
 

When to force it (if ever).

Definition at line 537 of file ncbiapp.hpp.

Referenced by CNcbiApplication(), and SetExitCode().

THideStdArgs CNcbiApplication::m_HideArgs [private]
 

Std cmd.-line flags to hide.

Definition at line 528 of file ncbiapp.hpp.

Referenced by CNcbiApplication(), HideStdArgs(), SetupArgDescriptions(), and x_AddDefaultArgs().

CNcbiApplication * CNcbiApplication::m_Instance [static, private]
 

Current app. instance.

Definition at line 519 of file ncbiapp.hpp.

Referenced by CNcbiApplication(), Instance(), and ~CNcbiApplication().

string CNcbiApplication::m_LogFileName [mutable, private]
 

Log file name.

Definition at line 534 of file ncbiapp.hpp.

string CNcbiApplication::m_ProgramDisplayName [private]
 

Display name of app.

Definition at line 531 of file ncbiapp.hpp.

Referenced by GetProgramDisplayName(), and SetProgramDisplayName().

string CNcbiApplication::m_RealExePath [private]
 

Symlink-free executable path.

Definition at line 533 of file ncbiapp.hpp.

Referenced by GetProgramExecutablePath().

TStdioSetupFlags CNcbiApplication::m_StdioFlags [private]
 

Std C++ I/O adjustments.

Definition at line 529 of file ncbiapp.hpp.

Referenced by CNcbiApplication(), SetStdioFlags(), and x_SetupStdio().

CRef<CVersion> CNcbiApplication::m_Version [private]
 

Program version.

Definition at line 520 of file ncbiapp.hpp.

Referenced by CNcbiApplication(), GetFullVersion(), GetVersion(), SetFullVersion(), and SetVersion().


The documentation for this class was generated from the following files:
Generated on Mon Dec 7 13:03:18 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Dec 07 16:23:32 2009 by modify_doxy.py rev. 173732