Adding vector template class 53/22553/11
authorRamasamy <ram.kannan@samsung.com>
Thu, 12 Jun 2014 06:15:32 +0000 (11:45 +0530)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Mon, 16 Jun 2014 10:29:02 +0000 (03:29 -0700)
- Adding vector template class definition

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

src/sensor_fusion/standalone/util/vector.cpp [new file with mode: 0755]
src/sensor_fusion/standalone/util/vector.h [new file with mode: 0755]

diff --git a/src/sensor_fusion/standalone/util/vector.cpp b/src/sensor_fusion/standalone/util/vector.cpp
new file mode 100755 (executable)
index 0000000..dee5244
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+ * 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 <vector.h>
+
+template <typename TYPE>
+vector<TYPE>::vector(void)
+{
+
+}
+
+template <typename TYPE>
+vector<TYPE>::vector(const int size)
+{
+
+}
+
+template <typename TYPE>
+vector<TYPE>::vector(const int size, TYPE *vec_data)
+{
+
+}
+
+template <typename TYPE>
+vector<TYPE>::vector(const vector<TYPE>& v)
+{
+
+}
+
+template <typename TYPE>
+vector<TYPE>::~vector()
+{
+
+}
+
+template <typename TYPE>
+vector<TYPE> vector<TYPE>::operator =(const vector<TYPE>& v)
+{
+
+}
+
+template <typename TYPE>
+vector<TYPE> operator +(const vector<TYPE> v1, const vector<TYPE> v2)
+{
+
+}
+
+template <typename TYPE>
+vector<TYPE> operator +(const vector<TYPE> v, const TYPE val)
+{
+
+}
+
+template <typename TYPE>
+vector<TYPE> operator -(const vector<TYPE> v1, const vector<TYPE> v2)
+{
+
+}
+
+template <typename TYPE>
+vector<TYPE> operator -(const vector<TYPE> v, const TYPE val)
+{
+
+}
+
+template <typename TYPE>
+matrix<TYPE> operator *(const matrix<TYPE> m, const vector<TYPE> v)
+{
+
+}
+
+template <typename TYPE>
+TYPE operator *(const vector<TYPE> v, const matrix<TYPE> m)
+{
+
+}
+
+template <typename TYPE>
+vector<TYPE> operator *(const vector<TYPE> v, const TYPE val)
+{
+
+}
+
+template <typename TYPE>
+vector<TYPE> operator /(const vector<TYPE> v1, const vector<TYPE> v2)
+{
+
+}
+
+template <typename TYPE>
+bool operator ==(const vector<TYPE> v1, const vector<TYPE> v2)
+{
+
+}
+
+template <typename TYPE>
+bool operator !=(const vector<TYPE> v1, const vector<TYPE> v2)
+{
+
+}
+
+template <typename TYPE>
+matrix<TYPE> vector<TYPE>::transpose(const vector<TYPE> v)
+{
+
+}
diff --git a/src/sensor_fusion/standalone/util/vector.h b/src/sensor_fusion/standalone/util/vector.h
new file mode 100755 (executable)
index 0000000..559c8ed
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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 _VECTOR_H
+#define _VECTOR_H
+
+#include <matrix.h>
+
+template <typename TYPE>
+class vector {
+public:
+       int m_size;
+       TYPE *m_vec;
+
+       vector(void);
+       vector(const int size);
+       vector(const int size, TYPE *vec_data);
+       vector(const vector<TYPE>& v);
+       ~vector();
+
+       vector<TYPE> operator =(const vector<TYPE>& v);
+
+       friend vector<TYPE> operator +(const vector<TYPE> v1, const vector<TYPE> v2);
+       friend vector<TYPE> operator +(const vector<TYPE> v, const TYPE val);
+       friend vector<TYPE> operator -(const vector<TYPE> v1, const vector<TYPE> v2);
+       friend vector<TYPE> operator -(const vector<TYPE> v, const TYPE val);
+       friend matrix<TYPE> operator *(const matrix<TYPE> v1, const vector<TYPE> v2);
+       friend TYPE operator *(const vector<TYPE> v, const matrix<TYPE> m);
+       friend vector<TYPE> operator *(const vector<TYPE> v, const TYPE val);
+       friend vector<TYPE> operator /(const vector<TYPE> v1, const vector<TYPE> v2);
+       friend bool operator ==(const vector<TYPE> v1, const vector<TYPE> v2);
+       friend bool operator !=(const vector<TYPE> v1, const vector<TYPE> v2);
+
+       friend matrix<TYPE> transpose(const vector<TYPE> v);
+};
+
+#endif  //_VECTOR_H