summaryrefslogtreecommitdiffstats
path: root/src/import/hwpf/fapi2/include/variable_buffer.H
diff options
context:
space:
mode:
authorBrian Silver <bsilver@us.ibm.com>2015-05-11 09:20:43 -0500
committerPatrick Williams <iawillia@us.ibm.com>2015-12-11 13:40:20 -0600
commitf6e1bb1abf5b9c3f43e16a195d42b0f83e9f1186 (patch)
tree8ef17eb2305c2ec950fa63a958853f35f6ee1d3d /src/import/hwpf/fapi2/include/variable_buffer.H
parentc0dca0999cb7e39e52decb3e7cf3b8e8610e2298 (diff)
downloadtalos-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/variable_buffer.H')
-rw-r--r--src/import/hwpf/fapi2/include/variable_buffer.H21
1 files changed, 19 insertions, 2 deletions
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
OpenPOWER on IntegriCloud