memory leak fix
[platform/framework/native/uix.git] / src / FUixSensorLightSensorData.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     FUixSensorLightSensorData.cpp
20  * @brief    This is the implementation file for the %LightSensorData class.
21  *
22  * This files contains implementation of the %LightSensorData class.
23  */
24
25 // Includes
26 #include <FBaseErrors.h>
27 #include <FBaseSysLog.h>
28 #include <FBaseFloat.h>
29 #include <FBaseLongLong.h>
30
31 #include <FUixSensorLightSensorData.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 LightSensorData::LightSensorData(void)
43         : level(0.0F)
44 {
45
46 }
47
48 LightSensorData::~LightSensorData(void)
49 {
50
51 }
52
53 LightSensorData::LightSensorData(const LightSensorData& rhs)
54         :level(rhs.level)
55 {
56
57 }
58
59 LightSensorData&
60 LightSensorData::operator =(const LightSensorData& rhs)
61 {
62         // check for self-assignment
63         if (this != &rhs)
64         {
65                 timestamp = rhs.timestamp;
66                 level = rhs.level;
67         }
68
69         return *this;
70 }
71
72 int
73 LightSensorData::GetHashCode(void) const
74 {
75         int hash = 0;
76
77                 hash += LongLong::GetHashCode(this->timestamp);
78                 hash += Float::GetHashCode(this->level);
79
80                 return hash;
81 }
82
83 bool
84 LightSensorData::Equals(const Object& rhs) const
85 {
86         const LightSensorData* pRhs = dynamic_cast <const LightSensorData*>(&rhs);
87         if (pRhs == null)
88         {
89                 return false;
90         }
91
92         if (this->timestamp != pRhs->timestamp)
93         {
94                 return false;
95         }
96
97         if (this->level != pRhs->level)
98         {
99                 return false;
100         }
101
102         return true;
103 }
104 result
105 LightSensorData::GetValue(SensorDataKey dataKey, long& value) const
106 {
107         SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY);
108         return E_INVALID_ARG;
109 }
110
111 result
112 LightSensorData::GetValue(SensorDataKey dataKey, float& value) const
113 {
114         SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY);
115         return E_INVALID_ARG;
116 }
117
118 result
119 LightSensorData::GetValue(SensorDataKey dataKey, bool& value) const
120 {
121         SysLogException(NID_UIX, E_INVALID_ARG, "[%s] %ls", GetErrorMessage(E_INVALID_ARG), W_MSG_INVALID_SENSOR_DATA_KEY);
122         return E_INVALID_ARG;
123 }
124 } } }// Tizen::Uix::Sensor