Commit 4e1bea37 authored by Pavel Vaynerman's avatar Pavel Vaynerman

Merge branch 'master' of git.eter:/projects/uniset

parents ee470b31 8936f108
...@@ -41,7 +41,7 @@ static struct option longopts[] = { ...@@ -41,7 +41,7 @@ static struct option longopts[] = {
{ "confile", required_argument, 0, 'c' }, { "confile", required_argument, 0, 'c' },
{ "create", no_argument, 0, 'b' }, { "create", no_argument, 0, 'b' },
{ "exist", no_argument, 0, 'e' }, { "exist", no_argument, 0, 'e' },
{ "omap", no_argument, 0, 'o' }, { "omap", no_argument, 0, 'o' },
{ "msgmap", no_argument, 0, 'm' }, { "msgmap", no_argument, 0, 'm' },
{ "start", no_argument, 0, 's' }, { "start", no_argument, 0, 's' },
{ "finish", no_argument, 0, 'f' }, { "finish", no_argument, 0, 'f' },
...@@ -58,9 +58,9 @@ static struct option longopts[] = { ...@@ -58,9 +58,9 @@ static struct option longopts[] = {
{ "setState", required_argument, 0, 'j' }, { "setState", required_argument, 0, 'j' },
{ "getValue", required_argument, 0, 'g' }, { "getValue", required_argument, 0, 'g' },
{ "getState", required_argument, 0, 'k' }, { "getState", required_argument, 0, 'k' },
{ "getRawValue", required_argument, 0, 'w' }, { "getRawValue", required_argument, 0, 'w' },
{ "getCalibrate", required_argument, 0, 'y' }, { "getCalibrate", required_argument, 0, 'y' },
{ "oinfo", required_argument, 0, 'p' }, { "oinfo", required_argument, 0, 'p' },
{ NULL, 0, 0, 0 } { NULL, 0, 0, 0 }
}; };
...@@ -69,10 +69,10 @@ string conffile("configure.xml"); ...@@ -69,10 +69,10 @@ string conffile("configure.xml");
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
static bool commandToAll(const string section, ObjectRepository *rep, Command cmd); static bool commandToAll(const string section, ObjectRepository *rep, Command cmd);
static void createSections(UniSetTypes::Configuration* c); static void createSections(UniSetTypes::Configuration* c);
bool separateArgs(string &args, string &arg); static bool separateArgs(string &args, string &arg);
//static bool getID( const string arg, ObjectId id, ObjectId node );
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
int omap(); int omap();
int msgmap(); int msgmap();
int configure( string args, UniversalInterface &ui ); int configure( string args, UniversalInterface &ui );
int logRotate( string args, UniversalInterface &ui ); int logRotate( string args, UniversalInterface &ui );
...@@ -88,7 +88,7 @@ int getValue( string args, UniversalInterface &ui ); ...@@ -88,7 +88,7 @@ int getValue( string args, UniversalInterface &ui );
int getRawValue( string args, UniversalInterface &ui ); int getRawValue( string args, UniversalInterface &ui );
int getState( string args, UniversalInterface &ui ); int getState( string args, UniversalInterface &ui );
int getCalibrate( string args, UniversalInterface &ui ); int getCalibrate( string args, UniversalInterface &ui );
int oinfo( string args, UniversalInterface &ui ); int oinfo( string args, UniversalInterface &ui );
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
static void print_help(int width, const string cmd, const string help, const string tab=" " ) static void print_help(int width, const string cmd, const string help, const string tab=" " )
...@@ -331,7 +331,7 @@ int main(int argc, char** argv) ...@@ -331,7 +331,7 @@ int main(int argc, char** argv)
uniset_init(argc,argv,conffile); uniset_init(argc,argv,conffile);
UniversalInterface ui(conf); UniversalInterface ui(conf);
Command cmd=StartUp; Command cmd=StartUp;
ObjectRepository* rep = new ObjectRepository(conf); ObjectRepository* rep = new ObjectRepository(conf);
commandToAll(conf->getServicesSection(), rep, (Command)cmd); commandToAll(conf->getServicesSection(), rep, (Command)cmd);
commandToAll(conf->getControllersSection(), rep, (Command)cmd); commandToAll(conf->getControllersSection(), rep, (Command)cmd);
...@@ -369,7 +369,7 @@ int main(int argc, char** argv) ...@@ -369,7 +369,7 @@ int main(int argc, char** argv)
commandToAll(conf->getControllersSection(), rep, (Command)cmd); commandToAll(conf->getControllersSection(), rep, (Command)cmd);
commandToAll(conf->getObjectsSection(), rep, (Command)cmd); commandToAll(conf->getObjectsSection(), rep, (Command)cmd);
delete rep; delete rep;
cout<<"(finish): done"<<endl; cout<<"(finish): done"<<endl;
} }
return 0; return 0;
...@@ -410,7 +410,7 @@ int main(int argc, char** argv) ...@@ -410,7 +410,7 @@ int main(int argc, char** argv)
commandToAll(conf->getControllersSection(), rep, (Command)cmd); commandToAll(conf->getControllersSection(), rep, (Command)cmd);
commandToAll(conf->getObjectsSection(), rep, (Command)cmd); commandToAll(conf->getObjectsSection(), rep, (Command)cmd);
delete rep; delete rep;
// cout<<"(foldUp): done"<<endl; // cout<<"(foldUp): done"<<endl;
} }
return 0; return 0;
...@@ -591,7 +591,7 @@ bool separateArgs(string &args,string &arg) ...@@ -591,7 +591,7 @@ bool separateArgs(string &args,string &arg)
if (args==arg) if (args==arg)
args=""; args="";
return true; return true;
} }
// ============================================================================================== // ==============================================================================================
...@@ -642,7 +642,7 @@ int alarm(string args, UniversalInterface &ui) ...@@ -642,7 +642,7 @@ int alarm(string args, UniversalInterface &ui)
UniSetTypes::DefaultObjectId, conf->getLocalNode()); UniSetTypes::DefaultObjectId, conf->getLocalNode());
TransportMessage tm(am.transport_msg()); TransportMessage tm(am.transport_msg());
cout << "Administrator Alarm: " << endl; cout << "Administrator Alarm: " << endl;
ui.send(conf->getInfoServer(), tm); ui.send(conf->getInfoServer(), tm);
return 0; return 0;
} }
...@@ -672,13 +672,13 @@ int alarm(string args, UniversalInterface &ui) ...@@ -672,13 +672,13 @@ int alarm(string args, UniversalInterface &ui)
{ {
cerr<<"(alarm): ch is not specified ! \n"; cerr<<"(alarm): ch is not specified ! \n";
unideb[Debug::WARN] << "ch is not specified ! \n"; unideb[Debug::WARN] << "ch is not specified ! \n";
return 1; return 1;
} }
switch(chid) switch(chid)
{ {
case 1: case 1:
ch = AlarmMessage::Normal; ch = AlarmMessage::Normal;
break; break;
case 2: case 2:
...@@ -741,7 +741,7 @@ int info(string arg, UniversalInterface &ui) ...@@ -741,7 +741,7 @@ int info(string arg, UniversalInterface &ui)
cout << "info: (" << code << ") "; cout << "info: (" << code << ") ";
cout << conf->mi->getMessage(code); cout << conf->mi->getMessage(code);
ui.send(conf->getInfoServer(), tm); ui.send(conf->getInfoServer(), tm);
cout << "send info OK" << endl; cout << "send info OK" << endl;
return 0; return 0;
} }
...@@ -802,7 +802,7 @@ int dnotify(string args, UniversalInterface &ui) ...@@ -802,7 +802,7 @@ int dnotify(string args, UniversalInterface &ui)
cout << ": " << conf->oind->getMapName(id) << "\n\n"; cout << ": " << conf->oind->getMapName(id) << "\n\n";
SensorMessage sm(sid,(bool)val); SensorMessage sm(sid,(bool)val);
sm.consumer = id; sm.consumer = id;
TransportMessage tm(sm.transport_msg()); TransportMessage tm(sm.transport_msg());
ui.send(id,tm); ui.send(id,tm);
...@@ -815,7 +815,8 @@ int saveValue(string args, UniversalInterface &ui) ...@@ -815,7 +815,8 @@ int saveValue(string args, UniversalInterface &ui)
int err; int err;
err=0; err=0;
string arg; string arg;
UniSetTypes::ObjectId sid(DefaultObjectId); UniSetTypes::ObjectId sid = DefaultObjectId;
UniSetTypes::ObjectId node = DefaultObjectId;
long val; long val;
cout << "====== saveValue ======" << endl; cout << "====== saveValue ======" << endl;
...@@ -823,7 +824,7 @@ int saveValue(string args, UniversalInterface &ui) ...@@ -823,7 +824,7 @@ int saveValue(string args, UniversalInterface &ui)
{ {
if( isdigit( arg[0] ) ) if( isdigit( arg[0] ) )
{ {
if( sscanf( arg.c_str(),"%ld=%ld",&sid,&val ) < 2 ) if( sscanf( arg.c_str(),"%ld:%ld=%ld",&sid,&node,&val ) < 2 )
{ {
cout << i <<"\t------------------------"<< endl; cout << i <<"\t------------------------"<< endl;
cerr << "!!!!!!!!! SensorId=Value #"<<i<<" '"<<arg<<"' !!!!!!\n"<< endl; cerr << "!!!!!!!!! SensorId=Value #"<<i<<" '"<<arg<<"' !!!!!!\n"<< endl;
...@@ -848,14 +849,17 @@ int saveValue(string args, UniversalInterface &ui) ...@@ -848,14 +849,17 @@ int saveValue(string args, UniversalInterface &ui)
continue; continue;
} }
} }
cout << i <<"\t------------------------"<< endl; cout << i <<"\t------------------------"<< endl;
try try
{ {
// cout <<"\n\t"<<sid<<"\t"<<val<<endl; // cout <<"\n\t"<<sid<<"\t"<<val<<endl;
cout << " value: " << val << endl; cout << " value: " << val << endl;
cout << " name: (" << sid << ") " << conf->oind->getMapName(sid) << endl; cout << " name: (" << sid << ") " << conf->oind->getMapName(sid) << endl;
cout << " text: " << conf->oind->getTextName(sid) << "\n\n"; cout << " text: " << conf->oind->getTextName(sid) << "\n\n";
ui.saveValue(sid,val,UniversalIO::AnalogInput); if( node == DefaultObjectId )
node = conf->getLocalNode();
ui.saveValue(sid,val,UniversalIO::AnalogInput,node);
} }
catch(Exception& ex) catch(Exception& ex)
{ {
...@@ -1319,3 +1323,32 @@ int oinfo(string arg, UniversalInterface &ui ) ...@@ -1319,3 +1323,32 @@ int oinfo(string arg, UniversalInterface &ui )
} }
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
/*
bool getID( const string arg, ObjectId id, ObjectId node )
{
if( isdigit( arg[0] ) )
{
if( sscanf( arg.c_str(),"%ld",&id ) < 1 )
{
cout << i <<"\t------------------------"<< endl;
cerr << "!!!!!!!! SensorID #"<<i<<" '"<<arg<<"' !!!!!!!\n"<< endl;
err = 1;
vout<<"| "<<arg<<"\t| ?\t| SensorID !!!\n-----------------\n";
continue;
}
}
string::size_type pos = arg.find_first_of(":");
if( pos == string::npos )
{
id = uni_atoi(arg);
return true;
}
id = uni_atoi(name.substr(0,pos-1));
node = uni_atoi( name.substr(pos+1,name.size()) );
return true;
}
*/
// --------------------------------------------------------------------------------------
...@@ -30,7 +30,10 @@ libUniSetIOControl_la_SOURCES = ComediInterface.cc IOControl.cc ...@@ -30,7 +30,10 @@ libUniSetIOControl_la_SOURCES = ComediInterface.cc IOControl.cc
# install # install
devel_include_HEADERS = *.h devel_include_HEADERS = *.h
devel_includedir = $(includedir)/@PACKAGE@/extensions devel_includedir = $(pkgincludedir)/extensions
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libUniSetIOControl.pc pkgconfig_DATA = libUniSetIOControl.pc
all-local:
ln -sf ../IOControl/$(devel_include_HEADERS) ../include
...@@ -28,7 +28,10 @@ bin_PROGRAMS = @PACKAGE@-logicproc @PACKAGE@-plogicproc ...@@ -28,7 +28,10 @@ bin_PROGRAMS = @PACKAGE@-logicproc @PACKAGE@-plogicproc
# install # install
devel_include_HEADERS = *.h devel_include_HEADERS = *.h
devel_includedir = $(includedir)/@PACKAGE@/extensions devel_includedir = $(pkgincludedir)/extensions
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libUniSetLogicProcessor.pc pkgconfig_DATA = libUniSetLogicProcessor.pc
all-local:
ln -sf ../LogicProcessor/$(devel_include_HEADERS) ../include
...@@ -17,7 +17,10 @@ libUniSetMBTCPMaster_la_SOURCES = MBMaster.cc ...@@ -17,7 +17,10 @@ libUniSetMBTCPMaster_la_SOURCES = MBMaster.cc
# install # install
devel_include_HEADERS = *.h devel_include_HEADERS = *.h
devel_includedir = $(includedir)/@PACKAGE@/extensions devel_includedir = $(pkgincludedir)/extensions
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libUniSetMBTCPMaster.pc pkgconfig_DATA = libUniSetMBTCPMaster.pc
all-local:
ln -sf ../MBTCPMaster/$(devel_include_HEADERS) ../include
...@@ -17,7 +17,10 @@ libUniSetMBSlave_la_SOURCES = MBSlave.cc ...@@ -17,7 +17,10 @@ libUniSetMBSlave_la_SOURCES = MBSlave.cc
# install # install
devel_include_HEADERS = *.h devel_include_HEADERS = *.h
devel_includedir = $(includedir)/@PACKAGE@/extensions devel_includedir = $(pkgincludedir)/extensions
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libUniSetMBSlave.pc pkgconfig_DATA = libUniSetMBSlave.pc
all-local:
ln -sf ../ModbusSlave/$(devel_include_HEADERS) ../include
...@@ -29,7 +29,10 @@ rtustate_SOURCES = rtustate.cc ...@@ -29,7 +29,10 @@ rtustate_SOURCES = rtustate.cc
# install # install
devel_include_HEADERS = *.h devel_include_HEADERS = *.h
devel_includedir = $(includedir)/@PACKAGE@/extensions devel_includedir = $(pkgincludedir)/extensions
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libUniSetRTU.pc pkgconfig_DATA = libUniSetRTU.pc
all-local:
ln -sf ../RTUExchange/$(devel_include_HEADERS) ../include
...@@ -14,7 +14,10 @@ include $(top_builddir)/conf/setting.mk ...@@ -14,7 +14,10 @@ include $(top_builddir)/conf/setting.mk
# install # install
devel_include_HEADERS = *.h devel_include_HEADERS = *.h
devel_includedir = $(includedir)/@PACKAGE@/extensions devel_includedir = $(pkgincludedir)/extensions
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libUniSetSharedMemory.pc pkgconfig_DATA = libUniSetSharedMemory.pc
all-local:
ln -sf ../SharedMemory/$(devel_include_HEADERS) ../include
...@@ -18,7 +18,10 @@ libUniSetUDP_la_SOURCES = UDPPacket.cc UDPExchange.cc ...@@ -18,7 +18,10 @@ libUniSetUDP_la_SOURCES = UDPPacket.cc UDPExchange.cc
# install # install
devel_include_HEADERS = *.h devel_include_HEADERS = *.h
devel_includedir = $(includedir)/@PACKAGE@/extensions devel_includedir = $(pkgincludedir)/extensions
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libUniSetUDP.pc pkgconfig_DATA = libUniSetUDP.pc
all-local:
ln -sf ../UDPExchange/$(devel_include_HEADERS) ../include
...@@ -8,7 +8,7 @@ include $(top_builddir)/conf/common.mk ...@@ -8,7 +8,7 @@ include $(top_builddir)/conf/common.mk
# install # install
devel_include_HEADERS = *.h *.hh devel_include_HEADERS = *.h *.hh
devel_includedir = $(includedir)/@PACKAGE@ devel_includedir = $(pkgincludedir)
all-local: all-local:
test -L extensions || ln -s ../extensions/include extensions test -L extensions || ln -s ../extensions/include extensions
...@@ -81,6 +81,8 @@ public: ...@@ -81,6 +81,8 @@ public:
// name node // name node
static std::string getProp(xmlNode* node, const std::string name); static std::string getProp(xmlNode* node, const std::string name);
static int getIntProp(xmlNode* node, const std::string name); static int getIntProp(xmlNode* node, const std::string name);
/// if value if not positive ( <= 0 ), returns def
static int getPIntProp(xmlNode* node, const std::string name, int def);
// name node // name node
static void setProp(xmlNode* node, const std::string name, const std::string text); static void setProp(xmlNode* node, const std::string name, const std::string text);
...@@ -126,6 +128,8 @@ class UniXML_iterator ...@@ -126,6 +128,8 @@ class UniXML_iterator
std::string getProp(const std::string name); std::string getProp(const std::string name);
int getIntProp(const std::string name); int getIntProp(const std::string name);
/// if value if not positive ( <= 0 ), returns def
int getPIntProp(const std::string name, int def);
void setProp(const std::string name, const std::string text); void setProp(const std::string name, const std::string text);
/*! . false, */ /*! . false, */
......
...@@ -33,7 +33,7 @@ cflags() ...@@ -33,7 +33,7 @@ cflags()
libs() libs()
{ {
echo -n "-L$EXPORTPATH/lib " echo -n "-L$EXPORTPATH/lib "
pkg-config --libs $1 | sed -e "s|-L$prefix ||g" pkg-config --libs $1 | sed -e "s|-L$prefix | |g"
} }
export UNISET_CFLAGS="$( cflags $PCFILE )" export UNISET_CFLAGS="$( cflags $PCFILE )"
...@@ -43,19 +43,19 @@ export UNISET_LIBS="$( libs $PCFILE )" ...@@ -43,19 +43,19 @@ export UNISET_LIBS="$( libs $PCFILE )"
ext_cflags() ext_cflags()
{ {
# FIXME: really use extensions/ # FIXME: really use extensions/
echo -n "-I$1" echo -n "-I$1 "
cflags $1/$2 cflags $1/$2
} }
ext_libs() ext_libs()
{ {
echo -n "-L$1" echo -n "-L$1 "
libs $1/$2 libs $1/$2
} }
EXFILE="$EXPORTPATH/extensions libUniSetExtensions.pc" EXFILE="$EXPORTPATH/extensions libUniSetExtensions.pc"
export UNISET_EXT_CFLAGS="-I$EXPORTPATH/extensions/include $( ext_cflags $EXFILE )" export UNISET_EXT_CFLAGS="-I$EXPORTPATH/extensions/include $( ext_cflags $EXFILE )"
export UNISET_EXT_LIBS="$( ext_libs $EXFILE )" export UNISET_EXT_LIBS="-L$EXPORTPATH/extensions/lib $( ext_libs $EXFILE )"
EXFILE="$EXPORTPATH/extensions/IOControl libUniSetIOControl.pc" EXFILE="$EXPORTPATH/extensions/IOControl libUniSetIOControl.pc"
export UNISET_EXT_IO_CFLAGS="$( ext_cflags $EXFILE )" export UNISET_EXT_IO_CFLAGS="$( ext_cflags $EXFILE )"
......
...@@ -226,8 +226,8 @@ void Configuration::initConfiguration( int argc, const char* const* argv ) ...@@ -226,8 +226,8 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
} }
try try
{ {
if( unixml.getProp(cnode,"idfromfile").empty() || unixml.getIntProp(cnode,"idfromfile")==0 ) if( unixml.getIntProp(cnode,"idfromfile") == 0 )
oind = new ObjectIndex_XML(unixml); //(fileConfName); oind = new ObjectIndex_XML(unixml); //(fileConfName);
else else
oind = new ObjectIndex_idXML(unixml); //(fileConfName); oind = new ObjectIndex_idXML(unixml); //(fileConfName);
...@@ -247,7 +247,7 @@ void Configuration::initConfiguration( int argc, const char* const* argv ) ...@@ -247,7 +247,7 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
mi = new DefaultMessageInterface(); mi = new DefaultMessageInterface();
else else
{ {
if( unixml.getProp(cnode,"idfromfile").empty() || unixml.getIntProp(cnode,"idfromfile")==0 ) if( unixml.getIntProp(cnode,"idfromfile") == 0 )
mi = new MessageInterface_XML(unixml); // (fileConfName); mi = new MessageInterface_XML(unixml); // (fileConfName);
else else
mi = new MessageInterface_idXML(unixml); // (fileConfName); mi = new MessageInterface_idXML(unixml); // (fileConfName);
...@@ -277,17 +277,17 @@ void Configuration::initConfiguration( int argc, const char* const* argv ) ...@@ -277,17 +277,17 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
initRepSections(); initRepSections();
// localIOR // localIOR
// localIOR = false; // ??. initParameters() // localIOR = false; // ??. initParameters()
string lior( getArgParam("--localIOR") ); int lior = getArgInt("--localIOR");
if( !lior.empty() ) if( lior )
localIOR = uni_atoi(lior); localIOR = lior;
// transientIOR // transientIOR
// transientIOR = false; // ??. initParameters() // transientIOR = false; // ??. initParameters()
string tior( getArgParam("--transientIOR") ); int tior = getArgInt("--transientIOR");
if( !tior.empty() ) if( tior )
transientIOR = uni_atoi(tior); transientIOR = tior;
if( imagesDir[0]!='/' && imagesDir[0]!='.' ) if( imagesDir[0]!='/' && imagesDir[0]!='.' )
imagesDir = dataDir + imagesDir + "/"; imagesDir = dataDir + imagesDir + "/";
......
...@@ -203,6 +203,8 @@ bool CycleStorage::create(const char* name, int inf_sz, int inf_count, int seek) ...@@ -203,6 +203,8 @@ bool CycleStorage::create(const char* name, int inf_sz, int inf_count, int seek)
if(fseek(file,seekpos,0)==-1) return false; if(fseek(file,seekpos,0)==-1) return false;
CycleStorageElem *jrn = (CycleStorageElem*)new char[full_size]; CycleStorageElem *jrn = (CycleStorageElem*)new char[full_size];
for( int i=0; i<full_size; i++ )
*((char*)jrn+i) = 0;
jrn->status=0; jrn->status=0;
/*! */ /*! */
...@@ -232,7 +234,8 @@ bool CycleStorage::addRow(void* str) ...@@ -232,7 +234,8 @@ bool CycleStorage::addRow(void* str)
if(file==NULL) return false; if(file==NULL) return false;
CycleStorageElem *jrn = (CycleStorageElem*)new char[full_size]; CycleStorageElem *jrn = (CycleStorageElem*)new char[full_size];
int i=0; int i=0;
for( i=0; i<full_size; i++ )
*((char*)jrn+i) = 0;
/*! 2 - (head=-1), 1 (head=tail=0) ) /*! 2 - (head=-1), 1 (head=tail=0) )
*/ */
......
...@@ -210,6 +210,9 @@ bool TableBlockStorage::create(const char* name, int key_sz, int inf_sz, int inf ...@@ -210,6 +210,9 @@ bool TableBlockStorage::create(const char* name, int key_sz, int inf_sz, int inf
/*! */ /*! */
mem = (TableBlockStorageElem*) new char[block_size*full_size]; mem = (TableBlockStorageElem*) new char[block_size*full_size];
for( i=0; i<block_size*full_size; i++ )
*((char*)mem+i) = 0;
StorageAttr sa; StorageAttr sa;
sa.k_size=k_size; sa.k_size=k_size;
sa.inf_size=inf_size; sa.inf_size=inf_size;
...@@ -259,7 +262,11 @@ bool TableBlockStorage::addRow(void* key, void* value) ...@@ -259,7 +262,11 @@ bool TableBlockStorage::addRow(void* key, void* value)
/*! , pos>=0, , empty */ /*! , pos>=0, , empty */
if(pos>=0) empty=pos; if(pos>=0) empty=pos;
else memcpy(keyPointer(empty),key,k_size); else
{
if( empty<0 ) return false; /*! false, */
memcpy(keyPointer(empty),key,k_size);
}
elemPointer(empty)->count=++max; elemPointer(empty)->count=++max;
memcpy(valPointer(empty),value,inf_size); memcpy(valPointer(empty),value,inf_size);
......
...@@ -213,6 +213,14 @@ int UniXML::getIntProp(xmlNode* node, const string name ) ...@@ -213,6 +213,14 @@ int UniXML::getIntProp(xmlNode* node, const string name )
return UniSetTypes::uni_atoi((const char*)::xmlGetProp(node, (const xmlChar*)name.c_str())); return UniSetTypes::uni_atoi((const char*)::xmlGetProp(node, (const xmlChar*)name.c_str()));
} }
int UniXML::getPIntProp(xmlNode* node, const string name, int def )
{
int i = getIntProp(node, name);
if (i <= 0)
return def;
return i;
}
void UniXML::setProp(xmlNode* node, string name, string text) void UniXML::setProp(xmlNode* node, string name, string text)
{ {
xmlSetProp(node, (const xmlChar*)name.c_str(), local2xml(text)); xmlSetProp(node, (const xmlChar*)name.c_str(), local2xml(text));
...@@ -448,6 +456,15 @@ int UniXML_iterator::getIntProp( const string name ) ...@@ -448,6 +456,15 @@ int UniXML_iterator::getIntProp( const string name )
{ {
return UniSetTypes::uni_atoi((char*)::xmlGetProp(curNode, (const xmlChar*)name.c_str())); return UniSetTypes::uni_atoi((char*)::xmlGetProp(curNode, (const xmlChar*)name.c_str()));
} }
int UniXML_iterator::getPIntProp( const string name, int def )
{
int i = getIntProp(name);
if (i <= 0)
return def;
return i;
}
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
void UniXML_iterator::setProp( const string name, const string text ) void UniXML_iterator::setProp( const string name, const string text )
{ {
......
...@@ -21,6 +21,17 @@ int main() ...@@ -21,6 +21,17 @@ int main()
return 1; return 1;
} }
PassiveTimer pt3(UniSetTimer::WaitUpTime);
cout << "pt3.getCurrent(): " << pt3.getCurrent() << endl;
msleep(3000);
int pt3_ms = pt3.getCurrent();
cout << "pt3.getCurrent(): " << pt3_ms << endl;
if( pt3_ms < 3000 )
{
cerr << "BAD getCurrent() function for WaitUpTime timer (pt3)" << endl;
return 1;
}
while(1) while(1)
{ {
......
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