Exemplo n.º 1
0
void Connection::send(const Atlas::Objects::Root &obj)
{
    if ((_status != CONNECTED) && (_status != DISCONNECTING)) {
        error() << "called send on closed connection";
        return;
    }

    if (!_socket) {
        handleFailure("Connection::send: stream failed");
        hardDisconnect(true);
        return;
    }

#ifdef ATLAS_LOG
    std::stringstream debugStream;

    Atlas::Codecs::Bach debugCodec(debugStream, *this /*dummy*/);
    Atlas::Objects::ObjectsEncoder debugEncoder(debugCodec);
    debugEncoder.streamObjectsMessage(obj);
    debugStream << std::flush;

    std::cout << "sending:" << debugStream.str() << std::endl;
#endif

    _socket->getEncoder().streamObjectsMessage(obj);
    _socket->write();
}
Exemplo n.º 2
0
std::ostream& operator<<(std::ostream& os, const Atlas::Message::Element& msg)
{
    std::stringstream s;
    Atlas::Codecs::Bach debugCodec(s, s, *(Atlas::Bridge*)0);
    Atlas::Message::Encoder debugEncoder(debugCodec);
    debugEncoder.streamMessageElement(msg.asMap());
    return os << s.str();
}
Exemplo n.º 3
0
std::ostream& operator<<(std::ostream& os, const Atlas::Objects::Root& obj)
{
    std::stringstream s;
    Atlas::Codecs::Bach debugCodec(s, s, *(Atlas::Bridge*)0);
    Atlas::Objects::ObjectsEncoder debugEncoder(debugCodec);
    debugEncoder.streamObjectsMessage(obj);
    return os << s.str();
}
Exemplo n.º 4
0
void Connection::postForDispatch(const Root& obj)
{
    RootOperation op = smart_dynamic_cast<RootOperation>(obj);
    assert(op.isValid());
    m_opDeque.push_back(op);

#ifdef ATLAS_LOG
    std::stringstream debugStream;
    Atlas::Codecs::Bach debugCodec(debugStream, *this /* dummy */);
    Atlas::Objects::ObjectsEncoder debugEncoder(debugCodec);
    debugEncoder.streamObjectsMessage(obj);
    debugStream << std::flush;

    std::cout << "posted for re-dispatch:" << debugStream.str() << std::endl;
#endif
}
Exemplo n.º 5
0
void Connection::objectArrived(const Root& obj)
{
#ifdef ATLAS_LOG
    std::stringstream debugStream;
    Atlas::Codecs::Bach debugCodec(debugStream, *this /* dummy */);
    Atlas::Objects::ObjectsEncoder debugEncoder(debugCodec);
    debugEncoder.streamObjectsMessage(obj);
    debugStream << std::flush;

    std::cout << "received:" << debugStream.str() << std::endl;
#endif
    RootOperation op = smart_dynamic_cast<RootOperation>(obj);
    if (op.isValid()) {
        m_opDeque.push_back(op);
    } else
        error() << "Con::objectArrived got non-op";
}