4 * Enumeration mapping strings (quarks) from/to integers.
6 * Copyright 2010 - 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 GQuark
ctf_enum_read(struct stream_pos
*pos
,
24 const struct type_class_enum
*src
)
26 const struct type_class_integer
*int_class
= &src
->p
;
28 if (!int_class
->signedness
) {
31 v
= ctf_uint_read(pos
, int_class
);
32 return enum_uint_to_quark(src
, v
);
36 v
= ctf_int_read(pos
, int_class
);
37 return enum_int_to_quark(src
, v
);
41 void ctf_enum_write(struct stream_pos
*pos
,
42 const struct type_class_enum
*dest
,
45 const struct type_class_integer
*int_class
= &dest
->p
;
47 if (!int_class
->signedness
) {
50 v
= enum_quark_to_uint(dest
, q
);
51 ctf_uint_write(pos
, int_class
, v
);
55 v
= enum_quark_to_int(dest
, q
);
56 ctf_int_write(pos
, int_class
, v
);
This page took 0.030147 seconds and 4 git commands to generate.