Commit 3f788adc authored by Pavel Vainerman's avatar Pavel Vainerman

getInfo(): long userparam --> string userparam

parent 75cf7f1a
......@@ -58,7 +58,7 @@
* \todo Подумать насчет применения итератора, при слишком
* большом( >1000 ) количестве подчиненных объектов...
*/
uniset::SimpleInfoSeq getObjectsInfo( in long MaxLength, in long userparam );
uniset::SimpleInfoSeq getObjectsInfo( in long MaxLength, in string userparam );
};
//}; // end of module UniSet
......
......@@ -39,15 +39,15 @@
uniset::ObjectId getId(); /*!< получение идентификатора объекта */
uniset::ObjectType getType(); /*!< получение типа объекта */
/*! получение информации о внутреннем состоянии объекта
/*! получение информации от объекта
\param userparam - Необязательный пользовательский параметр
*/
uniset::SimpleInfo getInfo( in long userparam );
uniset::SimpleInfo getInfo( in string userparam );
boolean exist(); /*!< проверка существования объекта */
/*! Функция посылки сообщения объекту */
void push(in uniset::TransportMessage msg);
void push( in uniset::TransportMessage msg );
};
//}; // end of module UniSet
......
......@@ -57,6 +57,7 @@ HTTP API:
- список объектов возвращать с их типом (чтобы можно было SM вычислять)
= Сделать возможность настраивать параметры httpserver-а из командной строки (количество потоков и т.п.)
- ТЕСТЫ (как вариант поизучать про тестовые фреймворки на питоне (pytest?)
- /sensors/XXX?config=name,textname,... - запрос полей (из configure.xml)
Version 2.5
......
......@@ -72,7 +72,7 @@ int getRawValue( const string& args, UInterface& ui );
int getChangedTime( const string& args, UInterface& ui );
int getState( const string& args, UInterface& ui );
int getCalibrate( const string& args, UInterface& ui );
int oinfo(const string& args, UInterface& ui , int userparam );
int oinfo(const string& args, UInterface& ui , const string& userparam );
// --------------------------------------------------------------------------
static void print_help(int width, const string& cmd, const string& help, const string& tab = " " )
{
......@@ -234,10 +234,10 @@ int main(int argc, char** argv)
UInterface ui(conf);
ui.initBackId(uniset::AdminID);
int userparam = 0;
std::string userparam = {""};
if( optind < argc )
userparam = uni_atoi(argv[optind]);
userparam = argv[optind];
return oinfo(optarg, ui, userparam);
}
......@@ -1003,7 +1003,7 @@ int configure( const string& arg, UInterface& ui )
}
// --------------------------------------------------------------------------------------
int oinfo( const string& args, UInterface& ui, int userparam )
int oinfo(const string& args, UInterface& ui, const string& userparam )
{
auto conf = uniset_conf();
auto sl = uniset::getObjectsList( args, conf );
......@@ -1025,7 +1025,7 @@ int oinfo( const string& args, UInterface& ui, int userparam )
}
else
{
SimpleInfo_var inf = obj->getInfo(userparam);
SimpleInfo_var inf = obj->getInfo(userparam.c_str());
cout << inf->info << endl;
}
}
......
......@@ -173,7 +173,7 @@
void askSensor( uniset::ObjectId sid, UniversalIO::UIOCommand, uniset::ObjectId node = uniset::uniset_conf()->getLocalNode() );
void updateValues();
virtual uniset::SimpleInfo* getInfo( CORBA::Long userparam = 0 ) override;
virtual uniset::SimpleInfo* getInfo( const char* userparam = 0 ) override;
virtual bool setMsg( uniset::ObjectId code, bool state = true ) noexcept;
......@@ -561,7 +561,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::preSysCommand( const SystemMessage*
}
// -----------------------------------------------------------------------------
uniset::SimpleInfo* <xsl:value-of select="$CLASSNAME"/>_SK::getInfo( CORBA::Long userparam )
uniset::SimpleInfo* <xsl:value-of select="$CLASSNAME"/>_SK::getInfo( const char* userparam )
{
<xsl:if test="not(normalize-space($BASECLASS)='')">uniset::SimpleInfo_var i = <xsl:value-of select="$BASECLASS"/>::getInfo(userparam);</xsl:if>
<xsl:if test="normalize-space($BASECLASS)=''">uniset::SimpleInfo_var i = UniSetObject::getInfo(userparam);</xsl:if>
......
......@@ -3286,7 +3286,7 @@ std::ostream& operator<<( std::ostream& os, const MBExchange::ExchangeMode& em )
return os;
}
// -----------------------------------------------------------------------------
uniset::SimpleInfo* MBExchange::getInfo( CORBA::Long userparam )
uniset::SimpleInfo* MBExchange::getInfo( const char* userparam )
{
uniset::SimpleInfo_var i = UniSetObject::getInfo(userparam);
......
......@@ -252,7 +252,7 @@ class MBExchange:
return mblog;
}
virtual uniset::SimpleInfo* getInfo( CORBA::Long userparam = 0 ) override;
virtual uniset::SimpleInfo* getInfo( const char* userparam = 0 ) override;
protected:
virtual void step();
......
......@@ -258,7 +258,7 @@ std::shared_ptr<MBTCPMaster> MBTCPMaster::init_mbmaster(int argc, const char* co
return make_shared<MBTCPMaster>(ID, icID, ic, prefix);
}
// -----------------------------------------------------------------------------
uniset::SimpleInfo* MBTCPMaster::getInfo( CORBA::Long userparam )
uniset::SimpleInfo* MBTCPMaster::getInfo( const char* userparam )
{
uniset::SimpleInfo_var i = MBExchange::getInfo(userparam);
......
......@@ -234,7 +234,7 @@ class MBTCPMaster:
/*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv );
virtual uniset::SimpleInfo* getInfo( CORBA::Long userparam = 0 ) override;
virtual uniset::SimpleInfo* getInfo( const char* userparam = 0 ) override;
protected:
virtual void sysCommand( const uniset::SystemMessage* sm ) override;
......
......@@ -761,7 +761,7 @@ const std::string MBTCPMultiMaster::MBSlaveInfo::getShortInfo() const
return std::move(s.str());
}
// -----------------------------------------------------------------------------
uniset::SimpleInfo* MBTCPMultiMaster::getInfo( CORBA::Long userparam )
uniset::SimpleInfo* MBTCPMultiMaster::getInfo( const char* userparam )
{
uniset::SimpleInfo_var i = MBExchange::getInfo(userparam);
......
......@@ -298,7 +298,7 @@ class MBTCPMultiMaster:
/*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv );
virtual uniset::SimpleInfo* getInfo( CORBA::Long userparam = 0 ) override;
virtual uniset::SimpleInfo* getInfo( const char* userparam = 0 ) override;
protected:
virtual void sysCommand( const uniset::SystemMessage* sm ) override;
......
......@@ -2593,7 +2593,7 @@ const std::string MBSlave::ClientInfo::getShortInfo() const
return std::move(s.str());
}
// -------------------------------------------------------------------------
uniset::SimpleInfo* MBSlave::getInfo( CORBA::Long userparam )
uniset::SimpleInfo* MBSlave::getInfo( const char* userparam )
{
uniset::SimpleInfo_var i = UniSetObject::getInfo(userparam);
......
......@@ -386,7 +386,7 @@ class MBSlave:
return mblog;
}
virtual uniset::SimpleInfo* getInfo( CORBA::Long userparam = 0 ) override;
virtual uniset::SimpleInfo* getInfo( const char* userparam = 0 ) override;
protected:
......
......@@ -998,7 +998,7 @@ bool SharedMemory::initFromSM( uniset::ObjectId sm_id, uniset::ObjectId sm_node
return false;
}
// ----------------------------------------------------------------------------
uniset::SimpleInfo* SharedMemory::getInfo( CORBA::Long userparam )
uniset::SimpleInfo* SharedMemory::getInfo( const char* userparam )
{
uniset::SimpleInfo_var i = IONotifyController::getInfo(userparam);
......
......@@ -337,7 +337,7 @@ class SharedMemory:
// чтобы понять, когда можно получать от SM данные.
virtual CORBA::Boolean exist() override;
virtual uniset::SimpleInfo* getInfo( CORBA::Long userparam = 0 ) override;
virtual uniset::SimpleInfo* getInfo( const char* userparam = 0 ) override;
void addReadItem( Restorer_XML::ReaderSlot sl );
......
......@@ -946,7 +946,7 @@ void UNetExchange::receiverEvent( const shared_ptr<UNetReceiver>& r, UNetReceive
}
}
// -----------------------------------------------------------------------------
uniset::SimpleInfo* UNetExchange::getInfo( CORBA::Long userparam )
uniset::SimpleInfo* UNetExchange::getInfo( const char* userparam )
{
uniset::SimpleInfo_var i = UniSetObject::getInfo(userparam);
......
......@@ -147,7 +147,7 @@ class UNetExchange:
return unetlog;
}
virtual uniset::SimpleInfo* getInfo( CORBA::Long userparam = 0 ) override;
virtual uniset::SimpleInfo* getInfo( const char* userparam = 0 ) override;
protected:
......
......@@ -8,7 +8,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
// --------------------------------------------------------------------------
// generate timestamp: 2016-11-19+03:00
// generate timestamp: 2016-11-23+03:00
// -----------------------------------------------------------------------------
#ifndef UObject_SK_H_
#define UObject_SK_H_
......@@ -39,7 +39,7 @@ class UObject_SK:
void askSensor( uniset::ObjectId sid, UniversalIO::UIOCommand, uniset::ObjectId node = uniset::uniset_conf()->getLocalNode() );
void updateValues();
virtual uniset::SimpleInfo* getInfo( CORBA::Long userparam = 0 ) override;
virtual uniset::SimpleInfo* getInfo( const char* userparam = 0 ) override;
virtual bool setMsg( uniset::ObjectId code, bool state = true ) noexcept;
......
......@@ -11,7 +11,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
// --------------------------------------------------------------------------
// generate timestamp: 2016-11-19+03:00
// generate timestamp: 2016-11-23+03:00
// -----------------------------------------------------------------------------
#include <memory>
#include <iomanip>
......@@ -501,7 +501,7 @@ void UObject_SK::preSysCommand( const SystemMessage* _sm )
}
// -----------------------------------------------------------------------------
uniset::SimpleInfo* UObject_SK::getInfo( CORBA::Long userparam )
uniset::SimpleInfo* UObject_SK::getInfo( const char* userparam )
{
uniset::SimpleInfo_var i = UniSetObject::getInfo(userparam);
......
......@@ -49,7 +49,7 @@ class IOController:
return uniset::ObjectType("IOController");
}
virtual uniset::SimpleInfo* getInfo( ::CORBA::Long userparam = 0 ) override;
virtual uniset::SimpleInfo* getInfo( const char* userparam = 0 ) override;
virtual CORBA::Long getValue( uniset::ObjectId sid ) override;
......
......@@ -144,7 +144,7 @@ class IONotifyController:
return uniset::ObjectType("IONotifyController");
}
virtual uniset::SimpleInfo* getInfo( ::CORBA::Long userparam = 0 ) override;
virtual uniset::SimpleInfo* getInfo( const char* userparam = 0 ) override;
virtual void askSensor(const uniset::ObjectId sid, const uniset::ConsumerInfo& ci, UniversalIO::UIOCommand cmd) override;
......
......@@ -72,7 +72,7 @@ class UniSetManager:
// ------ функции объявленные в интерфейсе(IDL) ------
virtual void broadcast( const uniset::TransportMessage& msg) override;
virtual uniset::SimpleInfoSeq* getObjectsInfo( CORBA::Long MaxLength = 300, CORBA::Long userparam = 0 ) override ;
virtual uniset::SimpleInfoSeq* getObjectsInfo( CORBA::Long MaxLength = 300, const char* userparam = 0 ) override ;
// --------------------------
virtual bool add( const std::shared_ptr<UniSetObject>& obj );
......@@ -139,7 +139,7 @@ class UniSetManager:
typedef UniSetManagerList::iterator MListIterator;
int getObjectsInfo(const std::shared_ptr<UniSetManager>& mngr, uniset::SimpleInfoSeq* seq,
int begin, const long uplimit, CORBA::Long userparam );
int begin, const long uplimit, const char* userparam );
PortableServer::POA_var poa;
PortableServer::POAManager_var pman;
......
......@@ -99,7 +99,7 @@ class UniSetObject:
return uniset::ObjectType("UniSetObject");
}
virtual uniset::SimpleInfo* getInfo( ::CORBA::Long userparam = 0 ) override;
virtual uniset::SimpleInfo* getInfo( const char* userparam = 0 ) override;
//! поместить сообщение в очередь
virtual void push( const uniset::TransportMessage& msg ) override;
......
......@@ -594,7 +594,7 @@ const std::shared_ptr<UniSetObject> UniSetManager::itemO( const ObjectId id )
// ------------------------------------------------------------------------------------------
int UniSetManager::getObjectsInfo( const std::shared_ptr<UniSetManager>& mngr, SimpleInfoSeq* seq,
int begin, const long uplimit, CORBA::Long userparam )
int begin, const long uplimit, const char* userparam )
{
auto ind = begin;
......@@ -645,7 +645,7 @@ int UniSetManager::getObjectsInfo( const std::shared_ptr<UniSetManager>& mngr, S
}
// ------------------------------------------------------------------------------------------
SimpleInfoSeq* UniSetManager::getObjectsInfo(CORBA::Long maxlength , CORBA::Long userparam )
SimpleInfoSeq* UniSetManager::getObjectsInfo(CORBA::Long maxlength, const char* userparam )
{
SimpleInfoSeq* res = new SimpleInfoSeq(); // ЗА ОСВОБОЖДЕНИЕ ПАМЯТИ ОТВЕЧАЕТ КЛИЕНТ!!!!!!
// поэтому ему лучше пользоваться при получении _var-классом
......
......@@ -744,7 +744,7 @@ timeout_t UniSetObject::askTimer( TimerId timerid, timeout_t timeMS, clock_t tic
}
// ------------------------------------------------------------------------------------------
uniset::SimpleInfo* UniSetObject::getInfo( ::CORBA::Long userparam )
uniset::SimpleInfo* UniSetObject::getInfo( const char* userparam )
{
ostringstream info;
info.setf(ios::left, ios::adjustfield);
......
......@@ -828,7 +828,7 @@ void IOController::USensorInfo::checkDepend( std::shared_ptr<USensorInfo>& d_it,
ic->localSetValue( d_usi, real_value, sup_id );
}
// -----------------------------------------------------------------------------
uniset::SimpleInfo* IOController::getInfo( ::CORBA::Long userparam )
uniset::SimpleInfo* IOController::getInfo( const char* userparam )
{
uniset::SimpleInfo_var i = UniSetManager::getInfo();
......
......@@ -76,7 +76,7 @@ IONotifyController::~IONotifyController()
conInit.disconnect();
}
// ------------------------------------------------------------------------------------------
SimpleInfo* IONotifyController::getInfo( ::CORBA::Long userparam )
SimpleInfo* IONotifyController::getInfo( const char* userparam )
{
uniset::SimpleInfo_var i = IOController::getInfo();
......@@ -102,7 +102,9 @@ SimpleInfo* IONotifyController::getInfo( ::CORBA::Long userparam )
inf << "----------------------------------------------------------------------------------" << endl;
}
if( userparam == 1 || userparam == 2 )
const std::string param(userparam);
if( param == "1" || param == "2" )
{
inf << "------------------------------- consumers list ------------------------------" << endl;
inf << "[userparam=" << userparam << "]" << endl;
......@@ -123,7 +125,7 @@ SimpleInfo* IONotifyController::getInfo( ::CORBA::Long userparam )
// Т.к. сперва выводится имя датчика, а только потом его заказчики
// то если надо выводить только тех, у кого есть "потери"(lostEvent>0)
// предварительно смотрим список есть ли там хоть один с "потерями", а потом уже выводим
if( userparam == 2 )
if( param == "2" )
{
bool lost = false;
......
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