Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType > Class Template Reference

Adapter for accessing structured register known to include an array of selector-iterated values. More...

#include <ValueArrayAdapter.h>

Inheritance diagram for GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >:
Inheritance graph
[legend]

Public Member Functions

 CValueArrayAdapter (TValueNodeType *base_value, IInteger *selector)
 Creates a CValueArrayAdapter object. More...
 
std::vector< TOutputValueType > GetAllValues ()
 Get all values of the array. More...
 
void GetAllValues (std::vector< TOutputValueType > &values)
 Get all values of the array. More...
 
bool IsValid () const
 Check if the instance is valid and useable. More...
 

Static Public Member Functions

static bool CheckAdvertisedCompatibility (TValueNodeType *base_value, IInteger *selector)
 Check value/selector feature pair suitability for use with the adapter. More...
 

Private Types

typedef void(CValueArrayAdapter::* ArrayGetterFunction) (std::vector< TOutputValueType > &values)
 

Private Member Functions

template<typename TFieldType >
void GetArrayOfFieldBits (std::vector< TOutputValueType > &values)
 
template<typename TFieldType >
void GetArrayOfFieldValues (std::vector< TOutputValueType > &values)
 
void PrepareValues ()
 

Static Private Member Functions

template<typename TRawType >
static TEffectiveValueType EffectiveValue (TRawType raw_value)
 
template<typename TFieldType >
static void ExtractFieldBits_Noswap (size_t num_values, size_t address_step, uint64_t mask, size_t shift, const uint8_t *src, TOutputValueType *dst)
 
template<typename TFieldType >
static void ExtractFieldBits_Swap (size_t num_values, size_t address_step, uint64_t mask, size_t shift, const uint8_t *src, TOutputValueType *dst)
 
template<typename TFieldType >
static void ExtractFieldValues_Noswap (size_t num_values, size_t address_step, const uint8_t *src, TOutputValueType *dst)
 
template<typename TFieldType >
static void ExtractFieldValues_Swap (size_t num_values, size_t address_step, const uint8_t *src, TOutputValueType *dst)
 
template<typename TFieldType >
static TFieldType ReadSwapped (const void *ptr)
 

Private Attributes

ArrayGetterFunction current_array_getter
 

Additional Inherited Members

- Protected Member Functions inherited from GENAPI_NAMESPACE::CValueArrayAdapterBase
 CValueArrayAdapterBase (IValue *base_value, IInteger *selector)
 
CLockGetLock () const
 
void ReadFromPort ()
 
virtual ~CValueArrayAdapterBase ()
 
- Protected Attributes inherited from GENAPI_NAMESPACE::CValueArrayAdapterBase
uint64_t current_address_step
 
uint8_t * current_array_shadow
 
uint64_t current_base_address
 
size_t current_num_values
 
uint64_t current_reg_length
 
bool is_int_reg
 
bool is_signed
 
bool is_valid
 
uint32_t lsbit
 
uint64_t lsbit_mask
 
bool masked_int
 
uint32_t msbit
 
bool swap_endian
 

Detailed Description

template<typename TValueNodeType, typename TOutputValueType, typename TEffectiveValueType = TOutputValueType>
class GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >

Adapter for accessing structured register known to include an array of selector-iterated values.

Generic worker for any numeric "output" type, typically used through "concretized" children, CIntegerValueArray, CFloatValueArray or CBooleanValueArray. Intended to significantly improve performance when reading large contiguous arrays that would otherwise be read using selector-based iteration. To be eligible for use with the adapter, the XML definition of the feature and its selector must conform to specific rules that are documented with SFNC feature ValueArrayCandidates (and can be tested using member function CheckAdvertisedCompatibility). The "effective" value type is expected to be usually same as the "output" value type, with exception of retrieving the bool array as vector<uint8_t> instead of the possibly problematic vector<bool>.

Definition at line 217 of file ValueArrayAdapter.h.

Member Typedef Documentation

template<typename TValueNodeType, typename TOutputValueType, typename TEffectiveValueType = TOutputValueType>
typedef void(CValueArrayAdapter::* GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >::ArrayGetterFunction) (std::vector< TOutputValueType > &values)
private

Definition at line 631 of file ValueArrayAdapter.h.

Constructor & Destructor Documentation

template<typename TValueNodeType, typename TOutputValueType, typename TEffectiveValueType = TOutputValueType>
GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >::CValueArrayAdapter ( TValueNodeType *  base_value,
IInteger selector 
)
inline

Creates a CValueArrayAdapter object.

Parameters
[in]base_valueThe value node holding the array of values (selector iterated).
[in]selectorThe selector node iterating the base_value array.

Does not throw C++ exceptions, except when memory allocation fails.

Definition at line 227 of file ValueArrayAdapter.h.

Member Function Documentation

template<typename TValueNodeType, typename TOutputValueType, typename TEffectiveValueType = TOutputValueType>
static bool GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >::CheckAdvertisedCompatibility ( TValueNodeType *  base_value,
IInteger selector 
)
inlinestatic

Check value/selector feature pair suitability for use with the adapter.

Parameters
[in]base_valueThe value node holding the array of values (selector iterated).
[in]selectorThe selector node iterating the base_value array.
Returns
Returns true if the value/selector pair is advertised to be eligible for use with the adapter.

The function does not directly touch the value/selector nodes, it rather checks, if the nodemap they belong to advertises their compatibility with the adapter using the ValueArrayCandidates SFNC feature. It is the device/nodemap designer's responsibility to advertise this compatibility only for suitable features.

Does not throw C++ exceptions.

Definition at line 333 of file ValueArrayAdapter.h.

template<typename TValueNodeType, typename TOutputValueType, typename TEffectiveValueType = TOutputValueType>
template<typename TRawType >
static TEffectiveValueType GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >::EffectiveValue ( TRawType  raw_value)
inlinestaticprivate

Definition at line 617 of file ValueArrayAdapter.h.

template<typename TValueNodeType, typename TOutputValueType, typename TEffectiveValueType = TOutputValueType>
template<typename TFieldType >
static void GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >::ExtractFieldBits_Noswap ( size_t  num_values,
size_t  address_step,
uint64_t  mask,
size_t  shift,
const uint8_t *  src,
TOutputValueType *  dst 
)
inlinestaticprivate

Definition at line 464 of file ValueArrayAdapter.h.

template<typename TValueNodeType, typename TOutputValueType, typename TEffectiveValueType = TOutputValueType>
template<typename TFieldType >
static void GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >::ExtractFieldBits_Swap ( size_t  num_values,
size_t  address_step,
uint64_t  mask,
size_t  shift,
const uint8_t *  src,
TOutputValueType *  dst 
)
inlinestaticprivate

Definition at line 478 of file ValueArrayAdapter.h.

template<typename TValueNodeType, typename TOutputValueType, typename TEffectiveValueType = TOutputValueType>
template<typename TFieldType >
static void GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >::ExtractFieldValues_Noswap ( size_t  num_values,
size_t  address_step,
const uint8_t *  src,
TOutputValueType *  dst 
)
inlinestaticprivate

Definition at line 440 of file ValueArrayAdapter.h.

template<typename TValueNodeType, typename TOutputValueType, typename TEffectiveValueType = TOutputValueType>
template<typename TFieldType >
static void GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >::ExtractFieldValues_Swap ( size_t  num_values,
size_t  address_step,
const uint8_t *  src,
TOutputValueType *  dst 
)
inlinestaticprivate

Definition at line 452 of file ValueArrayAdapter.h.

template<typename TValueNodeType, typename TOutputValueType, typename TEffectiveValueType = TOutputValueType>
std::vector<TOutputValueType> GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >::GetAllValues ( )
inline

Get all values of the array.

Gets all values of the array (for current selector range) as a vector. Returns same results as if the value array was iterated using the corresponding selector - if given value/selector pair is eligible for use with the adapter and conforms to the required rules, otherwise the results are undefined.

The nodemap is expected to advertise the value/selector pairs suitable for use with the adapter using the ValueArrayCandidates feature (defined in SFNC). The device (nodemap) designer guarantees compatibility with the adapter for the advertised features.

The function does not check access mode of the value feature, user should verify its readability when desirable.

Note that the first run might be little bit slower than following runs, because of some initial internal allocations. The data are not cached, the array is retrieved fresh on each run.

Throws C++ exceptions if the operation fails.

Definition at line 267 of file ValueArrayAdapter.h.

template<typename TValueNodeType, typename TOutputValueType, typename TEffectiveValueType = TOutputValueType>
void GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >::GetAllValues ( std::vector< TOutputValueType > &  values)
inline

Get all values of the array.

Parameters
[out]valuesThe output vector carrying the 'array' values.

Gets all values of the array (for current selector range) as a vector. Returns same results as if the value array was iterated using the corresponding selector - if given value/selector pair is eligible for use with the adapter and conforms to the required rules, otherwise the results are undefined.

The nodemap is expected to advertise the value/selector pairs suitable for use with the adapter using the ValueArrayCandidates feature (defined in SFNC). The device (nodemap) designer guarantees compatibility with the adapter for the advertised features.

The function does not check access mode of the value feature, user should verify its readability when desirable.

Note that the first run might be little bit slower than following runs, because of some initial internal allocations. The data are not cached, the array is retrieved fresh on each run.

This overload outputs the values in an out-parameter rather than as a return value which might offer small performance advantage if the same vector is reused across multiple calls (its capacity is reused).

Throws C++ exceptions if the operation fails.

Definition at line 301 of file ValueArrayAdapter.h.

template<typename TValueNodeType, typename TOutputValueType, typename TEffectiveValueType = TOutputValueType>
template<typename TFieldType >
void GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >::GetArrayOfFieldBits ( std::vector< TOutputValueType > &  values)
inlineprivate

Definition at line 409 of file ValueArrayAdapter.h.

template<typename TValueNodeType, typename TOutputValueType, typename TEffectiveValueType = TOutputValueType>
template<typename TFieldType >
void GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >::GetArrayOfFieldValues ( std::vector< TOutputValueType > &  values)
inlineprivate

Definition at line 384 of file ValueArrayAdapter.h.

template<typename TValueNodeType, typename TOutputValueType, typename TEffectiveValueType = TOutputValueType>
bool GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >::IsValid ( ) const
inline

Check if the instance is valid and useable.

The created instance might be invalid in particular if given value/selector feature pair is not eligible for use with the adapter (they do not conform to required rules).

Does not throw C++ exceptions.

Definition at line 240 of file ValueArrayAdapter.h.

template<typename TValueNodeType, typename TOutputValueType, typename TEffectiveValueType = TOutputValueType>
void GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >::PrepareValues ( )
inlineprivate

Definition at line 496 of file ValueArrayAdapter.h.

template<typename TValueNodeType, typename TOutputValueType, typename TEffectiveValueType = TOutputValueType>
template<typename TFieldType >
static TFieldType GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >::ReadSwapped ( const void *  ptr)
inlinestaticprivate

Definition at line 623 of file ValueArrayAdapter.h.

Member Data Documentation

template<typename TValueNodeType, typename TOutputValueType, typename TEffectiveValueType = TOutputValueType>
ArrayGetterFunction GENAPI_NAMESPACE::CValueArrayAdapter< TValueNodeType, TOutputValueType, TEffectiveValueType >::current_array_getter
private

Definition at line 632 of file ValueArrayAdapter.h.


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


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Mar 17 2021 02:48:42