00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <iostream>
00022 #include <vector>
00023 #include <boost/shared_ptr.hpp>
00024 #include <map>
00025 #include "amqp_types.h"
00026
00027 #ifndef _FieldTable_
00028 #define _FieldTable_
00029
00030 namespace qpid {
00035 namespace framing {
00036
00037 class FieldValue;
00038 class Buffer;
00039
00046 class FieldTable
00047 {
00048 public:
00049 typedef boost::shared_ptr<FieldValue> ValuePtr;
00050 typedef std::map<std::string, ValuePtr> ValueMap;
00051 typedef ValueMap::iterator iterator;
00052
00053 ~FieldTable();
00054 uint32_t size() const;
00055 void encode(Buffer& buffer) const;
00056 void decode(Buffer& buffer);
00057
00058 int count() const;
00059 void set(const std::string& name, const ValuePtr& value);
00060 ValuePtr get(const std::string& name) const;
00061
00062 void setString(const std::string& name, const std::string& value);
00063 void setInt(const std::string& name, int value);
00064 void setTimestamp(const std::string& name, uint64_t value);
00065 void setTable(const std::string& name, const FieldTable& value);
00066
00067
00068 std::string getString(const std::string& name) const;
00069 int getInt(const std::string& name) const;
00070
00071
00072
00073
00074
00075
00076 bool operator==(const FieldTable& other) const;
00077
00078
00079
00080 ValueMap::const_iterator begin() const { return values.begin(); }
00081 ValueMap::const_iterator end() const { return values.end(); }
00082 ValueMap::const_iterator find(const std::string& s) const { return values.find(s); }
00083
00084
00085
00086 ValueMap::iterator getValues() { return values.begin(); }
00087
00088 private:
00089 ValueMap values;
00090
00091 friend std::ostream& operator<<(std::ostream& out, const FieldTable& body);
00092 };
00093
00094
00095
00096
00097 }
00098 }
00099
00100
00101 #endif