本文整理汇总了C++中blob_t类的典型用法代码示例。如果您正苦于以下问题:C++ blob_t类的具体用法?C++ blob_t怎么用?C++ blob_t使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了blob_t类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: xattach_pipe
void zmq::socket_base_t::attach_pipe (pipe_t *pipe_,
const blob_t &peer_identity_)
{
// First, register the pipe so that we can terminate it later on.
pipe_->set_event_sink (this);
pipes.push_back (pipe_);
// Then, pass the pipe to the specific socket type.
// If the peer haven't specified it's identity, let's generate one.
if (peer_identity_.size ()) {
xattach_pipe (pipe_, peer_identity_);
}
else {
blob_t identity (17, 0);
generate_uuid ((unsigned char*) identity.data () + 1);
xattach_pipe (pipe_, identity);
}
// If the socket is already being closed, ask any new pipes to terminate
// straight away.
if (is_terminating ()) {
register_term_acks (1);
pipe_->terminate (false);
}
}
开发者ID:adymitruk,项目名称:zeromq3-0,代码行数:25,代码来源:socket_base.cpp
示例3: 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
示例4: 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
示例5: 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
示例6: 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
示例7: zmq_assert
int zmq::stream_engine_t::write_credential (msg_t *msg_)
{
zmq_assert (mechanism != NULL);
zmq_assert (session != NULL);
const blob_t credential = mechanism->get_user_id ();
if (credential.size () > 0) {
msg_t msg;
int rc = msg.init_size (credential.size ());
zmq_assert (rc == 0);
memcpy (msg.data (), credential.data (), credential.size ());
msg.set_flags (msg_t::credential);
rc = session->push_msg (&msg);
if (rc == -1) {
rc = msg.close ();
errno_assert (rc == 0);
return -1;
}
}
process_msg = &stream_engine_t::decode_and_push;
return decode_and_push (msg_);
}
开发者ID:HJoYer,项目名称:libzmq,代码行数:22,代码来源:stream_engine.cpp
示例8: xattach_pipes
void zmq::socket_base_t::attach_pipes (class reader_t *inpipe_,
class writer_t *outpipe_, const blob_t &peer_identity_)
{
// If the peer haven't specified it's identity, let's generate one.
if (peer_identity_.size ()) {
xattach_pipes (inpipe_, outpipe_, peer_identity_);
}
else {
blob_t identity (1, 0);
identity.append (uuid_t ().to_blob (), uuid_t::uuid_blob_len);
xattach_pipes (inpipe_, outpipe_, identity);
}
}
开发者ID:XyzalZhang,项目名称:SPlayer,代码行数:13,代码来源:socket_base.cpp
示例9: column_geometry
inline void column_geometry(sqlite3_stmt* stmt, int col, blob_t& blob)
{
using namespace brig::detail::ogc;
const uint8_t* data((const uint8_t*)lib::singleton().p_sqlite3_column_blob(stmt, col));
const int size(lib::singleton().p_sqlite3_column_bytes(stmt, col));
if (size <= 39) return;
blob.resize(size - 39);
const uint8_t byte_order(data[1]);
blob[0] = byte_order;
memcpy(blob.data() + 1, data + 39, blob.size() - 1);
uint8_t* ptr = blob.data() + 1;
switch (read<uint32_t>(byte_order, ptr))
{
default: throw std::runtime_error("SpatiaLite geometry error");
case Point:
case LineString:
case Polygon: return;
case MultiPoint:
case MultiLineString:
case MultiPolygon:
case GeometryCollection: break;
}
for (uint32_t i(0), count(read<uint32_t>(byte_order, ptr)); i < count; ++i)
{
write<uint8_t>(ptr, byte_order);
switch (read<uint32_t>(byte_order, ptr))
{
default: throw std::runtime_error("SpatiaLite geometry error");
case Point: skip_point(ptr); break;
case LineString: skip_line(byte_order, ptr); break;
case Polygon: skip_polygon(byte_order, ptr); break;
}
}
}
开发者ID:igor-sadchenko,项目名称:brig,代码行数:38,代码来源:column_geometry.hpp
示例10: operator
int operator()(const blob_t& r) const { return lib::singleton().p_sqlite3_bind_blob(stmt, i, r.data(), int(r.size()), SQLITE_STATIC); }
开发者ID:igor-sadchenko,项目名称:brig,代码行数:1,代码来源:binding.hpp
示例11: binding_blob
binding_blob(SQLSMALLINT sql_type, const blob_t& blob) : m_sql_type(sql_type), m_ptr((void*)blob.data()), m_ind(blob.size()) {}
开发者ID:respu,项目名称:brig,代码行数:1,代码来源:binding_blob.hpp
示例12: 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
示例13: draw
inline void draw(const blob_t& wkb, const frame& fr, QPainter& painter)
{
auto ptr(wkb.data());
detail::draw_geometry(ptr, fr, painter);
}
开发者ID:igor-sadchenko,项目名称:brig,代码行数:5,代码来源:draw.hpp
示例14: transform_wkb
inline void transform_wkb(blob_t& wkb, projPJ in_pj, projPJ out_pj)
{
const blob_t::value_type* in_ptr(wkb.data());
blob_t::value_type* out_ptr((blob_t::value_type*)wkb.data());
detail::transform_geometry(in_ptr, out_ptr, in_pj, out_pj);
}
开发者ID:igor-sadchenko,项目名称:brig,代码行数:6,代码来源:transform_wkb.hpp
注:本文中的blob_t类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论