qpid/framing/List.h Source File

Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET | Apache Qpid Documentation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 ValuePtr value_type;
    00044     typedef std::list<ValuePtr> Values;
    00045     typedef Values::const_iterator const_iterator;
    00046     typedef Values::iterator iterator;
    00047     typedef Values::const_reference const_reference;
    00048     typedef Values::reference reference;
    00049
    00050     QPID_COMMON_EXTERN uint32_t encodedSize() const;
    00051     QPID_COMMON_EXTERN void encode(Buffer& buffer) const;
    00052     QPID_COMMON_EXTERN void decode(Buffer& buffer);
    00053
    00054     QPID_COMMON_EXTERN bool operator==(const List& other) const;
    00055
    00056     // std collection interface.
    00057     QPID_COMMON_INLINE_EXTERN const_iterator begin() const { return values.begin(); }
    00058     QPID_COMMON_INLINE_EXTERN const_iterator end() const { return values.end(); }
    00059     QPID_COMMON_INLINE_EXTERN iterator begin() { return values.begin(); }
    00060     QPID_COMMON_INLINE_EXTERN iterator end(){ return values.end(); }
    00061
    00062     QPID_COMMON_INLINE_EXTERN ValuePtr front() const { return values.front(); }
    00063     QPID_COMMON_INLINE_EXTERN ValuePtr back() const { return values.back(); }
    00064     QPID_COMMON_INLINE_EXTERN size_t size() const { return values.size(); }
    00065
    00066     QPID_COMMON_INLINE_EXTERN iterator insert(iterator i, ValuePtr value) { return values.insert(i, value); }
    00067     QPID_COMMON_INLINE_EXTERN void erase(iterator i) { values.erase(i); }
    00068     QPID_COMMON_INLINE_EXTERN void push_back(ValuePtr value) { values.insert(end(), value); }
    00069     QPID_COMMON_INLINE_EXTERN void pop_back() { values.pop_back(); }
    00070
    00071   private:
    00072     Values values;
    00073
    00074     friend QPID_COMMON_EXTERN std::ostream& operator<<(std::ostream& out, const List& list);
    00075 };
    00076 }} // namespace qpid::framing
    00077
    00078 #endif