DUDS
Distributed Update of Data from Something
duds::hardware::interface::ConversationExternal Class Reference

References a conversation part in an externally controlled buffer. More...

#include <ConversationExternal.hpp>

Inheritance diagram for duds::hardware::interface::ConversationExternal:
Collaboration diagram for duds::hardware::interface::ConversationExternal:

Public Member Functions

 ConversationExternal (const ConversationExternal &)=default
 Copies are ok. More...
 
 ConversationExternal (const char *a, std::size_t length, Flags flags=Flags::Zero())
 Creates an output part from the given buffer. More...
 
 ConversationExternal (char *a, std::size_t length, Flags flags=MpfInput)
 Creates an input part from the given buffer. More...
 
template<typename T , std::size_t N>
 ConversationExternal (const T(&a)[N], Flags f=Flags::Zero())
 Creates an output part from the given array. More...
 
template<typename T , std::size_t N>
 ConversationExternal (T(&a)[N], Flags f=MpfInput)
 Creates an input part from the given array. More...
 
virtual std::size_t length () const
 Returns the length of the buffer following the start pointer. More...
 
virtual char * start () const
 Returns a pointer to the begining of the conversation part's buffer. More...
 
- Public Member Functions inherited from duds::hardware::interface::ConversationPart
 ConversationPart (const ConversationPart &)=default
 Copies are OK. More...
 
virtual ~ConversationPart ()
 
bool bigEndian () const
 True if this part is flagged as having data in big-endian form. More...
 
ConversationPartbigEndian (bool big)
 Changes the flagged endianess of this part. More...
 
ConversationPartbreakBefore ()
 Flags the conversation part to have a break before this part is sent. More...
 
bool extract () const
 True if this part is flagged for extraction by ConversationExtractor. More...
 
ConversationPartextract (bool ex)
 Changes the extraction flag for this part. More...
 
Flags flags () const
 Returns the flags. More...
 
bool input () const
 True if this part is flagged for input use. More...
 
bool littleEndian () const
 True if this part is flagged as having data in little-endian form. More...
 
ConversationPartlittleEndian (bool little)
 Changes the flagged endianess of this part. More...
 
bool output () const
 True if this part is flagged for output use. More...
 
bool varyingLength () const
 True if this part is flagged as having a variable length. More...
 

Private Attributes

char * data
 Points to the start of the external buffer. More...
 
std::size_t len
 Length of the external buffer. More...
 

Additional Inherited Members

- Public Types inherited from duds::hardware::interface::ConversationPart
typedef 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, or how the objects are used. More...
 
- Static Public Attributes inherited from duds::hardware::interface::ConversationPart
static constexpr Flags MpfBigendian = Flags::Bit(3)
 True/set to expect data to be big-endian. More...
 
static constexpr Flags MpfBreak = Flags::Bit(4)
 True/set to indicate that any kind of selection signal should be toggled, or a stop condition should occur, before communicating the part with this flag. More...
 
static constexpr Flags MpfExtract = Flags::Bit(1)
 True/set to extract message part contents with the ConversationExtractor. More...
 
static constexpr Flags MpfInput = Flags::Bit(0)
 True/set for input; false for output. More...
 
static constexpr Flags MpfVarlen = Flags::Bit(2)
 True/set for a varying length; valid only for input. More...
 
- Protected Member Functions inherited from duds::hardware::interface::ConversationPart
 ConversationPart (Flags f)
 Construct with the given flags. More...
 
 ConversationPart (Flags f, std::int16_t v)
 Construct with the given flags and an initial value for val16. More...
 
- Protected Attributes inherited from duds::hardware::interface::ConversationPart
std::int16_t val16
 A small integer for derived classes to use. More...
 

Detailed Description

References a conversation part in an externally controlled buffer.

The contents of the buffer are not copied for output parts, nor are they ever modified. Input parts will have new data writen directly into the buffer.

Todo:
Rename to ConversationBuffer.
Author
Jeff Jackowski

Definition at line 21 of file ConversationExternal.hpp.

Constructor & Destructor Documentation

◆ ConversationExternal() [1/5]

duds::hardware::interface::ConversationExternal::ConversationExternal ( const ConversationExternal )
default

Copies are ok.

◆ ConversationExternal() [2/5]

duds::hardware::interface::ConversationExternal::ConversationExternal ( const char *  a,
std::size_t  length,
Flags  flags = Flags::Zero() 
)
inline

Creates an output part from the given buffer.

Parameters
aThe start of the buffer with the output data. It is not copied; any changes to the buffer will affect the containing Conversation.
lengthThe length of the buffer in bytes.
flagsFlags that modify how the part will be used.

Definition at line 43 of file ConversationExternal.hpp.

◆ ConversationExternal() [3/5]

duds::hardware::interface::ConversationExternal::ConversationExternal ( char *  a,
std::size_t  length,
Flags  flags = MpfInput 
)
inline

Creates an input part from the given buffer.

Parameters
aThe start of the buffer that will take the intput data.
lengthThe length of the buffer in bytes.
flagsFlags that modify how the part will be used.

Definition at line 54 of file ConversationExternal.hpp.

◆ ConversationExternal() [4/5]

template<typename T , std::size_t N>
duds::hardware::interface::ConversationExternal::ConversationExternal ( const T(&)  a[N],
Flags  f = Flags::Zero() 
)
inline

Creates an output part from the given array.

Template Parameters
TThe array element type. It must be an integral type.
NThe length of the array.
Parameters
aThe array with the output data. It is not copied; any changes will affect the containing Conversation.
fFlags that modify how the part will be used.

Definition at line 65 of file ConversationExternal.hpp.

◆ ConversationExternal() [5/5]

template<typename T , std::size_t N>
duds::hardware::interface::ConversationExternal::ConversationExternal ( T(&)  a[N],
Flags  f = MpfInput 
)
inline

Creates an input part from the given array.

Template Parameters
TThe array element type. It must be an integral type.
NThe length of the array.
Parameters
aThe array where the input data will be written. It is handled internally as bytes. Variable length input may require writing a length to the start of the array. Since the size of the length data is implementation dependent, it is best to not use this class for variable length input.
fThe flags that modify the operation of the part.

Definition at line 81 of file ConversationExternal.hpp.

Member Function Documentation

◆ length()

std::size_t duds::hardware::interface::ConversationExternal::length ( ) const
virtual

Returns the length of the buffer following the start pointer.

Implements duds::hardware::interface::ConversationPart.

Definition at line 18 of file ConversationExternal.cpp.

Referenced by ConversationExternal().

◆ start()

char * duds::hardware::interface::ConversationExternal::start ( ) const
virtual

Returns a pointer to the begining of the conversation part's buffer.

The return type is not const because use for input will require a write operation. The implementation must not make changes to the part object, so the function is const.

Implements duds::hardware::interface::ConversationPart.

Definition at line 14 of file ConversationExternal.cpp.

Referenced by ConversationExternal().

Member Data Documentation

◆ data

char* duds::hardware::interface::ConversationExternal::data
private

Points to the start of the external buffer.

Definition at line 25 of file ConversationExternal.hpp.

Referenced by start().

◆ len

std::size_t duds::hardware::interface::ConversationExternal::len
private

Length of the external buffer.

Definition at line 29 of file ConversationExternal.hpp.

Referenced by length().


The documentation for this class was generated from the following files: