CIRCT 23.0.0git
Loading...
Searching...
No Matches
Classes | Typedefs | Functions | Variables
esi::detail Namespace Reference

Classes

struct  DeserializerSelector
 
struct  DeserializerSelector< T, std::void_t< typename T::TypeDeserializer > >
 
struct  has_type_deserializer
 
struct  has_type_deserializer< T, std::void_t< typename T::TypeDeserializer > >
 
class  PODTypeDeserializer
 Default deserializer for simple 1:1 typed reads. More...
 
class  PollingBuffer
 Shared queue/promise helper for polling-style read APIs. More...
 

Typedefs

template<typename T >
using TypedReadOwnedCallback = std::function< bool(std::unique_ptr< T > &)>
 Owning callback used by typed read deserializers.
 
template<typename T >
using DeserializerFor = typename DeserializerSelector< T >::type
 
template<typename T >
using DeserializerOutputCallback = typename DeserializerFor< T >::OutputCallback
 

Functions

template<typename Storage , std::size_t BitOffset, std::size_t Width>
constexpr Storage readUnsignedBits (const uint8_t *bytes)
 Read Width bits starting at BitOffset (LSB-first within bytes) and return them zero-extended in Storage.
 
template<typename Signed , std::size_t BitOffset, std::size_t Width>
constexpr Signed readSignedBits (const uint8_t *bytes)
 Read Width bits starting at BitOffset (LSB-first) and sign-extend into the signed integer type Signed.
 
template<typename Storage , std::size_t BitOffset, std::size_t Width>
constexpr void writeUnsignedBits (uint8_t *bytes, Storage value)
 Write the low Width bits of value into bytes starting at BitOffset (LSB-first).
 
template<typename Signed , std::size_t BitOffset, std::size_t Width>
constexpr void writeSignedBits (uint8_t *bytes, Signed value)
 Convenience overload for signed values.
 
template<std::size_t BitOffset, std::size_t Width>
constexpr void copyBitsIn (const uint8_t *src, uint8_t *dst)
 Copy Width bits out of src starting at BitOffset into dst packed LSB-first from bit 0.
 
template<std::size_t BitOffset, std::size_t Width>
constexpr void copyBitsOut (uint8_t *dst, const uint8_t *src)
 Inverse of copyBitsIn: take Width bits packed LSB-first from bit 0 of src and write them into dst starting at BitOffset.
 
template<typename T >
const MessageDatagetMessageDataRef (const SegmentedMessageData &msg, MessageData &scratch)
 
ChannelPort::ConnectOptions typedFunctionConnectOptions ()
 Standard ConnectOptions for typed function ports: untranslated frames so the deserializer can see raw frame boundaries.
 
template<typename T >
std::future< T > awaitDecoded (std::future< std::unique_ptr< T > > inner)
 Convert a std::future<std::unique_ptr<T>> (as returned by TypedReadPort::readAsync()) into a std::future<T>.
 
void throwNullFunction ()
 Throw the standard "null Function pointer" error used by every TypedFunction specialization.
 
void throwNotConnected ()
 Throw a clear "not connected" error from call() paths.
 
void throwAlreadyConnected ()
 Throw a clear "already connected" error from connect() paths.
 
void throwNullCallback ()
 Throw the standard "null Callback pointer" error used by every TypedCallback specialization.
 
void throwCallbackAlreadyConnected ()
 Throw a clear "already connected" error from TypedCallback connect() paths.
 

Variables

template<typename T >
constexpr bool has_type_deserializer_v = has_type_deserializer<T>::value
 

Typedef Documentation

◆ DeserializerFor

template<typename T >
using esi::detail::DeserializerFor = typedef typename DeserializerSelector<T>::type

Definition at line 232 of file TypedPorts.h.

◆ DeserializerOutputCallback

template<typename T >
using esi::detail::DeserializerOutputCallback = typedef typename DeserializerFor<T>::OutputCallback

Definition at line 235 of file TypedPorts.h.

◆ TypedReadOwnedCallback

template<typename T >
using esi::detail::TypedReadOwnedCallback = typedef std::function<bool(std::unique_ptr<T> &)>

Owning callback used by typed read deserializers.

Returning false means the callee did not accept the object and wants the exact same owned value retried later.

Definition at line 146 of file TypedPorts.h.

Function Documentation

◆ awaitDecoded()

template<typename T >
std::future< T > esi::detail::awaitDecoded ( std::future< std::unique_ptr< T > >  inner)
private

Convert a std::future<std::unique_ptr<T>> (as returned by TypedReadPort::readAsync()) into a std::future<T>.

Uses a deferred async so .get() blocks only when the caller actually waits for the value, preserving the per-call FIFO ordering of the underlying polling buffer. A null unique_ptr from a misbehaving deserializer is reported as a runtime error rather than dereferenced.

Definition at line 983 of file TypedPorts.h.

◆ copyBitsIn()

template<std::size_t BitOffset, std::size_t Width>
constexpr void esi::detail::copyBitsIn ( const uint8_t *  src,
uint8_t *  dst 
)
inlineconstexpr

Copy Width bits out of src starting at BitOffset into dst packed LSB-first from bit 0.

Used to embed an aggregate (struct, union, or array) at an arbitrary bit position inside a parent wire buffer: the inner type already stores its bits LSB-first in dst, so the destination bits land at the same positions they'd occupy if the inner was read out at byte alignment. dst must be zero-initialised on entry (the helper only sets 1 bits) and must hold at least ceil(Width / 8) bytes.

Definition at line 124 of file BitAccess.h.

◆ copyBitsOut()

template<std::size_t BitOffset, std::size_t Width>
constexpr void esi::detail::copyBitsOut ( uint8_t *  dst,
const uint8_t *  src 
)
inlineconstexpr

Inverse of copyBitsIn: take Width bits packed LSB-first from bit 0 of src and write them into dst starting at BitOffset.

Other bits in the affected bytes of dst are preserved.

Definition at line 137 of file BitAccess.h.

◆ getMessageDataRef()

template<typename T >
const MessageData & esi::detail::getMessageDataRef ( const SegmentedMessageData msg,
MessageData scratch 
)

Definition at line 159 of file TypedPorts.h.

References esi::SegmentedMessageData::toMessageData().

◆ readSignedBits()

template<typename Signed , std::size_t BitOffset, std::size_t Width>
constexpr Signed esi::detail::readSignedBits ( const uint8_t *  bytes)
inlineconstexpr

Read Width bits starting at BitOffset (LSB-first) and sign-extend into the signed integer type Signed.

Signed must be at least Width bits wide.

Definition at line 62 of file BitAccess.h.

◆ readUnsignedBits()

template<typename Storage , std::size_t BitOffset, std::size_t Width>
constexpr Storage esi::detail::readUnsignedBits ( const uint8_t *  bytes)
inlineconstexpr

Read Width bits starting at BitOffset (LSB-first within bytes) and return them zero-extended in Storage.

Storage must be an unsigned integer type wide enough to hold Width bits.

Definition at line 43 of file BitAccess.h.

◆ throwAlreadyConnected()

void esi::detail::throwAlreadyConnected ( )
inlineprivate

◆ throwCallbackAlreadyConnected()

void esi::detail::throwCallbackAlreadyConnected ( )
inlineprivate

◆ throwNotConnected()

void esi::detail::throwNotConnected ( )
inlineprivate

◆ throwNullCallback()

void esi::detail::throwNullCallback ( )
inlineprivate

◆ throwNullFunction()

void esi::detail::throwNullFunction ( )
inlineprivate

◆ typedFunctionConnectOptions()

ChannelPort::ConnectOptions esi::detail::typedFunctionConnectOptions ( )
inlineprivate

◆ writeSignedBits()

template<typename Signed , std::size_t BitOffset, std::size_t Width>
constexpr void esi::detail::writeSignedBits ( uint8_t *  bytes,
Signed  value 
)
inlineconstexpr

Convenience overload for signed values.

Reinterprets the value as unsigned (two's complement) and writes the low Width bits.

Definition at line 104 of file BitAccess.h.

◆ writeUnsignedBits()

template<typename Storage , std::size_t BitOffset, std::size_t Width>
constexpr void esi::detail::writeUnsignedBits ( uint8_t *  bytes,
Storage  value 
)
inlineconstexpr

Write the low Width bits of value into bytes starting at BitOffset (LSB-first).

Other bits in the affected bytes are preserved.

Definition at line 84 of file BitAccess.h.

Variable Documentation

◆ has_type_deserializer_v

template<typename T >
constexpr bool esi::detail::has_type_deserializer_v = has_type_deserializer<T>::value
inlineconstexpr

Definition at line 156 of file TypedPorts.h.