本文整理汇总了C++中QSharedPointer::ToString方法的典型用法代码示例。如果您正苦于以下问题:C++ QSharedPointer::ToString方法的具体用法?C++ QSharedPointer::ToString怎么用?C++ QSharedPointer::ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSharedPointer
的用法示例。
在下文中一共展示了QSharedPointer::ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EdgeCheck
void ConnectionManager::EdgeCheck(const int &)
{
qDebug() << "Checking edges";
QList<QSharedPointer<Edge> > edges_to_close;
qint64 now = Utils::Time::GetInstance().MSecsSinceEpoch();
qint64 check_time = now - EdgeCheckTimeout;
qint64 close_time = now - EdgeCloseTimeout;
foreach(const QSharedPointer<Edge> &edge, _con_tab.GetEdges()) {
qint64 last_msg = edge->GetLastIncomingMessage();
if(check_time < last_msg) {
continue;
} else if(last_msg < close_time) {
QSharedPointer<Connection> con = _con_tab.GetConnection(edge.data());
if(con && (con->GetRemoteId() == _local_id)) {
qDebug() << "Attempted to close loopback connection.";
continue;
}
qDebug() << "Closing edge:" << edge->ToString();
edge->Stop("Timed out");
} else {
QSharedPointer<Messaging::ISender> sender = _con_tab.GetConnection(edge.data());
if(!sender) {
sender = edge;
}
qDebug() << "Testing:" << sender->ToString();
_rpc->SendRequest(sender, "CM::Ping", QVariant(), _ping_handler, true);
}
}
}
示例2: SendNotification
void RpcHandler::SendNotification(const QSharedPointer<ISender> &to,
const QString &method, const QVariant &data)
{
int id = IncrementId();
QVariantList container = Request::BuildNotification(id, method, data);
QByteArray msg;
QDataStream stream(&msg, QIODevice::WriteOnly);
stream << container;
qDebug() << "RpcHandler: Sending notification" << id << "for" << method <<
"to" << to->ToString();
to->Send(msg);
}
示例3: Disconnect
void ConnectionManager::Disconnect(const Request ¬ification)
{
QSharedPointer<Connection> con =
notification.GetFrom().dynamicCast<Connection>();
if(!con) {
qWarning() << "Received DisconnectResponse from a non-connection: " <<
notification.GetFrom()->ToString();
return;
}
qDebug() << "Received disconnect for: " << con->ToString();
_con_tab.Disconnect(con.data());
con->GetEdge()->Stop("Remote disconnect");
}
示例4: BindEdge
void ConnectionManager::BindEdge(const QSharedPointer<Edge> &edge,
const Id &rem_id)
{
/// @TODO add an extra variable to the connection message such as a session
///token so that quick reconnects can be enabled.
if(_con_tab.GetConnection(rem_id) != 0) {
qDebug() << "Already have a connection to: " << rem_id.ToString() <<
" closing Edge: " << edge->ToString();
_rpc->SendNotification(edge, "CM::Close", QVariant());
Address addr = edge->GetRemoteAddress();
edge->Stop("Duplicate connection");
emit ConnectionAttemptFailure(addr, "Duplicate connection");
return;
}
_rpc->SendNotification(edge, "CM::Connect", _local_id.GetByteArray());
CreateConnection(edge, rem_id);
}
示例5: SendRequest
int RpcHandler::SendRequest(const QSharedPointer<ISender> &to,
const QString &method, const QVariant &data,
const QSharedPointer<ResponseHandler> &cb, bool timeout)
{
int id = IncrementId();
qint64 ctime = Utils::Time::GetInstance().MSecsSinceEpoch();
TimerCallback *callback = new TimerCallback(this, &RpcHandler::Timeout, id);
Utils::TimerEvent timer = Utils::Timer::GetInstance().QueueCallback(callback,
TimeoutDelta);
_requests[id] = QSharedPointer<RequestState>(
new RequestState(to, cb, ctime, timer, timeout));
QVariantList container = Request::BuildRequest(id, method, data);
QByteArray msg;
QDataStream stream(&msg, QIODevice::WriteOnly);
stream << container;
qDebug() << "RpcHandler: Sending request" << id << "for" << method <<
"to" << to->ToString();
to->Send(msg);
return id;
}