You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by fi...@apache.org on 2012/06/01 13:05:18 UTC

svn commit: r1345047 - in /incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu: ./ include/capu/os/ include/capu/os/arch/ include/capu/os/arch/Linux/ include/capu/os/arch/Win32/

Author: fitzner
Date: Fri Jun  1 11:05:17 2012
New Revision: 1345047

URL: http://svn.apache.org/viewvc?rev=1345047&view=rev
Log:
ETCH-149: Added Numeric Limits

Basic implementation of Numeric_Limits for Float

Change-Id: I9c7c68fef531092e32ed6468d9c4658ab2185fa1

Added:
    incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/NumericLimits.h
    incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/NumericLimits.inc
    incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/NumericLimits.inc
    incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Win32/NumericLimits.inc
Modified:
    incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/CMakeLists.txt

Modified: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/CMakeLists.txt?rev=1345047&r1=1345046&r2=1345047&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/CMakeLists.txt (original)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/CMakeLists.txt Fri Jun  1 11:05:17 2012
@@ -25,6 +25,7 @@ ADD_CLASS(util/SmartPointer)
 ADD_CLASS(os/Thread SOURCE_GROUP arch_source_group)
 ADD_CLASS(os/CondVar SOURCE_GROUP arch_source_group)
 ADD_CLASS(os/StringUtils SOURCE_GROUP arch_source_group)
+ADD_CLASS(os/NumericLimits SOURCE_GROUP arch_source_group)
 ADD_CLASS(container/List)
 ADD_CLASS(container/Comparator)
 ADD_CLASS(container/Hash)

Added: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/NumericLimits.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/NumericLimits.h?rev=1345047&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/NumericLimits.h (added)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/NumericLimits.h Fri Jun  1 11:05:17 2012
@@ -0,0 +1,84 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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 __NUMERIC_LIMITS_H__
+#define __NUMERIC_LIMITS_H__
+
+#include "capu/Config.h"
+
+#define NUMERIC_LIMITS_INC_HEADER
+#include "arch/NumericLimits.inc"
+#undef NUMERIC_LIMITS_INC_HEADER
+
+namespace capu {
+
+  template<typename T>
+  inline T NumericLimitMax() {
+    //not important
+    return 0;
+  }
+
+  template<typename T>
+  inline T NumericLimitMin() {
+    //not important
+    return 0;
+  }
+
+  template<>
+  inline capu::int32_t NumericLimitMax<capu::int32_t>() {
+    return 0x7fffffff;
+  }
+
+  template<>
+  inline capu::int32_t NumericLimitMin<capu::int32_t>() {
+    return 0x80000000;
+  }
+
+  template<>
+  inline capu::int16_t NumericLimitMin<capu::int16_t>() {
+    return -32768;
+  }
+
+  template<>
+  inline capu::int16_t NumericLimitMax<capu::int16_t>() {
+    return 32767;
+  }
+  
+  template<>
+  inline capu::int8_t NumericLimitMin<capu::int8_t>() {
+    return -128;
+  }
+
+  template<>
+  inline capu::int8_t NumericLimitMax<capu::int8_t>() {
+    return 127;
+  }
+  
+  template<>
+  inline capu::float_t NumericLimitMin<capu::float_t>() {
+    return FLT_MIN;
+  }
+
+  template<>
+  inline capu::float_t NumericLimitMax<capu::float_t>() {
+    return FLT_MAX;
+  }
+}
+
+#endif
+

Added: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/NumericLimits.inc
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/NumericLimits.inc?rev=1345047&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/NumericLimits.inc (added)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Linux/NumericLimits.inc Fri Jun  1 11:05:17 2012
@@ -0,0 +1,21 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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.
+ */
+
+#ifdef NUMERIC_LIMITS_INC_HEADER
+#include <float.h>
+#endif
\ No newline at end of file

Added: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/NumericLimits.inc
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/NumericLimits.inc?rev=1345047&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/NumericLimits.inc (added)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/NumericLimits.inc Fri Jun  1 11:05:17 2012
@@ -0,0 +1,23 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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.
+ */
+
+#ifdef ARCH_LINUX
+#include "Linux/NumericLimits.inc"
+#elif ARCH_WIN32
+#include "Win32/NumericLimits.inc"
+#endif

Added: incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Win32/NumericLimits.inc
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Win32/NumericLimits.inc?rev=1345047&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Win32/NumericLimits.inc (added)
+++ incubator/etch/trunk/binding-cpp/runtime/lib/capu/modules/capu/include/capu/os/arch/Win32/NumericLimits.inc Fri Jun  1 11:05:17 2012
@@ -0,0 +1,21 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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.
+ */
+
+#ifdef NUMERIC_LIMITS_INC_HEADER
+#include <float.h>
+#endif