OTB  6.7.0
Orfeo Toolbox
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
otb::Wrapper::CommandLineLauncher Class Reference

#include <otbWrapperCommandLineLauncher.h>

+ Inheritance diagram for otb::Wrapper::CommandLineLauncher:
+ Collaboration diagram for otb::Wrapper::CommandLineLauncher:

Public Types

typedef itk::MemberCommand< SelfAddProcessCommandType
 
typedef itk::SmartPointer
< const Self
ConstPointer
 
enum  ParamResultType {
  OKPARAM,
  MISSINGMANDATORYPARAMETER,
  MISSINGPARAMETERVALUE,
  WRONGPARAMETERVALUE,
  INVALIDNUMBEROFVALUE,
  DEFAULT
}
 
typedef
CommandLineParser::ParseResultType 
ParseResultType
 
typedef itk::SmartPointer< SelfPointer
 
typedef CommandLineLauncher Self
 
typedef itk::Object Superclass
 
typedef std::vector
< StandardOneLineFilterWatcher<> * > 
WatcherListType
 
- Public Types inherited from itk::Object
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef Object Self
 
typedef LightObject Superclass
 
- Public Types inherited from itk::LightObject
typedef SmartPointer< const SelfConstPointer
 
typedef SmartPointer< SelfPointer
 
typedef LightObject Self
 

Public Member Functions

bool BeforeExecute ()
 
virtual ::itk::LightObject::Pointer CreateAnother (void) const
 
void DisplayHelp (bool longHelp=false)
 
bool Execute ()
 
bool ExecuteAndWriteOutput ()
 
virtual const char * GetNameOfClass () const
 
bool Load ()
 
bool Load (const std::vector< std::string > &vexp)
 
void LoadTestEnv ()
 
- Public Member Functions inherited from itk::Object
unsigned long AddObserver (const EventObject &event, Command *)
 
unsigned long AddObserver (const EventObject &event, Command *) const
 
virtual void DebugOff () const
 
virtual void DebugOn () const
 
CommandGetCommand (unsigned long tag)
 
bool GetDebug () const
 
const MetaDataDictionaryGetMetaDataDictionary () const
 
MetaDataDictionaryGetMetaDataDictionary ()
 
virtual ModifiedTimeType GetMTime () const
 
virtual const std::string & GetObjectName () const
 
virtual const TimeStampGetTimeStamp () const
 
bool HasObserver (const EventObject &event) const
 
void InvokeEvent (const EventObject &)
 
void InvokeEvent (const EventObject &) const
 
virtual void Modified () const
 
virtual void Register () const override
 
void RemoveAllObservers ()
 
void RemoveObserver (unsigned long tag)
 
void SetDebug (bool debugFlag) const
 
void SetMetaDataDictionary (const MetaDataDictionary &rhs)
 
virtual void SetObjectName (std::string _arg)
 
virtual void SetReferenceCount (int) override
 
virtual void UnRegister () const noexceptoverride
 
- Public Member Functions inherited from itk::LightObject
virtual void Delete ()
 
virtual int GetReferenceCount () const
 
 itkCloneMacro (Self)
 
void Print (std::ostream &os, Indent indent=0) const
 

Static Public Member Functions

static Pointer New ()
 
- Static Public Member Functions inherited from itk::Object
static bool GetGlobalWarningDisplay ()
 
static void GlobalWarningDisplayOff ()
 
static void GlobalWarningDisplayOn ()
 
static Pointer New ()
 
static void SetGlobalWarningDisplay (bool flag)
 
- Static Public Member Functions inherited from itk::LightObject
static void BreakOnError ()
 
static Pointer New ()
 

Protected Member Functions

bool CheckKeyValidity (std::string &key)
 
bool CheckParametersPrefix ()
 
bool CheckUnicity ()
 
 CommandLineLauncher ()
 
void DeleteWatcherList ()
 
void DisplayOutputParameters ()
 
std::string DisplayParameterHelp (const Parameter::Pointer &param, const std::string paramKey, bool longHelp=false)
 
unsigned int GetMaxKeySize () const
 
void LinkWatchers (itk::Object *caller, const itk::EventObject &event)
 
bool LoadApplication ()
 
CommandLineLauncher::ParamResultType LoadParameters ()
 
bool LoadPath ()
 
 ~CommandLineLauncher () override
 
- Protected Member Functions inherited from itk::Object
 Object ()
 
bool PrintObservers (std::ostream &os, Indent indent) const
 
virtual void PrintSelf (std::ostream &os, Indent indent) const override
 
virtual void SetTimeStamp (const TimeStamp &time)
 
virtual ~Object ()
 
- Protected Member Functions inherited from itk::LightObject
virtual LightObject::Pointer InternalClone () const
 
 LightObject ()
 
virtual void PrintHeader (std::ostream &os, Indent indent) const
 
virtual void PrintTrailer (std::ostream &os, Indent indent) const
 
virtual ~LightObject ()
 

Private Member Functions

bool CheckMissingMandatoryParameter (const std::string &paramKey) const
 
bool CheckOutputPathsValidity (const std::string &paramKey) const
 
void CheckUnusedParameter (const std::string &paramKey) const
 
 CommandLineLauncher (const CommandLineLauncher &)=delete
 
bool ExecuteAndWriteOutputNoCatch ()
 
void operator= (const CommandLineLauncher &)=delete
 

Private Attributes

AddProcessCommandType::Pointer m_AddProcessCommand
 
Application::Pointer m_Application
 
itk::StdStreamLogOutput::Pointer m_LogOutput
 
CommandLineParser::Pointer m_Parser
 
std::string m_Path
 
bool m_ReportProgress
 
std::vector< std::string > m_VExpression
 
WatcherListType m_WatcherList
 

Additional Inherited Members

- Protected Attributes inherited from itk::LightObject
AtomicInt< int > m_ReferenceCount
 

Detailed Description

This class check the validity of a command line application.

To be valid, the expression must be as follow: ModuleName (ModulePath) –attribut1_Key attribut1_Value –attribut2_Key attribut2_Value After the attribute key, if the user give several values (expression without "--" separated by space), it will automatically be interpreted as a list.

Definition at line 57 of file otbWrapperCommandLineLauncher.h.

Member Typedef Documentation

Command Member

Definition at line 82 of file otbWrapperCommandLineLauncher.h.

Definition at line 64 of file otbWrapperCommandLineLauncher.h.

Parse result enum

Definition at line 70 of file otbWrapperCommandLineLauncher.h.

Definition at line 63 of file otbWrapperCommandLineLauncher.h.

Standard class typedefs.

Definition at line 61 of file otbWrapperCommandLineLauncher.h.

Definition at line 62 of file otbWrapperCommandLineLauncher.h.

Filter watcher list type

Definition at line 79 of file otbWrapperCommandLineLauncher.h.

Member Enumeration Documentation

Enumerator
OKPARAM 
MISSINGMANDATORYPARAMETER 
MISSINGPARAMETERVALUE 
WRONGPARAMETERVALUE 
INVALIDNUMBEROFVALUE 
DEFAULT 

Definition at line 74 of file otbWrapperCommandLineLauncher.h.

Constructor & Destructor Documentation

otb::Wrapper::CommandLineLauncher::CommandLineLauncher ( )
protected

Constructor

otb::Wrapper::CommandLineLauncher::~CommandLineLauncher ( )
overrideprotected

Destructor

otb::Wrapper::CommandLineLauncher::CommandLineLauncher ( const CommandLineLauncher )
privatedelete

Member Function Documentation

bool otb::Wrapper::CommandLineLauncher::BeforeExecute ( )

Gather the code process to do before Execute and ExecuteAndWriteOutput Returns false if a problem occurs, true otherwise.

bool otb::Wrapper::CommandLineLauncher::CheckKeyValidity ( std::string &  key)
protected

Check if each key is valid for the application.

bool otb::Wrapper::CommandLineLauncher::CheckMissingMandatoryParameter ( const std::string &  paramKey) const
private
Returns
false if paramKey is a missing mandatory parameter
bool otb::Wrapper::CommandLineLauncher::CheckOutputPathsValidity ( const std::string &  paramKey) const
private
Returns
false if paramKey is an OutputFilename parameter pointing to a path that does not exist
bool otb::Wrapper::CommandLineLauncher::CheckParametersPrefix ( )
protected

Check if option contains at least one "-".

bool otb::Wrapper::CommandLineLauncher::CheckUnicity ( )
protected

Check if each key is unique in the expression.

void otb::Wrapper::CommandLineLauncher::CheckUnusedParameter ( const std::string &  paramKey) const
private

Prints a warning to std::cerr if paramKey is an unused parameter

virtual::itk::LightObject::Pointer otb::Wrapper::CommandLineLauncher::CreateAnother ( void  ) const
virtual

Reimplemented from itk::Object.

void otb::Wrapper::CommandLineLauncher::DeleteWatcherList ( )
protected

Clear watcher list, deleting its pointers.

void otb::Wrapper::CommandLineLauncher::DisplayHelp ( bool  longHelp = false)

Create and display the help of the application

void otb::Wrapper::CommandLineLauncher::DisplayOutputParameters ( )
protected

Display the output parameter (Role == RoleOutput)

std::string otb::Wrapper::CommandLineLauncher::DisplayParameterHelp ( const Parameter::Pointer param,
const std::string  paramKey,
bool  longHelp = false 
)
protected

Create and display the help of the application

bool otb::Wrapper::CommandLineLauncher::Execute ( )

Launch the process, using the Execute application method The method will check if the user asked for help (looking at –help key) before loading parameter and launching process.

bool otb::Wrapper::CommandLineLauncher::ExecuteAndWriteOutput ( )

Launch the process, using the ExecuteAndWriteOutput application method The method will check if the user asked for help (looking at –help key) before loading parameter and launching process.

bool otb::Wrapper::CommandLineLauncher::ExecuteAndWriteOutputNoCatch ( )
private

Actually launch the process and write outputs, without catching exceptions.

unsigned int otb::Wrapper::CommandLineLauncher::GetMaxKeySize ( ) const
protected

Returns the width of the longest key (in number of chars)

virtual const char* otb::Wrapper::CommandLineLauncher::GetNameOfClass ( ) const
virtual

RTTI support

Reimplemented from itk::Object.

void otb::Wrapper::CommandLineLauncher::LinkWatchers ( itk::Object caller,
const itk::EventObject event 
)
protected

Load the watchers for internal progress and writing progress report.

bool otb::Wrapper::CommandLineLauncher::Load ( )

Load the application in several steps :

bool otb::Wrapper::CommandLineLauncher::Load ( const std::vector< std::string > &  vexp)

same as Load method but set the expression before.

bool otb::Wrapper::CommandLineLauncher::LoadApplication ( )
protected

Load the application calling the CreateApplication method of the ApplicationRegistry classes. Pay attention, the executable paths have to be loaded or set in the environment before calling the function.

CommandLineLauncher::ParamResultType otb::Wrapper::CommandLineLauncher::LoadParameters ( )
protected

Parse the user expression, extract the key and the associated string and set it as value of each corresponding application parameter.

bool otb::Wrapper::CommandLineLauncher::LoadPath ( )
protected

Load the executable path. It looks for the key –modulePath, extract and interpret as path the following strings.

void otb::Wrapper::CommandLineLauncher::LoadTestEnv ( )

Performs specific action for testing environment

static Pointer otb::Wrapper::CommandLineLauncher::New ( )
static

Defining ::New() static method

void otb::Wrapper::CommandLineLauncher::operator= ( const CommandLineLauncher )
privatedelete

Member Data Documentation

AddProcessCommandType::Pointer otb::Wrapper::CommandLineLauncher::m_AddProcessCommand
private

Definition at line 199 of file otbWrapperCommandLineLauncher.h.

Application::Pointer otb::Wrapper::CommandLineLauncher::m_Application
private

Definition at line 190 of file otbWrapperCommandLineLauncher.h.

itk::StdStreamLogOutput::Pointer otb::Wrapper::CommandLineLauncher::m_LogOutput
private

Definition at line 197 of file otbWrapperCommandLineLauncher.h.

CommandLineParser::Pointer otb::Wrapper::CommandLineLauncher::m_Parser
private

Definition at line 193 of file otbWrapperCommandLineLauncher.h.

std::string otb::Wrapper::CommandLineLauncher::m_Path
private

Definition at line 188 of file otbWrapperCommandLineLauncher.h.

bool otb::Wrapper::CommandLineLauncher::m_ReportProgress
private

Definition at line 200 of file otbWrapperCommandLineLauncher.h.

std::vector<std::string> otb::Wrapper::CommandLineLauncher::m_VExpression
private

Definition at line 192 of file otbWrapperCommandLineLauncher.h.

WatcherListType otb::Wrapper::CommandLineLauncher::m_WatcherList
private

Definition at line 195 of file otbWrapperCommandLineLauncher.h.


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