16 #ifndef DICT_SIGNAL_HPP
17 #define DICT_SIGNAL_HPP
19 #include <Bitmask.hpp>
30 getRequestType(
const Uint32& info) {
35 setRequestType(Uint32& info, Uint32 val) {
36 assert(val < (1 << 8));
43 getRequestExtra(
const Uint32& info) {
48 setRequestExtra(Uint32& info, Uint32 val) {
49 assert(val < (1 << 8));
54 addRequestExtra(Uint32& dst_info,
const Uint32& src_info) {
55 Uint32 val = getRequestExtra(src_info);
56 setRequestExtra(dst_info, val);
65 enum { RequestFlagsMask = 0xffff0000 };
66 enum { RequestFlagsGlobalMask = 0x00ff0000 };
77 RF_LOCAL_TRANS = (1 << 16),
84 RF_NO_BUILD = (1 << 17)
89 addRequestFlags(Uint32& dst_info,
const Uint32& src_info) {
90 dst_info |= src_info & RequestFlagsMask;
94 addRequestFlagsGlobal(Uint32& dst_info,
const Uint32& src_info) {
95 dst_info |= src_info & RequestFlagsGlobalMask;
99 getRequestFlagsText(
const Uint32& info) {
100 static char buf[100];
102 if (info & RF_LOCAL_TRANS)
103 strcat(buf,
" LOCAL_TRANS");
104 if (info & RF_NO_BUILD)
105 strcat(buf,
" NO_BUILD");
110 getRequestInfoText(
const Uint32& info) {
111 static char buf[100];
112 sprintf(buf,
"type: %u extra: %u flags: %s",
113 getRequestType(info), (info >> 8) & 0xff, getRequestFlagsText(info));
120 getTransModeName(Uint32 val) {
121 static const char*
name[] = {
122 "Undef",
"Normal",
"Rollback",
"Abort"
124 Uint32
size =
sizeof(
name)/
sizeof(name[0]);
125 return val < size ? name[val] :
"?";
129 getTransPhaseName(Uint32 val) {
130 static const char*
name[] = {
131 "Undef",
"Begin",
"Parse",
"Prepare",
"Commit",
"Complete",
"End"
133 Uint32
size =
sizeof(
name)/
sizeof(name[0]);
134 return val < size ? name[val] :
"?";
138 getTransStateName(Uint32 val) {
139 static const char*
name[] = {
140 "Undef",
"Ok",
"Error",
"NodeFail",
"NeedTrans",
"NoTrans",
"NeedOp",
"NoOp"
142 Uint32
size =
sizeof(
name)/
sizeof(name[0]);
143 return val < size ? name[val] :
"?";