NeTrainSim 0.1.1 beta
The Open-Source Network Trains Simulator
 
Loading...
Searching...
No Matches
Map< Key, Value > Class Template Reference

A map. More...

#include <map.h>

Inheritance diagram for Map< Key, Value >:

Public Types

using map_type = std::map< Key, Value >
 Type of the map.
 
using key_type = typename map_type::key_type
 Type of the key.
 
using mapped_type = typename map_type::mapped_type
 Type of the mapped.
 
using value_type = typename map_type::value_type
 Type of the value.
 

Public Member Functions

Vector< key_typeget_keys () const
 Gets the keys.
 
Vector< mapped_typeget_values () const
 Gets the values.
 
bool is_key (const key_type &key) const
 Query if 'key' is key.
 
bool is_value (const mapped_type &value) const
 Query if 'value' is value.
 
mapped_type sumValues () const
 Calculates the sum of all values in the map.
 
void print () const
 Prints this object.
 
std::string toString () const
 Convert this object into a string representation.
 

Detailed Description

template<typename Key, typename Value>
class Map< Key, Value >

A map.

Author
Ahmed Aredah
Date
2/28/2023
Template Parameters
KeyType of the key.
ValueType of the value.

Member Typedef Documentation

◆ key_type

template<typename Key , typename Value >
using Map< Key, Value >::key_type = typename map_type::key_type

Type of the key.

◆ map_type

template<typename Key , typename Value >
using Map< Key, Value >::map_type = std::map<Key, Value>

Type of the map.

◆ mapped_type

template<typename Key , typename Value >
using Map< Key, Value >::mapped_type = typename map_type::mapped_type

Type of the mapped.

◆ value_type

template<typename Key , typename Value >
using Map< Key, Value >::value_type = typename map_type::value_type

Type of the value.

Member Function Documentation

◆ get_keys()

template<typename Key , typename Value >
Vector< key_type > Map< Key, Value >::get_keys ( ) const
inline

Gets the keys.

Author
Ahmed Aredah
Date
2/28/2023
Returns
The keys.

◆ get_values()

template<typename Key , typename Value >
Vector< mapped_type > Map< Key, Value >::get_values ( ) const
inline

Gets the values.

Author
Ahmed Aredah
Date
2/28/2023
Returns
The values.

◆ is_key()

template<typename Key , typename Value >
bool Map< Key, Value >::is_key ( const key_type key) const
inline

Query if 'key' is key.

Author
Ahmed Aredah
Date
2/28/2023
Parameters
keyThe key.
Returns
True if key, false if not.

◆ is_value()

template<typename Key , typename Value >
bool Map< Key, Value >::is_value ( const mapped_type value) const
inline

Query if 'value' is value.

Author
Ahmed Aredah
Date
2/28/2023
Parameters
valueThe value.
Returns
True if value, false if not.

◆ print()

template<typename Key , typename Value >
void Map< Key, Value >::print ( ) const
inline

Prints this object.

Author
Ahmed Aredah
Date
2/28/2023

◆ sumValues()

template<typename Key , typename Value >
mapped_type Map< Key, Value >::sumValues ( ) const
inline

Calculates the sum of all values in the map.

Returns
The sum of all values.

◆ toString()

template<typename Key , typename Value >
std::string Map< Key, Value >::toString ( ) const
inline

Convert this object into a string representation.

Author
Ahmed Aredah
Date
2/28/2023
Returns
A std::string that represents this object.