activemq-cpp-3.3.0

src/main/decaf/internal/nio/BufferFactory.h

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef _DECAF_INTERNAL_NIO_BUFFERFACTORY_H_
00019 #define _DECAF_INTERNAL_NIO_BUFFERFACTORY_H_
00020 
00021 #include <decaf/nio/ByteBuffer.h>
00022 #include <decaf/nio/CharBuffer.h>
00023 #include <decaf/nio/DoubleBuffer.h>
00024 #include <decaf/nio/FloatBuffer.h>
00025 #include <decaf/nio/LongBuffer.h>
00026 #include <decaf/nio/IntBuffer.h>
00027 #include <decaf/nio/ShortBuffer.h>
00028 
00029 #include <decaf/lang/exceptions/IndexOutOfBoundsException.h>
00030 
00031 namespace decaf{
00032 namespace internal{
00033 namespace nio{
00034 
00041     class DECAF_API BufferFactory {
00042     public:
00043 
00044         virtual ~BufferFactory() {}
00045 
00057         static decaf::nio::ByteBuffer* createByteBuffer( int capacity );
00058 
00082         static decaf::nio::ByteBuffer* createByteBuffer(
00083                         unsigned char* buffer, int size, int offset, int length );
00084 
00100         static decaf::nio::ByteBuffer* createByteBuffer( std::vector<unsigned char>& buffer );
00101 
00113         static decaf::nio::CharBuffer* createCharBuffer( int capacity );
00114 
00138         static decaf::nio::CharBuffer* createCharBuffer( char* buffer, int size, int offset, int length );
00139 
00155         static decaf::nio::CharBuffer* createCharBuffer( std::vector<char>& buffer );
00156 
00168         static decaf::nio::DoubleBuffer* createDoubleBuffer( int capacity );
00169 
00193         static decaf::nio::DoubleBuffer* createDoubleBuffer( double* buffer, int size, int offset, int length );
00194 
00210         static decaf::nio::DoubleBuffer* createDoubleBuffer( std::vector<double>& buffer );
00211 
00223         static decaf::nio::FloatBuffer* createFloatBuffer( int capacity );
00224 
00248         static decaf::nio::FloatBuffer* createFloatBuffer( float* buffer, int size, int offset, int length );
00249 
00265         static decaf::nio::FloatBuffer* createFloatBuffer( std::vector<float>& buffer );
00266 
00275         static decaf::nio::LongBuffer* createLongBuffer( int capacity );
00276 
00300         static decaf::nio::LongBuffer* createLongBuffer( long long* buffer, int size, int offset, int length );
00301 
00317         static decaf::nio::LongBuffer* createLongBuffer( std::vector<long long>& buffer );
00318 
00330         static decaf::nio::IntBuffer* createIntBuffer( int capacity );
00331 
00355         static decaf::nio::IntBuffer* createIntBuffer( int* buffer, int size,  int offset, int length );
00356 
00372         static decaf::nio::IntBuffer* createIntBuffer( std::vector<int>& buffer );
00373 
00385         static decaf::nio::ShortBuffer* createShortBuffer( int capacity );
00386 
00410         static decaf::nio::ShortBuffer* createShortBuffer( short* buffer, int size, int offset, int length );
00411 
00427         static decaf::nio::ShortBuffer* createShortBuffer( std::vector<short>& buffer );
00428 
00429     };
00430 
00431 }}}
00432 
00433 #endif /*_DECAF_INTERNAL_NIO_BUFFERFACTORY_H_*/