use realpath to get the absolute pathname, fixes some forgotten cases, especially...
[lttv.git] / ltt / branches / poly / include / lttv / attribute.h
CommitLineData
9c312311 1/* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 Michel Dagenais
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
16 * MA 02111-1307, USA.
17 */
18
c5d77517 19#ifndef ATTRIBUTE_H
20#define ATTRIBUTE_H
21
dc877563 22#include <glib-object.h>
23#include <lttv/iattribute.h>
c5d77517 24
dc877563 25#define LTTV_ATTRIBUTE_TYPE (lttv_attribute_get_type ())
26#define LTTV_ATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LTTV_ATTRIBUTE_TYPE, LttvAttribute))
27#define LTTV_ATTRIBUTE_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), LTTV_ATTRIBUTE_TYPE, LttvAttributeClass))
28#define LTTV_IS_ATTRIBUTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LTTV_ATTRIBUTE_TYPE))
29#define LTTV_IS_ATTRIBUTE_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), LTTV_ATTRIBUTE_TYPE))
30#define LTTV_ATTRIBUTE_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), LTTV_ATTRIBUTE_TYPE, LttvAttributeClass))
c5d77517 31
c5d77517 32
dc877563 33typedef struct _LttvAttribute LttvAttribute;
34typedef struct _LttvAttributeClass LttvAttributeClass;
c5d77517 35
dc877563 36struct _LttvAttribute {
37 GObject parent;
c5d77517 38
dc877563 39 /* private members */
40 GHashTable *names;
41 GArray *attributes;
42};
c5d77517 43
dc877563 44struct _LttvAttributeClass {
45 GObjectClass parent;
46};
c5d77517 47
dc877563 48GType lttv_attribute_get_type (void);
c5d77517 49
c5d77517 50
dc877563 51/* The functions exported in the IAttribute interface are also available
52 directly. */
c5d77517 53
c5d77517 54
dc877563 55/* Total number of attributes */
c5d77517 56
dc877563 57unsigned int lttv_attribute_get_number(LttvAttribute *self);
c5d77517 58
c5d77517 59
dc877563 60/* Container type. Named (fields in struct or elements in a hash table)
61 or unnamed (elements in an array) attributes, homogeneous type or not. */
c5d77517 62
dc877563 63gboolean lttv_attribute_named(LttvAttribute *self, gboolean *homogeneous);
c5d77517 64
65
dc877563 66/* Get the i th attribute along with its type and a pointer to its value. */
c5d77517 67
dc877563 68LttvAttributeType lttv_attribute_get(LttvAttribute *self, unsigned i,
69 LttvAttributeName *name, LttvAttributeValue *v);
70
c5d77517 71
dc877563 72/* Get the named attribute in the table along with its type and a pointer to
73 its value. If the named attribute does not exist, the type is LTTV_NONE. */
c5d77517 74
dc877563 75LttvAttributeType lttv_attribute_get_by_name(LttvAttribute *self,
76 LttvAttributeName name, LttvAttributeValue *v);
c5d77517 77
78
dc877563 79/* Add an attribute, which must not exist. The name is an empty string for
80 containers with unnamed attributes. */
c5d77517 81
dc877563 82LttvAttributeValue lttv_attribute_add(LttvAttribute *self,
83 LttvAttributeName name, LttvAttributeType t);
c5d77517 84
c5d77517 85
dc877563 86/* Remove an attribute */
c5d77517 87
dc877563 88void lttv_attribute_remove(LttvAttribute *self, unsigned i);
c5d77517 89
dc877563 90void lttv_attribute_remove_by_name(LttvAttribute *self,
91 LttvAttributeName name);
c5d77517 92
c5d77517 93
dc877563 94/* Create an empty iattribute object and add it as an attribute under the
95 specified name, or return an existing iattribute attribute. If an
96 attribute of that name already exists but is not a GObject supporting the
97 iattribute interface, return NULL. */
1b82f325 98
b445142a 99LttvAttribute* lttv_attribute_find_subdir(LttvAttribute *self,
dc877563 100 LttvAttributeName name);
1b82f325 101
dc877563 102gboolean lttv_attribute_find(LttvAttribute *self, LttvAttributeName name,
103 LttvAttributeType t, LttvAttributeValue *v);
1b82f325 104
1b82f325 105
b445142a 106/* Free recursively a tree of attributes. All contained gobject of type
107 LttvAttribute are freed (unreferenced) recursively. */
108
109void lttv_attribute_recursive_free(LttvAttribute *self);
110
111/* Add items from a tree of attributes to another tree. */
112
113void lttv_attribute_recursive_add(LttvAttribute *dest, LttvAttribute *src);
114
c5d77517 115#endif // ATTRIBUTE_H
This page took 0.031324 seconds and 4 git commands to generate.