A class wrapping the send and recieve buffers that are to be filled and transported and the validated memories associated with them. More...
#include <uhal/Buffers.hpp>
Public Member Functions | |
Buffers (const uint32_t &aMaxSendSize=65536) | |
Constructor. More... | |
virtual | ~Buffers () |
Destructor. More... | |
const uint32_t & | sendCounter () |
Get the number of bytes that are currently in the send buffer. More... | |
const uint32_t & | replyCounter () |
Get the number of bytes that are currently expected by the reply buffer. More... | |
template<typename T > | |
uint8_t * | send (const T *aPtr) |
Helper function to copy an object to the send buffer. More... | |
template<typename T > | |
uint8_t * | send (const T &aRef) |
Helper function to copy an object to the send buffer. More... | |
uint8_t * | send (const uint8_t *aPtr, const uint32_t &aSize) |
Helper function to copy a block of memory to the send buffer. More... | |
template<typename T > | |
void | receive (T *aPtr) |
Helper function to add a destination object to the reply queue. More... | |
template<typename T > | |
void | receive (T &aRef) |
Helper function to add a destination object to the reply queue. More... | |
void | receive (uint8_t *aPtr, const uint32_t &aSize) |
Helper function to add a destination memory location to the reply queue. More... | |
void | add (const ValHeader &aValMem) |
Helper function to associate a validated memory with this buffer so that it is guaranteed to exist when the transaction is performed. More... | |
void | add (const ValWord< uint32_t > &aValMem) |
Helper function to associate a validated memory with this buffer so that it is guaranteed to exist when the transaction is performed. More... | |
void | add (const ValVector< uint32_t > &aValMem) |
Helper function to associate a validated memory with this buffer so that it is guaranteed to exist when the transaction is performed. More... | |
uint8_t * | getSendBuffer () |
Get a pointer to the start of the send buffer. More... | |
std::deque< std::pair< uint8_t *, uint32_t > > & | getReplyBuffer () |
Get a reference to the reply queue. More... | |
void | validate () |
Helper function to mark all validated memories associated with this buffer as valid. More... | |
void | clear () |
Clear the counters and the reply buffers. More... | |
Private Attributes | |
uint32_t | mSendCounter |
The number of bytes that are currently in the send buffer. More... | |
uint32_t | mReplyCounter |
The number of bytes that are currently expected by the reply buffer. More... | |
std::vector< uint8_t > | mSendBuffer |
The start location of the memory buffer. More... | |
std::deque< std::pair< uint8_t *, uint32_t > > | mReplyBuffer |
The queue of reply destinations. More... | |
std::deque< ValHeader > | mValHeaders |
Deque holding validated memories so that they are guaranteed to exist when the transaction is performed. More... | |
std::deque< ValWord< uint32_t > > | mUnsignedValWords |
Deque holding validated memories so that they are guaranteed to exist when the transaction is performed. More... | |
std::deque< ValVector< uint32_t > > | mUnsignedValVectors |
Deque holding validated memories so that they are guaranteed to exist when the transaction is performed. More... | |
A class wrapping the send and recieve buffers that are to be filled and transported and the validated memories associated with them.
Definition at line 55 of file Buffers.hpp.
uhal::Buffers::Buffers | ( | const uint32_t & | aMaxSendSize = 65536 | ) |
Constructor.
aMaxSendSize | The size of the buffer (in bytes) in the target device for receiving IPbus data packets from uhal. |
Definition at line 42 of file Buffers.cpp.
|
virtual |
Destructor.
Definition at line 50 of file Buffers.cpp.
void uhal::Buffers::add | ( | const ValHeader & | aValMem | ) |
Helper function to associate a validated memory with this buffer so that it is guaranteed to exist when the transaction is performed.
aValMem | a validated memory to be associated with this buffer |
Definition at line 81 of file Buffers.cpp.
References mValHeaders.
void uhal::Buffers::add | ( | const ValVector< uint32_t > & | aValMem | ) |
Helper function to associate a validated memory with this buffer so that it is guaranteed to exist when the transaction is performed.
aValMem | a validated memory to be associated with this buffer |
Definition at line 91 of file Buffers.cpp.
References mUnsignedValVectors.
void uhal::Buffers::add | ( | const ValWord< uint32_t > & | aValMem | ) |
Helper function to associate a validated memory with this buffer so that it is guaranteed to exist when the transaction is performed.
aValMem | a validated memory to be associated with this buffer |
Definition at line 86 of file Buffers.cpp.
References mUnsignedValWords.
void uhal::Buffers::clear | ( | ) |
Clear the counters and the reply buffers.
Definition at line 126 of file Buffers.cpp.
References mReplyBuffer, mReplyCounter, mSendCounter, mUnsignedValVectors, mUnsignedValWords, and mValHeaders.
std::deque< std::pair< uint8_t *, uint32_t > > & uhal::Buffers::getReplyBuffer | ( | ) |
Get a reference to the reply queue.
Definition at line 101 of file Buffers.cpp.
References mReplyBuffer.
uint8_t * uhal::Buffers::getSendBuffer | ( | ) |
Get a pointer to the start of the send buffer.
Definition at line 96 of file Buffers.cpp.
References mSendBuffer.
void uhal::Buffers::receive | ( | T & | aRef | ) |
Helper function to add a destination object to the reply queue.
aRef | a reference to some persistent object which can be written to when the transaction is performed |
Definition at line 72 of file Buffers.hxx.
References mReplyBuffer, and mReplyCounter.
void uhal::Buffers::receive | ( | T * | aPtr | ) |
Helper function to add a destination object to the reply queue.
aPtr | a pointer to some persistent object which can be written to when the transaction is performed |
Definition at line 64 of file Buffers.hxx.
References mReplyBuffer, and mReplyCounter.
void uhal::Buffers::receive | ( | uint8_t * | aPtr, |
const uint32_t & | aSize | ||
) |
Helper function to add a destination memory location to the reply queue.
aPtr | a pointer to some persistent memory which can be written to when the transaction is performed |
aSize | the number of bytes which can be safely written |
Definition at line 75 of file Buffers.cpp.
References mReplyBuffer, and mReplyCounter.
const uint32_t & uhal::Buffers::replyCounter | ( | ) |
Get the number of bytes that are currently expected by the reply buffer.
Definition at line 60 of file Buffers.cpp.
References mReplyCounter.
uint8_t * uhal::Buffers::send | ( | const T & | aRef | ) |
Helper function to copy an object to the send buffer.
aRef | a reference to an object to be copied |
Definition at line 54 of file Buffers.hxx.
References mSendBuffer, and mSendCounter.
uint8_t * uhal::Buffers::send | ( | const T * | aPtr | ) |
Helper function to copy an object to the send buffer.
aPtr | a pointer to an object to be copied |
Definition at line 44 of file Buffers.hxx.
References mSendBuffer, and mSendCounter.
uint8_t * uhal::Buffers::send | ( | const uint8_t * | aPtr, |
const uint32_t & | aSize | ||
) |
Helper function to copy a block of memory to the send buffer.
aPtr | a pointer to the start of the memory to be copied |
aSize | the number of bytes to be copied |
Definition at line 66 of file Buffers.cpp.
References mSendBuffer, and mSendCounter.
const uint32_t & uhal::Buffers::sendCounter | ( | ) |
Get the number of bytes that are currently in the send buffer.
Definition at line 55 of file Buffers.cpp.
References mSendCounter.
void uhal::Buffers::validate | ( | ) |
Helper function to mark all validated memories associated with this buffer as valid.
Definition at line 107 of file Buffers.cpp.
References mUnsignedValVectors, mUnsignedValWords, and mValHeaders.
|
private |
The queue of reply destinations.
Definition at line 171 of file Buffers.hpp.
Referenced by clear(), getReplyBuffer(), and receive().
|
private |
The number of bytes that are currently expected by the reply buffer.
Definition at line 166 of file Buffers.hpp.
Referenced by clear(), receive(), and replyCounter().
|
private |
The start location of the memory buffer.
Definition at line 169 of file Buffers.hpp.
Referenced by getSendBuffer(), and send().
|
private |
The number of bytes that are currently in the send buffer.
Definition at line 164 of file Buffers.hpp.
Referenced by clear(), send(), and sendCounter().
|
private |
Deque holding validated memories so that they are guaranteed to exist when the transaction is performed.
Definition at line 178 of file Buffers.hpp.
Referenced by add(), clear(), and validate().
|
private |
Deque holding validated memories so that they are guaranteed to exist when the transaction is performed.
Definition at line 176 of file Buffers.hpp.
Referenced by add(), clear(), and validate().
|
private |
Deque holding validated memories so that they are guaranteed to exist when the transaction is performed.
Definition at line 174 of file Buffers.hpp.
Referenced by add(), clear(), and validate().