summaryrefslogtreecommitdiff
path: root/dotnet/Qpid.Buffer
diff options
context:
space:
mode:
authorRobert Greig <rgreig@apache.org>2007-01-29 11:05:20 +0000
committerRobert Greig <rgreig@apache.org>2007-01-29 11:05:20 +0000
commit509d48d3a12c3477c893456549e0d052d9e5e9f9 (patch)
treedb601f414a0f65e79bd74a3957fc8a78f918df12 /dotnet/Qpid.Buffer
parenta6808589c1ce06773f599bc28fe90938e2dcd60f (diff)
downloadqpid-python-509d48d3a12c3477c893456549e0d052d9e5e9f9.tar.gz
(Patch supplied by Tomas Restrepo) QPID-312.diff applied. This converts Javadoc copied accross from the orignal Java code to .Net format. Renames some files/classes/methods to use .Net conventions.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@501006 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dotnet/Qpid.Buffer')
-rw-r--r--dotnet/Qpid.Buffer/BaseByteBuffer.cs35
-rw-r--r--dotnet/Qpid.Buffer/BufferDataException.cs8
-rw-r--r--dotnet/Qpid.Buffer/ByteBuffer.cs14
-rw-r--r--dotnet/Qpid.Buffer/ByteBufferAllocator.cs50
-rw-r--r--dotnet/Qpid.Buffer/IByteBufferAllocator.cs29
-rw-r--r--dotnet/Qpid.Buffer/Qpid.Buffer.csproj4
-rw-r--r--dotnet/Qpid.Buffer/SimpleByteBufferAllocator.cs16
7 files changed, 67 insertions, 89 deletions
diff --git a/dotnet/Qpid.Buffer/BaseByteBuffer.cs b/dotnet/Qpid.Buffer/BaseByteBuffer.cs
index 099c84d6fa..3a6beabae8 100644
--- a/dotnet/Qpid.Buffer/BaseByteBuffer.cs
+++ b/dotnet/Qpid.Buffer/BaseByteBuffer.cs
@@ -33,23 +33,21 @@
namespace Qpid.Buffer
{
- /**
- * A base implementation of {@link ByteBuffer}. This implementation
- * assumes that {@link ByteBuffer#buf()} always returns a correct NIO
- * {@link FixedByteBuffer} instance. Most implementations could
- * extend this class and implement their own buffer management mechanism.
- *
- * @noinspection StaticNonFinalField
- * @see ByteBufferAllocator
- */
+ /// <summary>
+ /// A base implementation of <see cref="ByteBuffer"/>. This implementation
+ /// assumes that <see cref="ByteBuffer.Buf"/> always returns a correct NIO
+ /// <see cref="FixedByteBuffer"/> instance. Most implementations could
+ /// extend this class and implement their own buffer management mechanism.
+ /// </summary>
+ /// <seealso cref="ByteBufferAllocator"/>
public abstract class BaseByteBuffer : ByteBuffer
{
private bool _autoExpand;
- /**
- * We don't have any access to Buffer.markValue(), so we need to track it down,
- * which will cause small extra overhead.
- */
+ /// <summary>
+ /// We don't have any access to Buffer.markValue(),
+ /// so we need to track it down, which will cause small extra overhead.
+ /// </summary>
private int _mark = -1;
protected BaseByteBuffer()
@@ -94,10 +92,11 @@ namespace Qpid.Buffer
return this;
}
- /**
- * Implement this method to increase the capacity of this buffer.
- * <tt>newCapacity</tt> is always greater than the current capacity.
- */
+
+ /// <summary>
+ /// Implement this method to increase the capacity of this buffer.
+ /// </summary>
+ /// <param name="newCapacity">is always greater than the current capacity.</param>
protected abstract void capacity0( int newCapacity );
public override bool isAutoExpand()
@@ -458,4 +457,4 @@ namespace Qpid.Buffer
// return buf().asDoubleBuffer();
// }
}
-} \ No newline at end of file
+}
diff --git a/dotnet/Qpid.Buffer/BufferDataException.cs b/dotnet/Qpid.Buffer/BufferDataException.cs
index bce2d7ef5a..c76441dde0 100644
--- a/dotnet/Qpid.Buffer/BufferDataException.cs
+++ b/dotnet/Qpid.Buffer/BufferDataException.cs
@@ -23,10 +23,10 @@ using System.Runtime.Serialization;
namespace Qpid.Buffer
{
- /**
- * A {@link RuntimeException} which is thrown when the data the {@link ByteBuffer}
- * contains is corrupt.
- */
+ /// <summary>
+ /// An exception thrown when the data the <see cref="ByteBuffer"/>
+ /// contains is corrupt
+ /// </summary>
[Serializable]
public class BufferDataException : Exception
{
diff --git a/dotnet/Qpid.Buffer/ByteBuffer.cs b/dotnet/Qpid.Buffer/ByteBuffer.cs
index d2941e8346..1a4f0072d6 100644
--- a/dotnet/Qpid.Buffer/ByteBuffer.cs
+++ b/dotnet/Qpid.Buffer/ByteBuffer.cs
@@ -604,7 +604,7 @@ namespace Qpid.Buffer
public abstract class ByteBuffer : IComparable
{
//private static ByteBufferAllocator allocator = new PooledByteBufferAllocator();
- private static ByteBufferAllocator allocator = new SimpleByteBufferAllocator();
+ private static IByteBufferAllocator allocator = new SimpleByteBufferAllocator();
private static bool _useDirectBuffers = false;
@@ -619,7 +619,7 @@ namespace Qpid.Buffer
/**
* Returns the current allocator which manages the allocated buffers.
*/
- public static ByteBufferAllocator getAllocator()
+ public static IByteBufferAllocator getAllocator()
{
return allocator;
}
@@ -628,20 +628,20 @@ namespace Qpid.Buffer
* Changes the current allocator with the specified one to manage
* the allocated buffers from now.
*/
- public static void setAllocator( ByteBufferAllocator newAllocator )
+ public static void setAllocator( IByteBufferAllocator newAllocator )
{
if( newAllocator == null )
{
throw new NullReferenceException("allocator cannot be null");
}
- ByteBufferAllocator oldAllocator = allocator;
+ IByteBufferAllocator oldAllocator = allocator;
allocator = newAllocator;
if( null != oldAllocator )
{
- oldAllocator.dispose();
+ oldAllocator.Dispose();
}
}
@@ -690,7 +690,7 @@ namespace Qpid.Buffer
*/
public static ByteBuffer allocate( int capacity, bool direct )
{
- return allocator.allocate( capacity, direct );
+ return allocator.Allocate( capacity, direct );
}
/**
@@ -698,7 +698,7 @@ namespace Qpid.Buffer
*/
public static ByteBuffer wrap( FixedByteBuffer nioBuffer )
{
- return allocator.wrap( nioBuffer );
+ return allocator.Wrap( nioBuffer );
}
/**
diff --git a/dotnet/Qpid.Buffer/ByteBufferAllocator.cs b/dotnet/Qpid.Buffer/ByteBufferAllocator.cs
deleted file mode 100644
index 2dabd0ef50..0000000000
--- a/dotnet/Qpid.Buffer/ByteBufferAllocator.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *
- * 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.
- *
- */
-using Qpid.Buffer;
-
-namespace Qpid.Buffer
-{
- /**
- * Allocates {@link ByteBuffer}s and manages them. Please implement this
- * interface if you need more advanced memory management scheme.
- */
- public interface ByteBufferAllocator
- {
- /**
- * Returns the buffer which is capable of the specified size.
- *
- * @param capacity the capacity of the buffer
- * @param direct <tt>true</tt> to get a direct buffer,
- * <tt>false</tt> to get a heap buffer.
- */
- ByteBuffer allocate(int capacity, bool direct);
-
- /**
- * Wraps the specified NIO {@link FixedByteBuffer} into MINA buffer.
- */
- ByteBuffer wrap(FixedByteBuffer nioBuffer);
-
- /**
- * Dispose of this allocator.
- */
- void dispose();
- }
-} \ No newline at end of file
diff --git a/dotnet/Qpid.Buffer/IByteBufferAllocator.cs b/dotnet/Qpid.Buffer/IByteBufferAllocator.cs
new file mode 100644
index 0000000000..215a9873fa
--- /dev/null
+++ b/dotnet/Qpid.Buffer/IByteBufferAllocator.cs
@@ -0,0 +1,29 @@
+namespace Qpid.Buffer
+{
+ /// <summary>
+ /// Allocates <see cref="ByteBuffer"/>'s and manages them. Please
+ /// implement this interface if you need more advanced memory management scheme
+ /// </summary>
+ public interface IByteBufferAllocator
+ {
+ /// <summary>
+ /// Returns the buffer which is capable of the specified size.
+ /// </summary>
+ /// <param name="capacity">The capacity of the buffer</param>
+ /// <param name="direct">true to get a direct buffer, false to get a heap buffer</param>
+ ByteBuffer Allocate(int capacity, bool direct);
+
+ /// <summary>
+ /// Wraps the specified buffer
+ /// </summary>
+ /// <param name="nioBuffer">fixed byte buffer</param>
+ /// <returns>The wrapped buffer</returns>
+ ByteBuffer Wrap(FixedByteBuffer nioBuffer);
+
+
+ /// <summary>
+ /// Dispose of this allocator.
+ /// </summary>
+ void Dispose();
+ }
+} \ No newline at end of file
diff --git a/dotnet/Qpid.Buffer/Qpid.Buffer.csproj b/dotnet/Qpid.Buffer/Qpid.Buffer.csproj
index 7bca166fbc..3e4b302a3a 100644
--- a/dotnet/Qpid.Buffer/Qpid.Buffer.csproj
+++ b/dotnet/Qpid.Buffer/Qpid.Buffer.csproj
@@ -41,11 +41,11 @@
<Compile Include="BufferOverflowException.cs" />
<Compile Include="BufferUnderflowException.cs" />
<Compile Include="ByteBuffer.cs" />
- <Compile Include="ByteBufferAllocator.cs" />
<Compile Include="ByteBufferHexDumper.cs" />
<Compile Include="ByteBufferProxy.cs" />
<Compile Include="FixedByteBuffer.cs" />
<Compile Include="HeapByteBuffer.cs" />
+ <Compile Include="IByteBufferAllocator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SimpleByteBufferAllocator.cs" />
</ItemGroup>
@@ -57,4 +57,4 @@
<Target Name="AfterBuild">
</Target>
-->
-</Project> \ No newline at end of file
+</Project>
diff --git a/dotnet/Qpid.Buffer/SimpleByteBufferAllocator.cs b/dotnet/Qpid.Buffer/SimpleByteBufferAllocator.cs
index b11d6b6b14..2de3a13560 100644
--- a/dotnet/Qpid.Buffer/SimpleByteBufferAllocator.cs
+++ b/dotnet/Qpid.Buffer/SimpleByteBufferAllocator.cs
@@ -23,11 +23,11 @@ using System.Runtime.CompilerServices;
namespace Qpid.Buffer
{
- /**
- * A simplistic {@link ByteBufferAllocator} which simply allocates a new
- * buffer every time.
- */
- public class SimpleByteBufferAllocator : ByteBufferAllocator
+ /// <summary>
+ /// A simplistic <see cref="ByteBufferAllocator"/> which simply allocates a new
+ /// buffer every time
+ /// </summary>
+ public class SimpleByteBufferAllocator : IByteBufferAllocator
{
private const int MINIMUM_CAPACITY = 1;
@@ -35,7 +35,7 @@ namespace Qpid.Buffer
{
}
- public ByteBuffer allocate( int capacity, bool direct )
+ public ByteBuffer Allocate( int capacity, bool direct )
{
FixedByteBuffer nioBuffer;
if( direct )
@@ -49,12 +49,12 @@ namespace Qpid.Buffer
return new SimpleByteBuffer( nioBuffer );
}
- public ByteBuffer wrap( FixedByteBuffer nioBuffer )
+ public ByteBuffer Wrap( FixedByteBuffer nioBuffer )
{
return new SimpleByteBuffer( nioBuffer );
}
- public void dispose()
+ public void Dispose()
{
}