MultiArray - Function that returns total values count

This commit is contained in:
Emmanuel BENOîT 2018-05-07 12:57:26 +02:00
parent d2122aff38
commit 8f939b6a32
3 changed files with 67 additions and 47 deletions
include/ebcl

View file

@ -379,11 +379,13 @@ class T_MultiArray
void copyFrom( T_Data const& source );
// Returns the amount of entries
uint32_t size( ) const;
uint32_t size( ) const noexcept;
// Returns the index of the first value for an entry
uint32_t firstOf( uint32_t item ) const;
uint32_t firstOf( uint32_t item ) const noexcept;
// Returns the amount of values for an entry
uint32_t sizeOf( uint32_t item ) const;
uint32_t sizeOf( uint32_t item ) const noexcept;
// Returns the amount of values across all entries
uint32_t values( ) const noexcept;
// Access a value in an entry
T const& get( uint32_t item , uint32_t sub ) const;

View file

@ -1553,23 +1553,29 @@ inline void T_MultiArray< T >::copyFrom( T_Array< T > const& source )
/*----------------------------------------------------------------------------*/
template< typename T >
inline uint32_t T_MultiArray< T >::size( ) const
inline uint32_t T_MultiArray< T >::size( ) const noexcept
{
return meta_.size( ) >> 1;
}
template< typename T >
inline uint32_t T_MultiArray< T >::firstOf( uint32_t item ) const
inline uint32_t T_MultiArray< T >::firstOf( uint32_t item ) const noexcept
{
return meta_[ item * 2 ];
}
template< typename T >
inline uint32_t T_MultiArray< T >::sizeOf( uint32_t item ) const
inline uint32_t T_MultiArray< T >::sizeOf( uint32_t item ) const noexcept
{
return meta_[ item * 2 + 1 ];
}
template< typename T >
inline uint32_t T_MultiArray< T >::values( ) const noexcept
{
return values_.size( );
}
/*----------------------------------------------------------------------------*/
template< typename T >