当前位置: 首页>>代码示例>>C++>>正文


C++ blob_t::empty方法代码示例

本文整理汇总了C++中blob_t::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ blob_t::empty方法的具体用法?C++ blob_t::empty怎么用?C++ blob_t::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在blob_t的用法示例。


在下文中一共展示了blob_t::empty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

void zmq::named_session_t::attached (const blob_t &peer_identity_)
{
    if (!name.empty ()) {

        //  If both IDs are temporary, no checking is needed.
        //  TODO: Old ID should be reused in this case...
        if (name.empty () || name [0] != 0 ||
            peer_identity_.empty () || peer_identity_ [0] != 0) {

            //  If we already know the peer name do nothing, just check whether
            //  it haven't changed.
            zmq_assert (name == peer_identity_);
        }
    }
    else if (!peer_identity_.empty ()) {

        //  Store the peer identity.
        name = peer_identity_;

        //  Register the session using the peer name.
        if (!register_session (name, this)) {

            //  TODO: There's already a session with the specified
            //  identity. We should presumably syslog it and drop the
            //  session.
            zmq_assert (false);
        }
    }
}
开发者ID:EvgeniyRudnev,项目名称:tatengine,代码行数:29,代码来源:named_session.cpp

示例2: malloc

void zmq::object_t::send_bind (socket_base_t *destination_,
    reader_t *in_pipe_, writer_t *out_pipe_, const blob_t &peer_identity_,
    bool inc_seqnum_)
{
    if (inc_seqnum_)
        destination_->inc_seqnum ();

    command_t cmd;
    cmd.destination = destination_;
    cmd.type = command_t::bind;
    cmd.args.bind.in_pipe = in_pipe_;
    cmd.args.bind.out_pipe = out_pipe_;
    if (peer_identity_.empty ()) {
        cmd.args.bind.peer_identity_size = 0;
        cmd.args.bind.peer_identity = NULL;
    }
    else {
        zmq_assert (peer_identity_.size () <= 0xff);
        cmd.args.bind.peer_identity_size =
            (unsigned char) peer_identity_.size ();
        cmd.args.bind.peer_identity =
            (unsigned char*) malloc (peer_identity_.size ());
        zmq_assert (cmd.args.bind.peer_identity_size);
        memcpy (cmd.args.bind.peer_identity, peer_identity_.data (),
            peer_identity_.size ());
    }
    send_command (cmd);
}
开发者ID:chenbk85,项目名称:zeromq2-0,代码行数:28,代码来源:object.cpp

示例3: memset

void zmq::object_t::send_bind (own_t *destination_, reader_t *in_pipe_,
    writer_t *out_pipe_, const blob_t &peer_identity_, bool inc_seqnum_)
{
    if (inc_seqnum_)
        destination_->inc_seqnum ();

    command_t cmd;
#if defined ZMQ_MAKE_VALGRIND_HAPPY
    memset (&cmd, 0, sizeof (cmd));
#endif
    cmd.destination = destination_;
    cmd.type = command_t::bind;
    cmd.args.bind.in_pipe = in_pipe_;
    cmd.args.bind.out_pipe = out_pipe_;
    if (peer_identity_.empty ()) {
        cmd.args.bind.peer_identity_size = 0;
        cmd.args.bind.peer_identity = NULL;
    }
    else {
        zmq_assert (peer_identity_.size () <= 0xff);
        cmd.args.bind.peer_identity_size =
            (unsigned char) peer_identity_.size ();
        cmd.args.bind.peer_identity =
            (unsigned char*) malloc (peer_identity_.size ());
        zmq_assert (cmd.args.bind.peer_identity_size);
        memcpy (cmd.args.bind.peer_identity, peer_identity_.data (),
            peer_identity_.size ());
    }
    send_command (cmd);
}
开发者ID:novas0x2a,项目名称:zeromq2,代码行数:30,代码来源:object.cpp

示例4: copy

        void copy(const blob_t& other) {
            if(other.empty()) {
                return;
            }

            m_data = other.m_data;
            m_size = other.m_size;
            m_ref_counter = other.m_ref_counter;

            ++*m_ref_counter;
        }
开发者ID:berekuk,项目名称:cocaine-core,代码行数:11,代码来源:blob.hpp

示例5: log

bool zmq::connect_session_t::attached (const blob_t &peer_identity_)
{
    //  If there was no previous connection...
    if (!connected) {

        //  Peer has transient identity.
        if (peer_identity_.empty () || peer_identity_ [0] == 0) {
            connected = true;
            return true;
        }

        //  Peer has strong identity. Let's register it and check whether noone
        //  else is using the same identity.
        if (!register_session (peer_identity_, this)) {
            log ("DPID: duplicate peer identity - disconnecting peer");
            return false;
        }
        connected = true;
        peer_identity = peer_identity_;
        return true;
    }

    //  New engine from listener can conflict with existing engine.
    //  Alternatively, new engine created by reconnection process can
    //  conflict with engine supplied by listener in the meantime.
    if (has_engine ()) {
        log ("DPID: duplicate peer identity - disconnecting peer");
        return false;
    }

    //  If there have been a connection before, we have to check whether
    //  peer's identity haven't changed in the meantime.
    if ((peer_identity_.empty () || peer_identity_ [0] == 0) &&
          peer_identity.empty ())
        return true;
    if (peer_identity != peer_identity_) {
        log ("CHID: peer have changed identity - disconnecting peer");
        return false;
    }
    return true;
}
开发者ID:ahqmhjk,项目名称:libzmq,代码行数:41,代码来源:connect_session.cpp

示例6: if

void zmq::session_t::process_attach (i_engine *engine_,
    const blob_t &peer_identity_)
{
    if (!peer_identity.empty ()) {

        //  If both IDs are temporary, no checking is needed.
        //  TODO: Old ID should be reused in this case...
        if (peer_identity.empty () || peer_identity [0] != 0 ||
            peer_identity_.empty () || peer_identity_ [0] != 0) {

            //  If we already know the peer name do nothing, just check whether
            //  it haven't changed.
            zmq_assert (peer_identity == peer_identity_);
        }
    }
    else if (!peer_identity_.empty ()) {

        //  Store the peer identity.
        peer_identity = peer_identity_;

        //  If the session is not registered with the ordinal, let's register
        //  it using the peer name.
        if (!ordinal) {
            if (!owner->register_session (peer_identity, this)) {

                //  TODO: There's already a session with the specified
                //  identity. We should presumably syslog it and drop the
                //  session.
                zmq_assert (false);
            }
        }
    }

    //  Check whether the required pipes already exist. If not so, we'll
    //  create them and bind them to the socket object.
    reader_t *socket_reader = NULL;
    writer_t *socket_writer = NULL;

    if (options.requires_in && !out_pipe) {
        pipe_t *pipe = new (std::nothrow) pipe_t (owner, this, options.hwm, options.swap);
        zmq_assert (pipe);
        out_pipe = &pipe->writer;
        out_pipe->set_endpoint (this);
        socket_reader = &pipe->reader;
    }

    if (options.requires_out && !in_pipe) {
        pipe_t *pipe = new (std::nothrow) pipe_t (this, owner, options.hwm, options.swap);
        zmq_assert (pipe);
        in_pipe = &pipe->reader;
        in_pipe->set_endpoint (this);
        socket_writer = &pipe->writer;
    }

    if (socket_reader || socket_writer)
        send_bind (owner, socket_reader, socket_writer, peer_identity);

    //  Plug in the engine.
    zmq_assert (!engine);
    zmq_assert (engine_);
    engine = engine_;
    engine->plug (this);
}
开发者ID:bnoordhuis,项目名称:mongrel2,代码行数:63,代码来源:session.cpp


注:本文中的blob_t::empty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。