Commit 1e4af3a1 authored by Vitaly Lipatov's avatar Vitaly Lipatov

use const for char **argv

parent fee92b77
......@@ -151,7 +151,7 @@ static void usage()
TransportMessage .
*/
// --------------------------------------------------------------------------------------
int main(int argc, char* argv[])
int main(int argc, const char** argv)
{
try
{
......@@ -159,7 +159,7 @@ int main(int argc, char* argv[])
char opt = 0;
while( (opt = getopt_long(argc, argv, "hc:beomsfur:l:a:n:d:i:v:t:x:j:g:k:w:p:y:",longopts,&optindex)) != -1 )
while( (opt = getopt_long(argc, (char * const*)argv, "hc:beomsfur:l:a:n:d:i:v:t:x:j:g:k:w:p:y:",longopts,&optindex)) != -1 )
{
switch (opt) //
{
......
......@@ -13,7 +13,7 @@ static void short_usage()
cout << "Usage: uniset-dbserver [--name ObjectId] [--confile configure.xml]\n";
}
// --------------------------------------------------------------------------
int main(int argc,char** argv)
int main(int argc, const char** argv)
{
try
{
......
......@@ -15,7 +15,7 @@ static void short_usage()
<< " [--confile configure.xml]\n";
}
// --------------------------------------------------------------------------
int main(int argc,char** argv)
int main(int argc, const char** argv)
{
try
{
......
......@@ -22,7 +22,7 @@ static void short_usage()
<< " --dbDumping [0,1] - dump- \n";
}
// --------------------------------------------------------------------------
int main(int argc,char** argv)
int main(int argc, const char** argv)
{
try
{
......
......@@ -9,7 +9,7 @@
using namespace UniSetTypes;
using namespace std;
// -----------------------------------------------------------------------------
int main( int argc, char **argv )
int main( int argc, const char **argv )
{
try
{
......
......@@ -12,7 +12,7 @@ static void short_usage()
cout << "Usage: uniset-sviewer-text [--fullname] [--polltime msec] [--confile uniset-confile]\n";
}
// --------------------------------------------------------------------------
int main(int argc, char **argv)
int main(int argc, const char **argv)
{
try
{
......
......@@ -38,7 +38,7 @@
using namespace std;
using namespace UniSetTypes;
// -----------------------------------------------------------------------------
int main( int argc, char* argv[] )
int main( int argc, const char** argv )
{
if( argc>1 &amp;&amp; strcmp(argv[1],"--help")==0 )
{
......@@ -51,7 +51,7 @@ int main( int argc, char* argv[] )
try
{
string confile = UniSetTypes::getArgParam( "--confile", argc, argv, "configure.xml" );
conf = new Configuration(argc, argv,confile);
conf = new Configuration(argc, argv, confile);
string logfilename = conf->getArgParam("--logfile","<xsl:value-of select="$CLASSNAME"/>.log");
......
......@@ -873,7 +873,7 @@ void IOControl::check_testlamp()
}
// -----------------------------------------------------------------------------
IOControl* IOControl::init_iocontrol( int argc, char* argv[],
IOControl* IOControl::init_iocontrol( int argc, const char** argv,
UniSetTypes::ObjectId icID, SharedMemory* ic )
{
string name = conf->getArgParam("--io-name","IOControl1");
......@@ -901,7 +901,7 @@ IOControl* IOControl::init_iocontrol( int argc, char* argv[],
return new IOControl(ID,icID,ic,numcards);
}
// -----------------------------------------------------------------------------
void IOControl::help_print( int argc, char* argv[] )
void IOControl::help_print( int argc, const char** argv )
{
cout << "--io-confnode name - xml-" << endl;
cout << "--io-name name - ID . IOController1." << endl;
......
......@@ -67,10 +67,10 @@ class IOControl:
virtual ~IOControl();
/*! */
static IOControl* init_iocontrol( int argc, char* argv[],
static IOControl* init_iocontrol( int argc, const char** argv,
UniSetTypes::ObjectId icID, SharedMemory* ic=0 );
/*! help- */
static void help_print( int argc, char* argv[] );
static void help_print( int argc, const char** argv );
// inline std::string getName(){ return myname; }
......
......@@ -11,7 +11,7 @@ using namespace UniSetTypes;
using namespace std;
using namespace UniSetExtensions;
// --------------------------------------------------------------------------
int main(int argc, char **argv)
int main(int argc, const char **argv)
{
if( argc>1 && strcmp(argv[1],"--help")==0 )
{
......
......@@ -7,7 +7,7 @@ using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
int main(int argc, char **argv)
int main(int argc, const char **argv)
{
try
{
......
......@@ -9,7 +9,7 @@ using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
int main(int argc, char **argv)
int main(int argc, const char **argv)
{
try
{
......
......@@ -795,11 +795,11 @@ void MBMaster::initIterators()
shm->initAIterator(aitHeartBeat);
}
// -----------------------------------------------------------------------------
void MBMaster::help_print( int argc, char* argv[] )
void MBMaster::help_print( int argc, const char** argv )
{
cout << "Default: prefix='mbtcp'" << endl;
cout << "--prefix-polltime msec - . 200 ." << endl;
cout << "--prefix-heartbeat-id - heartbeat-." << endl;
cout << "--prefix-heartbeat-id - heartbeat-." << endl;
cout << "--prefix-heartbeat-max - heartbeat-ޣ . 10." << endl;
cout << "--prefix-ready-timeout - SM , . (-1 - '')" << endl;
cout << "--prefix-force - SM, , " << endl;
......@@ -813,7 +813,7 @@ void MBMaster::help_print( int argc, char* argv[] )
cout << "--prefix-recv-timeout - ." << endl;
}
// -----------------------------------------------------------------------------
MBMaster* MBMaster::init_mbmaster( int argc, char* argv[], UniSetTypes::ObjectId shmID, SharedMemory* ic,
MBMaster* MBMaster::init_mbmaster( int argc, const char** argv, UniSetTypes::ObjectId shmID, SharedMemory* ic,
std::string prefix )
{
string name = conf->getArgParam("--" + prefix + "-name","MBTCPMaster1");
......
......@@ -24,11 +24,11 @@ class MBMaster:
virtual ~MBMaster();
/*! */
static MBMaster* init_mbmaster( int argc, char* argv[], UniSetTypes::ObjectId shmID, SharedMemory* ic=0,
static MBMaster* init_mbmaster( int argc, const char** argv, UniSetTypes::ObjectId shmID, SharedMemory* ic=0,
std::string prefix="mbtcp" );
/*! help- */
static void help_print( int argc, char* argv[] );
static void help_print( int argc, const char** argv );
static const int NoSafetyState=-1;
......
......@@ -11,7 +11,7 @@ using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
int main( int argc,char** argv )
int main( int argc, const char** argv )
{
if( argc>1 && (!strcmp(argv[1],"--help") || !strcmp(argv[1],"-h")) )
{
......@@ -19,13 +19,13 @@ int main( int argc,char** argv )
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << "--mbtcp-logfile filename - logfilename. Default: mbtcpmaster.log" << endl;
cout << endl;
MBMaster::help_print(argc,argv);
MBMaster::help_print(argc, argv);
return 0;
}
try
{
string confile=UniSetTypes::getArgParam("--confile",argc,argv,"configure.xml");
string confile=UniSetTypes::getArgParam("--confile",argc, argv, "configure.xml");
conf = new Configuration( argc, argv, confile );
string logfilename(conf->getArgParam("--mbtcp-logfile"));
......
......@@ -748,7 +748,7 @@ void MBSlave::initIterators()
shm->initAIterator(aitAskCount);
}
// -----------------------------------------------------------------------------
void MBSlave::help_print( int argc, char* argv[] )
void MBSlave::help_print( int argc, const char** argv )
{
cout << "Default: prefix='mbtcp'" << endl;
cout << "--prefix-heartbeat-id - heartbeat-." << endl;
......@@ -771,7 +771,7 @@ void MBSlave::help_print( int argc, char* argv[] )
cout << "--prefix-inet-port num - this modbus server port. Default: 502" << endl;
}
// -----------------------------------------------------------------------------
MBSlave* MBSlave::init_mbslave( int argc, char* argv[], UniSetTypes::ObjectId icID, SharedMemory* ic,
MBSlave* MBSlave::init_mbslave( int argc, const char** argv, UniSetTypes::ObjectId icID, SharedMemory* ic,
string prefix )
{
string name = conf->getArgParam("--" + prefix + "-name","MBSlave1");
......
......@@ -26,12 +26,12 @@ class MBSlave:
virtual ~MBSlave();
/*! */
static MBSlave* init_mbslave( int argc, char* argv[],
static MBSlave* init_mbslave( int argc, const char** argv,
UniSetTypes::ObjectId shmID, SharedMemory* ic=0,
std::string prefix="mbs" );
/*! help- */
static void help_print( int argc, char* argv[] );
static void help_print( int argc, const char** argv );
static const int NoSafetyState=-1;
......
......@@ -15,7 +15,7 @@ using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace std;
// --------------------------------------------------------------------------
int main(int argc, char **argv)
int main(int argc, const char **argv)
{
if( argc>1 && (!strcmp(argv[1],"--help") || !strcmp(argv[1],"-h")) )
......
......@@ -1406,7 +1406,7 @@ void RTUExchange::initIterators()
}
// -----------------------------------------------------------------------------
void RTUExchange::help_print( int argc, char* argv[] )
void RTUExchange::help_print( int argc, const char** argv )
{
cout << "--rs-polltime msec - . 200 ." << endl;
cout << "--rs-heartbeat-id - heartbeat-." << endl;
......@@ -1422,7 +1422,7 @@ void RTUExchange::help_print( int argc, char* argv[] )
cout << "--rs-recv-timeout - ." << endl;
}
// -----------------------------------------------------------------------------
RTUExchange* RTUExchange::init_rtuexchange( int argc, char* argv[], UniSetTypes::ObjectId icID, SharedMemory* ic )
RTUExchange* RTUExchange::init_rtuexchange( int argc, const char** argv, UniSetTypes::ObjectId icID, SharedMemory* ic )
{
string name = conf->getArgParam("--rs-name","RTUExchange1");
if( name.empty() )
......
......@@ -29,11 +29,11 @@ class RTUExchange:
virtual ~RTUExchange();
/*! */
static RTUExchange* init_rtuexchange( int argc, char* argv[],
static RTUExchange* init_rtuexchange( int argc, const char** argv,
UniSetTypes::ObjectId shmID, SharedMemory* ic=0 );
/*! help- */
static void help_print( int argc, char* argv[] );
static void help_print( int argc, const char** argv );
static const int NoSafetyState=-1;
......
......@@ -14,7 +14,7 @@ static void print_help()
printf("Usage: mtrconv TYPE[T1...T12] hex1 hex2\n");
}
// --------------------------------------------------------------------------
int main( int argc, char **argv )
int main( int argc, const char **argv )
{
ModbusRTU::ModbusData dt[3];
ModbusRTU::ModbusData* data = dt;
......
......@@ -9,7 +9,7 @@ using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
int main( int argc,char** argv )
int main( int argc, const char** argv )
{
try
{
......@@ -19,11 +19,11 @@ int main( int argc,char** argv )
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << "--rs-logfile filename - logfilename. Default: rtuexchange.log" << endl;
cout << endl;
RTUExchange::help_print(argc,argv);
RTUExchange::help_print(argc, argv);
return 0;
}
string confile=UniSetTypes::getArgParam("--confile",argc,argv,"configure.xml");
string confile=UniSetTypes::getArgParam("--confile", argc, argv, "configure.xml");
conf = new Configuration( argc, argv, confile );
string logfilename(conf->getArgParam("--rs-logfile"));
......
......@@ -14,7 +14,7 @@ static void print_help()
printf("Usage: vtconv TYPE[F2|F4] hex1 hex2 [hex3 hex4]\n");
}
// --------------------------------------------------------------------------
int main( int argc, char **argv )
int main( int argc, const char **argv )
{
VTypes::F2 f2;
......
......@@ -7,7 +7,7 @@ using namespace UniSetTypes;
using namespace UniSetExtensions;
using namespace std;
// -----------------------------------------------------------------------------
int main( int argc, char **argv )
int main( int argc, const char **argv )
{
try
{
......
......@@ -435,9 +435,9 @@ void SharedMemory::fastSaveValue(const IOController_i::SensorInfo& si, CORBA::Lo
IONotifyController_LT::fastSaveValue(si,value,type,sup_id);
}
// ------------------------------------------------------------------------------------------
SharedMemory* SharedMemory::init_smemory( int argc, char* argv[] )
SharedMemory* SharedMemory::init_smemory( int argc, const char** argv )
{
string dfile = conf->getArgParam("--datfile",conf->getConfFileName());
string dfile = conf->getArgParam("--datfile", conf->getConfFileName());
if( dfile[0]!='.' && dfile[0]!='/' )
dfile = conf->getConfDir() + dfile;
......@@ -455,7 +455,7 @@ SharedMemory* SharedMemory::init_smemory( int argc, char* argv[] )
return new SharedMemory(ID,dfile);
}
// -----------------------------------------------------------------------------
void SharedMemory::help_print( int argc, char* argv[] )
void SharedMemory::help_print( int argc, const char** argv )
{
cout << "--smemory-id - SharedMemeory ID" << endl;
cout << "--logfile fname - fname. smemory.log" << endl;
......
......@@ -27,9 +27,9 @@ class SharedMemory:
virtual ~SharedMemory();
/*! */
static SharedMemory* init_smemory( int argc, char* argv[] );
static SharedMemory* init_smemory( int argc, const char** argv );
/*! help- */
static void help_print( int argc, char* argv[] );
static void help_print( int argc, const char** argv );
virtual void saveValue(const IOController_i::SensorInfo& si, CORBA::Long value,
......@@ -62,7 +62,7 @@ class SharedMemory:
AIOStateList::iterator ait;
DIOStateList::iterator dit;
void add( long val, int size )
void add( long val, size_t size )
{
buf.push_back(val);
if( buf.size() >= size )
......
......@@ -11,12 +11,12 @@ using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
// --------------------------------------------------------------------------
int main(int argc, char **argv)
int main(int argc, const char **argv)
{
if( argc>1 && strcmp(argv[1],"--help")==0 )
{
cout << "--confile - . . configure.xml" << endl;
SharedMemory::help_print(argc,argv);
SharedMemory::help_print(argc, argv);
return 0;
}
......@@ -31,7 +31,7 @@ int main(int argc, char **argv)
unideb.logFile( logname.c_str() );
dlog.logFile( logname.c_str() );
SharedMemory* shm = SharedMemory::init_smemory(argc,argv);
SharedMemory* shm = SharedMemory::init_smemory(argc, argv);
if( !shm )
return 1;
......
......@@ -9,7 +9,7 @@ using namespace std;
using namespace UniSetTypes;
using namespace UniSetExtensions;
// -----------------------------------------------------------------------------
int main( int argc,char** argv )
int main( int argc, const char** argv )
{
try
{
......
......@@ -58,13 +58,13 @@ namespace UniSetTypes
virtual ~Configuration();
/*! xml- ( ) */
Configuration( int argc, char** argv, const std::string xmlfile="" );
Configuration( int argc, const char** argv, const std::string xmlfile="" );
/*! xml- */
Configuration( int argc, char** argv, ObjectIndex* oind, const std::string xmlfile="" );
Configuration( int argc, const char** argv, ObjectIndex* oind, const std::string xmlfile="" );
/*! , */
Configuration( int argc, char** argv,
Configuration( int argc, const char** argv,
const std::string fileConf, UniSetTypes::ObjectInfo* objectsMap );
/// ԣ path
......@@ -82,7 +82,7 @@ namespace UniSetTypes
std::string getRootDir(); /*!< , */
inline int getArgc(){ return _argc; }
inline char** getArgv() const { return _argv; }
inline const char** getArgv() const { return _argv; }
inline ObjectId getTimerService() const { return localTimerService; } /*!< TimerServic- */
inline ObjectId getDBServer() const { return localDBServer; } /*!< DBServer- */
inline ObjectId getInfoServer() const { return localInfoServer; } /*!< InfoServer- */
......@@ -158,7 +158,7 @@ namespace UniSetTypes
protected:
Configuration();
virtual void initConfiguration(int argc, char** argv);
virtual void initConfiguration(int argc, const char** argv);
void createNodesList();
virtual void initNode( UniSetTypes::NodeInfo& ninfo, UniXML_iterator& it);
......@@ -177,7 +177,7 @@ namespace UniSetTypes
UniXML unixml;
int _argc;
char** _argv;
const char** _argv;
CORBA::ORB_var orb;
CORBA::PolicyList policyList;
......@@ -230,7 +230,7 @@ namespace UniSetTypes
// UniSetTypes::conf.
// ( --confile --id-from-config )
void uniset_init( int argc, char* argv[], const std::string xmlfile="configure.xml" );
void uniset_init( int argc, const char** argv, const std::string xmlfile="configure.xml" );
} // end of UniSetTypes namespace
......
......@@ -44,7 +44,7 @@ namespace ORepHelpers
//!
CosNaming::NamingContext_ptr getContext(const std::string& cname, int argc,
char* *argv, const std::string& nsName)
const char** argv, const std::string& nsName)
throw(UniSetTypes::ORepFailed);
CosNaming::NamingContext_ptr getContext(CORBA::ORB_ptr orb, const std::string& cname,
......
......@@ -146,7 +146,7 @@ namespace UniSetTypes
\param defval - , ,
*/
inline std::string getArgParam( const std::string name,
int _argc, char** _argv,
int _argc, const char** _argv,
const std::string defval="" )
{
for( int i=1; i < (_argc - 1) ; i++ )
......@@ -162,7 +162,7 @@ namespace UniSetTypes
\return -1, .
, .
*/
inline int findArgParam( const std::string name, int _argc, char** _argv )
inline int findArgParam( const std::string name, int _argc, const char** _argv )
{
for( int i=1; i<_argc; i++ )
{
......
......@@ -44,9 +44,9 @@ namespace ORepHelpers
* \param cname - , .
* \param argc, argv - ORB
*/
CosNaming::NamingContext_ptr getContext(const string& cname, int argc, char* *argv, const string& nsName )throw(ORepFailed)
CosNaming::NamingContext_ptr getContext(const string& cname, int argc, const char** argv, const string& nsName )throw(ORepFailed)
{
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );
CORBA::ORB_var orb = CORBA::ORB_init( argc, (char**)argv );
unideb[Debug::REPOSITORY] << "OREPHELP: orb init ok"<< endl;
return getContext(orb, cname, nsName);
}
......
......@@ -74,7 +74,7 @@ bool ObjectRepositoryFactory::createSection( const char* name, const char* in_se
}
int argc(uconf->getArgc());
char **argv(uconf->getArgv());
const char **argv(uconf->getArgv());
CosNaming::NamingContext_var ctx = ORepHelpers::getContext(in_section, argc, argv, uconf->getNSName() );
return createContext( name, ctx.in() );
}
......@@ -223,7 +223,7 @@ bool ObjectRepositoryFactory::removeSection(const string& fullName, bool recursi
try
{
int argc(uconf->getArgc());
char **argv(uconf->getArgv());
const char **argv(uconf->getArgv());
ctx = ORepHelpers::getContext(fullName, argc, argv, nsName);
}
catch( ORepFailed )
......@@ -285,7 +285,7 @@ bool ObjectRepositoryFactory::removeSection(const string& fullName, bool recursi
try
{
int argc(uconf->getArgc());
char **argv(uconf->getArgv());
const char **argv(uconf->getArgv());
CosNaming::Name_var ctxName = omniURI::stringToName(name.c_str());
CosNaming::NamingContext_var in_ctx = ORepHelpers::getContext(in_sec, argc, argv, nsName);
ctx->destroy();
......@@ -327,7 +327,7 @@ bool ObjectRepositoryFactory::renameSection( const string& newFName, const strin
// unideb[Debug::REPOSITORY] << "ORepFactory: "<< in_sec << endl;
// unideb[Debug::REPOSITORY] << "ORepFactory: " << oldFName << " " << newFName << endl;
int argc(uconf->getArgc());
char **argv(uconf->getArgv());
const char **argv(uconf->getArgv());
CosNaming::NamingContext_var in_ctx = ORepHelpers::getContext(in_sec, argc, argv, nsName);
CosNaming::NamingContext_var ctx = ORepHelpers::getContext(oldFName, argc, argv, nsName);
......
......@@ -123,7 +123,7 @@ Configuration::~Configuration()
}
// ---------------------------------------------------------------------------------
Configuration::Configuration( int argc, char** argv, const string xmlfile ):
Configuration::Configuration( int argc, const char** argv, const string xmlfile ):
mi(NULL),
oind(NULL),
_argc(argc),
......@@ -141,7 +141,7 @@ Configuration::Configuration( int argc, char** argv, const string xmlfile ):
initConfiguration(argc,argv);
}
// ---------------------------------------------------------------------------------
Configuration::Configuration( int argc, char** argv, ObjectIndex* _oind,
Configuration::Configuration( int argc, const char** argv, ObjectIndex* _oind,
const string fileConf ):
mi(NULL),
oind(NULL),
......@@ -161,7 +161,7 @@ Configuration::Configuration( int argc, char** argv, ObjectIndex* _oind,
initConfiguration(argc,argv);
}
// ---------------------------------------------------------------------------------
Configuration::Configuration( int argc, char** argv, const string fileConf,
Configuration::Configuration( int argc, const char** argv, const string fileConf,
UniSetTypes::ObjectInfo* omap ):
mi(NULL),
oind(NULL),
......@@ -181,7 +181,7 @@ Configuration::Configuration( int argc, char** argv, const string fileConf,
initConfiguration(argc,argv);
}
// ---------------------------------------------------------------------------------
void Configuration::initConfiguration( int argc, char** argv )
void Configuration::initConfiguration( int argc, const char** argv )
{
// PassiveTimer pt(UniSetTimer::WaitUpTime);
if( unideb.debugging(Debug::SYSTEM) )
......@@ -305,7 +305,7 @@ void Configuration::initConfiguration( int argc, char** argv )
// +N --> -ORBIniRef NodeName=
// +2 --> -ORBIniRef NameService=
_argc = argc+2*lnodes.size()+2;
_argv = new char*[_argc];
_argv = new const char*[_argc];
int i = 0;
//
......@@ -358,7 +358,7 @@ void Configuration::initConfiguration( int argc, char** argv )
// ------------- CORBA INIT -------------
// orb init
orb = CORBA::ORB_init(_argc,_argv);
orb = CORBA::ORB_init(_argc,(char**)_argv);
// create policy
CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
......@@ -402,7 +402,7 @@ void Configuration::initConfiguration( int argc, char** argv )
// -------------------------------------------------------------------------
string Configuration::getArgParam( const string name, const string defval )
{
return UniSetTypes::getArgParam(name,_argc,_argv,defval);
return UniSetTypes::getArgParam(name, _argc, _argv, defval);
}
// -------------------------------------------------------------------------
// ????????????? ????????... (??? ???????????)
......@@ -959,7 +959,7 @@ xmlNode* Configuration::getXMLServicesSection()
return xmlServicesSec;
}
// -------------------------------------------------------------------------
void uniset_init( int argc, char* argv[], const std::string xmlfile )
void uniset_init( int argc, const char** argv, const std::string xmlfile )
{
string confile = UniSetTypes::getArgParam( "--confile", argc, argv, xmlfile );
UniSetTypes::conf = new Configuration(argc, argv, confile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment