16 #ifndef CONVERSATION_HPP 17 #define CONVERSATION_HPP 23 namespace duds {
namespace hardware {
namespace interface {
31 typedef boost::error_info<struct Info_ConversationPartIndex, int>
57 typedef std::vector< std::unique_ptr<ConversationPart> >
PartVector;
96 PartVector::iterator
end() {
103 PartVector::const_iterator
cbegin()
const {
104 return parts.cbegin();
109 PartVector::const_iterator
cend()
const {
122 return parts.empty();
139 void add(std::unique_ptr<CP> &cp) {
153 parts.emplace_back(np);
175 template <
class LengthType>
178 parts.emplace_back(cv);
193 template <
typename T, std::
size_t N>
196 parts.emplace_back(ce);
215 template <
typename T, std::
size_t N>
218 parts.emplace_back(ce);
232 #endif // #ifndef CONVERSATION_HPP ConversationExternal & addOutputBuffer(const char *a, std::size_t len)
Adds a conversation part that will use the given buffer for output.
void clear()
Makes the conversation empty.
std::size_t size() const
Returns the number of parts within this conversation.
ConversationVector & addInputVector(std::size_t len)
Creates a new ConversationVector for fixed length input and initializes it with the given length...
void add(std::unique_ptr< CP > &cp)
Adds an already constructed conversation part to the end of the conversation.
ConversationVector & addInputVector(std::size_t len, LengthType lt)
Creates a new ConversationVector for fixed or variable length input and initializes it with the given...
CP & add(const CP &cp)
Adds a copy of an existing conversation part to the end of the conversation.
ConversationExternal & addInputBuffer(T(&a)[N])
Adds a conversation part that will write input into the given array.
move_impl move(unsigned int c, unsigned int r)
Display stream manipulator that moves the display cursor to the given location.
References a conversation part in an externally controlled buffer.
PartVector::const_iterator cend() const
An iterator to the end of ConversationPart vector.
PartVector::iterator begin()
An iterator to the first ConversationPart that allows modification.
PartVector parts
The container of the parts that make up the full conversation.
PartVector::iterator end()
An iterator to the end of ConversationPart vector.
ConversationExtractor extract() const
Returns an extraction object that can be used to read all the conversation data marked extractible...
ConversationVector & addOutputVector()
Creates a new ConversationVector for output and returns it for modification.
ConversationExternal & addOutputBuffer(const T(&a)[N])
Adds a conversation part that will use the given array for output.
PartVector::const_iterator cbegin() const
An iterator to the first ConversationPart that does not allow modification.
std::vector< std::unique_ptr< ConversationPart > > PartVector
The storage type for the ConversationPart objects.
ConversationExternal & addInputBuffer(char *a, std::size_t len)
Adds a conversation part that will write input into the given buffer.
bool empty() const
Returns true if the conversation has no parts.
Holds a conversation part inside a vector.
Represents a two-way conversation with a device.
boost::error_info< struct Info_ConversationPartIndex, int > ConversationPartIndex
An attribute for errors when using Conversation objects that references the ConversationPart by index...