You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2007/11/20 00:20:56 UTC
svn commit: r596483 - in
/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util:
ByteArray.cpp ByteArray.h
Author: tabish
Date: Mon Nov 19 15:20:55 2007
New Revision: 596483
URL: http://svn.apache.org/viewvc?rev=596483&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQCPP-103
Working on the NIO package
Modified:
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.cpp
activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.h
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.cpp?rev=596483&r1=596482&r2=596483&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.cpp (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.cpp Mon Nov 19 15:20:55 2007
@@ -29,6 +29,22 @@
using namespace decaf::lang::exceptions;
////////////////////////////////////////////////////////////////////////////////
+ByteArray::ByteArray( std::size_t capacity ) {
+
+ try{
+
+ this->capacity = capacity;
+ this->array = new unsigned char[capacity];
+ this->own = true;
+
+ // Ensure memory is clear
+ memset( this->array, 0, capacity );
+ }
+ DECAF_CATCH_RETHROW( Exception )
+ DECAF_CATCHALL_THROW( Exception )
+}
+
+////////////////////////////////////////////////////////////////////////////////
ByteArray::ByteArray( unsigned char* array, std::size_t capacity, bool own )
throw( lang::exceptions::NullPointerException ) {
Modified: activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.h?rev=596483&r1=596482&r2=596483&view=diff
==============================================================================
--- activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.h (original)
+++ activemq/activemq-cpp/decaf/trunk/src/main/decaf/internal/util/ByteArray.h Mon Nov 19 15:20:55 2007
@@ -48,6 +48,14 @@
public:
/**
+ * Creates a byte array object that is allocated internally and is then owned
+ * and deleted when this object is deleted. The array is initially created
+ * with all elements initialized to zero.
+ * @param capacity - size of the array, this is the limit we read and write to.
+ */
+ ByteArray( std::size_t capacity );
+
+ /**
* Creates a byte array object that wraps the given array. If the own flag
* is set then it will delete this array when this object is deleted.
* @param array - array to wrap
@@ -57,13 +65,6 @@
*/
ByteArray( unsigned char* array, std::size_t capacity, bool own = false )
throw( lang::exceptions::NullPointerException );
-
- /**
- * Create a new byte array object which allocates an internal buffer with
- * the given capacity.
- * @param capacity - amount of space to
- */
- ByteArray( std::size_t capacity );
virtual ~ByteArray();