本文整理汇总了C++中ConnectionState::getLog方法的典型用法代码示例。如果您正苦于以下问题:C++ ConnectionState::getLog方法的具体用法?C++ ConnectionState::getLog怎么用?C++ ConnectionState::getLog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionState
的用法示例。
在下文中一共展示了ConnectionState::getLog方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readYarpInt
int AbstractCarrier::readYarpInt(ConnectionState& proto) {
char buf[8];
Bytes header((char*)&buf[0],sizeof(buf));
YARP_SSIZE_T len = proto.is().readFull(header);
if ((size_t)len!=header.length()) {
YARP_DEBUG(proto.getLog(),"data stream died");
return -1;
}
return interpretYarpNumber(header);
}
示例2: defaultExpectAck
bool AbstractCarrier::defaultExpectAck(ConnectionState& proto) {
if (proto.getConnection().requireAck()) {
char buf[8];
Bytes header((char*)&buf[0],sizeof(buf));
YARP_SSIZE_T hdr = proto.is().readFull(header);
if ((size_t)hdr!=header.length()) {
YARP_DEBUG(proto.getLog(),"did not get acknowledgement header");
return false;
}
int len = interpretYarpNumber(header);
if (len<0) {
YARP_DEBUG(proto.getLog(),"acknowledgement header is bad");
return false;
}
size_t len2 = proto.is().readDiscard(len);
if ((size_t)len!=len2) {
YARP_DEBUG(proto.getLog(),"did not get an acknowledgement of the promised length");
return false;
}
}
return true;
}
示例3: defaultExpectIndex
bool AbstractCarrier::defaultExpectIndex(ConnectionState& proto)
{
Log& log = proto.getLog();
YARP_DEBUG(Logger::get(), "expecting an index");
YARP_SPRINTF1(Logger::get(),
debug,
"ConnectionState::expectIndex for %s",
proto.getRoute().toString().c_str());
// expect index header
char buf[8];
Bytes header((char*)&buf[0], sizeof(buf));
YARP_SSIZE_T r = proto.is().readFull(header);
if ((size_t)r!=header.length()) {
YARP_DEBUG(log, "broken index");
return false;
}
int len = interpretYarpNumber(header);
if (len<0) {
YARP_DEBUG(log, "broken index - header is not a number");
return false;
}
if (len!=10) {
YARP_DEBUG(log, "broken index - header is wrong length");
return false;
}
YARP_DEBUG(Logger::get(), "index coming in happily...");
char buf2[10];
Bytes indexHeader((char*)&buf2[0], sizeof(buf2));
r = proto.is().readFull(indexHeader);
if ((size_t)r!=indexHeader.length()) {
YARP_DEBUG(log, "broken index, secondary header");
return false;
}
YARP_DEBUG(Logger::get(), "secondary header came in happily...");
int inLen = (unsigned char)(indexHeader.get()[0]);
int outLen = (unsigned char)(indexHeader.get()[1]);
// Big limit on number of blocks here! Inherited from QNX.
// should make it go away if it hurts someone.
int total = 0;
NetInt32 numberSrc;
Bytes number((char*)&numberSrc, sizeof(NetInt32));
for (int i=0; i<inLen; i++) {
YARP_SSIZE_T l = proto.is().readFull(number);
if ((size_t)l!=number.length()) {
YARP_DEBUG(log, "bad input block length");
return false;
}
int x = NetType::netInt(number);
total += x;
}
for (int i2=0; i2<outLen; i2++) {
YARP_SSIZE_T l = proto.is().readFull(number);
if ((size_t)l!=number.length()) {
YARP_DEBUG(log, "bad output block length");
return false;
}
int x = NetType::netInt(number);
total += x;
}
proto.setRemainingLength(total);
YARP_SPRINTF1(Logger::get(),
debug,
"Total message length: %d",
total);
return true;
}