您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DOWNCAST函数代码示例

51自学网 2021-06-01 20:23:15
  C++
这篇教程C++ DOWNCAST函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DOWNCAST函数的典型用法代码示例。如果您正苦于以下问题:C++ DOWNCAST函数的具体用法?C++ DOWNCAST怎么用?C++ DOWNCAST使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

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

示例1: DOWNCAST

void UpnpCache::removeTrack( Meta::TrackPtr t ){#define DOWNCAST( Type, item ) Meta::Upnp##Type##Ptr::staticCast( item )    Meta::UpnpTrackPtr track = DOWNCAST( Track, t );    DOWNCAST( Artist, m_artistMap[ track->artist()->name() ] )->removeTrack( track );    DOWNCAST( Album, m_albumMap.value( track->album() ) )->removeTrack( track );    DOWNCAST( Genre, m_genreMap[ track->genre()->name() ] )->removeTrack( track );    DOWNCAST( Year, m_yearMap[ track->year()->year() ] )->removeTrack( track );#undef DOWNCAST    m_trackMap.remove( track->uidUrl() );}
开发者ID:ErrAza,项目名称:amarok,代码行数:11,


示例2: sip_deserialize

static void sip_deserialize(struct proto_info *info_, uint8_t const **buf){    struct sip_proto_info *info = DOWNCAST(info_, info, sip_proto_info);    proto_info_deserialize(info_, buf);    info->set_values = deserialize_2(buf);    if (info->set_values & SIP_CMD_SET)        info->cmd = deserialize_1(buf);    if (info->set_values & SIP_FROM_SET)        deserialize_str(buf, info->from, sizeof(info->from));    if (info->set_values & SIP_TO_SET)        deserialize_str(buf, info->to, sizeof(info->to));    if (info->set_values & SIP_CALLID_SET)        deserialize_str(buf, info->call_id, sizeof(info->call_id));    if (info->set_values & SIP_MIME_SET)        deserialize_str(buf, info->mime_type, sizeof(info->mime_type));    if (info->set_values & SIP_VIA_SET) {        info->via.protocol = deserialize_1(buf);        ip_addr_deserialize(&info->via.addr, buf);        info->via.port = deserialize_2(buf);    }    if (info->set_values & SIP_LENGTH_SET)        info->content_length = deserialize_4(buf);    if (info->set_values & SIP_CODE_SET)        info->code = deserialize_4(buf);    if (info->set_values & SIP_CSEQ_SET)        info->cseq = deserialize_4(buf);}
开发者ID:bsmr-c-cpp,项目名称:junkie,代码行数:27,


示例3: pg_sbuf_parse

static enum proto_parse_status pg_sbuf_parse(struct parser *parser, struct proto_info *parent, unsigned way, uint8_t const *payload, size_t cap_len, size_t wire_len, struct timeval const *now, size_t tot_cap_len, uint8_t const *tot_packet){    struct pgsql_parser *pg_parser = DOWNCAST(parser, parser, pgsql_parser);    // If this is the first time we are called, init c2s_way    if (pg_parser->c2s_way == UNSET) {        SLOG(LOG_DEBUG, "First packet, init c2s_way to %u", way);        pg_parser->c2s_way = way;    }    // Now build the proto_info    struct sql_proto_info info;    proto_info_ctor(&info.info, parser, parent, wire_len, 0);    info.is_query = way == pg_parser->c2s_way;    info.set_values = 0;    switch (pg_parser->phase) {        case NONE:    return pg_parse_init   (pg_parser, &info, way, payload, cap_len, wire_len, now, tot_cap_len, tot_packet);        case STARTUP: return pg_parse_startup(pg_parser, &info, way, payload, cap_len, wire_len, now, tot_cap_len, tot_packet);        case QUERY:   return pg_parse_query  (pg_parser, &info, way, payload, cap_len, wire_len, now, tot_cap_len, tot_packet);        case EXIT:    return PROTO_PARSE_ERR;   // we do not expect payload after a termination message    }    return PROTO_PARSE_ERR;}
开发者ID:IAmAnubhavSaini,项目名称:junkie,代码行数:25,


示例4: sip_serialize

static void sip_serialize(struct proto_info const *info_, uint8_t **buf){    struct sip_proto_info const *info = DOWNCAST(info_, info, sip_proto_info);    proto_info_serialize(info_, buf);    serialize_2(buf, info->set_values);    if (info->set_values & SIP_CMD_SET)        serialize_1(buf, info->cmd);    if (info->set_values & SIP_FROM_SET)        serialize_str(buf, info->from);    if (info->set_values & SIP_TO_SET)        serialize_str(buf, info->to);    if (info->set_values & SIP_CALLID_SET)        serialize_str(buf, info->call_id);    if (info->set_values & SIP_MIME_SET)        serialize_str(buf, info->mime_type);    if (info->set_values & SIP_VIA_SET) {        serialize_1(buf, info->via.protocol);        ip_addr_serialize(&info->via.addr, buf);        serialize_2(buf, info->via.port);    }    if (info->set_values & SIP_LENGTH_SET)        serialize_4(buf, info->content_length);    if (info->set_values & SIP_CODE_SET)        serialize_4(buf, info->code);    if (info->set_values & SIP_CSEQ_SET)        serialize_4(buf, info->cseq);}
开发者ID:bsmr-c-cpp,项目名称:junkie,代码行数:27,


示例5: sdp_parser_del

static void sdp_parser_del(struct parser *parser){    struct sdp_parser *sdp_parser = DOWNCAST(parser, parser, sdp_parser);    parser_dtor(parser);    FREE(sdp_parser);}
开发者ID:krissg,项目名称:junkie,代码行数:7,


示例6: test_conn_download_status_add_a_connection

static dir_connection_t *test_conn_download_status_add_a_connection(const char *resource){  dir_connection_t *conn = DOWNCAST(dir_connection_t,                                    test_conn_get_connection(                                                      TEST_CONN_STATE,                                                      TEST_CONN_TYPE,                                                      TEST_CONN_RSRC_PURPOSE));  tt_assert(conn);  assert_connection_ok(&conn->base_, time(NULL));  /* Replace the existing resource with the one we want */  if (resource) {    if (conn->requested_resource) {      tor_free(conn->requested_resource);    }    conn->requested_resource = tor_strdup(resource);    assert_connection_ok(&conn->base_, time(NULL));  }  return conn; done:  test_conn_get_rsrc_teardown(NULL, conn);  return NULL;}
开发者ID:isislovecruft,项目名称:tor,代码行数:27,


示例7: test_conn_get_rsrc_teardown

static inttest_conn_get_rsrc_teardown(const struct testcase_t *tc, void *arg){  int rv = 0;  connection_t *conn = (connection_t *)arg;  tt_assert(conn);  assert_connection_ok(conn, time(NULL));  if (conn->type == CONN_TYPE_DIR) {    dir_connection_t *dir_conn = DOWNCAST(dir_connection_t, arg);    tt_assert(dir_conn);    assert_connection_ok(&dir_conn->base_, time(NULL));    /* avoid a last-ditch attempt to refetch the consensus */    dir_conn->base_.state = TEST_CONN_RSRC_STATE_SUCCESSFUL;    assert_connection_ok(&dir_conn->base_, time(NULL));  }  /* connection_free_() cleans up requested_resource */  rv = test_conn_get_basic_teardown(tc, conn); done:  return rv;}
开发者ID:isislovecruft,项目名称:tor,代码行数:26,


示例8: test_conn_get_rend_setup

static void *test_conn_get_rend_setup(const struct testcase_t *tc){  dir_connection_t *conn = DOWNCAST(dir_connection_t,                                    test_conn_get_basic_setup(tc));  tt_assert(conn);  assert_connection_ok(&conn->base_, time(NULL));  rend_cache_init();  /* TODO: use directory_initiate_command_rend() to do this - maybe? */  conn->rend_data = tor_malloc_zero(sizeof(rend_data_t));  tor_assert(strlen(TEST_CONN_REND_ADDR) == REND_SERVICE_ID_LEN_BASE32);  memcpy(conn->rend_data->onion_address,         TEST_CONN_REND_ADDR,         REND_SERVICE_ID_LEN_BASE32+1);  conn->rend_data->hsdirs_fp = smartlist_new();  conn->base_.purpose = TEST_CONN_REND_PURPOSE;  assert_connection_ok(&conn->base_, time(NULL));  return conn;  /* On failure */ done:  test_conn_get_rend_teardown(tc, conn);  /* Returning NULL causes the unit test to fail */  return NULL;}
开发者ID:1833183060,项目名称:tor-1,代码行数:28,


示例9: test_conn_get_rend

static voidtest_conn_get_rend(void *arg){  dir_connection_t *conn = DOWNCAST(dir_connection_t, arg);  tt_assert(conn);  assert_connection_ok(&conn->base_, time(NULL));  tt_assert(connection_get_by_type_state_rendquery(                                            conn->base_.type,                                            conn->base_.state,                                            conn->rend_data->onion_address)            == TO_CONN(conn));  tt_assert(connection_get_by_type_state_rendquery(                                            TEST_CONN_TYPE,                                            TEST_CONN_STATE,                                            TEST_CONN_REND_ADDR)            == TO_CONN(conn));  tt_assert(connection_get_by_type_state_rendquery(TEST_CONN_REND_TYPE_2,                                                   !conn->base_.state,                                                   "")            == NULL);  tt_assert(connection_get_by_type_state_rendquery(TEST_CONN_REND_TYPE_2,                                                   !TEST_CONN_STATE,                                                   TEST_CONN_REND_ADDR_2)            == NULL); done:  ;}
开发者ID:1833183060,项目名称:tor-1,代码行数:29,


示例10: cap_deserialize

static void cap_deserialize(struct proto_info *info_, uint8_t const **buf){    struct cap_proto_info *info = DOWNCAST(info_, info, cap_proto_info);    proto_info_deserialize(info_, buf);    info->dev_id = deserialize_2(buf);    timeval_deserialize(&info->tv, buf);}
开发者ID:bonnefoa,项目名称:junkie,代码行数:7,


示例11: tcp_deserialize

static void tcp_deserialize(struct proto_info *info_, uint8_t const **buf){    struct tcp_proto_info *info = DOWNCAST(info_, info, tcp_proto_info);    proto_info_deserialize(info_, buf);    info->key.port[0] = deserialize_2(buf);    info->key.port[1] = deserialize_2(buf);    unsigned flags = deserialize_1(buf);    info->syn = !!(flags & 0x01);    info->ack = !!(flags & 0x02);    info->rst = !!(flags & 0x04);    info->fin = !!(flags & 0x08);    info->urg = !!(flags & 0x10);    info->psh = !!(flags & 0x20);    info->to_srv = !!(flags & 0x40);    info->window = deserialize_2(buf);    info->urg_ptr = deserialize_2(buf);    info->ack_num = deserialize_4(buf);    info->seq_num = deserialize_4(buf);    info->rel_seq_num = deserialize_4(buf);    info->set_values = deserialize_1(buf);    info->mss = deserialize_2(buf);    info->wsf = deserialize_1(buf);    info->nb_options = deserialize_1(buf);    for (unsigned o = 0; o < info->nb_options; o++) {        info->options[o] = deserialize_1(buf);    }}
开发者ID:Mybrc91,项目名称:junkie,代码行数:27,


示例12: DOWNCAST

static char const *mgcp_info_2_str(struct proto_info const *info_){    struct mgcp_proto_info const *info = DOWNCAST(info_, info, mgcp_proto_info);    return tempstr_printf("%s, %s, %s",        proto_info_2_str(info_),        info->response ? mgcp_resp_2_str(&info->u.resp) : mgcp_query_2_str(&info->u.query),        mgcp_params_2_str(info));}
开发者ID:rixed,项目名称:junkie,代码行数:8,


示例13: tns_parse

static enum proto_parse_status tns_parse(struct parser *parser, struct proto_info *parent, unsigned way, uint8_t const *payload, size_t cap_len, size_t wire_len, struct timeval const *now, size_t tot_cap_len, uint8_t const *tot_packet){    struct tns_parser *tns_parser = DOWNCAST(parser, parser, tns_parser);    enum proto_parse_status const status = streambuf_add(&tns_parser->sbuf, parser, parent, way, payload, cap_len, wire_len, now, tot_cap_len, tot_packet);    return status;}
开发者ID:awesome-security,项目名称:junkie,代码行数:8,


示例14: assert

struct mux_subparser *udp_subparser_and_parser_new(struct parser *parser, struct proto *proto, struct proto *requestor, uint16_t src, uint16_t dst, unsigned way, struct timeval const *now){    assert(parser->proto == proto_udp);    struct mux_parser *mux_parser = DOWNCAST(parser, parser, mux_parser);    struct port_key key;    port_key_init(&key, src, dst, way);    return mux_subparser_and_parser_new(mux_parser, proto, requestor, &key, now);}
开发者ID:IAmAnubhavSaini,项目名称:junkie,代码行数:8,


示例15: eth_serialize

static void eth_serialize(struct proto_info const *info_, uint8_t **buf){    struct eth_proto_info const *info = DOWNCAST(info_, info, eth_proto_info);    proto_info_serialize(info_, buf);    serialize_3(buf, info->vlan_id);    // 16 bits for vlan itself, +we need to handle -1 for UNSET    serialize_n(buf, info->addr[0], ETH_ADDR_LEN);    serialize_n(buf, info->addr[1], ETH_ADDR_LEN);    serialize_2(buf, info->protocol);}
开发者ID:bsmr-c-cpp,项目名称:junkie,代码行数:9,


示例16: rtp_serialize

static void rtp_serialize(struct proto_info const *info_, uint8_t **buf){    struct rtp_proto_info const *info = DOWNCAST(info_, info, rtp_proto_info);    proto_info_serialize(info_, buf);    serialize_4(buf, info->sync_src);    serialize_2(buf, info->seq_num);    serialize_1(buf, info->payload_type);    serialize_4(buf, info->timestamp);}
开发者ID:bonnefoa,项目名称:junkie,代码行数:9,


示例17: rtp_deserialize

static void rtp_deserialize(struct proto_info *info_, uint8_t const **buf){    struct rtp_proto_info *info = DOWNCAST(info_, info, rtp_proto_info);    proto_info_deserialize(info_, buf);    info->sync_src = deserialize_4(buf);    info->seq_num = deserialize_2(buf);    info->payload_type = deserialize_1(buf);    info->timestamp = deserialize_4(buf);}
开发者ID:bonnefoa,项目名称:junkie,代码行数:9,


示例18: TO_EWMA_POL_CIRC_DATA

static inline ewma_policy_circ_data_t *TO_EWMA_POL_CIRC_DATA(circuitmux_policy_circ_data_t *pol){  if (!pol) return NULL;  else {    tor_assert(pol->magic == EWMA_POL_CIRC_DATA_MAGIC);    return DOWNCAST(ewma_policy_circ_data_t, pol);  }}
开发者ID:jfrazelle,项目名称:tor,代码行数:9,


示例19: DOWNCAST

char const *tds_info_2_str(struct proto_info const *info_){    struct tds_proto_info const *info = DOWNCAST(info_, info, tds_proto_info);    char *str = tempstr_printf("%s, type=%s, status=0x%x, length=%"PRIu16"",            proto_info_2_str(info_),            tds_packet_type_2_str(info->type),            info->status, info->length);    return str;}
开发者ID:iHaD,项目名称:junkie,代码行数:9,


示例20: tds_parse

static enum proto_parse_status tds_parse(struct parser *parser, struct proto_info *parent, unsigned way, uint8_t const *payload, size_t cap_len, size_t wire_len, struct timeval const *now, size_t tot_cap_len, uint8_t const *tot_packet){    struct tds_parser *tds_parser = DOWNCAST(parser, parser, tds_parser);    if (cap_len == 0 && wire_len > 0) return PROTO_TOO_SHORT;   // We do not know how to handle pure gaps    enum proto_parse_status const status = streambuf_add(&tds_parser->sbuf, parser, parent, way, payload, cap_len, wire_len, now, tot_cap_len, tot_packet);    return status;}
开发者ID:haiwanxue,项目名称:junkie,代码行数:9,


示例21: DOWNCAST

static char const *proto_name(struct proto_info const *info){    if (info->parser->proto->code == PROTO_CODE_DISCOVERY) {        struct discovery_proto_info const *pipi = DOWNCAST(info, info, discovery_proto_info);        return pipi->protocol.name;    }    return info->parser->proto->name;}
开发者ID:Mybrc91,项目名称:junkie,代码行数:9,


示例22: DOWNCAST

static char const *udp_info_2_str(struct proto_info const *info_){    struct udp_proto_info const *info = DOWNCAST(info_, info, udp_proto_info);    char *str = tempstr();    snprintf(str, TEMPSTR_SIZE, "%s, ports=%"PRIu16"->%"PRIu16,        proto_info_2_str(info_),        info->key.port[0], info->key.port[1]);    return str;}
开发者ID:IAmAnubhavSaini,项目名称:junkie,代码行数:9,


示例23: DOWNCAST

static char const *cifs_info_2_str(struct proto_info const *info_){    struct cifs_proto_info const *info = DOWNCAST(info_, info, cifs_proto_info);    char *str = tempstr_printf("%s, command=%#04x, status=0x%08"PRIx32,            proto_info_2_str(info_),            info->command,            info->status);    return str;}
开发者ID:IAmAnubhavSaini,项目名称:junkie,代码行数:9,


示例24: DOWNCAST

static char const *cap_info_2_str(struct proto_info const *info_){    struct cap_proto_info const *info = DOWNCAST(info_, info, cap_proto_info);    char *str = tempstr();    snprintf(str, TEMPSTR_SIZE, "%s, dev_id=%u, tv=%s",        proto_info_2_str(info_),        info->dev_id,        timeval_2_str(&info->tv));    return str;}
开发者ID:bonnefoa,项目名称:junkie,代码行数:10,


示例25: DOWNCAST

static char const *rtp_info_2_str(struct proto_info const *info_){    struct rtp_proto_info const *info = DOWNCAST(info_, info, rtp_proto_info);    char *str = tempstr();    snprintf(str, TEMPSTR_SIZE, "%s, payload_type=%s, SSRC=%"PRIu32", seqnum=%"PRIu16", timestamp=%"PRIu32,        proto_info_2_str(info_), rtp_payload_type_2_str(info->payload_type), info->sync_src, info->seq_num, info->timestamp);    return str;}
开发者ID:IAmAnubhavSaini,项目名称:junkie,代码行数:10,


示例26: eth_deserialize

static void eth_deserialize(struct proto_info *info_, uint8_t const **buf){    struct eth_proto_info *info = DOWNCAST(info_, info, eth_proto_info);    proto_info_deserialize(info_, buf);    info->vlan_id = deserialize_3(buf);    if (info->vlan_id == 0xffffff) info->vlan_id = -1;    deserialize_n(buf, info->addr[0], ETH_ADDR_LEN);    deserialize_n(buf, info->addr[1], ETH_ADDR_LEN);    info->protocol = deserialize_2(buf);}
开发者ID:bsmr-c-cpp,项目名称:junkie,代码行数:10,


示例27: sdp_deserialize

static void sdp_deserialize(struct proto_info *info_, uint8_t const **buf){    struct sdp_proto_info *info = DOWNCAST(info_, info, sdp_proto_info);    proto_info_deserialize(info_, buf);    info->set_values = deserialize_1(buf);    if (info->set_values & SDP_HOST_SET)        ip_addr_deserialize(&info->host, buf);    if (info->set_values & SDP_PORT_SET)        info->port = deserialize_2(buf);}
开发者ID:Mybrc91,项目名称:junkie,代码行数:10,


示例28: DOWNCAST

static char const *fcoe_info_2_str(struct proto_info const *info_){    struct fcoe_proto_info *info = DOWNCAST(info_, info, fcoe_proto_info);    char *str = tempstr();    snprintf(str, TEMPSTR_SIZE, "%s, version=%d, sof=0x%02x, eof=0x%02x",             proto_info_2_str(info_),             info->version,             info->sof,             info->eof);    return str;}
开发者ID:IAmAnubhavSaini,项目名称:junkie,代码行数:11,


示例29: dup_callback

static void dup_callback(struct proto_subscriber unused_ *s, struct proto_info const *last, size_t cap_len, uint8_t const unused_ *packet, struct timeval const unused_ *now){    struct dedup_proto_info *dedup = DOWNCAST(last, info, dedup_proto_info);    mutex_lock(&dup_lock);    init();    unsigned const b = MIN(nb_buckets-1, dedup->dt / bucket_width);    nb_dups ++;    sz_dups += cap_len;    dups[b] ++;    mutex_unlock(&dup_lock);}
开发者ID:rixed,项目名称:junkie,代码行数:11,


示例30: dhcp_serialize

static void dhcp_serialize(struct proto_info const *info_, uint8_t **buf){    struct dhcp_proto_info const *info = DOWNCAST(info_, info, dhcp_proto_info);    proto_info_serialize(info_, buf);    serialize_1(buf, info->hw_addr_is_eth + (info->opcode << 1U));    serialize_4(buf, info->xid);    serialize_1(buf, info->set_values);    if (info->set_values & DHCP_CLIENT_SET) ip_addr_serialize(&info->client, buf);    serialize_n(buf, info->client_mac, sizeof(info->client_mac));    serialize_str(buf, info->server_name);}
开发者ID:bonnefoa,项目名称:junkie,代码行数:11,



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


C++ DO_ANI函数代码示例
C++ DOUT函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。