ADTF
Loading...
Searching...
No Matches
adtf::base::ant::hash_value_map< STORAGE, INTERFACE > Class Template Reference

#include <hashedvaluemap.h>

Inherits adtf::base::ant::IHashValueMap.

Classes

struct  tHashValueStorageType
 

Public Types

typedef tHashValueStorageType value_type
 
- Public Types inherited from adtf::base::ant::IHashValueMap
using tHashKey = adtf::util::cStringUtil::tHashKey32
 Type for the HashKey of the Value.
 

Public Member Functions

 hash_value_map ()
 CTOR.
 
 hash_value_map (size_t szPreAllocatedKeyValueSize)
 
virtual ~hash_value_map ()
 DTOR.
 
 hash_value_map (const hash_value_map &oToCopy)
 
hash_value_mapoperator= (const hash_value_map &oToCopy)
 
 hash_value_map (hash_value_map &&oToCopy)=delete
 no move DTOR
 
hash_value_mapoperator= (hash_value_map &&oToCopy)=delete
 no move operator
 
bool Exists (const IHashValueMap::tHashKey &oKey) const override
 
tResult Get (IHashValueMap &oHashMap) const override
 
tResult GetValue (const IHashValueMap::tHashKey &oHashKey, IHashValueMapValue &oValue) const override
 
void Reset () override
 
tResult SetValue (const IHashValueMap::tHashKey &oHashKey, const IHashValueMapValue &oValue) override
 
size_t GetCapacity () const
 
bool IsEmpty () const override
 
tResult FromRaw (const IRawMemory &oRawValue) override
 
tResult ToRaw (IRawMemory &&oRawValue) const override
 
uint8_t GetRawMemoryLayoutVersion () const
 
void * GetPtr () const
 

Protected Member Functions

 hash_value_map (size_t szPreallocateMemorySize, bool bZeroMemory)
 
- Protected Member Functions inherited from adtf::base::ant::IHashValueMap
virtual ~IHashValueMap ()=default
 protected DTOR
 
- Protected Member Functions inherited from adtf::base::ant::IRawValue
virtual ~IRawValue ()=default
 protected DTOR
 

Protected Attributes

size_t m_szPreAllocatedKeyValueSize = 0
 Value count for preallocation of the memory.
 

Detailed Description

template<typename STORAGE = adtf::util::cMemoryBlock, typename INTERFACE = IHashValueMap>
class adtf::base::ant::hash_value_map< STORAGE, INTERFACE >

implementation of the IHashValueMap.

Template Parameters
STORAGEMemory storage type
INTERFACEinterface derived from

Constructor & Destructor Documentation

◆ hash_value_map() [1/2]

template<typename STORAGE = adtf::util::cMemoryBlock, typename INTERFACE = IHashValueMap>
adtf::base::ant::hash_value_map< STORAGE, INTERFACE >::hash_value_map ( size_t szPreAllocatedKeyValueSize)
inline

CTOR

Parameters
[in]szPreAllocatedKeyValueSizecount of values to preallocate memory

◆ hash_value_map() [2/2]

template<typename STORAGE = adtf::util::cMemoryBlock, typename INTERFACE = IHashValueMap>
adtf::base::ant::hash_value_map< STORAGE, INTERFACE >::hash_value_map ( const hash_value_map< STORAGE, INTERFACE > & oToCopy)
inline

Copy CTOR

Parameters
[in]oToCopymap to copy from

Member Function Documentation

◆ Exists()

template<typename STORAGE = adtf::util::cMemoryBlock, typename INTERFACE = IHashValueMap>
bool adtf::base::ant::hash_value_map< STORAGE, INTERFACE >::Exists ( const IHashValueMap::tHashKey & oKey) const
inlineoverridevirtual

Tests is a value for the oKey exists.

Parameters
[in]oKeyhash key to check.
Return values
truevalue exists
falsevalue does not exists

Implements adtf::base::ant::IHashValueMap.

◆ FromRaw()

template<typename STORAGE = adtf::util::cMemoryBlock, typename INTERFACE = IHashValueMap>
tResult adtf::base::ant::hash_value_map< STORAGE, INTERFACE >::FromRaw ( const IRawMemory & oRawValue)
inlineoverridevirtual

Implement to create a fast value copy in memory. Usually this method is called if types are equal implementation is within the same binary!

Parameters
oRawValue[in] Memory representation of the value
Return values
ERR_NOERRORSuccessfully copied.
ERR_MEMORYYou have to return ERR_MEMORY if size of oRawValue does not fit !!
any_errorDepends on the implementation.

Implements adtf::base::ant::IRawValue.

◆ Get()

template<typename STORAGE = adtf::util::cMemoryBlock, typename INTERFACE = IHashValueMap>
tResult adtf::base::ant::hash_value_map< STORAGE, INTERFACE >::Get ( IHashValueMap & oHashMap) const
inlineoverridevirtual

Copy operation to the oHashMap.

Parameters
[in]oHashMaphash map to copy values to another hash map
Remarks
if the implementation is equal you should use IRawValue to copy memory other use SetValue!
Returns
returns the standard error code
Return values
ERR_NOERRORcopy operation succeeded
ERR_MEMORYIRawValue::FromRaw or SetValue returned error

Implements adtf::base::ant::IHashValueMap.

◆ GetCapacity()

template<typename STORAGE = adtf::util::cMemoryBlock, typename INTERFACE = IHashValueMap>
size_t adtf::base::ant::hash_value_map< STORAGE, INTERFACE >::GetCapacity ( ) const
inline

Retrieve the current count of value can be stored

Returns
The capacity

◆ GetRawMemoryLayoutVersion()

template<typename STORAGE = adtf::util::cMemoryBlock, typename INTERFACE = IHashValueMap>
uint8_t adtf::base::ant::hash_value_map< STORAGE, INTERFACE >::GetRawMemoryLayoutVersion ( ) const
inlinevirtual

Return the Version of the memory layout used to store the values.

Returns
The version number of the Memory layout.

Implements adtf::base::ant::IHashValueMap.

◆ GetValue()

template<typename STORAGE = adtf::util::cMemoryBlock, typename INTERFACE = IHashValueMap>
tResult adtf::base::ant::hash_value_map< STORAGE, INTERFACE >::GetValue ( const IHashValueMap::tHashKey & oHashKey,
IHashValueMapValue & oValue ) const
inlineoverridevirtual

Retrieves the value for the hash key oHashKey to oValue if exists.

Parameters
[in]oHashKeyhashkey
[out]oValuevalue
Returns
returns the standard error code
Return values
ERR_NOERRORsuccedded
ERR_INVALID_TYPEType not supported
anydepends on implementation of IHashedValue.
See also
get_hashed_value

Implements adtf::base::ant::IHashValueMap.

◆ IsEmpty()

template<typename STORAGE = adtf::util::cMemoryBlock, typename INTERFACE = IHashValueMap>
bool adtf::base::ant::hash_value_map< STORAGE, INTERFACE >::IsEmpty ( ) const
inlineoverridevirtual

Tests if value map is empty.

Return values
falsevalues exist
trueno values exist, map is empty.

Implements adtf::base::ant::IHashValueMap.

◆ operator=()

template<typename STORAGE = adtf::util::cMemoryBlock, typename INTERFACE = IHashValueMap>
hash_value_map & adtf::base::ant::hash_value_map< STORAGE, INTERFACE >::operator= ( const hash_value_map< STORAGE, INTERFACE > & oToCopy)
inline

Copy operator

Parameters
[in]oToCopymap to copy from
Returns
this instance

◆ Reset()

template<typename STORAGE = adtf::util::cMemoryBlock, typename INTERFACE = IHashValueMap>
void adtf::base::ant::hash_value_map< STORAGE, INTERFACE >::Reset ( )
inlineoverridevirtual

Clears the value map.

Implements adtf::base::ant::IHashValueMap.

◆ SetValue()

template<typename STORAGE = adtf::util::cMemoryBlock, typename INTERFACE = IHashValueMap>
tResult adtf::base::ant::hash_value_map< STORAGE, INTERFACE >::SetValue ( const IHashValueMap::tHashKey & oHashKey,
const IHashValueMapValue & oValue )
inlineoverridevirtual

Sets or resets the value for the hash key oHashKey as copy of oValue.

Parameters
[in]oHashKeyhashkey
[in]oValuevalue to set
Returns
returns the standard error code
Return values
ERR_NOERRORcopy operation succeeded
ERR_MEMORYIRawValue::FromRaw returned error
See also
set_hashed_value

Implements adtf::base::ant::IHashValueMap.

◆ ToRaw()

template<typename STORAGE = adtf::util::cMemoryBlock, typename INTERFACE = IHashValueMap>
tResult adtf::base::ant::hash_value_map< STORAGE, INTERFACE >::ToRaw ( IRawMemory && oRawValue) const
inlineoverridevirtual

Implement to create a fast value copy in memory. Usually this method is called if types are equal implementation is within the same binary!

Parameters
oRawValue[oRawValue] copy of the memory representation of the value
Return values
ERR_NOERRORSuccessfully copied.
any_errorDepends on the implementation. You are adviced to return the return value of IRawMemory::Set.

Implements adtf::base::ant::IRawValue.


The documentation for this class was generated from the following file: