Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation
qpid/framing/List.h
Go to the documentation of this file.
00001 #ifndef QPID_FRAMING_LIST_H
00002 #define QPID_FRAMING_LIST_H
00003 
00004 /*
00005  *
00006  * Licensed to the Apache Software Foundation (ASF) under one
00007  * or more contributor license agreements.  See the NOTICE file
00008  * distributed with this work for additional information
00009  * regarding copyright ownership.  The ASF licenses this file
00010  * to you under the Apache License, Version 2.0 (the
00011  * "License"); you may not use this file except in compliance
00012  * with the License.  You may obtain a copy of the License at
00013  * 
00014  *   http://www.apache.org/licenses/LICENSE-2.0
00015  * 
00016  * Unless required by applicable law or agreed to in writing,
00017  * software distributed under the License is distributed on an
00018  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00019  * KIND, either express or implied.  See the License for the
00020  * specific language governing permissions and limitations
00021  * under the License.
00022  *
00023  */
00024 #include "qpid/CommonImportExport.h"
00025 #include "qpid/framing/amqp_types.h"
00026 #include <iostream>
00027 #include <list>
00028 #include <boost/shared_ptr.hpp>
00029 
00030 namespace qpid {
00031 namespace framing {
00032 
00033 class Buffer;
00034 class FieldValue;
00035 
00039 class QPID_COMMON_CLASS_EXTERN List
00040 {
00041   public:
00042     typedef boost::shared_ptr<FieldValue> ValuePtr;
00043     typedef std::list<ValuePtr> Values;
00044     typedef Values::const_iterator const_iterator;
00045     typedef Values::iterator iterator;
00046     typedef Values::const_reference const_reference;
00047     typedef Values::reference reference;
00048 
00049     QPID_COMMON_EXTERN uint32_t encodedSize() const;
00050     QPID_COMMON_EXTERN void encode(Buffer& buffer) const;
00051     QPID_COMMON_EXTERN void decode(Buffer& buffer);
00052 
00053     QPID_COMMON_EXTERN bool operator==(const List& other) const;
00054 
00055     // std collection interface.
00056     QPID_COMMON_INLINE_EXTERN const_iterator begin() const { return values.begin(); }
00057     QPID_COMMON_INLINE_EXTERN const_iterator end() const { return values.end(); }
00058     QPID_COMMON_INLINE_EXTERN iterator begin() { return values.begin(); }
00059     QPID_COMMON_INLINE_EXTERN iterator end(){ return values.end(); }
00060 
00061     QPID_COMMON_INLINE_EXTERN ValuePtr front() const { return values.front(); }
00062     QPID_COMMON_INLINE_EXTERN ValuePtr back() const { return values.back(); }
00063     QPID_COMMON_INLINE_EXTERN size_t size() const { return values.size(); }
00064 
00065     QPID_COMMON_INLINE_EXTERN iterator insert(iterator i, ValuePtr value) { return values.insert(i, value); }
00066     QPID_COMMON_INLINE_EXTERN void erase(iterator i) { values.erase(i); }
00067     QPID_COMMON_INLINE_EXTERN void push_back(ValuePtr value) { values.insert(end(), value); }
00068     QPID_COMMON_INLINE_EXTERN void pop_back() { values.pop_back(); }
00069 
00070   private:
00071     Values values;
00072 
00073     friend QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& out, const List& list);
00074 };
00075 }} // namespace qpid::framing
00076 
00077 #endif  

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