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/08/02 16:01:26 UTC

svn commit: r1368475 - in /incubator/etch/trunk/binding-cpp/runtime: include/common/ include/support/ src/main/ src/main/support/ src/test/ src/test/support/

Author: fitzner
Date: Thu Aug  2 14:01:26 2012
New Revision: 1368475

URL: http://svn.apache.org/viewvc?rev=1368475&view=rev
Log:
ETCH-141: EtchFreePool skeleton implementation

Skeleton implementation of EtchFreePool

Change-Id: Ifb5ccb3fb8cad708df435e210d1c524610a8abe6

Added:
    incubator/etch/trunk/binding-cpp/runtime/include/support/EtchFreePool.h
    incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchFreePool.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/test/support/
    incubator/etch/trunk/binding-cpp/runtime/src/test/support/EtchFreePoolTest.cpp
Modified:
    incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h
    incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt
    incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt

Modified: incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h?rev=1368475&r1=1368474&r2=1368475&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/common/EtchObjectType.h Thu Aug  2 14:01:26 2012
@@ -53,6 +53,8 @@ enum EtchObjectTypeIds {
   EOTID_VALIDATOR_COMBO,
   EOTID_VALIDATOR_OBJECT,
   EOTID_VALIDATOR_RUNTIME_EXCEPTION,
+  EOTID_VALIDATOR_STRUCT_VALUE,
+  EOTID_VALIDATOR_NONE,
   EOTID_FIELD,
   EOTID_OBJECT_TYPE,
   EOTID_VALUE_FACTORY,
@@ -62,8 +64,7 @@ enum EtchObjectTypeIds {
   EOTID_AUTH_EXCEPTION,
   EOTID_RUNTIME_EXCEPTION,
   EOTID_ARRAY_VALUE,
-  EOTID_VALIDATOR_STRUCT_VALUE,
-  EOTID_VALIDATOR_NONE
+  EOTID_FREEPOOL
 };
 
 class EtchObjectType : public EtchObject {

Added: incubator/etch/trunk/binding-cpp/runtime/include/support/EtchFreePool.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/support/EtchFreePool.h?rev=1368475&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/support/EtchFreePool.h (added)
+++ incubator/etch/trunk/binding-cpp/runtime/include/support/EtchFreePool.h Thu Aug  2 14:01:26 2012
@@ -0,0 +1,80 @@
+/* $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 __ETCHFREEPOOL_H__
+#define __ETCHFREEPOOL_H__
+
+#include "capu/container/List.h"
+#include "support/EtchPool.h"
+#include "support/EtchPoolRunnable.h"
+
+// forward declarations
+namespace capu {
+  class Thread;
+}
+
+/**
+ * A implementation of the free pool.
+ */
+class EtchFreePool : public EtchPool
+{
+public:
+
+  /**
+   * EtchObjectType for EtchFreePool.
+   */
+  static const EtchObjectType* TYPE();
+
+  /**
+   * Creats a new instance of the EtchFreePool-Class.
+   * @param size of the pool
+   */
+  EtchFreePool(capu::int32_t size = 50);
+
+  /**
+   * Destructure.
+   */
+  virtual ~EtchFreePool();
+
+  /**
+   * Closes the pool. This just marks the pool as being closed, it doesn't
+   * actually do anything to the currently running thread. But no more
+   * threads are allowed to start.
+   * @return error if somthings goes wrong
+   */
+  capu::status_t close();
+
+  /**
+   * Joins each of the threads in this pool until there
+   * are none left. The pool will be closed first.
+   * @return error if somthings goes wrong
+   */
+  capu::status_t join();
+
+  /**
+   * @see EtchPool
+   */
+  virtual capu::status_t add(capu::SmartPointer<EtchPoolRunnable> runnable);
+
+private:
+  capu::int32_t mMaxSize;
+  capu::bool_t mIsOpen;
+  capu::List<capu::Thread*> mThreads;
+};
+
+#endif /* __ETCHFREEPOOL_H__ */

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt?rev=1368475&r1=1368474&r2=1368475&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/CMakeLists.txt Thu Aug  2 14:01:26 2012
@@ -108,6 +108,7 @@ SET(MAIN_INCLUDES
     ${PROJECT_SOURCE_DIR}/include/transport/EtchFormat.h
     ${PROJECT_SOURCE_DIR}/include/support/EtchAsyncResultBase.h
     ${PROJECT_SOURCE_DIR}/include/support/EtchDeliveryService.h
+    ${PROJECT_SOURCE_DIR}/include/support/EtchFreePool.h
     ${PROJECT_SOURCE_DIR}/include/support/EtchMailbox.h
     ${PROJECT_SOURCE_DIR}/include/support/EtchObjectSession.h
     ${PROJECT_SOURCE_DIR}/include/support/EtchPool.h
@@ -181,6 +182,7 @@ SET(MAIN_SOURCES
     serialization/EtchBinaryTaggedData.cpp
     serialization/EtchBinaryTaggedDataInput.cpp
     serialization/EtchBinaryTaggedDataOutput.cpp
+    support/EtchFreePool.cpp
     support/EtchStubBase.cpp
     )
 

Added: incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchFreePool.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchFreePool.cpp?rev=1368475&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchFreePool.cpp (added)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/support/EtchFreePool.cpp Thu Aug  2 14:01:26 2012
@@ -0,0 +1,45 @@
+/* $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.
+ */
+
+#include "support/EtchFreePool.h"
+
+const EtchObjectType* EtchFreePool::TYPE() {
+  const static EtchObjectType TYPE(EOTID_FREEPOOL, NULL);
+  return &TYPE;
+}
+
+EtchFreePool::EtchFreePool(capu::int32_t size)
+ : EtchPool(EtchFreePool::TYPE())
+ , mMaxSize(size)
+ , mIsOpen(false) {
+}
+
+EtchFreePool::~EtchFreePool() {
+}
+
+capu::status_t EtchFreePool::close() {
+  return ETCH_EUNIMPL;
+}
+
+capu::status_t EtchFreePool::join() {
+  return ETCH_EUNIMPL;
+}
+
+capu::status_t EtchFreePool::add(capu::SmartPointer<EtchPoolRunnable> runnable) {
+  return ETCH_EUNIMPL;
+}

Modified: incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt?rev=1368475&r1=1368474&r2=1368475&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/CMakeLists.txt Thu Aug  2 14:01:26 2012
@@ -49,11 +49,13 @@ add_executable (etch-cpp-test
     common/EtchArrayValueTest.cpp
     util/EtchURLTest.cpp
     util/EtchResourcesTest.cpp
+    util/EtchUtilTest.cpp
     transport/EtchFlexBufferTest.cpp
     transport/EtchTcpConnectionTest.cpp
     transport/EtchTcpListenerTest.cpp
     transport/EtchPacketizerTest.cpp
     transport/EtchMessageTest.cpp
+    transport/EtchMessagizerTest.cpp
     serialization/EtchValidatorBooleanTest.cpp
     serialization/EtchValidatorByteTest.cpp
     serialization/EtchValidatorIntTest.cpp
@@ -80,8 +82,7 @@ add_executable (etch-cpp-test
     serialization/EtchDefaultValueFactoryTest.cpp
     serialization/EtchValidatorStructValueTest.cpp
     serialization/EtchBinaryTaggedDataInputOutputTest.cpp
-    transport/EtchMessagizerTest.cpp
-    util/EtchUtilTest.cpp
+    support/EtchFreePoolTest.cpp
     ${GTEST}/src/gtest-all.cc
     ${GMOCK}/src/gmock-all.cc
     main.cpp

Added: incubator/etch/trunk/binding-cpp/runtime/src/test/support/EtchFreePoolTest.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/test/support/EtchFreePoolTest.cpp?rev=1368475&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/test/support/EtchFreePoolTest.cpp (added)
+++ incubator/etch/trunk/binding-cpp/runtime/src/test/support/EtchFreePoolTest.cpp Thu Aug  2 14:01:26 2012
@@ -0,0 +1,26 @@
+/* $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.
+ */
+
+#include <gtest/gtest.h>
+#include "support/EtchFreePool.h"
+
+TEST(EtchFreePoolTest, Constructor_Default){
+  EtchFreePool* pool = new EtchFreePool(20);
+  delete pool;
+
+}