本文整理汇总了C++中bt_get函数的典型用法代码示例。如果您正苦于以下问题:C++ bt_get函数的具体用法?C++ bt_get怎么用?C++ bt_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bt_get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: BT_LOGW
struct bt_clock_value *bt_event_get_clock_value(
struct bt_event *event, struct bt_clock_class *clock_class)
{
struct bt_clock_value *clock_value = NULL;
if (!event || !clock_class) {
BT_LOGW("Invalid parameter: event or clock class is NULL: "
"event-addr=%p, clock-class-addr=%p",
event, clock_class);
goto end;
}
clock_value = g_hash_table_lookup(event->clock_values, clock_class);
if (!clock_value) {
BT_LOGV("No clock value associated to the given clock class: "
"event-addr=%p, event-class-name=\"%s\", "
"event-class-id=%" PRId64 ", clock-class-addr=%p, "
"clock-class-name=\"%s\"", event,
bt_event_class_get_name(event->event_class),
bt_event_class_get_id(event->event_class),
clock_class, bt_clock_class_get_name(clock_class));
goto end;
}
bt_get(clock_value);
end:
return clock_value;
}
开发者ID:abusque,项目名称:babeltrace,代码行数:28,代码来源:event.c
示例2: BT_LOGV
void *bt_get(void *ptr)
{
struct bt_object *obj = ptr;
if (unlikely(!obj)) {
goto end;
}
if (unlikely(!obj->ref_count.release)) {
goto end;
}
if (unlikely(obj->parent && bt_object_get_ref_count(obj) == 0)) {
BT_LOGV("Incrementing object's parent's reference count: "
"addr=%p, parent-addr=%p", ptr, obj->parent);
bt_get(obj->parent);
}
BT_LOGV("Incrementing object's reference count: %lu -> %lu: "
"addr=%p, cur-count=%lu, new-count=%lu",
obj->ref_count.count, obj->ref_count.count + 1,
ptr,
obj->ref_count.count, obj->ref_count.count + 1);
bt_ref_get(&obj->ref_count);
end:
return obj;
}
开发者ID:eepp,项目名称:babeltrace,代码行数:27,代码来源:ref.c
示例3: stack_push
static
int stack_push(struct stack *stack, struct bt_field_type *base_type,
size_t base_len)
{
int ret = 0;
struct stack_entry *entry;
assert(stack);
assert(base_type);
BT_LOGV("Pushing field type on stack: stack-addr=%p, "
"ft-addr=%p, ft-id=%s, base-length=%zu, "
"stack-size-before=%u, stack-size-after=%u",
stack, base_type, bt_field_type_id_string(
bt_field_type_get_type_id(base_type)),
base_len, stack->entries->len, stack->entries->len + 1);
entry = g_new0(struct stack_entry, 1);
if (!entry) {
BT_LOGE("Failed to allocate one stack entry: stack-addr=%p",
stack);
ret = BT_BTR_STATUS_ERROR;
goto end;
}
entry->base_type = base_type;
bt_get(entry->base_type);
entry->base_len = base_len;
g_ptr_array_add(stack->entries, entry);
end:
return ret;
}
开发者ID:eepp,项目名称:babeltrace,代码行数:32,代码来源:btr.c
示例4: bt_ctf_stream_set_packet_context
BT_HIDDEN
int bt_ctf_stream_set_packet_context(struct bt_ctf_stream *stream,
struct bt_ctf_field *field)
{
int ret = 0;
struct bt_ctf_field_type *field_type;
if (!stream || !field || stream->pos.fd < 0) {
ret = -1;
goto end;
}
field_type = bt_ctf_field_get_type(field);
if (bt_ctf_field_type_compare(field_type,
stream->stream_class->packet_context_type)) {
ret = -1;
goto end;
}
bt_put(field_type);
bt_get(field);
bt_put(stream->packet_context);
stream->packet_context = field;
end:
return ret;
}
开发者ID:mjeanson,项目名称:debian-babeltrace,代码行数:26,代码来源:stream.c
示例5: bt_ctf_stream_set_packet_header
BT_HIDDEN
int bt_ctf_stream_set_packet_header(struct bt_ctf_stream *stream,
struct bt_ctf_field *field)
{
int ret = 0;
struct bt_ctf_trace *trace = NULL;
struct bt_ctf_field_type *field_type = NULL;
if (!stream || !field || stream->pos.fd < 0) {
ret = -1;
goto end;
}
trace = (struct bt_ctf_trace *) bt_object_get_parent(stream);
field_type = bt_ctf_field_get_type(field);
if (bt_ctf_field_type_compare(field_type, trace->packet_header_type)) {
ret = -1;
goto end;
}
bt_get(field);
bt_put(stream->packet_header);
stream->packet_header = field;
end:
BT_PUT(trace);
bt_put(field_type);
return ret;
}
开发者ID:mjeanson,项目名称:debian-babeltrace,代码行数:28,代码来源:stream.c
示例6: BT_LOGW_STR
struct bt_stream *bt_event_get_stream(struct bt_event *event)
{
struct bt_stream *stream = NULL;
if (!event) {
BT_LOGW_STR("Invalid parameter: event is NULL.");
goto end;
}
/*
* If the event has a parent, then this is its (writer) stream.
* If the event has no parent, then if it has a packet, this
* is its (non-writer) stream.
*/
if (event->base.parent) {
stream = (struct bt_stream *) bt_object_get_parent(event);
} else {
if (event->packet) {
stream = bt_get(event->packet->stream);
}
}
end:
return stream;
}
开发者ID:abusque,项目名称:babeltrace,代码行数:25,代码来源:event.c
示例7: g_ptr_array_index
struct bt_ctf_clock *bt_ctf_trace_get_clock_by_name(
struct bt_ctf_trace *trace, const char *name)
{
size_t i;
struct bt_ctf_clock *clock = NULL;
if (!trace || !name) {
goto end;
}
for (i = 0; i < trace->clocks->len; ++i) {
struct bt_ctf_clock *cur_clk =
g_ptr_array_index(trace->clocks, i);
const char *cur_clk_name = bt_ctf_clock_get_name(cur_clk);
if (!cur_clk_name) {
goto end;
}
if (!strcmp(cur_clk_name, name)) {
clock = cur_clk;
bt_get(clock);
goto end;
}
}
end:
return clock;
}
开发者ID:brianrob,项目名称:babeltrace,代码行数:29,代码来源:trace.c
示例8: bt_ctf_event_set_stream_event_context
BT_HIDDEN
int bt_ctf_event_set_stream_event_context(struct bt_ctf_event *event,
struct bt_ctf_field *stream_event_context)
{
int ret = 0;
struct bt_ctf_field_type *field_type = NULL;
struct bt_ctf_stream_class *stream_class = NULL;
if (!event || !stream_event_context || event->frozen) {
ret = -1;
goto end;
}
stream_class = bt_ctf_event_class_get_stream_class(event->event_class);
/*
* We should not have been able to create the event without associating
* the event class to a stream class.
*/
assert(stream_class);
field_type = bt_ctf_field_get_type(stream_event_context);
if (bt_ctf_field_type_compare(field_type,
stream_class->event_context_type)) {
ret = -1;
goto end;
}
bt_get(stream_event_context);
BT_MOVE(event->stream_event_context, stream_event_context);
end:
BT_PUT(stream_class);
bt_put(field_type);
return ret;
}
开发者ID:mjeanson,项目名称:debian-babeltrace,代码行数:34,代码来源:event.c
示例9: bt_ctf_event_set_header
BT_HIDDEN
int bt_ctf_event_set_header(struct bt_ctf_event *event,
struct bt_ctf_field *header)
{
int ret = 0;
struct bt_ctf_field_type *field_type = NULL;
struct bt_ctf_stream_class *stream_class = NULL;
if (!event || !header || event->frozen) {
ret = -1;
goto end;
}
stream_class = (struct bt_ctf_stream_class *) bt_object_get_parent(
event->event_class);
/*
* Ensure the provided header's type matches the one registered to the
* stream class.
*/
field_type = bt_ctf_field_get_type(header);
if (bt_ctf_field_type_compare(field_type,
stream_class->event_header_type)) {
ret = -1;
goto end;
}
bt_get(header);
bt_put(event->event_header);
event->event_header = header;
end:
bt_put(stream_class);
bt_put(field_type);
return ret;
}
开发者ID:mjeanson,项目名称:debian-babeltrace,代码行数:34,代码来源:event.c
示例10: bt_ctf_event_set_event_context
BT_HIDDEN
int bt_ctf_event_set_event_context(struct bt_ctf_event *event,
struct bt_ctf_field *context)
{
int ret = 0;
struct bt_ctf_field_type *field_type = NULL;
if (!event || !context || event->frozen) {
ret = -1;
goto end;
}
field_type = bt_ctf_field_get_type(context);
if (bt_ctf_field_type_compare(field_type,
event->event_class->context)) {
ret = -1;
goto end;
}
bt_get(context);
bt_put(event->context_payload);
event->context_payload = context;
end:
bt_put(field_type);
return ret;
}
开发者ID:mjeanson,项目名称:debian-babeltrace,代码行数:26,代码来源:event.c
示例11: bt_ctf_event_set_payload_field
BT_HIDDEN
int bt_ctf_event_set_payload_field(struct bt_ctf_event *event,
struct bt_ctf_field *payload)
{
int ret = 0;
struct bt_ctf_field_type *payload_type = NULL;
if (!event || !payload || event->frozen) {
ret = -1;
goto end;
}
payload_type = bt_ctf_field_get_type(payload);
if (!payload_type) {
ret = -1;
goto end;
}
if (bt_ctf_field_type_get_type_id(payload_type) !=
CTF_TYPE_STRUCT) {
ret = -1;
goto end;
}
bt_get(payload);
bt_put(event->fields_payload);
event->fields_payload = payload;
end:
bt_put(payload_type);
return ret;
}
开发者ID:mjeanson,项目名称:debian-babeltrace,代码行数:32,代码来源:event.c
示例12: bt_ctf_event_set_payload
int bt_ctf_event_set_payload(struct bt_ctf_event *event,
const char *name,
struct bt_ctf_field *payload)
{
int ret = 0;
if (!event || !payload || event->frozen) {
ret = -1;
goto end;
}
if (name) {
ret = bt_ctf_field_structure_set_field(event->fields_payload,
name, payload);
} else {
struct bt_ctf_field_type *payload_type;
payload_type = bt_ctf_field_get_type(payload);
if (bt_ctf_field_type_compare(payload_type,
event->event_class->fields) == 0) {
bt_put(event->fields_payload);
bt_get(payload);
event->fields_payload = payload;
} else {
ret = -1;
}
bt_put(payload_type);
}
end:
return ret;
}
开发者ID:mjeanson,项目名称:debian-babeltrace,代码行数:33,代码来源:event.c
示例13: bt_object_get_parent
BT_HIDDEN
struct bt_ctf_stream *bt_ctf_event_get_stream(struct bt_ctf_event *event)
{
struct bt_ctf_stream *stream = NULL;
if (!event) {
goto end;
}
/*
* If the event has a parent, then this is its (writer) stream.
* If the event has no parent, then if it has a packet, this
* is its (non-writer) stream.
*/
if (event->base.parent) {
stream = (struct bt_ctf_stream *) bt_object_get_parent(event);
} else {
if (event->packet) {
stream = bt_get(event->packet->stream);
}
}
end:
return stream;
}
开发者ID:mjeanson,项目名称:debian-babeltrace,代码行数:25,代码来源:event.c
示例14: bt_ctf_packet_get_stream
BT_HIDDEN
struct bt_ctf_packet *trimmer_new_packet(
struct trimmer_iterator *trim_it,
struct bt_ctf_packet *packet)
{
struct bt_ctf_stream *stream = NULL;
struct bt_ctf_field *writer_packet_context = NULL;
struct bt_ctf_packet *writer_packet = NULL;
int int_ret;
stream = bt_ctf_packet_get_stream(packet);
if (!stream) {
fprintf(trim_it->err, "[error] %s in %s:%d\n",
__func__, __FILE__, __LINE__);
goto error;
}
/*
* If a packet was already opened, close it and remove it from
* the HT.
*/
writer_packet = lookup_packet(trim_it, packet);
if (writer_packet) {
g_hash_table_remove(trim_it->packet_map, packet);
BT_PUT(writer_packet);
}
writer_packet = insert_new_packet(trim_it, packet, stream);
if (!writer_packet) {
fprintf(trim_it->err, "[error] %s in %s:%d\n",
__func__, __FILE__, __LINE__);
goto error;
}
bt_get(writer_packet);
writer_packet_context = ctf_copy_packet_context(trim_it->err, packet,
stream);
if (!writer_packet_context) {
fprintf(trim_it->err, "[error] %s in %s:%d\n",
__func__, __FILE__, __LINE__);
goto error;
}
int_ret = bt_ctf_packet_set_context(writer_packet, writer_packet_context);
if (int_ret) {
fprintf(trim_it->err, "[error] %s in %s:%d\n",
__func__, __FILE__, __LINE__);
goto error;
}
goto end;
error:
BT_PUT(writer_packet);
end:
bt_put(writer_packet_context);
bt_put(stream);
return writer_packet;
}
开发者ID:jdesfossez,项目名称:babeltrace-dev,代码行数:59,代码来源:copy.c
示例15: bt_ctf_stream_append_event
int bt_ctf_stream_append_event(struct bt_ctf_stream *stream,
struct bt_ctf_event *event)
{
int ret = 0;
struct bt_ctf_field *event_context_copy = NULL;
if (!stream || !event) {
ret = -1;
goto end;
}
ret = bt_ctf_event_set_stream(event, stream);
if (ret) {
/* Event was already associated to a stream */
ret = -1;
goto end;
}
ret = bt_ctf_event_populate_event_header(event);
if (ret) {
goto end;
}
/* Make sure the event's payload is set */
ret = bt_ctf_event_validate(event);
if (ret) {
goto end;
}
/* Sample the current stream event context by copying it */
if (stream->event_context) {
/* Make sure the event context's payload is set */
ret = bt_ctf_field_validate(stream->event_context);
if (ret) {
goto end;
}
event_context_copy = bt_ctf_field_copy(stream->event_context);
if (!event_context_copy) {
ret = -1;
goto end;
}
}
bt_get(event);
/* Save the new event along with its associated stream event context */
g_ptr_array_add(stream->events, event);
if (event_context_copy) {
g_ptr_array_add(stream->event_contexts, event_context_copy);
}
end:
if (ret) {
(void) bt_ctf_event_set_stream(event, NULL);
}
return ret;
}
开发者ID:brianrob,项目名称:babeltrace,代码行数:56,代码来源:stream.c
示例16: bt_get
BT_HIDDEN
struct bt_ctf_field *bt_ctf_event_get_payload_field(struct bt_ctf_event *event)
{
struct bt_ctf_field *payload = NULL;
if (!event || !event->fields_payload) {
goto end;
}
payload = event->fields_payload;
bt_get(payload);
end:
return payload;
}
开发者ID:mjeanson,项目名称:debian-babeltrace,代码行数:14,代码来源:event.c
示例17: bt_get
struct bt_ctf_stream_class *bt_ctf_stream_get_class(
struct bt_ctf_stream *stream)
{
struct bt_ctf_stream_class *stream_class = NULL;
if (!stream) {
goto end;
}
stream_class = stream->stream_class;
bt_get(stream_class);
end:
return stream_class;
}
开发者ID:brianrob,项目名称:babeltrace,代码行数:14,代码来源:stream.c
示例18: bt_get
struct bt_ctf_field_type *bt_ctf_trace_get_packet_header_type(
struct bt_ctf_trace *trace)
{
struct bt_ctf_field_type *field_type = NULL;
if (!trace) {
goto end;
}
bt_get(trace->packet_header_type);
field_type = trace->packet_header_type;
end:
return field_type;
}
开发者ID:brianrob,项目名称:babeltrace,代码行数:14,代码来源:trace.c
示例19: g_new0
struct bt_notification *bt_notification_event_create(struct bt_ctf_event *event,
struct bt_clock_class_priority_map *cc_prio_map)
{
struct bt_notification_event *notification = NULL;
if (!event || !cc_prio_map) {
goto error;
}
if (!bt_ctf_event_borrow_packet(event)) {
goto error;
}
if (!event_has_trace(event)) {
goto error;
}
notification = g_new0(struct bt_notification_event, 1);
if (!notification) {
goto error;
}
bt_notification_init(¬ification->parent,
BT_NOTIFICATION_TYPE_EVENT,
bt_notification_event_destroy);
notification->event = bt_get(event);
notification->cc_prio_map = bt_get(cc_prio_map);
if (!validate_clock_classes(notification)) {
goto error;
}
bt_ctf_event_freeze(notification->event);
bt_clock_class_priority_map_freeze(notification->cc_prio_map);
return ¬ification->parent;
error:
bt_put(notification);
return NULL;
}
开发者ID:jdesfossez,项目名称:babeltrace-dev,代码行数:37,代码来源:event.c
示例20: bt_ctf_event_set_packet
BT_HIDDEN
int bt_ctf_event_set_packet(struct bt_ctf_event *event,
struct bt_ctf_packet *packet)
{
struct bt_ctf_stream_class *event_stream_class = NULL;
struct bt_ctf_stream_class *packet_stream_class = NULL;
struct bt_ctf_stream *stream = NULL;
int ret = 0;
if (!event || !packet || event->frozen) {
ret = -1;
goto end;
}
/*
* Make sure the new packet was created by this event's
* stream, if it is set.
*/
stream = bt_ctf_event_get_stream(event);
if (stream) {
if (packet->stream != stream) {
ret = -1;
goto end;
}
} else {
event_stream_class =
bt_ctf_event_class_get_stream_class(event->event_class);
packet_stream_class =
bt_ctf_stream_get_class(packet->stream);
assert(event_stream_class);
assert(packet_stream_class);
if (event_stream_class != packet_stream_class) {
ret = -1;
goto end;
}
}
bt_get(packet);
BT_MOVE(event->packet, packet);
end:
BT_PUT(stream);
BT_PUT(event_stream_class);
BT_PUT(packet_stream_class);
return ret;
}
开发者ID:mjeanson,项目名称:debian-babeltrace,代码行数:49,代码来源:event.c
注:本文中的bt_get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论