OTB  9.0.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 SelfConstPointer
 
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 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 ()
 

Static Public Member Functions

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
 

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
 

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

◆ AddProcessCommandType

Command Member

Definition at line 80 of file otbWrapperCommandLineLauncher.h.

◆ ConstPointer

typedef itk::SmartPointer<const Self> otb::Wrapper::CommandLineLauncher::ConstPointer

Definition at line 64 of file otbWrapperCommandLineLauncher.h.

◆ ParseResultType

Parse result enum

Definition at line 70 of file otbWrapperCommandLineLauncher.h.

◆ Pointer

Definition at line 63 of file otbWrapperCommandLineLauncher.h.

◆ Self

Standard class typedefs.

Definition at line 61 of file otbWrapperCommandLineLauncher.h.

◆ Superclass

Definition at line 62 of file otbWrapperCommandLineLauncher.h.

◆ WatcherListType

Filter watcher list type

Definition at line 77 of file otbWrapperCommandLineLauncher.h.

Member Enumeration Documentation

◆ ParamResultType

Enumerator
OKPARAM 
MISSINGMANDATORYPARAMETER 
MISSINGPARAMETERVALUE 
WRONGPARAMETERVALUE 
INVALIDNUMBEROFVALUE 
DEFAULT 

Definition at line 74 of file otbWrapperCommandLineLauncher.h.

Constructor & Destructor Documentation

◆ CommandLineLauncher() [1/2]

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

Constructor

◆ ~CommandLineLauncher()

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

Destructor

◆ CommandLineLauncher() [2/2]

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

Member Function Documentation

◆ BeforeExecute()

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

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

◆ CheckKeyValidity()

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

Check if each key is valid for the application.

◆ CheckMissingMandatoryParameter()

bool otb::Wrapper::CommandLineLauncher::CheckMissingMandatoryParameter ( const std::string &  paramKey) const
private
Returns
false if paramKey is a missing mandatory parameter

◆ CheckOutputPathsValidity()

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

◆ CheckParametersPrefix()

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

Check if option contains at least one "-".

◆ CheckUnicity()

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

Check if each key is unique in the expression.

◆ CheckUnusedParameter()

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

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

◆ CreateAnother()

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

◆ DeleteWatcherList()

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

Clear watcher list, deleting its pointers.

◆ DisplayHelp()

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

Create and display the help of the application

◆ DisplayOutputParameters()

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

Display the output parameter (Role == RoleOutput)

◆ DisplayParameterHelp()

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

◆ Execute()

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.

◆ ExecuteAndWriteOutput()

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.

◆ ExecuteAndWriteOutputNoCatch()

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

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

◆ GetMaxKeySize()

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

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

◆ GetNameOfClass()

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

RTTI support

◆ LinkWatchers()

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

Load the watchers for internal progress and writing progress report.

◆ Load() [1/2]

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

Load the application in several steps :

◆ Load() [2/2]

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

same as Load method but set the expression before.

◆ LoadApplication()

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.

◆ LoadParameters()

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.

◆ LoadPath()

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

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

◆ LoadTestEnv()

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

Performs specific action for testing environment

◆ New()

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

Defining ::New() static method

◆ operator=()

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

Member Data Documentation

◆ m_AddProcessCommand

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

Definition at line 196 of file otbWrapperCommandLineLauncher.h.

◆ m_Application

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

Definition at line 187 of file otbWrapperCommandLineLauncher.h.

◆ m_LogOutput

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

Definition at line 194 of file otbWrapperCommandLineLauncher.h.

◆ m_Parser

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

Definition at line 190 of file otbWrapperCommandLineLauncher.h.

◆ m_Path

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

Definition at line 185 of file otbWrapperCommandLineLauncher.h.

◆ m_ReportProgress

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

Definition at line 197 of file otbWrapperCommandLineLauncher.h.

◆ m_VExpression

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

Definition at line 189 of file otbWrapperCommandLineLauncher.h.

◆ m_WatcherList

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

Definition at line 192 of file otbWrapperCommandLineLauncher.h.


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