00001 #ifndef QPID_AMQP_0_10_CONTROL_H
00002 #define QPID_AMQP_0_10_CONTROL_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "Struct.h"
00026
00027 namespace qpid {
00028 namespace amqp_0_10 {
00029
00030 struct Command;
00031 struct Control;
00032
00033 struct Action {
00034 virtual ~Action() {}
00035 virtual Command* getCommand() { return 0; }
00036 virtual Control* getControl() { return 0; }
00037
00038 virtual const Command* getCommand() const {
00039 return const_cast<Action*>(this)->getCommand();
00040 }
00041 virtual const Control* getControl() const {
00042 return const_cast<Action*>(this)->getControl();
00043 }
00044 static const uint8_t SIZE=0;
00045 static const uint8_t PACK=2;
00046 };
00047
00048 struct ControlVisitor;
00049 struct ConstControlVisitor;
00050 struct ControlHolder;
00051 struct Control
00052 : public Action,
00053 public Visitable<ControlVisitor, ConstControlVisitor, ControlHolder>
00054 {
00055 using Action::getControl;
00056 Control* getControl() { return this; }
00057 uint8_t getCode() const;
00058 uint8_t getClassCode() const;
00059 const char* getName() const;
00060 const char* getClassName() const;
00061 };
00062 std::ostream& operator<<(std::ostream&, const Control&);
00063
00064 template <SegmentType E> struct ActionType;
00065 template <> struct ActionType<CONTROL> { typedef Control type; };
00066 template <> struct ActionType<COMMAND> { typedef Command type; };
00067
00068 }}
00069
00070 #endif