Ejemplo n.º 1
0
bool RequestHandler::waitRequest( const uint32_t requestID, uint128_t& rUint128,
                                  const uint32_t timeout )
{
    Request::Result result;
    if( !_impl->waitRequest( requestID, result, timeout ))
        return false;

    rUint128.high() = result.rUint128.high;
    rUint128.low() = result.rUint128.low;
    return true;
}
Ejemplo n.º 2
0
::zeroeq::Event serializeRequest( const uint128_t& eventType )
{
    ::zeroeq::Event event( ::zeroeq::vocabulary::EVENT_REQUEST );
    flatbuffers::FlatBufferBuilder& fbb = event.getFBB();

    RequestBuilder builder( fbb );
    builder.add_eventHigh( eventType.high( ));
    builder.add_eventLow( eventType.low( ));

    fbb.Finish( builder.Finish( ));
    return event;
}
Ejemplo n.º 3
0
void RequestHandler::serveRequest( const uint32_t requestID,
                                   const uint128_t& result )
{
    Request* request = 0;
    {
        ScopedFastWrite mutex( _impl->lock );
        RequestHashCIter i = _impl->requests.find( requestID );

        if( i != _impl->requests.end( ))
            request = i->second;
    }
        
    if( request )
    {
        request->result.rUint128.low = result.low();
        request->result.rUint128.high = result.high();
        request->lock.unset();
    }
}
Ejemplo n.º 4
0
template<> ZEROBUF_INL void toJSON( const uint128_t& value, Json::Value& json )
{
    json[ "high" ] = Json::UInt64( value.high( ));
    json[ "low" ] = Json::UInt64( value.low( ));
}