activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r595119 - in /activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio: ByteArray.cpp ByteArray.h PooledByteBuffer.cpp PooledByteBuffer.h
Date Wed, 14 Nov 2007 23:21:19 GMT
Author: tabish
Date: Wed Nov 14 15:21:17 2007
New Revision: 595119

URL: http://svn.apache.org/viewvc?rev=595119&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-103

Working on the NIO package

Added:
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArray.cpp
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArray.h
      - copied, changed from r595069, activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/PooledByteBuffer.h
Removed:
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/PooledByteBuffer.cpp
    activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/PooledByteBuffer.h

Added: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArray.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArray.cpp?rev=595119&view=auto
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArray.cpp (added)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArray.cpp Wed Nov 14
15:21:17 2007
@@ -0,0 +1,41 @@
+/*
+ * 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 "ByteArray.h"
+
+using namespace decaf;
+using namespace decaf::internal;
+using namespace decaf::internal::nio;
+
+////////////////////////////////////////////////////////////////////////////////
+ByteArray::ByteArray( unsigned char* buffer, std::size_t size, bool own ) {
+
+    if( buffer == NULL ) {
+        throw NullPointerException(
+            __FILE__, __LINE__,
+            "ByteArray::ByteArray - Passed Buffer is null" );
+    }
+
+    this->buffer = buffer;
+    this->size = size;
+    this->own = own;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+ByteArray::~ByteArray() {
+
+}

Copied: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArray.h (from r595069,
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/PooledByteBuffer.h)
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArray.h?p2=activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArray.h&p1=activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/PooledByteBuffer.h&r1=595069&r2=595119&rev=595119&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/PooledByteBuffer.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/nio/ByteArray.h Wed Nov 14 15:21:17
2007
@@ -15,8 +15,8 @@
  * limitations under the License.
  */
 
-#ifndef _DECAF_INTERNAL_NIO_POOLEDBYTEBUFFER_H_
-#define _DECAF_INTERNAL_NIO_POOLEDBYTEBUFFER_H_
+#ifndef _DECAF_INTERNAL_NIO_BYTEARRAY_H_
+#define _DECAF_INTERNAL_NIO_BYTEARRAY_H_
 
 #include <decaf/lang/exceptions/NullPointerException.h>
 
@@ -24,7 +24,14 @@
 namespace internal{
 namespace nio{
 
-    class PooledByteBuffer {
+    class Perspective;
+
+    /**
+     * Wrapper around an unsigned char* that allows perspectives to be created
+     * that reference this ByteArray.  The ByteArray will be deleted only when all
+     * referencing perspectives are deleted.
+     */
+    class ByteArray {
     private:
 
         // Buffer to read and write to, may be shared with other instances.
@@ -36,17 +43,20 @@
         // Wether this object owns the buffer
         bool own;
 
+        // Number of Perspectives that reference this ByteArray
+        std::size_t numPerspectives;
+
     public:
 
         /**
          *
          * @throws NullPointerException if buffer is NULL
          */
-        PooledByteBuffer( unsigned char* buffer, std::size_t size, bool own = false );
-        virtual ~PooledByteBuffer();
+        ByteArray( unsigned char* buffer, std::size_t size, bool own = false );
+        virtual ~ByteArray();
 
     };
 
 }}}
 
-#endif /*_DECAF_INTERNAL_NIO_POOLEDBYTEBUFFER_H_*/
+#endif /*_DECAF_INTERNAL_NIO_BYTEARRAY_H_*/



Mime
View raw message