40 #ifndef _uhal_ClientInterface_hpp_ 41 #define _uhal_ClientInterface_hpp_ 50 #include <boost/date_time/posix_time/posix_time_types.hpp> 51 #include <boost/shared_ptr.hpp> 52 #include <boost/thread/mutex.hpp> 74 UHAL_DEFINE_EXCEPTION_CLASS ( BitsSetWhichAreForbiddenByBitMask , "Exception class to handle the case where a masked
write was attempted with a data source which has non-zero bits outside the bit-mask's bounds." )
80 UHAL_DEFINE_EXCEPTION_CLASS ( NullBufferException , "Exception class to handle a NULL buffer being passed to the transport class." )
84 UHAL_DEFINE_EXCEPTION_CLASS ( TransactionLevelError, "Base exception class covering situations in which a transaction-level error occurs (i.e. error occurs in individual read/
write).")
101 ClientInterface (
const std::string& aId,
const URI& aUri ,
const boost::posix_time::time_duration& aTimeoutPeriod );
113 ClientInterface (
const ClientInterface& aClientInterface );
120 virtual ClientInterface& operator= (
const ClientInterface& aClientInterface );
126 virtual ~ClientInterface();
132 const std::string& id()
const;
143 std::string
uri()
const;
155 void setTimeoutPeriod (
const uint32_t& aTimeoutPeriod = 0 );
162 uint64_t getTimeoutPeriod();
170 const boost::posix_time::time_duration& getBoostTimeoutPeriod();
179 ValHeader write (
const uint32_t& aAddr,
const uint32_t& aValue );
187 ValHeader write (
const uint32_t& aAddr,
const uint32_t& aValue,
const uint32_t& aMask );
228 ValWord< uint32_t > rmw_bits (
const uint32_t& aAddr ,
const uint32_t& aANDterm ,
const uint32_t& aORterm );
246 virtual void Flush( );
259 virtual ValHeader implementWrite (
const uint32_t& aAddr,
const uint32_t& aValue ) = 0;
294 virtual ValWord< uint32_t > implementRMWbits (
const uint32_t& aAddr ,
const uint32_t& aANDterm ,
const uint32_t& aORterm ) = 0;
302 virtual ValWord< uint32_t > implementRMWsum (
const uint32_t& aAddr ,
const int32_t& aAddend ) = 0;
312 virtual uint32_t getPreambleSize();
324 std::pair < ValHeader , _ValHeader_* > CreateValHeader();
338 std::pair < ValVector<uint32_t> ,
_ValVector_<uint32_t>* > CreateValVector (
const uint32_t& aSize );
359 uint8_t* aSendBufferEnd ,
360 std::deque< std::pair< uint8_t* , uint32_t > >::iterator aReplyStartIt ,
361 std::deque< std::pair< uint8_t* , uint32_t > >::iterator aReplyEndIt ) = 0;
364 virtual void dispatchExceptionHandler();
392 void updateCurrentBuffers();
393 void deleteBuffers();
404 std::deque < boost::shared_ptr< Buffers > >
mBuffers;
406 #ifdef NO_PREEMPTIVE_DISPATCH 407 std::deque < boost::shared_ptr< Buffers > > mNoPreemptiveDispatchBuffers;
435 virtual boost::shared_ptr< Buffers > checkBufferSpace (
const uint32_t& aSendSize ,
const uint32_t& aReplySize , uint32_t& aAvailableSendSize , uint32_t& aAvailableReplySize );
442 virtual uint32_t getMaxNumberOfBuffers() = 0;
447 virtual uint32_t getMaxSendSize() = 0;
452 virtual uint32_t getMaxReplySize() = 0;
std::deque< boost::shared_ptr< Buffers > > mBuffers
A memory pool of buffers which will be dispatched.
boost::shared_ptr< Buffers > mCurrentBuffers
A pointer to a buffer-wrapper object.
boost::mutex mBufferMutex
A MutEx lock used to make sure the access to the buffers is thread safe.
A Template helper struct wrapping an IPbus header, a register for storing a single word of data...
#define UHAL_DEFINE_EXCEPTION_CLASS(ClassName, ClassDescription)
An abstract base exception class providing an interface to a throw/ThrowAsDerivedType mechanism which...
boost::mutex mUserSideMutex
A MutEx lock used to make sure the access functions are thread safe.
const uint32_t NOMASK
define what it means to have no mask
boost::posix_time::time_duration mTimeoutPeriod
Timeout period for transactions.
for(size_t i=0;i< lDepths.size();i++)
std::string mId
the identifier of the target for this client
A class providing the core IPbus packing functionality.
An abstract base class for defining the interface to the various IPbus clients as well as providing t...
BlockReadWriteMode
define whether transactions target a single register, a block of registers, a block-read/write port o...
URI mUri
a struct containing the full URI of the target for this client
Struct to store a URI when parsed by boost spirit.
A Template helper struct wrapping a block of IPbus header, a register for storing a block of data and...