Adding sensor_data class implementation 86/23286/1
authorRamasamy <ram.kannan@samsung.com>
Mon, 23 Jun 2014 05:45:55 +0000 (11:15 +0530)
committerRamasamy <ram.kannan@samsung.com>
Mon, 23 Jun 2014 05:46:10 +0000 (11:16 +0530)
  - Adding sensor_data template class
  - Adding implementation for the sensor_data template class
  - Adding sensor_data class testing code

  - Testing application contributed by Gurleen Kaur

signed-off-by: Ramasamy <ram.kannan@samsung.com>
Change-Id: I96ff03a716b562d0c006bbe95b054936f5b90775

src/sensor_fusion/standalone/util/sensor_data.cpp [new file with mode: 0644]
src/sensor_fusion/standalone/util/sensor_data.h [new file with mode: 0644]
src/sensor_fusion/standalone/util/test/sensor_data_test/.cproject [new file with mode: 0644]
src/sensor_fusion/standalone/util/test/sensor_data_test/.project [new file with mode: 0644]
src/sensor_fusion/standalone/util/test/sensor_data_test/sensor_data_main.cpp [new file with mode: 0644]

diff --git a/src/sensor_fusion/standalone/util/sensor_data.cpp b/src/sensor_fusion/standalone/util/sensor_data.cpp
new file mode 100644 (file)
index 0000000..ed00cee
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * sensord
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#if defined (_SENSOR_DATA_H) && defined (_VECTOR_H)
+
+#include "math.h"
+
+#define SENSOR_DATA_SIZE 3
+
+template <typename TYPE>
+sensor_data<TYPE>::sensor_data() : m_data(SENSOR_DATA_SIZE)
+{
+}
+
+template <typename TYPE>
+sensor_data<TYPE>::sensor_data(const TYPE x, const TYPE y, const TYPE z)
+{
+       TYPE vec_data[SENSOR_DATA_SIZE] = {x, y, z};
+
+       vector<TYPE> v(SENSOR_DATA_SIZE, vec_data);
+       m_data = v;
+}
+
+template <typename TYPE>
+sensor_data<TYPE>::sensor_data(const vector<TYPE> v)
+{
+       m_data = v;
+}
+
+template <typename TYPE>
+sensor_data<TYPE>::sensor_data(const sensor_data<TYPE>& s)
+{
+       m_data = s.m_data;
+}
+
+template <typename TYPE>
+sensor_data<TYPE>::~sensor_data()
+{
+}
+
+template <typename TYPE>
+sensor_data<TYPE> sensor_data<TYPE>::operator =(const sensor_data<TYPE>& s)
+{
+       m_data = s.m_data;
+}
+
+template <typename T>
+sensor_data<T> operator +(sensor_data<T> data1, sensor_data<T> data2)
+{
+       return (data1.m_data + data2.m_data);
+}
+
+template <typename T>
+sensor_data<T> normalize(sensor_data<T> data)
+{
+       T x, y, z;
+
+       x = data.m_data.m_vec[0];
+       y = data.m_data.m_vec[1];
+       z = data.m_data.m_vec[2];
+
+       T val = sqrt(x*x + y*y + z*z);
+
+       x /= val;
+       y /= val;
+       z /= val;
+
+       sensor_data<T> s(x, y, z);
+
+       return s;
+}
+
+template <typename T>
+sensor_data<T> scale_data(sensor_data<T> data, T scaling_factor)
+{
+       T x, y, z;
+
+       x = data.m_data.m_vec[0] / scaling_factor;
+       y = data.m_data.m_vec[1] / scaling_factor;
+       z = data.m_data.m_vec[2] / scaling_factor;
+
+       sensor_data<T> s(x, y, z);
+
+       return s;
+}
+
+#endif /* _SENSOR_DATA_H */
+
diff --git a/src/sensor_fusion/standalone/util/sensor_data.h b/src/sensor_fusion/standalone/util/sensor_data.h
new file mode 100644 (file)
index 0000000..18a5ee1
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * sensord
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef _SENSOR_DATA_H
+#define _SENSOR_DATA_H
+
+#include "vector.h"
+
+template <typename TYPE>
+class sensor_data {
+public:
+       vector<TYPE> m_data;
+
+       sensor_data();
+       sensor_data(const TYPE x, const TYPE y, const TYPE z);
+       sensor_data(const vector<TYPE> v);
+       sensor_data(const sensor_data<TYPE>& s);
+       ~sensor_data();
+
+       sensor_data<TYPE> operator =(const sensor_data<TYPE>& s);
+
+       template<typename T> friend sensor_data<T> operator +(sensor_data<T> data1,
+                       sensor_data<T> data2);
+
+       template<typename T> friend sensor_data<T> normalize(sensor_data<T> data);
+       template<typename T> friend sensor_data<T> scale_data(sensor_data<T> data,
+                       T scaling_factor);
+};
+
+#include "sensor_data.cpp"
+
+#endif /* _SENSOR_DATA_H */
diff --git a/src/sensor_fusion/standalone/util/test/sensor_data_test/.cproject b/src/sensor_fusion/standalone/util/test/sensor_data_test/.cproject
new file mode 100644 (file)
index 0000000..031195b
--- /dev/null
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+       <storageModule moduleId="org.eclipse.cdt.core.settings">
+               <cconfiguration id="cdt.managedbuild.config.gnu.exe.debug.1935671287">
+                       <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.debug.1935671287" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+                               <externalSettings/>
+                               <extensions>
+                                       <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+                                       <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                               </extensions>
+                       </storageModule>
+                       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                               <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.debug.1935671287" name="Debug" parent="cdt.managedbuild.config.gnu.exe.debug">
+                                       <folderInfo id="cdt.managedbuild.config.gnu.exe.debug.1935671287." name="/" resourcePath="">
+                                               <toolChain id="cdt.managedbuild.toolchain.gnu.exe.debug.69147269" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.debug">
+                                                       <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.debug.1522412147" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.debug"/>
+                                                       <builder buildPath="${workspace_loc:/sensor_data_test/Debug}" id="cdt.managedbuild.target.gnu.builder.exe.debug.1954859812" managedBuildOn="true" name="Gnu Make Builder.Debug" superClass="cdt.managedbuild.target.gnu.builder.exe.debug"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.archiver.base.1943038052" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1587172267" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug">
+                                                               <option id="gnu.cpp.compiler.exe.debug.option.optimization.level.1355790312" superClass="gnu.cpp.compiler.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
+                                                               <option id="gnu.cpp.compiler.exe.debug.option.debugging.level.2021253150" superClass="gnu.cpp.compiler.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1969871049" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.debug.840831634" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.debug">
+                                                               <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.exe.debug.option.optimization.level.1606191096" superClass="gnu.c.compiler.exe.debug.option.optimization.level" valueType="enumerated"/>
+                                                               <option id="gnu.c.compiler.exe.debug.option.debugging.level.1989342841" superClass="gnu.c.compiler.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1853950730" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.c.linker.exe.debug.2116536720" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.debug"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug.1606698158" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.debug">
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1709811642" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+                                                                       <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+                                                                       <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+                                                               </inputType>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.assembler.exe.debug.572439291" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.debug">
+                                                               <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1947486216" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+                                                       </tool>
+                                               </toolChain>
+                                       </folderInfo>
+                               </configuration>
+                       </storageModule>
+                       <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+               </cconfiguration>
+               <cconfiguration id="cdt.managedbuild.config.gnu.exe.release.1152204539">
+                       <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.exe.release.1152204539" moduleId="org.eclipse.cdt.core.settings" name="Release">
+                               <externalSettings/>
+                               <extensions>
+                                       <extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
+                                       <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                                       <extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+                               </extensions>
+                       </storageModule>
+                       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+                               <configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release,org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.exe.release.1152204539" name="Release" parent="cdt.managedbuild.config.gnu.exe.release">
+                                       <folderInfo id="cdt.managedbuild.config.gnu.exe.release.1152204539." name="/" resourcePath="">
+                                               <toolChain id="cdt.managedbuild.toolchain.gnu.exe.release.1006630619" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.exe.release">
+                                                       <targetPlatform id="cdt.managedbuild.target.gnu.platform.exe.release.1609970281" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.exe.release"/>
+                                                       <builder buildPath="${workspace_loc:/sensor_data_test/Release}" id="cdt.managedbuild.target.gnu.builder.exe.release.825092798" managedBuildOn="true" name="Gnu Make Builder.Release" superClass="cdt.managedbuild.target.gnu.builder.exe.release"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.archiver.base.1494673448" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.2046812702" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.exe.release">
+                                                               <option id="gnu.cpp.compiler.exe.release.option.optimization.level.1229714845" superClass="gnu.cpp.compiler.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
+                                                               <option id="gnu.cpp.compiler.exe.release.option.debugging.level.899931234" superClass="gnu.cpp.compiler.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.893011941" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.c.compiler.exe.release.1890177840" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.exe.release">
+                                                               <option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.exe.release.option.optimization.level.1836828687" superClass="gnu.c.compiler.exe.release.option.optimization.level" valueType="enumerated"/>
+                                                               <option id="gnu.c.compiler.exe.release.option.debugging.level.354539101" superClass="gnu.c.compiler.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
+                                                               <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.922265647" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.c.linker.exe.release.522385108" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.exe.release"/>
+                                                       <tool id="cdt.managedbuild.tool.gnu.cpp.linker.exe.release.557377159" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.exe.release">
+                                                               <inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1671262799" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
+                                                                       <additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
+                                                                       <additionalInput kind="additionalinput" paths="$(LIBS)"/>
+                                                               </inputType>
+                                                       </tool>
+                                                       <tool id="cdt.managedbuild.tool.gnu.assembler.exe.release.1963188819" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.exe.release">
+                                                               <inputType id="cdt.managedbuild.tool.gnu.assembler.input.1593367089" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+                                                       </tool>
+                                               </toolChain>
+                                       </folderInfo>
+                               </configuration>
+                       </storageModule>
+               </cconfiguration>
+       </storageModule>
+       <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+               <project id="sensor_data_test.cdt.managedbuild.target.gnu.exe.1404541679" name="Executable" projectType="cdt.managedbuild.target.gnu.exe"/>
+       </storageModule>
+       <storageModule moduleId="scannerConfiguration">
+               <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
+               <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1152204539;cdt.managedbuild.config.gnu.exe.release.1152204539.;cdt.managedbuild.tool.gnu.c.compiler.exe.release.1890177840;cdt.managedbuild.tool.gnu.c.compiler.input.922265647">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+               </scannerConfigBuildInfo>
+               <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.release.1152204539;cdt.managedbuild.config.gnu.exe.release.1152204539.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.release.2046812702;cdt.managedbuild.tool.gnu.cpp.compiler.input.893011941">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
+               </scannerConfigBuildInfo>
+               <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1935671287;cdt.managedbuild.config.gnu.exe.debug.1935671287.;cdt.managedbuild.tool.gnu.cpp.compiler.exe.debug.1587172267;cdt.managedbuild.tool.gnu.cpp.compiler.input.1969871049">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
+               </scannerConfigBuildInfo>
+               <scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.exe.debug.1935671287;cdt.managedbuild.config.gnu.exe.debug.1935671287.;cdt.managedbuild.tool.gnu.c.compiler.exe.debug.840831634;cdt.managedbuild.tool.gnu.c.compiler.input.1853950730">
+                       <autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
+               </scannerConfigBuildInfo>
+       </storageModule>
+</cproject>
diff --git a/src/sensor_fusion/standalone/util/test/sensor_data_test/.project b/src/sensor_fusion/standalone/util/test/sensor_data_test/.project
new file mode 100644 (file)
index 0000000..2e0296a
--- /dev/null
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>sensor_data_test</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+                       <triggers>clean,full,incremental,</triggers>
+                       <arguments>
+                               <dictionary>
+                                       <key>?name?</key>
+                                       <value></value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.append_environment</key>
+                                       <value>true</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.autoBuildTarget</key>
+                                       <value>all</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.buildArguments</key>
+                                       <value></value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.buildCommand</key>
+                                       <value>make</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.buildLocation</key>
+                                       <value>${workspace_loc:/sensor_data_test/Debug}</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
+                                       <value>clean</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.contents</key>
+                                       <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
+                                       <value>false</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
+                                       <value>true</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.enableFullBuild</key>
+                                       <value>true</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
+                                       <value>all</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.stopOnError</key>
+                                       <value>true</value>
+                               </dictionary>
+                               <dictionary>
+                                       <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
+                                       <value>true</value>
+                               </dictionary>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+                       <triggers>full,incremental,</triggers>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.tizen.nativecpp.apichecker.core.builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.cdt.core.cnature</nature>
+               <nature>org.eclipse.cdt.core.ccnature</nature>
+               <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+               <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+               <nature>org.tizen.nativecpp.apichecker.core.tizenCppNature</nature>
+       </natures>
+</projectDescription>
diff --git a/src/sensor_fusion/standalone/util/test/sensor_data_test/sensor_data_main.cpp b/src/sensor_fusion/standalone/util/test/sensor_data_test/sensor_data_main.cpp
new file mode 100644 (file)
index 0000000..8040ad6
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * sensord
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "../../sensor_data.h"
+
+int main()
+{
+       float arr1[3] = {1.04, -4.678, -2.34};
+
+       vector<float> v1(3, arr1);
+
+       sensor_data<float> sd1(2.0, 3.0, 4.0);
+       sensor_data<float> sd2(1.04, -4.678, -2.34);
+       sensor_data<float> sd3(0.054, 1.097, 4.456);
+       sensor_data<float> sd10(v1);
+
+       cout << "Constructor tests\n";
+       cout << "input\t" << v1 << "\n";
+       cout << "output\t" << sd10.m_data << "\n\n";
+       cout << "input\t" << v1 << "\n";
+       cout << "output\t" << sd2.m_data<< "\n\n";
+
+       cout<< "Addition:\n";
+       sensor_data<float> sd4 = sd1 + sd2;
+       cout<< "\n" << sd1.m_data << "\n" << sd2.m_data;
+       cout<< "\nSum:\n" << sd4.m_data << endl;
+       sensor_data<float> sd9 = sd1 + sd10;
+       cout<< "\n" << sd1.m_data << "\n" << sd10.m_data;
+       cout<< "\nSum:\n" << sd9.m_data << endl;
+
+       cout<< "\n\n\nNormalization:\n";
+       sensor_data<float> sd6 = normalize(sd3);
+       cout<< "\n" << sd3.m_data;
+       cout<< "\nResult:\n" << sd6.m_data << endl;
+       sensor_data<float> sd7 = normalize(sd2);
+       cout<< "\n" << sd2.m_data;
+       cout<< "\nResult:\n" << sd7.m_data << endl;
+
+       float xx = 2.5;
+       cout<<"\n\n\nScale data:\n";
+       sensor_data<float> sd8 = scale_data(sd2, xx);
+       cout<< "\n" << sd2.m_data << "\n" << xx;
+       cout<< "\nResult:\n" << sd8.m_data << endl;
+}
+