diff options
| author | Brian Silver <bsilver@us.ibm.com> | 2015-05-11 09:20:43 -0500 |
|---|---|---|
| committer | Patrick Williams <iawillia@us.ibm.com> | 2015-12-11 13:40:20 -0600 |
| commit | f6e1bb1abf5b9c3f43e16a195d42b0f83e9f1186 (patch) | |
| tree | 8ef17eb2305c2ec950fa63a958853f35f6ee1d3d /src/import/hwpf/fapi2/include | |
| parent | c0dca0999cb7e39e52decb3e7cf3b8e8610e2298 (diff) | |
| download | talos-hostboot-f6e1bb1abf5b9c3f43e16a195d42b0f83e9f1186.tar.gz talos-hostboot-f6e1bb1abf5b9c3f43e16a195d42b0f83e9f1186.zip | |
Add variable_buffer get<OT>()
Change-Id: Iaf658f2d4a43703400ea016c37244f27524a73c0
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/17679
Tested-by: Jenkins Server
Reviewed-by: Richard J. Knight <rjknight@us.ibm.com>
Reviewed-by: Matt K. Light <mklight@us.ibm.com>
Reviewed-by: Brian Silver <bsilver@us.ibm.com>
Diffstat (limited to 'src/import/hwpf/fapi2/include')
| -rw-r--r-- | src/import/hwpf/fapi2/include/buffer.H | 4 | ||||
| -rw-r--r-- | src/import/hwpf/fapi2/include/variable_buffer.H | 21 |
2 files changed, 21 insertions, 4 deletions
diff --git a/src/import/hwpf/fapi2/include/buffer.H b/src/import/hwpf/fapi2/include/buffer.H index 6a3a2bddb..ec55fed42 100644 --- a/src/import/hwpf/fapi2/include/buffer.H +++ b/src/import/hwpf/fapi2/include/buffer.H @@ -615,7 +615,7 @@ namespace fapi2 /// @tparam OT the type of the outgoing (target) /// @param[out] o_out OT to copy into - data is placed left aligned /// @param[in] Start bit in source - /// @param[in] Length of bits to insert + /// @param[in] Length of bits to extract /// @param[in] Start bit to insert into (target start) /// @return FAPI2_RC_SUCCESS if ok /// @@ -638,7 +638,7 @@ namespace fapi2 /// /// @brief Copy data from this buffer into an OT and right justify /// @tparam SS Start bit to insert into (source start) - /// @tparam L Length of bits to insert + /// @tparam L Length of bits to extract /// @tparam OT the type of the outgoing (target) /// @param[out] o_out OT to copy into - data is placed right aligned /// @return buffer& Useful for method chaining diff --git a/src/import/hwpf/fapi2/include/variable_buffer.H b/src/import/hwpf/fapi2/include/variable_buffer.H index 2af09a83b..b1739be94 100644 --- a/src/import/hwpf/fapi2/include/variable_buffer.H +++ b/src/import/hwpf/fapi2/include/variable_buffer.H @@ -288,8 +288,6 @@ namespace fapi2 /// @param[in] i_offset Start OT (start word, for example) in buffer /// - defaults to 0 (will by default write the left most element) /// @return FAPI2_RC_SUCCESS on success, FAPI2_RC_OVERFLOW otherwise - /// @note This is is only available for integral types. To set a - /// variable_buffer into a variable_buffer, use insert() /// template< typename OT> inline fapi2::ReturnCodes set(OT i_value, const bits_type i_offset = 0) @@ -318,6 +316,17 @@ namespace fapi2 return FAPI2_RC_SUCCESS; } + /// + /// @brief Get an OT of data from buffer + /// @tparam OT the type of the data to get + /// @param[in] i_offset Start OT (start word, for example) in buffer + /// - defaults to 0 (will by default write the left most element) + /// @return OT + /// @note uint8_t b = get<uint8_t>(N) <- gets the N'th left byte from the buffer + /// + template< typename OT> + inline OT get(const bits_type i_offset = 0); + /// @name Bit/Word Manipulation Functions ///@{ @@ -1177,5 +1186,13 @@ namespace fapi2 return rc; } + template< typename OT> + inline OT variable_buffer::get(const bits_type i_offset) + { + // Get is just an extract. + OT l_tmp; + extract(l_tmp, parameterTraits<OT>::bit_length() * i_offset, parameterTraits<OT>::bit_length()); + return l_tmp; + } } #endif |

