μHAL (v2.7.9)
Part of the IPbus software repository
Public Member Functions | Private Member Functions | List of all members
uhal::tests::DummyClient Class Reference

Empty client class, written to test registration. More...

#include <uhal/tests/DummyClient.hpp>

Inheritance diagram for uhal::tests::DummyClient:
[legend]
Collaboration diagram for uhal::tests::DummyClient:
[legend]

Public Member Functions

 DummyClient (const std::string &aId, const URI &aUri)
 
 ~DummyClient ()
 
- Public Member Functions inherited from uhal::ClientInterface
virtual ~ClientInterface ()
 Destructor. More...
 
const std::string & id () const
 Return the identifier of the target for this client. More...
 
const std::string & uri () const
 Return the url of the target for this client. More...
 
void dispatch ()
 Method to dispatch all queued transactions, and wait until all corresponding responses have been received. More...
 
void setTimeoutPeriod (const uint32_t &aTimeoutPeriod=0)
 A method to modify the timeout period for any pending or future transactions. More...
 
uint64_t getTimeoutPeriod ()
 A method to retrieve the timeout period currently being used. More...
 
ValHeader write (const uint32_t &aAddr, const uint32_t &aValue)
 Write a single, unmasked word to a register. More...
 
ValHeader write (const uint32_t &aAddr, const uint32_t &aValue, const uint32_t &aMask)
 Write a single, masked word to a register. More...
 
ValHeader writeBlock (const uint32_t &aAddr, const std::vector< uint32_t > &aValues, const defs::BlockReadWriteMode &aMode=defs::INCREMENTAL)
 Write a block of data to a block of registers or a block-write port. More...
 
ValWord< uint32_t > read (const uint32_t &aAddr)
 Read a single, unmasked, unsigned word. More...
 
ValWord< uint32_t > read (const uint32_t &aAddr, const uint32_t &aMask)
 Read a single, masked, unsigned word. More...
 
ValVector< uint32_t > readBlock (const uint32_t &aAddr, const uint32_t &aSize, const defs::BlockReadWriteMode &aMode=defs::INCREMENTAL)
 Read a block of unsigned data from a block of registers or a block-read port. More...
 
ValWord< uint32_t > rmw_bits (const uint32_t &aAddr, const uint32_t &aANDterm, const uint32_t &aORterm)
 Read the value of a register, apply the AND-term, apply the OR-term, set the register to this new value and return a copy of the original value to the user. More...
 
ValWord< uint32_t > rmw_sum (const uint32_t &aAddr, const int32_t &aAddend)
 Read the value of a register, add the addend, set the register to this new value and return a copy of the original value to the user. More...
 

Private Member Functions

void implementDispatch (boost::shared_ptr< Buffers > aBuffers)
 Pure virtual function which actually performs the dispatch operation. More...
 
ValHeader implementBOT ()
 Send a byte order transaction. More...
 
ValHeader implementWrite (const uint32_t &aAddr, const uint32_t &aValue)
 Write a single, unmasked word to a register. More...
 
ValHeader implementWriteBlock (const uint32_t &aAddr, const std::vector< uint32_t > &aValues, const defs::BlockReadWriteMode &aMode)
 Write a block of data to a block of registers or a block-write port. More...
 
ValWord< uint32_t > implementRead (const uint32_t &aAddr, const uint32_t &aMask)
 Read a single, masked, unsigned word. More...
 
ValVector< uint32_t > implementReadBlock (const uint32_t &aAddr, const uint32_t &aSize, const defs::BlockReadWriteMode &aMode)
 Read a block of unsigned data from a block of registers or a block-read port. More...
 
ValWord< uint32_t > implementRMWbits (const uint32_t &aAddr, const uint32_t &aANDterm, const uint32_t &aORterm)
 Read the value of a register, apply the AND-term, apply the OR-term, set the register to this new value and return a copy of the new value to the user. More...
 
ValWord< uint32_t > implementRMWsum (const uint32_t &aAddr, const int32_t &aAddend)
 Read the value of a register, add the addend, set the register to this new value and return a copy of the new value to the user. More...
 
exception::exceptionvalidate (uint8_t *aSendBufferStart, uint8_t *aSendBufferEnd, std::deque< std::pair< uint8_t *, uint32_t > >::iterator aReplyStartIt, std::deque< std::pair< uint8_t *, uint32_t > >::iterator aReplyEndIt)
 Function which the dispatch calls when the reply is received to check that the headers are as expected. More...
 
uint32_t getMaxNumberOfBuffers ()
 Return the maximum number of packets in flight. More...
 
uint32_t getMaxSendSize ()
 Return the maximum size to be sent based on the buffer size in the target. More...
 
uint32_t getMaxReplySize ()
 Return the maximum size of reply packet based on the buffer size in the target. More...
 

Additional Inherited Members

- Protected Member Functions inherited from uhal::ClientInterface
 ClientInterface (const std::string &aId, const URI &aUri, const boost::posix_time::time_duration &aTimeoutPeriod)
 Constructor. More...
 
const boost::posix_time::time_duration & getBoostTimeoutPeriod ()
 A method to retrieve the timeout period currently being used. More...
 
virtual void Flush ()
 Virtual function to dispatch all buffers and block until all replies are received. More...
 
virtual void preamble (boost::shared_ptr< Buffers > aBuffers)
 Add a preamble to an IPbus buffer. More...
 
virtual uint32_t getPreambleSize ()
 Return the size of the preamble. More...
 
virtual void predispatch (boost::shared_ptr< Buffers > aBuffers)
 Finalize the buffer before it is transmitted. More...
 
std::pair< ValHeader, _ValHeader_ * > CreateValHeader ()
 Helper function to create a ValHeader object. More...
 
std::pair< ValWord< uint32_t >, _ValWord_< uint32_t > * > CreateValWord (const uint32_t &aValue, const uint32_t &aMask=defs::NOMASK)
 Helper function to create a ValWord object. More...
 
std::pair< ValVector< uint32_t >, _ValVector_< uint32_t > * > CreateValVector (const uint32_t &aSize)
 Helper function to create a ValVector object. More...
 
virtual exception::exceptionvalidate (boost::shared_ptr< Buffers > aBuffers)
 Function which dispatch calls when the reply is received to check that the headers are as expected. More...
 
virtual void dispatchExceptionHandler ()
 Function which is called when an exception is thrown. More...
 
void returnBufferToPool (boost::shared_ptr< Buffers > &aBuffers)
 Function to return a buffer to the buffer pool. More...
 
void returnBufferToPool (std::deque< boost::shared_ptr< Buffers > > &aBuffers)
 Function to return a collection of buffers to the buffer pool. More...
 
void returnBufferToPool (std::vector< boost::shared_ptr< Buffers > > &aBuffers)
 Function to return a collection of buffers to the buffer pool. More...
 
void returnBufferToPool (std::deque< std::vector< boost::shared_ptr< Buffers > > > &aBuffers)
 Function to return a collection of buffers to the buffer pool. More...
 
virtual boost::shared_ptr< BufferscheckBufferSpace (const uint32_t &aSendSize, const uint32_t &aReplySize, uint32_t &aAvailableSendSize, uint32_t &aAvailableReplySize)
 Function which checks the available space in the currently filling buffer against requested send and receive sizes and, if there is insufficient space in the currently filling buffer, then dispatch it and create a new buffer. More...
 
- Protected Attributes inherited from uhal::ClientInterface
URI mUri
 a struct containing the full URI of the target for this client More...
 
std::string mUriString
 

Detailed Description

Empty client class, written to test registration.

Definition at line 13 of file DummyClient.hpp.

Constructor & Destructor Documentation

◆ DummyClient()

uhal::tests::DummyClient::DummyClient ( const std::string &  aId,
const URI aUri 
)

Definition at line 12 of file DummyClient.cpp.

◆ ~DummyClient()

uhal::tests::DummyClient::~DummyClient ( )

Definition at line 17 of file DummyClient.cpp.

Member Function Documentation

◆ getMaxNumberOfBuffers()

uint32_t uhal::tests::DummyClient::getMaxNumberOfBuffers ( )
privatevirtual

Return the maximum number of packets in flight.

Returns
the maximum number of packets in flight

Implements uhal::ClientInterface.

Definition at line 68 of file DummyClient.cpp.

◆ getMaxReplySize()

uint32_t uhal::tests::DummyClient::getMaxReplySize ( )
privatevirtual

Return the maximum size of reply packet based on the buffer size in the target.

Returns
the maximum size of reply packet

Implements uhal::ClientInterface.

Definition at line 78 of file DummyClient.cpp.

◆ getMaxSendSize()

uint32_t uhal::tests::DummyClient::getMaxSendSize ( )
privatevirtual

Return the maximum size to be sent based on the buffer size in the target.

Returns
the maximum size to be sent

Implements uhal::ClientInterface.

Definition at line 73 of file DummyClient.cpp.

◆ implementBOT()

ValHeader uhal::tests::DummyClient::implementBOT ( )
privatevirtual

Send a byte order transaction.

Implements uhal::ClientInterface.

Definition at line 25 of file DummyClient.cpp.

◆ implementDispatch()

void uhal::tests::DummyClient::implementDispatch ( boost::shared_ptr< Buffers aBuffers)
privatevirtual

Pure virtual function which actually performs the dispatch operation.

Parameters
aBuffersthe buffer to be dispatched

Implements uhal::ClientInterface.

Definition at line 21 of file DummyClient.cpp.

◆ implementRead()

ValWord< uint32_t > uhal::tests::DummyClient::implementRead ( const uint32_t &  aAddr,
const uint32_t &  aMask 
)
privatevirtual

Read a single, masked, unsigned word.

Parameters
aAddrthe address of the register to read
aMaskthe mask to apply to the value after reading
Returns
a Validated Memory which wraps the location to which the reply data is to be written

Implements uhal::ClientInterface.

Definition at line 40 of file DummyClient.cpp.

◆ implementReadBlock()

ValVector< uint32_t > uhal::tests::DummyClient::implementReadBlock ( const uint32_t &  aAddr,
const uint32_t &  aSize,
const defs::BlockReadWriteMode aMode 
)
privatevirtual

Read a block of unsigned data from a block of registers or a block-read port.

Parameters
aAddrthe lowest address in the block of registers or the address of the block-read port
aSizethe number of words to read
aModewhether we are reading from a block of registers (INCREMENTAL) or a block-read port (NON_INCREMENTAL)
Returns
a Validated Memory which wraps the location to which the reply data is to be written

Implements uhal::ClientInterface.

Definition at line 45 of file DummyClient.cpp.

◆ implementRMWbits()

ValWord< uint32_t > uhal::tests::DummyClient::implementRMWbits ( const uint32_t &  aAddr,
const uint32_t &  aANDterm,
const uint32_t &  aORterm 
)
privatevirtual

Read the value of a register, apply the AND-term, apply the OR-term, set the register to this new value and return a copy of the new value to the user.

Parameters
aAddrthe address of the register to read, modify, write
aANDtermthe AND-term to apply to existing value in the target register
aORtermthe OR-term to apply to existing value in the target register
Returns
a Validated Memory which wraps the location to which the reply data is to be written

Implements uhal::ClientInterface.

Definition at line 50 of file DummyClient.cpp.

◆ implementRMWsum()

ValWord< uint32_t > uhal::tests::DummyClient::implementRMWsum ( const uint32_t &  aAddr,
const int32_t &  aAddend 
)
privatevirtual

Read the value of a register, add the addend, set the register to this new value and return a copy of the new value to the user.

Parameters
aAddrthe address of the register to read, modify, write
aAddendthe addend to add to the existing value in the target register
Returns
a Validated Memory which wraps the location to which the reply data is to be written

Implements uhal::ClientInterface.

Definition at line 55 of file DummyClient.cpp.

◆ implementWrite()

ValHeader uhal::tests::DummyClient::implementWrite ( const uint32_t &  aAddr,
const uint32_t &  aValue 
)
privatevirtual

Write a single, unmasked word to a register.

Parameters
aAddrthe address of the register to write
aValuethe value to write to the register

Implements uhal::ClientInterface.

Definition at line 30 of file DummyClient.cpp.

◆ implementWriteBlock()

ValHeader uhal::tests::DummyClient::implementWriteBlock ( const uint32_t &  aAddr,
const std::vector< uint32_t > &  aValues,
const defs::BlockReadWriteMode aMode 
)
privatevirtual

Write a block of data to a block of registers or a block-write port.

Parameters
aAddrthe address of the register to write
aValuesthe values to write to the registers or a block-write port
aModewhether we are writing to a block of registers (INCREMENTAL) or a block-write port (NON_INCREMENTAL)

Implements uhal::ClientInterface.

Definition at line 35 of file DummyClient.cpp.

◆ validate()

exception::exception * uhal::tests::DummyClient::validate ( uint8_t *  aSendBufferStart,
uint8_t *  aSendBufferEnd,
std::deque< std::pair< uint8_t *, uint32_t > >::iterator  aReplyStartIt,
std::deque< std::pair< uint8_t *, uint32_t > >::iterator  aReplyEndIt 
)
privatevirtual

Function which the dispatch calls when the reply is received to check that the headers are as expected.

Parameters
aSendBufferStarta pointer to the start of the first word of IPbus data which was sent (i.e. with no preamble)
aSendBufferEnda pointer to the end of the last word of IPbus data which was sent
aReplyStartItan iterator to the start of the list of memory locations in to which the reply was written
aReplyEndItan iterator to the end (one past last valid entry) of the list of memory locations in to which the reply was written
Returns
whether the returned IPbus packet is valid

Implements uhal::ClientInterface.

Definition at line 60 of file DummyClient.cpp.


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