1
/* rygel-environment-test.c generated by valac 0.18.1, the Vala compiler
2
* generated from rygel-environment-test.vala, do not modify */
5
* Copyright (C) 2012 Intel Corporation.
7
* Author: Jens Georg <jensg@openismus.com>
9
* This file is part of Rygel.
11
* Rygel is free software; you can redistribute it and/or modify
12
* it under the terms of the GNU Lesser General Public License as published by
13
* the Free Software Foundation; either version 2 of the License, or
14
* (at your option) any later version.
16
* Rygel is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Lesser General Public License for more details.
21
* You should have received a copy of the GNU Lesser General Public License
22
* along with this program; if not, write to the Free Software Foundation,
23
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27
#include <glib-object.h>
31
#include <gobject/gvaluecollector.h>
34
#define TYPE_ENVIRONMENT_TEST (environment_test_get_type ())
35
#define ENVIRONMENT_TEST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_ENVIRONMENT_TEST, EnvironmentTest))
36
#define ENVIRONMENT_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_ENVIRONMENT_TEST, EnvironmentTestClass))
37
#define IS_ENVIRONMENT_TEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_ENVIRONMENT_TEST))
38
#define IS_ENVIRONMENT_TEST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_ENVIRONMENT_TEST))
39
#define ENVIRONMENT_TEST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_ENVIRONMENT_TEST, EnvironmentTestClass))
41
typedef struct _EnvironmentTest EnvironmentTest;
42
typedef struct _EnvironmentTestClass EnvironmentTestClass;
43
typedef struct _EnvironmentTestPrivate EnvironmentTestPrivate;
44
typedef struct _ParamSpecEnvironmentTest ParamSpecEnvironmentTest;
45
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
47
struct _EnvironmentTest {
48
GTypeInstance parent_instance;
49
volatile int ref_count;
50
EnvironmentTestPrivate * priv;
53
struct _EnvironmentTestClass {
54
GTypeClass parent_class;
55
void (*finalize) (EnvironmentTest *self);
58
struct _ParamSpecEnvironmentTest {
59
GParamSpec parent_instance;
63
static gpointer environment_test_parent_class = NULL;
65
gpointer environment_test_ref (gpointer instance);
66
void environment_test_unref (gpointer instance);
67
GParamSpec* param_spec_environment_test (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
68
void value_set_environment_test (GValue* value, gpointer v_object);
69
void value_take_environment_test (GValue* value, gpointer v_object);
70
gpointer value_get_environment_test (const GValue* value);
71
GType environment_test_get_type (void) G_GNUC_CONST;
73
ENVIRONMENT_TEST_DUMMY_PROPERTY
75
gint environment_test_main (gchar** args, int args_length1);
76
EnvironmentTest* environment_test_new (void);
77
EnvironmentTest* environment_test_construct (GType object_type);
78
static void environment_test_finalize (EnvironmentTest* obj);
81
gint environment_test_main (gchar** args, int args_length1) {
83
_vala_assert ((G_TIME_SPAN_SECOND * GST_USECOND) == ((GTimeSpan) GST_SECOND), "TimeSpan.SECOND * Gst.USECOND == Gst.SECOND");
89
int main (int argc, char ** argv) {
91
return environment_test_main (argv, argc);
95
EnvironmentTest* environment_test_construct (GType object_type) {
96
EnvironmentTest* self = NULL;
97
self = (EnvironmentTest*) g_type_create_instance (object_type);
102
EnvironmentTest* environment_test_new (void) {
103
return environment_test_construct (TYPE_ENVIRONMENT_TEST);
107
static void value_environment_test_init (GValue* value) {
108
value->data[0].v_pointer = NULL;
112
static void value_environment_test_free_value (GValue* value) {
113
if (value->data[0].v_pointer) {
114
environment_test_unref (value->data[0].v_pointer);
119
static void value_environment_test_copy_value (const GValue* src_value, GValue* dest_value) {
120
if (src_value->data[0].v_pointer) {
121
dest_value->data[0].v_pointer = environment_test_ref (src_value->data[0].v_pointer);
123
dest_value->data[0].v_pointer = NULL;
128
static gpointer value_environment_test_peek_pointer (const GValue* value) {
129
return value->data[0].v_pointer;
133
static gchar* value_environment_test_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
134
if (collect_values[0].v_pointer) {
135
EnvironmentTest* object;
136
object = collect_values[0].v_pointer;
137
if (object->parent_instance.g_class == NULL) {
138
return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
139
} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
140
return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
142
value->data[0].v_pointer = environment_test_ref (object);
144
value->data[0].v_pointer = NULL;
150
static gchar* value_environment_test_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
151
EnvironmentTest** object_p;
152
object_p = collect_values[0].v_pointer;
154
return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
156
if (!value->data[0].v_pointer) {
158
} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
159
*object_p = value->data[0].v_pointer;
161
*object_p = environment_test_ref (value->data[0].v_pointer);
167
GParamSpec* param_spec_environment_test (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
168
ParamSpecEnvironmentTest* spec;
169
g_return_val_if_fail (g_type_is_a (object_type, TYPE_ENVIRONMENT_TEST), NULL);
170
spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
171
G_PARAM_SPEC (spec)->value_type = object_type;
172
return G_PARAM_SPEC (spec);
176
gpointer value_get_environment_test (const GValue* value) {
177
g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENVIRONMENT_TEST), NULL);
178
return value->data[0].v_pointer;
182
void value_set_environment_test (GValue* value, gpointer v_object) {
183
EnvironmentTest* old;
184
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENVIRONMENT_TEST));
185
old = value->data[0].v_pointer;
187
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_ENVIRONMENT_TEST));
188
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
189
value->data[0].v_pointer = v_object;
190
environment_test_ref (value->data[0].v_pointer);
192
value->data[0].v_pointer = NULL;
195
environment_test_unref (old);
200
void value_take_environment_test (GValue* value, gpointer v_object) {
201
EnvironmentTest* old;
202
g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_ENVIRONMENT_TEST));
203
old = value->data[0].v_pointer;
205
g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_ENVIRONMENT_TEST));
206
g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
207
value->data[0].v_pointer = v_object;
209
value->data[0].v_pointer = NULL;
212
environment_test_unref (old);
217
static void environment_test_class_init (EnvironmentTestClass * klass) {
218
environment_test_parent_class = g_type_class_peek_parent (klass);
219
ENVIRONMENT_TEST_CLASS (klass)->finalize = environment_test_finalize;
223
static void environment_test_instance_init (EnvironmentTest * self) {
228
static void environment_test_finalize (EnvironmentTest* obj) {
229
EnvironmentTest * self;
230
self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_ENVIRONMENT_TEST, EnvironmentTest);
234
GType environment_test_get_type (void) {
235
static volatile gsize environment_test_type_id__volatile = 0;
236
if (g_once_init_enter (&environment_test_type_id__volatile)) {
237
static const GTypeValueTable g_define_type_value_table = { value_environment_test_init, value_environment_test_free_value, value_environment_test_copy_value, value_environment_test_peek_pointer, "p", value_environment_test_collect_value, "p", value_environment_test_lcopy_value };
238
static const GTypeInfo g_define_type_info = { sizeof (EnvironmentTestClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) environment_test_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (EnvironmentTest), 0, (GInstanceInitFunc) environment_test_instance_init, &g_define_type_value_table };
239
static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
240
GType environment_test_type_id;
241
environment_test_type_id = g_type_register_fundamental (g_type_fundamental_next (), "EnvironmentTest", &g_define_type_info, &g_define_type_fundamental_info, 0);
242
g_once_init_leave (&environment_test_type_id__volatile, environment_test_type_id);
244
return environment_test_type_id__volatile;
248
gpointer environment_test_ref (gpointer instance) {
249
EnvironmentTest* self;
251
g_atomic_int_inc (&self->ref_count);
256
void environment_test_unref (gpointer instance) {
257
EnvironmentTest* self;
259
if (g_atomic_int_dec_and_test (&self->ref_count)) {
260
ENVIRONMENT_TEST_GET_CLASS (self)->finalize (self);
261
g_type_free_instance ((GTypeInstance *) self);