From e0c250ea7ea03358d44519a52665fd371a8167fa Mon Sep 17 00:00:00 2001 From: crgeddes Date: Fri, 10 Jun 2016 16:08:08 -0500 Subject: Implement < operator to fapi2::target's platform implementation This is needed for doing lookup operations on a vector of fapi2 targets. Change-Id: I941b0f1e95507f506f9735739c95685afa371083 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/25682 Tested-by: Jenkins Server Reviewed-by: Martin Gloff Tested-by: FSP CI Jenkins Reviewed-by: Andrew J. Geissler Reviewed-by: Daniel M. Crowell --- src/include/usr/fapi2/target.H | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'src/include/usr/fapi2') diff --git a/src/include/usr/fapi2/target.H b/src/include/usr/fapi2/target.H index 756b1d85f..3aa7e9342 100644 --- a/src/include/usr/fapi2/target.H +++ b/src/include/usr/fapi2/target.H @@ -109,8 +109,9 @@ Target& Target::operator=(const Target& i_right) /// @tparam V the type of the target's Value /// @param[in] i_right Reference to Target to compare. /// @return bool. True if equal. -/// @note Platforms need to define this so that the physical -/// targets are determined to be equivilent rather than just the handles +/// @note This platform uses handles for comparison as +/// target handles are statically defined so the order +/// is consistent. /// template bool Target::operator==(const Target& i_right) const @@ -122,13 +123,27 @@ bool Target::operator==(const Target& i_right) const /// @tparam V the type of the target's Value /// @param[in] i_right Reference to Target to compare. /// @return bool. True if not equal. -/// @note Platforms need to define this so that the physical -/// targets are determined to be equivilent rather than just the handles +/// @note This platform uses handles for comparison as +/// target handles are statically defined so the order +/// is consistent. /// template bool Target::operator!=(const Target& i_right) const { return i_right.iv_handle != iv_handle; } +/// +/// @brief Less Than Comparison Operator +/// @param[in] i_right Reference to Target to compare. +/// @return bool. True if less than i_right +/// @note This platform uses handles for comparison as +/// target handles are statically defined so the order +/// is consistent. +/// +template +bool Target::operator<(const Target& i_right) const +{ + return iv_handle < i_right.iv_handle; +} /// /// @brief This function takes in a FAPI2 Type and returns the corresponding -- cgit v1.2.3