Hash tables - Accessing values in RW mode

This commit is contained in:
Emmanuel BENOîT 2017-12-10 12:00:17 +01:00
parent 53feddb4ee
commit 04726e2067
2 changed files with 24 additions and 10 deletions

View file

@ -90,9 +90,10 @@ class T_KeyValueTable
// ---------------------------------------------------------------------
uint32_t size( ) const;
T_Array< KeyType > const& keys( ) const;
T_Array< ValueType > const& values( ) const;
uint32_t size( ) const noexcept;
T_Array< KeyType > const& keys( ) const noexcept;
T_Array< ValueType > const& values( ) const noexcept;
T_Array< ValueType >& values( ) noexcept;
uint32_t indexOf( KeyType const& k ) const;
bool contains( KeyType const& k ) const;
@ -182,8 +183,9 @@ class T_ObjectTable
uint32_t size( ) const;
uint32_t indexOf( KeyType const& k ) const;
bool contains( KeyType const& k ) const;
T_Array< KeyType > keys( ) const;
T_Array< ValueType > const& values( ) const;
T_Array< KeyType > keys( ) const noexcept;
T_Array< ValueType > const& values( ) const noexcept;
T_Array< ValueType >& values( ) noexcept;
ValueType const * get( KeyType const& k ) const;
ValueType * get( KeyType const& k );

View file

@ -131,19 +131,25 @@ inline void T_KeyValueTable< K , V >::free( )
/*----------------------------------------------------------------------------*/
template< typename K , typename V >
inline uint32_t T_KeyValueTable< K , V >::size( ) const
inline uint32_t T_KeyValueTable< K , V >::size( ) const noexcept
{
return keys_.size( );
}
template< typename K , typename V >
T_Array< K > const& T_KeyValueTable< K , V >::keys( ) const
T_Array< K > const& T_KeyValueTable< K , V >::keys( ) const noexcept
{
return keys_;
}
template< typename K , typename V >
T_Array< V > const& T_KeyValueTable< K , V >::values( ) const
T_Array< V > const& T_KeyValueTable< K , V >::values( ) const noexcept
{
return values_;
}
template< typename K , typename V >
T_Array< V >& T_KeyValueTable< K , V >::values( ) noexcept
{
return values_;
}
@ -364,7 +370,7 @@ inline bool T_ObjectTable< K , V >::contains( K const& k ) const
/*----------------------------------------------------------------------------*/
template< typename K , typename V >
inline T_Array< K > T_ObjectTable< K , V >::keys( ) const
inline T_Array< K > T_ObjectTable< K , V >::keys( ) const noexcept
{
const auto sz( size( ) );
T_Array< K > k( sz ? sz : 1 );
@ -375,7 +381,13 @@ inline T_Array< K > T_ObjectTable< K , V >::keys( ) const
}
template< typename K , typename V >
inline T_Array< V > const& T_ObjectTable< K , V >::values( ) const
inline T_Array< V > const& T_ObjectTable< K , V >::values( ) const noexcept
{
return values_;
}
template< typename K , typename V >
inline T_Array< V >& T_ObjectTable< K , V >::values( ) noexcept
{
return values_;
}