10 #ifndef CONVERSATIONPART_HPP 11 #define CONVERSATIONPART_HPP 15 #include <boost/exception/info.hpp> 17 namespace duds {
namespace hardware {
namespace interface {
62 static constexpr
Flags MpfInput = Flags::Bit(0);
67 static constexpr
Flags MpfExtract = Flags::Bit(1);
73 static constexpr
Flags MpfVarlen = Flags::Bit(2);
77 static constexpr
Flags MpfBigendian = Flags::Bit(3);
88 static constexpr
Flags MpfBreak = Flags::Bit(4);
130 return mpf & MpfInput;
136 return !(mpf & MpfInput);
142 return mpf & MpfExtract;
150 mpf.
setTo(MpfExtract, ex);
158 return (mpf & MpfVarlen) && (mpf & MpfInput);
164 return mpf & MpfBigendian;
173 mpf.
setTo(MpfBigendian, big);
180 return !(mpf & MpfBigendian);
189 mpf.
setTo(MpfBigendian, !little);
211 virtual char *start()
const = 0;
215 virtual std::size_t length()
const = 0;
220 #endif // #ifndef CONVERSATIONPART_HPP BitFlags setTo(const BitFlags &bf, bool val)
Make all bits in bf set or clear based on the value of val.
ConversationPart & breakBefore()
Flags the conversation part to have a break before this part is sent.
ConversationPart & extract(bool ex)
Changes the extraction flag for this part.
bool bigEndian() const
True if this part is flagged as having data in big-endian form.
bool varyingLength() const
True if this part is flagged as having a variable length.
bool output() const
True if this part is flagged for output use.
ConversationPart(Flags f, std::int16_t v)
Construct with the given flags and an initial value for val16.
Represents a section of a half-duplex conversation with a device.
std::int16_t val16
A small integer for derived classes to use.
bool littleEndian() const
True if this part is flagged as having data in little-endian form.
Base class for conversation related errors.
duds::general::BitFlags< struct ConversationPartFlags, std::uint16_t > Flags
The type used to store flags that modify the operation of the classes derived from this class...
ConversationPart(Flags f)
Construct with the given flags.
Flags flags() const
Returns the flags.
bool extract() const
True if this part is flagged for extraction by ConversationExtractor.
ConversationPart & bigEndian(bool big)
Changes the flagged endianess of this part.
ConversationPart & littleEndian(bool little)
Changes the flagged endianess of this part.
Flags mpf
A set of flags that alter the behavior of the message part.
bool input() const
True if this part is flagged for input use.