Nymph  v1.5.2
Flow-Based Data Processing Framework
Public Member Functions | Protected Attributes | Private Member Functions | List of all members
KTApplication Class Reference

Interface for the command-line handler and the configurator. More...

#include <KTApplication.hh>

Inheritance diagram for KTApplication:
Inheritance graph

Public Member Functions

 KTApplication ()
 
 KTApplication (int argC, char **argV, bool requireArgs=true, const scarab::param_node &defaultConfig=scarab::param_node())
 Constructor to use with command-line options; includes parsing of the command line by KTCommandLineHandler (except for config-file-dependent options) More...
 
virtual ~KTApplication ()
 
virtual bool Configure (const scarab::param_node &node)
 Should perform parameter store and command-line configurations. More...
 
KTCommandLineHandlerGetCommandLineHandler () const
 
const KTConfiguratorGetConfigurator () const
 
const std::string & GetConfigFilename () const
 
void AddEventLoop (KTEventLoop *loop)
 
void RemoveEventLoop (KTEventLoop *loop)
 Adds loop to the set of event loops overseen by KTApplication. Does NOT assume ownership of an event loop. More...
 
- Public Member Functions inherited from KTConfigurable
 KTConfigurable (const std::string &name="default-name")
 
virtual ~KTConfigurable ()
 
bool Configure (const std::string &config)
 Implement the option for calling Configure without passing a parameter store node. More...
 
const std::string & GetConfigName () const
 
void SetConfigName (const std::string &name)
 

Protected Attributes

KTCommandLineHandlerfCLHandler
 Removes loop from the set of event loops overseen by KTApplication. Does not stop the loop. More...
 
KTConfiguratorfConfigurator
 
std::string fConfigFilename
 
std::set< KTEventLoop *> fEventLoops
 
- Protected Attributes inherited from KTConfigurable
KTCommandLineHandlerfCLHandler
 
std::string fConfigName
 

Private Member Functions

void AddConfigOptionsToCLHandler (const scarab::param &param, const std::string &rootName)
 

Detailed Description

Interface for the command-line handler and the configurator.

Author
N. S. Oblath

The interface implemented here is meant to simplify the use of the command line and parameter store.

The basic format for the command line arguments are as follows:

When creating an application, the user would perform the following steps:

  1. Create the KTApplication and pass it the command-line arguments (argc and argv). The configuration file will be automatically extracted from the command line. If –help (-h) or –version (-v) were given, those will be handled immediately, and the program will exit.
  2. Call KTApplication::ReadConfigFile() to read the config file and store the values in the parameter store.
  3. Use KTAppilcation::GetNode(address) to get parameter-store nodes.

Event Loops: KTApplication can oversee the running of event loops. It takes a very light-handed approach to that oversight. In the event that the KTApplication object is deleted, all loops it knows about will be stopped. Event loops are not deleted. If an event loop is going out of scope before the KTApplication object, the user should make sure to remove it from KTApplication's oversight.

Definition at line 56 of file KTApplication.hh.

Constructor & Destructor Documentation

◆ KTApplication() [1/2]

Definition at line 25 of file KTApplication.cc.

◆ KTApplication() [2/2]

KTApplication ( int  argC,
char **  argV,
bool  requireArgs = true,
const scarab::param_node &  defaultConfig = scarab::param_node() 
)

Constructor to use with command-line options; includes parsing of the command line by KTCommandLineHandler (except for config-file-dependent options)

Definition at line 33 of file KTApplication.cc.

◆ ~KTApplication()

~KTApplication ( )
virtual

Definition at line 111 of file KTApplication.cc.

Member Function Documentation

◆ AddConfigOptionsToCLHandler()

void AddConfigOptionsToCLHandler ( const scarab::param &  param,
const std::string &  rootName 
)
private

Definition at line 120 of file KTApplication.cc.

◆ AddEventLoop()

void AddEventLoop ( KTEventLoop loop)

Definition at line 162 of file KTApplication.cc.

◆ Configure()

bool Configure ( const scarab::param_node &  node)
virtual

Should perform parameter store and command-line configurations.

Implements KTConfigurable.

Definition at line 157 of file KTApplication.cc.

◆ GetCommandLineHandler()

KTCommandLineHandler * GetCommandLineHandler ( ) const
inline

Definition at line 89 of file KTApplication.hh.

◆ GetConfigFilename()

const std::string & GetConfigFilename ( ) const
inline

Definition at line 99 of file KTApplication.hh.

◆ GetConfigurator()

const KTConfigurator * GetConfigurator ( ) const
inline

Definition at line 94 of file KTApplication.hh.

◆ RemoveEventLoop()

void RemoveEventLoop ( KTEventLoop loop)

Adds loop to the set of event loops overseen by KTApplication. Does NOT assume ownership of an event loop.

Definition at line 168 of file KTApplication.cc.

Member Data Documentation

◆ fCLHandler

KTCommandLineHandler* fCLHandler
protected

Removes loop from the set of event loops overseen by KTApplication. Does not stop the loop.

Definition at line 80 of file KTApplication.hh.

◆ fConfigFilename

std::string fConfigFilename
protected

Definition at line 83 of file KTApplication.hh.

◆ fConfigurator

KTConfigurator* fConfigurator
protected

Definition at line 81 of file KTApplication.hh.

◆ fEventLoops

std::set< KTEventLoop* > fEventLoops
protected

Definition at line 85 of file KTApplication.hh.


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