153c82bd1f7e406770439f24634354211626a72f
4 * Enumeration mapping strings (quarks) from/to integers.
6 * Copyright 2010, 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
19 #include <babeltrace/ctf/types.h>
23 void ctf_enum_read(struct stream_pos
*ppos
, struct definition
*definition
)
25 struct definition_enum
*enum_definition
=
26 container_of(definition
, struct definition_enum
, p
);
27 const struct declaration_enum
*enum_declaration
=
28 enum_definition
->declaration
;
29 struct definition_integer
*integer_definition
=
30 enum_definition
->integer
;
31 const struct declaration_integer
*integer_declaration
=
32 integer_definition
->declaration
;
35 ctf_integer_read(ppos
, &integer_definition
->p
);
36 if (!integer_declaration
->signedness
)
37 qs
= enum_uint_to_quark_set(enum_declaration
,
38 integer_definition
->value
._unsigned
);
40 qs
= enum_int_to_quark_set(enum_declaration
,
41 integer_definition
->value
._signed
);
43 /* unref previous quark set */
44 if (enum_definition
->value
)
45 g_array_unref(enum_definition
->value
);
46 enum_definition
->value
= qs
;
49 void ctf_enum_write(struct stream_pos
*pos
, struct definition
*definition
)
51 struct definition_enum
*enum_definition
=
52 container_of(definition
, struct definition_enum
, p
);
53 struct definition_integer
*integer_definition
=
54 enum_definition
->integer
;
56 ctf_integer_write(pos
, &integer_definition
->p
);
This page took 0.030299 seconds and 3 git commands to generate.