1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
/* Copyright (c) 2003, 2005 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
#ifndef TRIG_ATTRINFO_HPP
#define TRIG_ATTRINFO_HPP
#include "SignalData.hpp"
#include <NodeBitmask.hpp>
#include <trigger_definitions.h>
#include <string.h>
/**
* TrigAttrInfo
*
* This signal is sent by TUP to signal
* that a trigger has fired
*/
class TrigAttrInfo {
/**
* Sender(s)
*/
// API
/**
* Sender(s) / Reciver(s)
*/
friend class Dbtup;
/**
* Reciver(s)
*/
friend class Dbtc;
friend class Backup;
friend class SumaParticipant;
/**
* For printing
*/
friend bool printTRIG_ATTRINFO(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
public:
enum AttrInfoType {
PRIMARY_KEY = 0,
BEFORE_VALUES = 1,
AFTER_VALUES = 2
};
STATIC_CONST( DataLength = 22 );
STATIC_CONST( StaticLength = 3 );
private:
Uint32 m_connectionPtr;
Uint32 m_trigId;
Uint32 m_type;
Uint32 m_data[DataLength];
// Public methods
public:
Uint32 getConnectionPtr() const;
void setConnectionPtr(Uint32);
AttrInfoType getAttrInfoType() const;
void setAttrInfoType(AttrInfoType anAttrType);
Uint32 getTriggerId() const;
void setTriggerId(Uint32 aTriggerId);
Uint32 getTransactionId1() const;
void setTransactionId1(Uint32 aTransId);
Uint32 getTransactionId2() const;
void setTransactionId2(Uint32 aTransId);
Uint32* getData() const;
int setData(Uint32* aDataBuf, Uint32 aDataLen);
};
inline
Uint32 TrigAttrInfo::getConnectionPtr() const
{
return m_connectionPtr;
}
inline
void TrigAttrInfo::setConnectionPtr(Uint32 aConnectionPtr)
{
m_connectionPtr = aConnectionPtr;
}
inline
TrigAttrInfo::AttrInfoType TrigAttrInfo::getAttrInfoType() const
{
return (TrigAttrInfo::AttrInfoType) m_type;
}
inline
void TrigAttrInfo::setAttrInfoType(TrigAttrInfo::AttrInfoType anAttrType)
{
m_type = (Uint32) anAttrType;
}
inline
Uint32 TrigAttrInfo::getTriggerId() const
{
return m_trigId;
}
inline
void TrigAttrInfo::setTriggerId(Uint32 aTriggerId)
{
m_trigId = aTriggerId;
}
inline
Uint32* TrigAttrInfo::getData() const
{
return (Uint32*)&m_data[0];
}
inline
int TrigAttrInfo::setData(Uint32* aDataBuf, Uint32 aDataLen)
{
if (aDataLen > DataLength)
return -1;
memcpy(m_data, aDataBuf, aDataLen*sizeof(Uint32));
return 0;
}
#endif
|