Commit 6f8dfd03 authored by Pavel Vainerman's avatar Pavel Vainerman

Убрал лишние вызовы std::move() которые препятсвуют исползованию

компилятором оптимизации RVO
parent e201a96a
......@@ -250,7 +250,7 @@
std::string strval( uniset::ObjectId id, bool showLinkName=true ) const;
/*! Вывод состояния внутренних переменных */
inline std::string dumpVars(){ return std::move(vmon.pretty_str()); }
inline std::string dumpVars(){ return vmon.pretty_str(); }
// ------------------------------------------------------------
std::string help() noexcept;
......@@ -878,7 +878,7 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::help() noexcept
s &lt;&lt; " ****************************************************************************************** " &lt;&lt; endl;
return std::move(s.str());
return s.str();
}
// ----------------------------------------------------------------------------
</xsl:template>
......@@ -1529,7 +1529,7 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::dumpIO()
s &lt;&lt; std::endl;
}
return std::move(s.str());
return s.str();
}
// ----------------------------------------------------------------------------
std::string <xsl:value-of select="$CLASSNAME"/>_SK::str( uniset::ObjectId id, bool showLinkName ) const
......@@ -1540,7 +1540,7 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::str( uniset::ObjectId id, b
{
s &lt;&lt; "<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>";
if( showLinkName ) s &lt;&lt; "(" &lt;&lt; ORepHelpers::getShortName( uniset_conf()->oind->getMapName(<xsl:value-of select="@name"/>)) &lt;&lt; ")";
return std::move(s.str());
return s.str();
}
</xsl:for-each>
return "";
......@@ -1556,7 +1556,7 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::strval( uniset::ObjectId id
s &lt;&lt; "<xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>";
if( showLinkName ) s &lt;&lt; "(" &lt;&lt; ORepHelpers::getShortName( uniset_conf()->oind->getMapName(<xsl:value-of select="@name"/>)) &lt;&lt; ")";
s &lt;&lt; "=" &lt;&lt; <xsl:call-template name="setprefix"/><xsl:value-of select="@name"/>;
return std::move(s.str());
return s.str();
}
</xsl:for-each>
return "";
......@@ -1898,7 +1898,7 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::dumpIO()
s &lt;&lt; endl;
}
return std::move(s.str());
return s.str();
}
// ----------------------------------------------------------------------------
std::string <xsl:value-of select="$CLASSNAME"/>_SK::str( uniset::ObjectId id, bool showLinkName ) const
......@@ -1911,7 +1911,7 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::str( uniset::ObjectId id, b
{
s &lt;&lt; "<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>";
if( showLinkName ) s &lt;&lt; "(<xsl:value-of select="../../@name"/>)";
return std::move(s.str());
return s.str();
}
</xsl:if>
</xsl:if>
......@@ -1930,7 +1930,7 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::strval( uniset::ObjectId id,
s &lt;&lt; "<xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>";
if( showLinkName ) s &lt;&lt; " ( <xsl:value-of select="../../@name"/> )";
s &lt;&lt; "=" &lt;&lt; <xsl:call-template name="setprefix"/><xsl:value-of select="../../@name"/>;
return std::move(s.str());
return s.str();
}
</xsl:if>
</xsl:if>
......
......@@ -177,7 +177,7 @@ string MySQLInterface::addslashes( const string& str )
tmp << str[i];
}
return std::move(tmp.str());
return tmp.str();
}
// -----------------------------------------------------------------------------------------
void MySQLInterface::makeResult(DBResult& dbres, MYSQL_RES* myres, bool finalize )
......
......@@ -182,7 +182,7 @@ DBResult PostgreSQLInterface::query( const string& q )
result res( n.exec(q) );
DBResult dbres;
makeResult(dbres, res);
return std::move(dbres);
return dbres;
}
catch( const std::exception& e )
{
......
......@@ -412,6 +412,6 @@ std::string MQTTPublisher::MQTTTextInfo::replace( RangeInfo* ri, long value )
txt = replace_all(txt, "%rmax", smax.str());
txt = replace_all(txt, "%r", r.str());
return std::move(txt);
return txt;
}
//--------------------------------------------------------------------------------
......@@ -3326,7 +3326,7 @@ namespace uniset
<< " type=" << dtype
<< " ask_every_reg=" << ask_every_reg
<< ")" << endl;
return std::move( s.str() );
return s.str();
}
// ----------------------------------------------------------------------------
} // end of namespace uniset
......@@ -758,7 +758,7 @@ const std::string MBTCPMultiMaster::MBSlaveInfo::getShortInfo() const
<< " persistent-connection=" << !force_disconnect
<< ")";
return std::move(s.str());
return s.str();
}
// -----------------------------------------------------------------------------
uniset::SimpleInfo* MBTCPMultiMaster::getInfo( const char* userparam )
......
......@@ -2590,7 +2590,7 @@ namespace uniset
s << iaddr << " askCount=" << askCount;
return std::move(s.str());
return s.str();
}
// -------------------------------------------------------------------------
uniset::SimpleInfo* MBSlave::getInfo( const char* userparam )
......
......@@ -948,7 +948,7 @@ const std::string UNetReceiver::getShortInfo() const noexcept
<< endl
<< "\t[ qsize=" << qpack.size() << " recv=" << statRecvPerSec << " update=" << statUpPerSec << " per sec ]";
return std::move(s.str());
return s.str();
}
// -----------------------------------------------------------------------------
UNetReceiver::pack_guard::pack_guard( mutex& _m, UNetReceiver::UpdateStrategy _s ):
......
......@@ -552,7 +552,7 @@ namespace uniset
}
}
return std::move(s.str());
return s.str();
}
// -----------------------------------------------------------------------------
} // end of namespace uniset
......@@ -76,7 +76,7 @@ static UniSetUDP::UDPMessage receive( unsigned int pnum = 0, timeout_t tout = 20
ncycle--;
}
return std::move(pack);
return pack;
}
// -----------------------------------------------------------------------------
void send( UniSetUDP::UDPMessage& pack, int tout = 2000 )
......
......@@ -8,7 +8,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
// --------------------------------------------------------------------------
// generate timestamp: 2016-12-12+03:00
// generate timestamp: 2016-12-23+03:00
// -----------------------------------------------------------------------------
#ifndef UObject_SK_H_
#define UObject_SK_H_
......@@ -116,7 +116,7 @@ class UObject_SK:
std::string strval( uniset::ObjectId id, bool showLinkName=true ) const;
/*! Вывод состояния внутренних переменных */
inline std::string dumpVars(){ return std::move(vmon.pretty_str()); }
inline std::string dumpVars(){ return vmon.pretty_str(); }
// ------------------------------------------------------------
std::string help() noexcept;
......
......@@ -840,7 +840,7 @@ namespace uniset
b.ondelay_state = ondelay_state;
b.offdelay_state = offdelay_state;
return std::move(b);
return b;
}
// ------------------------------------------------------------------------------------------
void IOBase::create_from_iobase( const IOBase& b )
......
......@@ -11,7 +11,7 @@
ВСЕ ВАШИ ИЗМЕНЕНИЯ БУДУТ ПОТЕРЯНЫ.
*/
// --------------------------------------------------------------------------
// generate timestamp: 2016-12-12+03:00
// generate timestamp: 2016-12-23+03:00
// -----------------------------------------------------------------------------
#include <memory>
#include <iomanip>
......@@ -343,7 +343,7 @@ std::string UObject_SK::dumpIO()
s << std::endl;
}
return std::move(s.str());
return s.str();
}
// ----------------------------------------------------------------------------
std::string UObject_SK::str( uniset::ObjectId id, bool showLinkName ) const
......@@ -724,7 +724,7 @@ std::string UObject_SK::help() noexcept
s << " ****************************************************************************************** " << endl;
return std::move(s.str());
return s.str();
}
// ----------------------------------------------------------------------------
......
......@@ -54,7 +54,7 @@ string LostTestProc::getMonitInfo()
{
ostringstream inf;
inf << "COUNT SENSORS: " << slist.size() << endl;
return std::move(inf.str());
return inf.str();
}
// -----------------------------------------------------------------------------
void LostTestProc::timerInfo( const TimerMessage* tm )
......
......@@ -122,7 +122,7 @@ static UTypes::ShortIOInfo toUTypes( IOController_i::ShortIOInfo i )
ret.tv_nsec = i.tv_nsec;
ret.supplier = i.supplier;
return std::move(ret);
return ret;
}
//---------------------------------------------------------------------------
UTypes::ShortIOInfo UConnector::getTimeChange( long id, long node )
......
......@@ -103,7 +103,7 @@ namespace uniset
s << "]";
return std::move(s.str());
return s.str();
}
// --------------------------------------------------------------------------------
mbErrCode ModbusServer::processing( ModbusMessage& buf )
......@@ -1511,7 +1511,7 @@ namespace uniset
{
std::unordered_set<ModbusRTU::ModbusAddr> v;
v.emplace(mbaddr);
return std::move(v);
return v;
}
// -------------------------------------------------------------------------
mbErrCode ModbusServer::receive(const std::unordered_set<ModbusAddr>& vaddr, timeout_t msecTimeout)
......@@ -1658,7 +1658,7 @@ namespace uniset
ModbusServer::ExchangeErrorMap ModbusServer::getErrorMap()
{
ExchangeErrorMap m(errmap);
return std::move(m);
return m;
}
// -------------------------------------------------------------------------
size_t ModbusServer::getErrCount( mbErrCode e )
......
......@@ -360,7 +360,7 @@ namespace uniset
// длина сообщения...
mm.dlen = ind; // szData();
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
std::ostream& ModbusRTU::operator<<(std::ostream& os, ErrorRetMessage& m )
......@@ -409,7 +409,7 @@ namespace uniset
memcpy(&(mm.data[last]), &crc, szCRC);
mm.dlen = szData();
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
ReadCoilMessage::ReadCoilMessage( const ModbusMessage& m )
......@@ -539,7 +539,7 @@ namespace uniset
udata |= 1 << i;
}
return std::move(udata);
return udata;
}
// -------------------------------------------------------------------------
const DataBits16& DataBits16::operator=( const ModbusData& r )
......@@ -677,7 +677,7 @@ namespace uniset
// длина сообщения...
mm.dlen = ind;
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
size_t ReadCoilRetMessage::szData() const
......@@ -729,7 +729,7 @@ namespace uniset
memcpy(&(mm.data[last]), &crc, szCRC);
mm.dlen = szData();
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
ReadInputStatusMessage::ReadInputStatusMessage( const ModbusMessage& m )
......@@ -878,7 +878,7 @@ namespace uniset
// длина сообщения...
mm.dlen = ind;
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
size_t ReadInputStatusRetMessage::szData() const
......@@ -933,7 +933,7 @@ namespace uniset
// длина сообщения...
mm.dlen = szData();
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
ReadOutputMessage::ReadOutputMessage( const ModbusMessage& m )
......@@ -1088,7 +1088,7 @@ namespace uniset
// длина сообщения...
mm.dlen = ind;
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
size_t ReadOutputRetMessage::szData() const
......@@ -1141,7 +1141,7 @@ namespace uniset
// длина сообщения...
mm.dlen = szData();
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
ReadInputMessage::ReadInputMessage( const ModbusMessage& m )
......@@ -1301,7 +1301,7 @@ namespace uniset
// длина сообщения...
mm.dlen = ind;
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
size_t ReadInputRetMessage::szData()
......@@ -1423,7 +1423,7 @@ namespace uniset
// длина сообщения...
mm.dlen = ind;
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
......@@ -1583,7 +1583,7 @@ namespace uniset
// длина сообщения...
mm.dlen = szData();
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
std::ostream& ModbusRTU::operator<<(std::ostream& os, ForceCoilsRetMessage& m )
......@@ -1666,7 +1666,7 @@ namespace uniset
// длина сообщения...
mm.dlen = ind;
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
......@@ -1842,7 +1842,7 @@ namespace uniset
// длина сообщения...
mm.dlen = szData();
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
std::ostream& ModbusRTU::operator<<(std::ostream& os, WriteOutputRetMessage& m )
......@@ -1876,7 +1876,7 @@ namespace uniset
// копируем CRC (последний элемент). Без переворачивания...
memcpy(&(mm.data[last]), &crc, szCRC);
mm.dlen = szData();
return std::move(mm);
return mm;
}
// --------------------------------------------------------------------------------
......@@ -2012,7 +2012,7 @@ namespace uniset
// длина сообщения...
mm.dlen = szData();
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
std::ostream& ModbusRTU::operator<<(std::ostream& os, ForceSingleCoilRetMessage& m )
......@@ -2047,7 +2047,7 @@ namespace uniset
// копируем CRC (последний элемент). Без переворачивания...
memcpy(&(mm.data[last]), &crc, szCRC);
mm.dlen = szData();
return std::move(mm);
return mm;
}
// --------------------------------------------------------------------------------
......@@ -2190,7 +2190,7 @@ namespace uniset
// длина сообщения...
mm.dlen = szData();
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
std::ostream& ModbusRTU::operator<<(std::ostream& os, WriteSingleOutputRetMessage& m )
......@@ -2379,7 +2379,7 @@ namespace uniset
// длина сообщения...
mm.dlen = szData();
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
size_t DiagnosticMessage::szData() const
......@@ -2475,7 +2475,7 @@ namespace uniset
// длина сообщения...
mm.dlen = szData();
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
......@@ -2710,7 +2710,7 @@ namespace uniset
// длина сообщения...
mm.dlen = ind;
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
size_t MEIMessageRetRDI::szData() const
......@@ -2881,7 +2881,7 @@ namespace uniset
// длина сообщения...
mm.dlen = ind;
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
size_t JournalCommandRetMessage::szData() const
......@@ -3118,7 +3118,7 @@ namespace uniset
memcpy(&(mm.data[bcnt]), &crc, szCRC);
// длина сообщения...
mm.dlen = szData(); // bcnt + szCRC
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
SetDateTimeRetMessage::SetDateTimeRetMessage( const ModbusMessage& m )
......@@ -3192,7 +3192,7 @@ namespace uniset
// длина сообщения...
mm.dlen = szData(); // bcnt + szCRC
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
RemoteServiceMessage::RemoteServiceMessage( const ModbusMessage& m )
......@@ -3311,7 +3311,7 @@ namespace uniset
// длина сообщения...
mm.dlen = ind;
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
ReadFileRecordMessage::ReadFileRecordMessage( const ModbusMessage& m )
......@@ -3415,7 +3415,7 @@ namespace uniset
// длина сообщения...
mm.dlen = szData();
return std::move(mm);
return mm;
}
// -------------------------------------------------------------------------
FileTransferMessage::FileTransferMessage( const ModbusMessage& m )
......@@ -3576,7 +3576,7 @@ namespace uniset
// длина сообщения...
mm.dlen = ind;
return std::move(mm);
return mm;
}
// -----------------------------------------------------------------------
std::ostream& ModbusRTU::operator<<(std::ostream& os, FileTransferRetMessage& m )
......
......@@ -249,11 +249,11 @@ namespace uniset
if( pos == string::npos )
{
vector<string> v{lname, ""};
return std::move(v);
return v;
}
vector<string> v = {lname.substr(0, pos), lname.substr(pos + 1, lname.length()) };
return std::move(v);
return v;
}
// -------------------------------------------------------------------------
bool LogAgregator::logExist( std::shared_ptr<DebugStream>& log ) const
......@@ -326,7 +326,7 @@ namespace uniset
cerr << "(LogAgregator::getLogList): " << ex.what() << std::endl;
}
return std::move(l);
return l;
}
// -------------------------------------------------------------------------
std::list<LogAgregator::iLog> LogAgregator::getLogList() const
......@@ -336,7 +336,7 @@ namespace uniset
{
return a.name < b.name;
});
return std::move(lst);
return lst;
}
// -------------------------------------------------------------------------
std::list<LogAgregator::iLog> LogAgregator::makeLogNameList( const std::string& prefix ) const
......@@ -363,7 +363,7 @@ namespace uniset
}
}
return std::move(lst);
return lst;
}
// -------------------------------------------------------------------------
void LogAgregator::offLogFile( const std::string& logname )
......
......@@ -333,7 +333,7 @@ namespace uniset
{
ostringstream h;
h << "--" << prefix << "-cmd-timeout msec - Timeout for wait command. Default: 2000 msec." << endl;
return std::move( h.str() );
return h.str();
}
// -----------------------------------------------------------------------------
string LogServer::getShortInfo()
......@@ -353,7 +353,7 @@ namespace uniset
inf << " " << s->getShortInfo() << endl;
}
return std::move(inf.str());
return inf.str();
}
// -----------------------------------------------------------------------------
#ifndef DISABLE_REST_API
......@@ -491,7 +491,7 @@ namespace uniset
s << "=================================" << endl << endl;
return std::move(s.str());
return s.str();
}
return "";
......
......@@ -41,7 +41,7 @@ string IORFile::getIOR( const ObjectId id )
string sior;
ior_file >> sior;
return std::move(sior);
return sior;
}
// -----------------------------------------------------------------------------------------
void IORFile::setIOR( const ObjectId id, const string& sior )
......@@ -69,6 +69,6 @@ string IORFile::getFileName( const ObjectId id )
{
ostringstream fname;
fname << uniset_conf()->getLockDir() << id;
return std::move( fname.str() );
return fname.str();
}
// -----------------------------------------------------------------------------------------
......@@ -257,7 +257,7 @@ namespace uniset
}
return std::move(bad);
return bad;
}
// ---------------------------------------------------------------------------------------------------------------
}
......
......@@ -212,7 +212,7 @@ bool uniset::file_exist( const std::string& filename )
uniset::IDList uniset::explode( const std::string& str, char sep )
{
uniset::IDList l( explode_str(str, sep) );
return std::move(l);
return l;
}
// -------------------------------------------------------------------------
std::vector<std::string> uniset::explode_str( const std::string& str, char sep )
......@@ -256,7 +256,7 @@ std::vector<std::string> uniset::explode_str( const std::string& str, char sep )
}
while( pos != string::npos );
return std::move(v);
return v;
}
// ------------------------------------------------------------------------------------------
bool uniset::is_digit( const std::string& s ) noexcept
......@@ -338,7 +338,7 @@ std::list<uniset::ParamSInfo> uniset::getSInfoList( const string& str, std::shar
res.emplace_back( std::move(item) );
}
return std::move(res);
return res;
}
// --------------------------------------------------------------------------------------
std::list<uniset::ConsumerInfo> uniset::getObjectsList( const string& str, std::shared_ptr<Configuration> conf )
......@@ -401,7 +401,7 @@ std::list<uniset::ConsumerInfo> uniset::getObjectsList( const string& str, std::
res.emplace_back( std::move(item) );
}
return std::move(res);
return res;
}
// --------------------------------------------------------------------------------------
UniversalIO::IOType uniset::getIOType( const std::string& stype ) noexcept
......@@ -571,7 +571,7 @@ std::string uniset::replace_all( const std::string& src, const std::string& from
string res(src);
if( from.empty() )
return std::move(res);
return res;
size_t pos = res.find(from, 0);
......@@ -582,7 +582,7 @@ std::string uniset::replace_all( const std::string& src, const std::string& from
pos = res.find(from, pos);
}
return std::move(res);
return res;
}
// -------------------------------------------------------------------------
timeval uniset::to_timeval( const chrono::system_clock::duration& d )
......@@ -598,7 +598,7 @@ timeval uniset::to_timeval( const chrono::system_clock::duration& d )
tv.tv_usec = std::chrono::duration_cast<std::chrono::microseconds>(d - sec).count();
}
return std::move(tv);
return tv;
}
// -------------------------------------------------------------------------
timespec uniset::to_timespec( const chrono::system_clock::duration& d )
......@@ -614,7 +614,7 @@ timespec uniset::to_timespec( const chrono::system_clock::duration& d )
ts.tv_nsec = std::chrono::duration_cast<std::chrono::nanoseconds>(d - sec).count();
}
return std::move(ts);
return ts;
}
// -------------------------------------------------------------------------
timespec uniset::now_to_timespec()
......
......@@ -138,6 +138,6 @@ std::string DBServer::help_print()
h << "--prefix-logserver-port num - listen port. Default: ID" << endl;
h << LogServer::help_print("prefix-logserver") << endl;
return std::move( h.str() );
return h.str();
}
//--------------------------------------------------------------------------------------------
......@@ -331,7 +331,7 @@ namespace uniset
{
const string a(omniIt.getProp("arg"));
uinfo << "(Configuration): add omniORB option '" << p << "' " << a << endl;
omniParams.emplace_back( std::move(std::make_pair(p, a)) );
omniParams.emplace_back( std::make_pair(p, a) );
}
}
}
......@@ -485,7 +485,7 @@ namespace uniset
string s(uniset::getArgParam(name, _argc, _argv, ""));
if( !s.empty() )
return std::move(s);
return s;
if( !defval.empty() )
return defval;
......@@ -1010,7 +1010,7 @@ namespace uniset
{
ostringstream n;
n << sec << "/" << name;
return std::move(n.str());
return n.str();
}
// -------------------------------------------------------------------------
void Configuration::initRepSections()
......@@ -1052,7 +1052,7 @@ namespace uniset
if( ret.empty() )
ret = unixml->getProp(secnode, "name");
return std::move(ret);
return ret;
}
// -------------------------------------------------------------------------
void Configuration::setConfFileName( const string& fn )
......
......@@ -155,7 +155,7 @@ LT_Object::TimersList LT_Object::getTimersList()
{
uniset_rwmutex_rlock l(lstMutex);
TimersList lst(tlst);
return std::move(lst);
return lst;
}
// ------------------------------------------------------------------------------------------
string LT_Object::getTimerName(int id)
......
......@@ -160,7 +160,7 @@ string UniXML::getProp2(const xmlNode* node, const string& name, const string& d
string s(getProp(node, name));
if( !s.empty() )
return std::move(s);
return s;
}
catch(...) {}
......@@ -182,7 +182,7 @@ string UniXML::getProp(const xmlNode* node, const string& name) noexcept
// формально при конструировании строки может быть exception
const string t( (const char*)text );
xmlFree( (xmlChar*) text );
return std::move(t);
return t;
}
catch(...) {}
......@@ -214,7 +214,7 @@ UniXMLPropList UniXML::getPropList( xmlNode* node )
{
UniXMLPropList lst;
if( !node )
return std::move(lst);
return lst;
xmlAttr* attribute = node->properties;
while( attribute )
......@@ -227,7 +227,7 @@ UniXMLPropList UniXML::getPropList( xmlNode* node )
attribute = attribute->next;
}
return std::move(lst);
return lst;
}
// -----------------------------------------------------------------------------
xmlNode* UniXML::createChild(xmlNode* node, const string& title, const string& text)
......
......@@ -33,7 +33,7 @@ namespace uniset
{ \
std::ostringstream s; \
s << std::right << std::setw(nwidth) << name << std::left << " = " << std::right << std::setw(10) << *(v); \
return std::move(s.str()); \
return s.str(); \
} \
const std::string VMonitor::pretty_str( const std::string& name, const T& v, int nwidth ) \
{ \
......@@ -49,7 +49,7 @@ namespace uniset
{ \
std::ostringstream s; \
s << std::right << std::setw(nwidth) << name << std::left << " = " << std::right << std::setw(10) << *(v); \
return std::move(s.str()); \
return s.str(); \
} \
const std::string VMonitor::pretty_str( const std::string& name, const T& v, int nwidth ) \
{ \
......@@ -69,13 +69,13 @@ namespace uniset
{ \
std::ostringstream s; \
s << std::right << std::setw(nwidth) << name << std::left << " = " << std::right << std::setw(10) << *(v); \
return std::move(s.str()); \
return s.str(); \
} \
const std::string VMonitor::pretty_str( const std::string& name, const unsigned T* v, int nwidth ) \
{ \
std::ostringstream s; \
s << std::right << std::setw(nwidth) << name << std::left << " = " << std::right << std::setw(10) << *(v); \
return std::move(s.str()); \
return s.str(); \
} \
const std::string VMonitor::pretty_str( const std::string& name, const T& v, int nwidth ) \
{ \
......@@ -94,7 +94,7 @@ namespace uniset
{ \
std::ostringstream s; \
s << std::right << std::setw(nwidth) << name << std::left << " = " << std::right << std::setw(10) << *(v); \
return std::move(s.str()); \
return s.str(); \
} \
const std::string VMonitor::pretty_str( const std::string& name, const T& v, int nwidth ) \
{ \
......@@ -167,7 +167,7 @@ namespace uniset
{
std::ostringstream s;
s << (*this);
return std::move(s.str());
return s.str();
}
// --------------------------------------------------------------------------
std::list<std::pair<std::string, std::string> > VMonitor::getList()
......@@ -181,7 +181,7 @@ namespace uniset
VMON_MAKE_PAIR(vlist, float);
VMON_MAKE_PAIR(vlist, double);
VMON_MAKE_PAIR_S(vlist, string);
return std::move(vlist);
return vlist;
}
// --------------------------------------------------------------------------
std::string VMonitor::pretty_str( int namewidth, int colnum )
......@@ -205,7 +205,7 @@ namespace uniset
os << std::endl;
}
return std::move(os.str());
return os.str();
}
// --------------------------------------------------------------------------
} // end of namespace uniset
......@@ -6,7 +6,6 @@
#include <type_traits>
#include <tuple>
#include "UTCPCore.h"
#include <chrono>
template<typename... Args>
class VMon
......@@ -18,91 +17,81 @@ class VMon
// ------------------------------------------------------------------------------
using namespace std;
using namespace uniset;
class PtrMapHashFn
// ------------------------------------------------------------------------------
struct TestClass
{
public:
size_t operator() (const long* const& key) const
TestClass()
{
return std::hash<long>()((long)key);
cerr << "TEST CLASS CREATE.." << endl;
}
};
struct struct_t
{
unsigned char hour = { 0 }; /*!< часы [0..23] */
unsigned char min = { 0 }; /*!< минуты [0..59] */
unsigned char sec = { 0 }; /*!< секунды [0..59] */
unsigned char day = { 1 }; /*!< день [1..31] */
unsigned char mon = { 1 }; /*!< месяц [1..12] */
unsigned char year = { 0 }; /*!< год [0..99] */
unsigned char century = { 20 }; /*!<*/
} __attribute__((packed));
int main( int argc, const char** argv )
{
cerr << "2000%1000000=" << int(2000 % 1000000) << endl;
return 0;
unordered_map<const long*, const long*, PtrMapHashFn> vmap;
const long id = 10;
long prive_val = 100;
const long& val(prive_val);
vmap.emplace(&id, &val);
auto i = vmap.find(&id);
return 0;
auto now = std::chrono::system_clock::now();
auto sec = std::chrono::time_point_cast<std::chrono::nanoseconds>(now);
auto nsec = std::chrono::time_point_cast<std::chrono::seconds>(now);
// TestClass( TestClass&& ) = default;
TestClass( const TestClass& t )
{
cerr << "TEST CLASS COPY.." << endl;
(*this) = t;
}
cout << "SEC=" << std::chrono::duration<double>(sec.time_since_epoch()).count()
<< endl;
return 0;
TestClass& operator=(const TestClass& t )
{
cerr << "TEST CLASS COPY FUNC.." << endl;
(*this) = t;
return (*this);
}
TestClass& operator=( TestClass&& t ) = default;
std::chrono::time_point<std::chrono::system_clock> p1, p2, p3;
TestClass( TestClass&& t )
{
cerr << "TEST CLASS MOVE.." << endl;
(*this) = std::move(t);
}
p2 = std::chrono::system_clock::now();
p3 = p2 - std::chrono::hours(24);
size_t len = { 10 };
int data[10];
};
std::time_t epoch_time = std::chrono::system_clock::to_time_t(p1);
std::cout << "epoch: " << std::ctime(&epoch_time);
std::time_t today_time = std::chrono::system_clock::to_time_t(p2);
std::cout << "today: " << std::ctime(&today_time);
struct MClass
{
MClass( int d1, int d2 = 0 )
{
data[0] = d1;
data[1] = d2;
}
std::cout << "hours since epoch: "
<< std::chrono::duration_cast<std::chrono::hours>(
p2.time_since_epoch()).count()
<< '\n';
std::cout << "yesterday, hours since epoch: "
<< std::chrono::duration_cast<std::chrono::hours>(
p3.time_since_epoch()).count()
<< '\n';
size_t len = { 2 };
int data[2];
return 0;
unsigned char dat[] = { '1', '2', '3' , '4' };
TestClass get()
{
TestClass m;
m.len = len;
memcpy(data, &m.data, sizeof(data));
//return std::move(m);
return m;
}
};
// UTCPCore::Buffer* buf = new UTCPCore::Buffer( dat, 0 );
UTCPCore::Buffer* buf = new UTCPCore::Buffer( dat, 3 );
void test_func( TestClass& m )
{
cerr << "func.." << endl;
}
// if( buf->nbytes() == 0 )
// delete buf;
cout << "buf: " << buf->dpos() << endl;
void test_func( TestClass&& m )
{
cerr << "move func.." << endl;
}
// ------------------------------------------------------------------------------
delete buf;
int main( int argc, const char** argv )
{
MClass m(10, 11);
// VMon<int,double,char> vmon;
TestClass c = m.get();
// cout << std::get<0>(vmon.m_tuple).size() << endl;
test_func(c);
test_func( std::move(c) );
return 0;
}
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