Adapter for accessing structured register known to include an array of selector-iterated values. More...
#include <ValueArrayAdapter.h>
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) | |
CLock & | GetLock () 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 |
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.
|
private |
Definition at line 631 of file ValueArrayAdapter.h.
|
inline |
Creates a CValueArrayAdapter object.
[in] | base_value | The value node holding the array of values (selector iterated). |
[in] | selector | The 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.
|
inlinestatic |
Check value/selector feature pair suitability for use with the adapter.
[in] | base_value | The value node holding the array of values (selector iterated). |
[in] | selector | The selector node iterating the base_value array. |
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.
|
inlinestaticprivate |
Definition at line 617 of file ValueArrayAdapter.h.
|
inlinestaticprivate |
Definition at line 464 of file ValueArrayAdapter.h.
|
inlinestaticprivate |
Definition at line 478 of file ValueArrayAdapter.h.
|
inlinestaticprivate |
Definition at line 440 of file ValueArrayAdapter.h.
|
inlinestaticprivate |
Definition at line 452 of file ValueArrayAdapter.h.
|
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.
|
inline |
Get all values of the array.
[out] | values | The 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.
|
inlineprivate |
Definition at line 409 of file ValueArrayAdapter.h.
|
inlineprivate |
Definition at line 384 of file ValueArrayAdapter.h.
|
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.
|
inlineprivate |
Definition at line 496 of file ValueArrayAdapter.h.
|
inlinestaticprivate |
Definition at line 623 of file ValueArrayAdapter.h.
|
private |
Definition at line 632 of file ValueArrayAdapter.h.