Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation
qpid/management/Buffer.h
Go to the documentation of this file.
00001 #ifndef _Management_Buffer_
00002 #define _Management_Buffer_
00003 /*
00004  * Licensed to the Apache Software Foundation (ASF) under one
00005  * or more contributor license agreements.  See the NOTICE file
00006  * distributed with this work for additional information
00007  * regarding copyright ownership.  The ASF licenses this file
00008  * to you under the Apache License, Version 2.0 (the
00009  * "License"); you may not use this file except in compliance
00010  * with the License.  You may obtain a copy of the License at
00011  *
00012  *   http://www.apache.org/licenses/LICENSE-2.0
00013  *
00014  * Unless required by applicable law or agreed to in writing,
00015  * software distributed under the License is distributed on an
00016  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00017  * KIND, either express or implied.  See the License for the
00018  * specific language governing permissions and limitations
00019  * under the License.
00020  *
00021  */
00022 #include "qpid/CommonImportExport.h"
00023 #include "qpid/types/Exception.h"
00024 #include "qpid/types/Variant.h"
00025 #include <string>
00026 
00027 namespace qpid {
00028 namespace framing {
00029     class Buffer;
00030 }
00031 
00032 namespace management {
00033 
00034 struct OutOfBounds : qpid::types::Exception {
00035     OutOfBounds() : qpid::types::Exception(std::string("Out of Bounds")) {}
00036 };
00037 
00038 
00043 class Buffer
00044 {
00045 public:
00046     QPID_COMMON_EXTERN Buffer(char* data=0, uint32_t size=0);
00047     QPID_COMMON_EXTERN ~Buffer();
00048 
00049     QPID_COMMON_EXTERN void record();
00050     QPID_COMMON_EXTERN void restore(bool reRecord = false);
00051     QPID_COMMON_EXTERN void reset();
00052 
00053     QPID_COMMON_EXTERN uint32_t available();
00054     QPID_COMMON_EXTERN uint32_t getSize();
00055     QPID_COMMON_EXTERN uint32_t getPosition();
00056     QPID_COMMON_EXTERN char* getPointer();
00057 
00058     QPID_COMMON_EXTERN void putOctet(uint8_t i);
00059     QPID_COMMON_EXTERN void putShort(uint16_t i);
00060     QPID_COMMON_EXTERN void putLong(uint32_t i);
00061     QPID_COMMON_EXTERN void putLongLong(uint64_t i);
00062     QPID_COMMON_EXTERN void putInt8(int8_t i);
00063     QPID_COMMON_EXTERN void putInt16(int16_t i);
00064     QPID_COMMON_EXTERN void putInt32(int32_t i);
00065     QPID_COMMON_EXTERN void putInt64(int64_t i);
00066     QPID_COMMON_EXTERN void putFloat(float f);
00067     QPID_COMMON_EXTERN void putDouble(double f);
00068     QPID_COMMON_EXTERN void putBin128(const uint8_t* b);
00069 
00070     QPID_COMMON_EXTERN uint8_t  getOctet();
00071     QPID_COMMON_EXTERN uint16_t getShort();
00072     QPID_COMMON_EXTERN uint32_t getLong();
00073     QPID_COMMON_EXTERN uint64_t getLongLong();
00074     QPID_COMMON_EXTERN int8_t   getInt8();
00075     QPID_COMMON_EXTERN int16_t  getInt16();
00076     QPID_COMMON_EXTERN int32_t  getInt32();
00077     QPID_COMMON_EXTERN int64_t  getInt64();
00078     QPID_COMMON_EXTERN float    getFloat();
00079     QPID_COMMON_EXTERN double   getDouble();
00080 
00081     QPID_COMMON_EXTERN void putShortString(const std::string& s);
00082     QPID_COMMON_EXTERN void putMediumString(const std::string& s);
00083     QPID_COMMON_EXTERN void putLongString(const std::string& s);
00084     QPID_COMMON_EXTERN void getShortString(std::string& s);
00085     QPID_COMMON_EXTERN void getMediumString(std::string& s);
00086     QPID_COMMON_EXTERN void getLongString(std::string& s);
00087     QPID_COMMON_EXTERN void getBin128(uint8_t* b);
00088 
00089     QPID_COMMON_EXTERN void putMap(const types::Variant::Map& map);
00090     QPID_COMMON_EXTERN void putList(const types::Variant::List& list);
00091     QPID_COMMON_EXTERN void getMap(types::Variant::Map& map);
00092     QPID_COMMON_EXTERN void getList(types::Variant::List& list);
00093 
00094     QPID_COMMON_EXTERN void putRawData(const std::string& s);
00095     QPID_COMMON_EXTERN void getRawData(std::string& s, uint32_t size);
00096 
00097     QPID_COMMON_EXTERN void putRawData(const uint8_t* data, size_t size);
00098     QPID_COMMON_EXTERN void getRawData(uint8_t* data, size_t size);
00099 
00100 private:
00101     framing::Buffer* impl;
00102 };
00103 
00104 }} // namespace qpid::management
00105 
00106 #endif

Qpid C++ API Reference
Generated on Mon Aug 22 2011 for Qpid C++ Client API by doxygen 1.7.4