Rework about dialog by using gtk_show_about_dialog
[lttv.git] / ltt / ltt-types.h
CommitLineData
b240042f 1/* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2004-2005 Mathieu Desnoyers
3 *
1b44b0b5 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License Version 2.1 as published by the Free Software Foundation.
b240042f 7 *
1b44b0b5 8 * This library is distributed in the hope that it will be useful,
b240042f 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1b44b0b5 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
b240042f 12 *
1b44b0b5 13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the
15 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 * Boston, MA 02111-1307, USA.
b240042f 17 */
18
19#ifndef LTT_TYPES_H
20#define LTT_TYPES_H
21
22/* Set of functions to access the types portably, given the trace as parameter.
23 * */
24
25#include <ltt/ltt.h>
b240042f 26#include <glib.h>
0f7f40c1 27#include <ltt/time.h>
b240042f 28
29
30/*****************************************************************************
31 *Function name
32 * ltt_get_int64 : get a 64 bits integer number
33 *Input params
34 * ptr : pointer to the integer
35 *Return value
36 * gint64 : a 64 bits integer
37 *
38 * Takes care of endianness
39 *
40 ****************************************************************************/
41
0f7f40c1 42static inline gint64 ltt_get_int64(gboolean reverse_byte_order, void *ptr)
b240042f 43{
0f7f40c1 44 guint64 value = *(guint64*)ptr;
45 return (gint64) (reverse_byte_order ? GUINT64_SWAP_LE_BE(value): value);
b240042f 46}
47
48
0f7f40c1 49static inline guint64 ltt_get_uint64(gboolean reverse_byte_order, void *ptr)
b240042f 50{
0f7f40c1 51 guint64 value = *(guint64*)ptr;
52 return (guint64) (reverse_byte_order ? GUINT64_SWAP_LE_BE(value): value);
b240042f 53}
54
0f7f40c1 55static inline gint32 ltt_get_int32(gboolean reverse_byte_order, void *ptr)
b240042f 56{
0f7f40c1 57 guint32 value = *(guint32*)ptr;
58 return (gint32) (reverse_byte_order ? GUINT32_SWAP_LE_BE(value): value);
b240042f 59}
60
0f7f40c1 61static inline guint32 ltt_get_uint32(gboolean reverse_byte_order, void *ptr)
b240042f 62{
0f7f40c1 63 guint32 value = *(guint32*)ptr;
64 return (guint32) (reverse_byte_order ? GUINT32_SWAP_LE_BE(value): value);
b240042f 65}
66
0f7f40c1 67static inline gint16 ltt_get_int16(gboolean reverse_byte_order, void *ptr)
b240042f 68{
0f7f40c1 69 guint16 value = *(guint16*)ptr;
70 return (gint16) (reverse_byte_order ? GUINT16_SWAP_LE_BE(value): value);
b240042f 71}
72
0f7f40c1 73static inline guint16 ltt_get_uint16(gboolean reverse_byte_order, void *ptr)
b240042f 74{
0f7f40c1 75 guint16 value = *(guint16*)ptr;
76 return (guint16) (reverse_byte_order ? GUINT16_SWAP_LE_BE(value): value);
77}
78
79static inline LttTime ltt_get_time(gboolean reverse_byte_order, void *ptr)
80{
81 LttTime output;
82
e4035e18 83 output.tv_sec = ltt_get_uint32(reverse_byte_order, ptr);
84 ptr += sizeof(guint32);
85 output.tv_nsec = ltt_get_uint32(reverse_byte_order, ptr);
0f7f40c1 86
87 return output;
b240042f 88}
89
90#endif // LTT_TYPES_H
This page took 0.059904 seconds and 4 git commands to generate.