source: branches/client-library-split/memphis-data-pool.c @ 104

Last change on this file since 104 was 104, checked in by simon, 5 years ago

data pool: remove unused private struct

File size: 2.7 KB
Line 
1/*
2 * Memphis - Cairo Rederer for OSM in C
3 * Copyright (C) 2009  Simon Wenner <simon@wenner.ch>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18 */
19
20#include "memphis-data-pool.h"
21#include "mlib.h"
22
23G_DEFINE_TYPE (MemphisDataPool, memphis_data_pool, G_TYPE_OBJECT)
24
25static MemphisDataPool *instance = NULL;
26
27static void
28memphis_data_pool_get_property (GObject *object, guint property_id,
29                              GValue *value, GParamSpec *pspec)
30{
31  switch (property_id) {
32  default:
33    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
34  }
35}
36
37static void
38memphis_data_pool_set_property (GObject *object, guint property_id,
39                              const GValue *value, GParamSpec *pspec)
40{
41  switch (property_id) {
42  default:
43    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
44  }
45}
46
47static void
48memphis_data_pool_dispose (GObject *object)
49{
50  G_OBJECT_CLASS (memphis_data_pool_parent_class)->dispose (object);
51}
52
53static void
54memphis_data_pool_finalize (GObject *object)
55{
56  MemphisDataPool *self = (MemphisDataPool *) object;
57  g_tree_destroy (self->stringTree);
58  g_string_chunk_free (self->stringChunk);
59 
60  G_OBJECT_CLASS (memphis_data_pool_parent_class)->finalize (object);
61}
62
63static void
64memphis_data_pool_class_init (MemphisDataPoolClass *klass)
65{
66  GObjectClass *object_class = G_OBJECT_CLASS (klass);
67
68  object_class->get_property = memphis_data_pool_get_property;
69  object_class->set_property = memphis_data_pool_set_property;
70  object_class->dispose = memphis_data_pool_dispose;
71  object_class->finalize = memphis_data_pool_finalize;
72}
73
74static void
75memphis_data_pool_init (MemphisDataPool *self)
76{
77  self->stringChunk = g_string_chunk_new (265);
78  self->stringTree = g_tree_new (m_tree_strcmp);
79}
80
81MemphisDataPool*
82memphis_data_pool_new (void)
83{
84  MemphisDataPool *pool;
85 
86  if (instance == NULL)
87    {
88      pool = g_object_new (MEMPHIS_TYPE_DATA_POOL, NULL);
89      instance = pool;
90    }
91  else
92    {
93      pool = g_object_ref (instance);
94    }
95
96  return pool;
97}
Note: See TracBrowser for help on using the repository browser.