MDSTk Libraries
1.1.0
Medical Data Segmentation Toolkit
|
Class encapsulating a simple console application. More...
#include <mdsConsole.h>
Public Types | |
enum | { CLASS_OBJECT } |
Templates that require members of the CObject class can use this enum to check the existence. More... | |
enum | { HEAP_OBJECT = 0x70616568 } |
Signature used to recognize objects on the heap. More... | |
Public Member Functions | |
void | allowArguments (const std::string &sArgs) |
Additinal command line arguments should be specified. | |
CConsole (const std::string &sDescription) | |
Default constructor. | |
void | exit () |
Exits the application. | |
CArgv * | getArguments () |
Returns pointer to the parsed command line arguments. | |
const std::string & | getDescription () const |
Returns the application description. | |
const std::string & | getFilename () const |
Returns real name of the executed binary application. | |
int | getReferencesCount () const |
Returns the number of references. | |
virtual bool | init (int argc, char *argv[]) |
Initializes console application and parses a given command line. | |
bool | isActive () |
Returns true whenever the processing thread is running. | |
bool | isOnHeap () const |
Returns true if the object is allocated on the heap. | |
virtual bool | main ()=0 |
Virtual method repeatedly called by the processing thread. | |
MDS_SHAREDPTR (CConsole) | |
Smart pointer type. | |
virtual void | printFullUsage () |
Writes full help to the cerr stream. | |
virtual void | printUsage () |
Writes simple usage to the cerr stream. | |
bool | run () |
Executes processing thread and console I/O. | |
virtual void | shutdown ()=0 |
Called on console shutdown. | |
virtual bool | startup ()=0 |
Virtual method called on console startup. | |
virtual void | writeExtendedUsage (std::ostream &Stream)=0 |
Called on writing a full usage statement. | |
virtual | ~CConsole () |
Virtual destructor. | |
Static Public Member Functions | |
static void * | operator new (std::size_t Size) |
Allocates a new object on the heap. | |
Protected Member Functions | |
void | addReference () const |
Increase the reference counter. | |
bool | delReference () const |
Decrease the reference counter. | |
Static Protected Member Functions | |
static int | threadRoutine (mds::sys::CThread *pThread) |
The main thread routine. | |
Protected Attributes | |
CArgv | m_Arguments |
Parsed command line arguments. | |
mds::sys::CExitHandler | m_ExitHandler |
Exit handler. | |
int | m_iHeapObject |
Flag initialized if the object is on the heap. | |
int | m_iReferences |
The number of references to the object. | |
std::string | m_sAllowedArguments |
Allowed command line arguments. | |
std::string | m_sDescription |
Application description. | |
std::string | m_sFilename |
Application filename. | |
mds::sys::CThread | m_Thread |
Processing thread. |
Class encapsulating a simple console application.
anonymous enum [inherited] |
Templates that require members of the CObject class can use this enum to check the existence.
mds::mod::CConsole::CConsole | ( | const std::string & | sDescription | ) |
Default constructor.
mds::mod::CConsole::~CConsole | ( | ) | [virtual] |
Virtual destructor.
void mds::base::CObject::addReference | ( | ) | const [protected, inherited] |
Increase the reference counter.
void mds::mod::CConsole::allowArguments | ( | const std::string & | sArgs | ) |
Additinal command line arguments should be specified.
bool mds::base::CObject::delReference | ( | ) | const [protected, inherited] |
Decrease the reference counter.
void mds::mod::CConsole::exit | ( | ) |
Exits the application.
Returns pointer to the parsed command line arguments.
const std::string& mds::mod::CConsole::getDescription | ( | ) | const |
Returns the application description.
const std::string& mds::mod::CConsole::getFilename | ( | ) | const |
Returns real name of the executed binary application.
int mds::base::CObject::getReferencesCount | ( | ) | const [inherited] |
Returns the number of references.
bool mds::mod::CConsole::init | ( | int | argc, |
char * | argv[] | ||
) | [virtual] |
Initializes console application and parses a given command line.
Reimplemented in mds::mod::CModule, and mds::mod::CView.
bool mds::mod::CConsole::isActive | ( | ) |
Returns true whenever the processing thread is running.
bool mds::base::CObject::isOnHeap | ( | ) | const [inherited] |
Returns true if the object is allocated on the heap.
virtual bool mds::mod::CConsole::main | ( | ) | [pure virtual] |
Virtual method repeatedly called by the processing thread.
Implemented in mds::mod::CModule, and mds::mod::CView.
Smart pointer type.
static void* mds::base::CObject::operator new | ( | std::size_t | Size | ) | [static, inherited] |
Allocates a new object on the heap.
void mds::mod::CConsole::printFullUsage | ( | ) | [virtual] |
Writes full help to the cerr stream.
Reimplemented in mds::mod::CModule, and mds::mod::CView.
void mds::mod::CConsole::printUsage | ( | ) | [virtual] |
Writes simple usage to the cerr stream.
Reimplemented in mds::mod::CModule, and mds::mod::CView.
bool mds::mod::CConsole::run | ( | ) |
Executes processing thread and console I/O.
virtual void mds::mod::CConsole::shutdown | ( | ) | [pure virtual] |
Called on console shutdown.
Implemented in mds::mod::CModule, and mds::mod::CView.
virtual bool mds::mod::CConsole::startup | ( | ) | [pure virtual] |
Virtual method called on console startup.
Implemented in mds::mod::CModule, and mds::mod::CView.
static int mds::mod::CConsole::threadRoutine | ( | mds::sys::CThread * | pThread | ) | [static, protected] |
The main thread routine.
virtual void mds::mod::CConsole::writeExtendedUsage | ( | std::ostream & | Stream | ) | [pure virtual] |
Called on writing a full usage statement.
Implemented in mds::mod::CModule, and mds::mod::CView.
CArgv mds::mod::CConsole::m_Arguments [protected] |
Parsed command line arguments.
Exit handler.
int mds::base::CObject::m_iHeapObject [mutable, protected, inherited] |
Flag initialized if the object is on the heap.
int mds::base::CObject::m_iReferences [mutable, protected, inherited] |
The number of references to the object.
std::string mds::mod::CConsole::m_sAllowedArguments [protected] |
Allowed command line arguments.
std::string mds::mod::CConsole::m_sDescription [protected] |
Application description.
std::string mds::mod::CConsole::m_sFilename [protected] |
Application filename.
mds::sys::CThread mds::mod::CConsole::m_Thread [protected] |
Processing thread.