4 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Youngae Kang <youngae.kang@samsung.com>, Yunhan Kim <yhan.kim@samsung.com>,
7 * Genie Kim <daejins.kim@samsung.com>, Minjune Kim <sena06.kim@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
26 #include "location-velocity.h"
27 #include "location-log.h"
30 location_velocity_get_type (void)
32 static volatile gsize type_volatile = 0;
33 if(g_once_init_enter(&type_volatile)) {
34 GType type = g_boxed_type_register_static (
35 g_intern_static_string ("LocationVelocity"),
36 (GBoxedCopyFunc) location_velocity_copy,
37 (GBoxedFreeFunc) location_velocity_free);
38 g_once_init_leave(&type_volatile, type);
43 EXPORT_API LocationVelocity*
44 location_velocity_new (guint timestamp,
49 LocationVelocity* velocity = g_slice_new0(LocationVelocity);
50 velocity->timestamp = timestamp;
51 velocity->speed = speed;
52 velocity->direction = direction;
53 velocity->climb = climb;
58 location_velocity_free (LocationVelocity* velocity)
60 g_return_if_fail(velocity);
61 g_slice_free(LocationVelocity, velocity);
65 location_velocity_equal (const LocationVelocity *velocity1, const LocationVelocity *velocity2)
67 g_return_val_if_fail(velocity1, FALSE);
68 g_return_val_if_fail(velocity2, FALSE);
70 if (velocity1->timestamp == velocity2->timestamp &&
71 velocity1->speed == velocity2->speed &&
72 velocity1->direction == velocity2->direction &&
73 velocity1->climb == velocity2->climb)
78 EXPORT_API LocationVelocity*
79 location_velocity_copy (const LocationVelocity *velocity)
81 g_return_val_if_fail(velocity, NULL);
83 LocationVelocity *new_velocity = NULL;
85 new_velocity = location_velocity_new(velocity->timestamp,