• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ASSERTN函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: bus_write

int bus_write(struct bus_t *self_p,
              int id,
              const void *buf_p,
              size_t size)
{
    ASSERTN(self_p != NULL, EINVAL);
    ASSERTN(buf_p != NULL, EINVAL);
    ASSERTN(size > 0, EINVAL);

    int number_of_receivers;
    struct bus_listener_t *curr_p;

    rwlock_reader_take(&self_p->rwlock);

    curr_p = (struct bus_listener_t *)binary_tree_search(
        &self_p->listeners, id);
    number_of_receivers = 0;

    while (curr_p != NULL) {
        ((struct chan_t *)curr_p->chan_p)->write(curr_p->chan_p,
                                                 buf_p,
                                                 size);
        number_of_receivers++;
        curr_p = curr_p->next_p;
    }

    rwlock_reader_give(&self_p->rwlock);

    return (number_of_receivers);
}
开发者ID:eerimoq,项目名称:simba,代码行数:30,代码来源:bus.c


示例2: settings_write_by_name

ssize_t settings_write_by_name(const char *name_p,
                               const void *src_p,
                               size_t size)
{
    ASSERTN(name_p != NULL, EINVAL);
    ASSERTN(src_p != NULL, EINVAL);
    ASSERTN(size > 0, EINVAL);

    const FAR struct setting_t *setting_p;

    /* Find the setting in the settings array. */
    setting_p = &settings[0];

    while (setting_p->name_p != NULL) {
        if (std_strcmp(name_p, setting_p->name_p) == 0) {
            if (size > setting_p->size) {
                return (-1);
            }

            return (settings_write(setting_p->address, src_p, size));
        }

        setting_p++;
    }

    return (-1);
}
开发者ID:eerimoq,项目名称:simba,代码行数:27,代码来源:settings.c


示例3: spi_init

int spi_init(struct spi_driver_t *self_p,
             struct spi_device_t *dev_p,
             struct pin_device_t *ss_pin_p,
             int mode,
             int speed,
             int polarity,
             int phase)
{
    ASSERTN(self_p != NULL, EINVAL);
    ASSERTN(dev_p != NULL, EINVAL);
    ASSERTN(ss_pin_p != NULL, EINVAL);

    self_p->dev_p = dev_p;
    self_p->mode = mode;
    self_p->speed = speed;
    self_p->polarity = polarity;
    self_p->phase = phase;

    return (spi_port_init(self_p,
                          dev_p,
                          ss_pin_p,
                          mode,
                          speed,
                          polarity,
                          phase));
}
开发者ID:eerimoq,项目名称:simba,代码行数:26,代码来源:spi.c


示例4: queue_init

int queue_init(struct queue_t *self_p,
               void *buf_p,
               size_t size)
{
    ASSERTN(self_p != NULL, EINVAL);
    ASSERTN((buf_p == NULL)
            || ((buf_p != NULL) && (size > 0)), EINVAL);

    chan_init(&self_p->base,
              (chan_read_fn_t)queue_read,
              (chan_write_fn_t)queue_write,
              (chan_size_fn_t)queue_size);
    chan_set_write_isr_cb(&self_p->base, (chan_write_fn_t)queue_write_isr);

    self_p->buffer.begin_p = buf_p;
    self_p->buffer.read_p = buf_p;
    self_p->buffer.write_p = buf_p;
    self_p->buffer.end_p = &((char*)buf_p)[size];
    self_p->buffer.size = size;

    self_p->state = QUEUE_STATE_INITIALIZED;

    self_p->buf_p = NULL;
    self_p->size = 0;
    self_p->left = 0;

    return (0);
}
开发者ID:eerimoq,项目名称:simba,代码行数:28,代码来源:queue.c


示例5: heap_free

int heap_free(struct heap_t *self_p,
              void *buf_p)
{
    ASSERTN(self_p != NULL, EINVAL);
    ASSERTN(buf_p != NULL, EINVAL);

    int count;
    struct heap_buffer_header_t *header_p;

    header_p = &((struct heap_buffer_header_t *)buf_p)[-1];

    sys_lock();

    if (header_p->count > 0) {
        header_p->count--;
        count = header_p->count;
        
        /* Free when count is zero. */
        if (count == 0) {
            if (header_p->u.fixed_p != NULL) {
                count = free_fixed_size(self_p, header_p);
            } else {
                count = free_dynamic_buffer(self_p, header_p);
            }
        }
    } else {
        count = -1;
    }

    sys_unlock();

    return (count);
}
开发者ID:eerimoq,项目名称:simba,代码行数:33,代码来源:heap.c


示例6: http_server_init

int http_server_init(struct http_server_t *self_p,
                     struct http_server_listener_t *listener_p,
                     struct http_server_connection_t *connections_p,
                     const char *root_path_p,
                     const struct http_server_route_t *routes_p,
                     http_server_route_callback_t on_no_route)
{
    ASSERTN(self_p != NULL, EINVAL);
    ASSERTN(listener_p != NULL, EINVAL)
    ASSERTN(connections_p != NULL, EINVAL);
    ASSERTN(routes_p != NULL, EINVAL);
    ASSERTN(on_no_route != NULL, EINVAL);

    struct http_server_connection_t *connection_p;

    self_p->listener_p = listener_p;
    self_p->connections_p = connections_p;
    self_p->root_path_p = root_path_p;
    self_p->routes_p = routes_p;
    self_p->on_no_route = on_no_route;

    connection_p = self_p->connections_p;

    while (connection_p->thrd.name_p != NULL) {
        connection_p->state = http_server_connection_state_free_t;
        connection_p->self_p = self_p;
        event_init(&connection_p->events);

        connection_p++;
    }

    event_init(&self_p->events);

    return (0);
}
开发者ID:eerimoq,项目名称:simba,代码行数:35,代码来源:http_server.c


示例7: event_read

ssize_t event_read(struct event_t *self_p,
                   void *buf_p,
                   size_t size)
{
    ASSERTN(self_p != NULL, EINVAL);
    ASSERTN(buf_p != NULL, EINVAL);
    ASSERTN(size == sizeof(uint32_t), EINVAL);

    uint32_t *mask_p, mask;

    mask_p = (uint32_t *)buf_p;

    sys_lock();

    mask = (self_p->mask & *mask_p);

    /* Event already set? Otherwise wait for it. */
    if (mask != 0) {
        *mask_p = mask;
    } else {
        self_p->base.reader_p = thrd_self();
        thrd_suspend_isr(NULL);
        *mask_p = (self_p->mask & *mask_p);
    }

    /* Remove read events from the event channel. */
    self_p->mask &= (~(*mask_p));

    sys_unlock();

    return (size);
}
开发者ID:eerimoq,项目名称:simba,代码行数:32,代码来源:event.c


示例8: pin_write

int pin_write(struct pin_driver_t *self_p, int value)
{
    ASSERTN(self_p != NULL, EINVAL);
    ASSERTN((value == 0) || (value == 1), EINVAL);

    return (pin_port_write(self_p, value));
}
开发者ID:eerimoq,项目名称:simba,代码行数:7,代码来源:pin.c


示例9: network_interface_wifi_init

int network_interface_wifi_init(struct network_interface_wifi_t *self_p,
                                const char *name_p,
                                struct network_interface_wifi_driver_t *driver_p,
                                void *arg_p,
                                const char *ssid_p,
                                const char *password_p)
{
    ASSERTN(self_p != NULL, EINVAL);
    ASSERTN(name_p != NULL, EINVAL);
    ASSERTN(driver_p != NULL, EINVAL);
    ASSERTN(ssid_p != NULL, EINVAL);

    self_p->network_interface.name_p = name_p;
    self_p->network_interface.start =
        (network_interface_start_t)network_interface_wifi_start;
    self_p->network_interface.stop =
        (network_interface_stop_t)network_interface_wifi_stop;
    self_p->network_interface.is_up =
        (network_interface_is_up_t)network_interface_wifi_is_up;
    self_p->network_interface.set_ip_info =
        (network_interface_set_ip_info_t)network_interface_wifi_set_ip_info;
    self_p->network_interface.get_ip_info =
        (network_interface_get_ip_info_t)network_interface_wifi_get_ip_info;

    self_p->driver_p = driver_p;
    self_p->arg_p = arg_p;
    self_p->ssid_p = ssid_p;
    self_p->password_p = password_p;
    self_p->info_p = NULL;

    /* Initialize the driver. */
    driver_p->init(arg_p);
    
    return (0);
}
开发者ID:wuwx,项目名称:simba,代码行数:35,代码来源:wifi.c


示例10: settings_read

ssize_t settings_read(void *dst_p, size_t src, size_t size)
{
    ASSERTN(dst_p != NULL, EINVAL);
    ASSERTN(src >= 0, EINVAL);
    ASSERTN(size > 0, EINVAL);

    return (settings_port_read(dst_p, src, size));
}
开发者ID:eerimoq,项目名称:simba,代码行数:8,代码来源:settings.c


示例11: settings_write

ssize_t settings_write(size_t dst, const void *src_p, size_t size)
{
    ASSERTN(dst >= 0, EINVAL);
    ASSERTN(src_p != NULL, EINVAL);
    ASSERTN(size > 0, EINVAL);

    return (settings_port_write(dst, src_p, size));
}
开发者ID:eerimoq,项目名称:simba,代码行数:8,代码来源:settings.c


示例12: network_interface_wifi_get_ip_info

int network_interface_wifi_get_ip_info(struct network_interface_wifi_t *self_p,
                                       struct inet_if_ip_info_t *info_p)
{
    ASSERTN(self_p != NULL, EINVAL);
    ASSERTN(info_p != NULL, EINVAL);

    return (self_p->driver_p->get_ip_info(self_p->arg_p, info_p));
}
开发者ID:wuwx,项目名称:simba,代码行数:8,代码来源:wifi.c


示例13: spi_get

ssize_t spi_get(struct spi_driver_t *self_p,
                uint8_t *data_p)
{
    ASSERTN(self_p != NULL, EINVAL);
    ASSERTN(data_p != NULL, EINVAL);

    return (spi_read(self_p, data_p, 1));
}
开发者ID:eerimoq,项目名称:simba,代码行数:8,代码来源:spi.c


示例14: spi_read

ssize_t spi_read(struct spi_driver_t *self_p,
                 void *rxbuf_p,
                 size_t size)
{
    ASSERTN(self_p != NULL, EINVAL);
    ASSERTN(rxbuf_p != NULL, EINVAL);
    ASSERTN(size > 0, EINVAL);

    return (spi_transfer(self_p, rxbuf_p, NULL, size));
}
开发者ID:eerimoq,项目名称:simba,代码行数:10,代码来源:spi.c


示例15: can_read

ssize_t can_read(struct can_driver_t *self_p,
                 struct can_frame_t *frame_p,
                 size_t size)
{
    ASSERTN(self_p != NULL, EINVAL);
    ASSERTN(frame_p != NULL, EINVAL);
    ASSERTN(size > 0, EINVAL);

    return (queue_read(&self_p->chin, frame_p, size));
}
开发者ID:wuwx,项目名称:simba,代码行数:10,代码来源:can.c


示例16: spi_write

ssize_t spi_write(struct spi_driver_t *self_p,
                  const void *txbuf_p,
                  size_t size)
{
    ASSERTN(self_p != NULL, EINVAL);
    ASSERTN(txbuf_p != NULL, EINVAL);
    ASSERTN(size > 0, EINVAL);

    return (spi_transfer(self_p, NULL, txbuf_p, size));
}
开发者ID:eerimoq,项目名称:simba,代码行数:10,代码来源:spi.c


示例17: dac_convert

int dac_convert(struct dac_driver_t *self_p,
                uint32_t *samples_p,
                size_t length)
{
    ASSERTN(self_p != NULL, EINVAL);
    ASSERTN(samples_p != NULL, EINVAL);
    ASSERTN(length > 0, EINVAL);

    return (dac_port_convert(self_p, samples_p, length));
}
开发者ID:eerimoq,项目名称:simba,代码行数:10,代码来源:dac.c


示例18: can_write

ssize_t can_write(struct can_driver_t *self_p,
                  const struct can_frame_t *frame_p,
                  size_t size)
{
    ASSERTN(self_p != NULL, EINVAL);
    ASSERTN(frame_p != NULL, EINVAL);
    ASSERTN(size > 0, EINVAL);

    return (chan_write(&self_p->base, frame_p, size));
}
开发者ID:wuwx,项目名称:simba,代码行数:10,代码来源:can.c


示例19: spi_transfer

ssize_t spi_transfer(struct spi_driver_t *self_p,
                     void *rxbuf_p,
                     const void *txbuf_p,
                     size_t size)
{
    ASSERTN(self_p != NULL, EINVAL);
    ASSERTN((rxbuf_p != NULL) || (txbuf_p != NULL), EINVAL);
    ASSERTN(size > 0, EINVAL);

    return(spi_port_transfer(self_p, rxbuf_p, txbuf_p, size));
}
开发者ID:eerimoq,项目名称:simba,代码行数:11,代码来源:spi.c


示例20: pin_init

int pin_init(struct pin_driver_t *self_p,
             struct pin_device_t *dev_p,
             int mode)
{
    ASSERTN(self_p != NULL, EINVAL);
    ASSERTN(dev_p != NULL, EINVAL);

    self_p->dev_p = dev_p;

    return (pin_port_init(self_p, dev_p, mode));
}
开发者ID:eerimoq,项目名称:simba,代码行数:11,代码来源:pin.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ASSERTP函数代码示例发布时间:2022-05-30
下一篇:
C++ ASSERTMSG函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap