merge with master
[platform/framework/native/uix.git] / src / FUixSensorGyroSensorData.cpp
1 // 
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd. 
4 // 
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file     FUixSensorGyroSensorData.cpp
20  * @brief    This is the implementation file for the %GyroSensorData class.
21  *
22  * This files contains implementation of the %GyroSensorData class.
23  */
24
25 // Includes
26 #include <FBaseErrors.h>
27 #include <FBaseSysLog.h>
28 #include <FBaseFloat.h>
29 #include <FBaseLongLong.h>
30
31 #include <FUixSensorGyroSensorData.h>
32
33 using namespace Tizen::Base;
34
35 namespace Tizen { namespace Uix { namespace Sensor
36 {
37 namespace
38 {
39 static const wchar_t W_MSG_INVALID_SENSOR_DATA_KEY[] = L"A data matching the specified key and data type cannot be found.";
40 } // Anonymous
41
42 GyroSensorData::GyroSensorData(void)
43         : x(0.0F)
44         , y(0.0F)
45         , z(0.0F)
46 {
47
48 }
49
50 GyroSensorData::~GyroSensorData(void)
51 {
52
53 }
54
55 GyroSensorData::GyroSensorData(const GyroSensorData& rhs)
56         :x(rhs.x)
57         ,y(rhs.y)
58         ,z(rhs.z)
59 {
60
61 }
62
63 GyroSensorData&
64 GyroSensorData::operator =(const GyroSensorData& rhs)
65 {
66         // check for self-assignment
67         if (this != &rhs)
68         {
69                 timestamp = rhs.timestamp;
70                 x = rhs.x;
71                 y = rhs.y;
72                 z = rhs.z;
73         }
74
75         return *this;
76 }
77
78 int
79 GyroSensorData::GetHashCode(void) const
80 {
81         int hash = 0;
82
83                 hash += LongLong::GetHashCode(this->timestamp);
84                 hash += Float::GetHashCode(this->x);
85                 hash += Float::GetHashCode(this->y);
86                 hash += Float::GetHashCode(this->z);
87
88                 return hash;
89 }
90
91 bool
92 GyroSensorData::Equals(const Object& rhs) const
93 {
94         const GyroSensorData* pRhs = dynamic_cast <const GyroSensorData*>(&rhs);
95         if (pRhs == null)
96         {
97                 return false;
98         }
99
100         if (this->timestamp != pRhs->timestamp)
101         {
102                 return false;
103         }
104
105         if (this->x != pRhs->x)
106         {
107                 return false;
108         }
109
110         if (this->y != pRhs->y)
111         {
112                 return false;
113         }
114
115         if (this->z != pRhs->z)
116         {
117                 return false;
118         }
119
120         return true;
121 }
122
123 result
124 GyroSensorData::GetValue(SensorDataKey dataKey, long& value) const
125 {
126         SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY);
127         return E_INVALID_ARG;
128 }
129
130 result
131 GyroSensorData::GetValue(SensorDataKey dataKey, float& value) const
132 {
133         SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY);
134         return E_INVALID_ARG;
135 }
136
137 result
138 GyroSensorData::GetValue(SensorDataKey dataKey, bool& value) const
139 {
140         SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY);
141         return E_INVALID_ARG;
142 }
143 } } }// Tizen::Uix::Sensor