#include <Iguana/Framework/interface/IgArgsElement.h>
Public Member Functions | |
virtual char * | arg (int arg) |
virtual int & | args (void) |
virtual char ** | argv (void) |
virtual bool | exists (const std::string &arg, bool hasvalue=false) |
virtual bool | exists (const std::vector< std::string > &arg, bool hasvalue=false) |
virtual bool | find (const std::string &arg, int &value, bool remove=false) |
virtual bool | find (const std::string &arg, std::string &value, bool remove=false) |
virtual bool | find (const std::vector< std::string > &arg, std::string &value, bool remove=false) |
IgArgsElement (IgState *in, int argc, char **argv) | |
virtual void | remove (const std::string &arg, bool hasvalue=false) |
virtual void | remove (const std::vector< std::string > &arg, bool hasvalue=false) |
Private Member Functions | |
IG_DECLARE_STATE_ELEMENT (IgArgsElement) | |
Private Attributes | |
int | m_argc |
char ** | m_argv |
IgState * | m_state |
Definition at line 20 of file IgArgsElement.h.
Definition at line 20 of file IgArgsElement.cc.
References ASSERT, find(), m_state, and IgState::put().
00021 : m_state (in), 00022 m_argc (argc), 00023 m_argv (argv) 00024 { 00025 ASSERT (argv); 00026 ASSERT (std::find (argv, argv+argc+1, (char *) 0) == argv+argc); 00027 m_state->put (s_key, this); 00028 }
char * IgArgsElement::arg | ( | int | arg | ) | [virtual] |
Definition at line 35 of file IgArgsElement.cc.
References args(), argv(), and ASSERT.
Referenced by VisMainProgram::configFailureCallback(), IgServerPool::IgServerPool(), and IgStudioDriver::run().
Definition at line 31 of file IgArgsElement.cc.
References m_argc.
Referenced by arg(), VisMainProgram::configFailureCallback(), IgServerPool::IgServerPool(), VisEventProcessorService::initEventProcessor(), IgSocketDriver::run(), and IgStudioDriver::run().
00032 { return m_argc; }
char ** IgArgsElement::argv | ( | void | ) | [virtual] |
Definition at line 39 of file IgArgsElement.cc.
References m_argv.
Referenced by arg(), VisEventMenu::autoEvents(), VisEventMenu::autoPrint(), VisExceptionService::cmsExceptionCallback(), VisMainProgram::cmsExceptionCallback(), VisMainProgram::configFailureCallback(), VisExceptionService::errorCallback(), VisMainProgram::exceptionCallback(), VisExceptionService::exceptionCallback(), VisMainProgram::frameworkExceptionCallback(), VisEventMenu::initEventProcessor(), VisEventProcessorService::initEventProcessor(), VisEventMenu::nextEvent(), VisEventMenu::previousEvent(), VisEventMenu::reInitEventProcessor(), IgSocketDriver::run(), IgStudioDriver::run(), VisEventMenu::skipEvent(), VisMainProgram::unhandledExceptionCallback(), and VisExceptionService::unhandledExceptionCallback().
00040 { return m_argv; }
Definition at line 132 of file IgArgsElement.cc.
References exists().
00134 { 00135 std::vector<std::string> argument; 00136 argument.push_back (arg); 00137 return exists (argument, hasvalue); 00138 }
bool IgArgsElement::exists | ( | const std::vector< std::string > & | arg, | |
bool | hasvalue = false | |||
) | [virtual] |
Definition at line 116 of file IgArgsElement.cc.
References i, j, m_argc, and m_argv.
Referenced by exists(), IgFileManager::IgFileManager(), and IgSocketDriver::run().
00118 { 00119 int total = hasvalue ? m_argc - 1 : m_argc; 00120 for(int i = 1; i < total; i++) 00121 { 00122 for(unsigned int j = 0; j < arg.size (); j++) 00123 { 00124 if (arg[j] == m_argv[i]) 00125 return true; 00126 } 00127 } 00128 return false; 00129 }
Definition at line 72 of file IgArgsElement.cc.
References find().
00074 { 00075 std::vector<std::string> argument; 00076 argument.push_back (arg); 00077 std::string strValue; 00078 if (find (argument, strValue, remove)) 00079 { 00080 value = atoi (strValue.c_str()); 00081 return true; 00082 } 00083 return false; 00084 }
bool IgArgsElement::find | ( | const std::vector< std::string > & | arg, | |
std::string & | value, | |||
bool | remove = false | |||
) | [virtual] |
Definition at line 43 of file IgArgsElement.cc.
References i, j, m_argc, and m_argv.
Referenced by IgServerSocket::cmdLineHostname(), IgServerSocket::cmdLinePort(), IgServerSocket::cmdLineProxy(), VisMainProgram::configFailureCallback(), find(), IgIVView::IgIVView(), IgServerPool::IgServerPool(), IgConfigElement::initConfiguration(), IgServerSocket::initialize(), and IgStudioDriver::run().
00045 { 00046 for(int i = 1; i < m_argc - 1; i++) 00047 { 00048 for(unsigned int j = 0; j < arg.size (); j++) 00049 { 00050 if (arg[j] == m_argv[i]) 00051 { 00052 value = m_argv[i+1]; 00053 if (remove) 00054 { m_argv[i][0] = '\0'; m_argv[i+1][0] = '\0';} 00055 return true; 00056 } 00057 } 00058 } 00059 return false; 00060 }
IgArgsElement::IG_DECLARE_STATE_ELEMENT | ( | IgArgsElement | ) | [private] |
Definition at line 107 of file IgArgsElement.cc.
00109 { 00110 std::vector<std::string> argument; 00111 argument.push_back (arg); 00112 remove (argument, hasvalue); 00113 }
void IgArgsElement::remove | ( | const std::vector< std::string > & | arg, | |
bool | hasvalue = false | |||
) | [virtual] |
Definition at line 87 of file IgArgsElement.cc.
References i, j, m_argc, and m_argv.
00089 { 00090 int total = hasvalue ? m_argc - 1 : m_argc; 00091 for(int i = 1; i < total; i++) 00092 { 00093 for(unsigned int j = 0; j < arg.size (); j++) 00094 { 00095 if (arg[j] == m_argv[i]) 00096 { 00097 m_argv[i][0]='\0'; 00098 if (hasvalue) 00099 m_argv[i+1][0]='\0'; 00100 return; 00101 } 00102 } 00103 } 00104 }
int IgArgsElement::m_argc [private] |
char** IgArgsElement::m_argv [private] |
IgState* IgArgsElement::m_state [private] |