00001 #ifndef QPID_FRAMING_EXECUTIONEXCEPTIONBODY_H
00002 #define QPID_FRAMING_EXECUTIONEXCEPTIONBODY_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00028
00029
00030 #include "qpid/framing/AMQMethodBody.h"
00031 #include "qpid/framing/AMQP_ServerOperations.h"
00032 #include "qpid/framing/MethodBodyConstVisitor.h"
00033 #include "qpid/framing/ModelMethod.h"
00034
00035 #include <ostream>
00036 #include "qpid/framing/amqp_types_full.h"
00037
00038 namespace qpid {
00039 namespace framing {
00040
00041 class ExecutionExceptionBody : public ModelMethod {
00042 uint16_t errorCode;
00043 SequenceNumber commandId;
00044 uint8_t classCode;
00045 uint8_t commandCode;
00046 uint8_t fieldIndex;
00047 string description;
00048 FieldTable errorInfo;
00049 uint16_t flags;
00050 public:
00051 static const ClassId CLASS_ID = 0x3;
00052 static const MethodId METHOD_ID = 0x3;
00053 ExecutionExceptionBody(
00054 ProtocolVersion, uint16_t _errorCode,
00055 const SequenceNumber& _commandId,
00056 uint8_t _classCode,
00057 uint8_t _commandCode,
00058 uint8_t _fieldIndex,
00059 const string& _description,
00060 const FieldTable& _errorInfo) :
00061 errorCode(_errorCode),
00062 commandId(_commandId),
00063 classCode(_classCode),
00064 commandCode(_commandCode),
00065 fieldIndex(_fieldIndex),
00066 description(_description),
00067 errorInfo(_errorInfo),
00068 flags(0){
00069 flags |= (1 << 8);
00070 flags |= (1 << 9);
00071 flags |= (1 << 10);
00072 flags |= (1 << 11);
00073 flags |= (1 << 12);
00074 flags |= (1 << 13);
00075 flags |= (1 << 14);
00076 }
00077 ExecutionExceptionBody(ProtocolVersion=ProtocolVersion()) : errorCode(0), classCode(0), commandCode(0), fieldIndex(0), flags(0) {}
00078
00079 void setErrorCode(uint16_t _errorCode);
00080 uint16_t getErrorCode() const;
00081 bool hasErrorCode() const;
00082 void clearErrorCodeFlag();
00083 void setCommandId(const SequenceNumber& _commandId);
00084 SequenceNumber getCommandId() const;
00085 bool hasCommandId() const;
00086 void clearCommandIdFlag();
00087 void setClassCode(uint8_t _classCode);
00088 uint8_t getClassCode() const;
00089 bool hasClassCode() const;
00090 void clearClassCodeFlag();
00091 void setCommandCode(uint8_t _commandCode);
00092 uint8_t getCommandCode() const;
00093 bool hasCommandCode() const;
00094 void clearCommandCodeFlag();
00095 void setFieldIndex(uint8_t _fieldIndex);
00096 uint8_t getFieldIndex() const;
00097 bool hasFieldIndex() const;
00098 void clearFieldIndexFlag();
00099 void setDescription(const string& _description);
00100 const string& getDescription() const;
00101 bool hasDescription() const;
00102 void clearDescriptionFlag();
00103 void setErrorInfo(const FieldTable& _errorInfo);
00104 const FieldTable& getErrorInfo() const;
00105 FieldTable& getErrorInfo();
00106 bool hasErrorInfo() const;
00107 void clearErrorInfoFlag();
00108 typedef void ResultType;
00109
00110 template <class T> ResultType invoke(T& invocable) const {
00111 return invocable.exception(getErrorCode(), getCommandId(), getClassCode(), getCommandCode(), getFieldIndex(), getDescription(), getErrorInfo());
00112 }
00113
00114 using AMQMethodBody::accept;
00115 void accept(MethodBodyConstVisitor& v) const { v.visit(*this); }
00116
00117 ClassId amqpClassId() const { return CLASS_ID; }
00118 MethodId amqpMethodId() const { return METHOD_ID; }
00119 bool isContentBearing() const { return false; }
00120 bool resultExpected() const { return false; }
00121 bool responseExpected() const { return false; }
00122 void encode(Buffer&) const;
00123 void decode(Buffer&, uint32_t=0);
00124 void encodeStructBody(Buffer&) const;
00125 void decodeStructBody(Buffer&, uint32_t=0);
00126 uint32_t size() const;
00127 uint32_t bodySize() const;
00128 void print(std::ostream& out) const;
00129 };
00130
00131 }}
00132 #endif