souffle  2.0.2-371-g6315b36
Public Member Functions | Private Attributes
souffle::BaseTable< K, V > Class Template Reference

#include <Global.h>

Collaboration diagram for souffle::BaseTable< K, V >:
Collaboration graph

Public Member Functions

 BaseTable ()
 
 BaseTable (const BaseTable &other)
 
const std::map< K, V > & data () const
 
void data (const std::map< K, V > &otherData)
 
const V & get (const K &key) const
 
const V & get (const K &key, const V &value) const
 
bool has (const K &key) const
 
bool has (const K &key, const V &value) const
 
BaseTableoperator= (const BaseTable &other)
 
void print (std::ostream &os)
 
void set (const K &key)
 
void set (const K &key, const V &value)
 
void unset (const K &key)
 

Private Attributes

std::map< K, V > _data
 
const V _default
 

Detailed Description

template<typename K, typename V>
class souffle::BaseTable< K, V >

Definition at line 34 of file Global.h.

Constructor & Destructor Documentation

◆ BaseTable() [1/2]

template<typename K , typename V >
souffle::BaseTable< K, V >::BaseTable ( )
inline

Definition at line 43 of file Global.h.

◆ BaseTable() [2/2]

template<typename K , typename V >
souffle::BaseTable< K, V >::BaseTable ( const BaseTable< K, V > &  other)
inline

Definition at line 45 of file Global.h.

46  {
47  _data = otherData;

References souffle::BaseTable< K, V >::_data.

Member Function Documentation

◆ data() [1/2]

template<typename K , typename V >
const std::map<K, V>& souffle::BaseTable< K, V >::data ( ) const
inline

Definition at line 54 of file Global.h.

55  {
56  return (has(key)) ? _data.at(key) : value;

References souffle::BaseTable< K, V >::_data, and souffle::BaseTable< K, V >::has().

Here is the call graph for this function:

◆ data() [2/2]

template<typename K , typename V >
void souffle::BaseTable< K, V >::data ( const std::map< K, V > &  otherData)
inline

Definition at line 58 of file Global.h.

59  {
60  return _data.find(key) != _data.end();

References souffle::BaseTable< K, V >::_data.

◆ get() [1/2]

template<typename K , typename V >
const V& souffle::BaseTable< K, V >::get ( const K &  key) const
inline

Definition at line 63 of file Global.h.

63  {
64  return has(key) && _data.at(key) == value;
65  }

References souffle::BaseTable< K, V >::_data, and souffle::BaseTable< K, V >::has().

Here is the call graph for this function:

◆ get() [2/2]

template<typename K , typename V >
const V& souffle::BaseTable< K, V >::get ( const K &  key,
const V &  value 
) const
inline

Definition at line 67 of file Global.h.

68  {
69  _data[key] = _default;

References souffle::BaseTable< K, V >::_data, and souffle::BaseTable< K, V >::_default.

◆ has() [1/2]

template<typename K , typename V >
bool souffle::BaseTable< K, V >::has ( const K &  key) const
inline

◆ has() [2/2]

template<typename K , typename V >
bool souffle::BaseTable< K, V >::has ( const K &  key,
const V &  value 
) const
inline

Definition at line 75 of file Global.h.

76  {
77  _data.erase(key);

References souffle::BaseTable< K, V >::_data.

◆ operator=()

template<typename K , typename V >
BaseTable& souffle::BaseTable< K, V >::operator= ( const BaseTable< K, V > &  other)
inline

Definition at line 49 of file Global.h.

51  {
52  return (has(key)) ? _data.at(key) : _default;

References souffle::BaseTable< K, V >::_data, souffle::BaseTable< K, V >::_default, and souffle::BaseTable< K, V >::has().

Here is the call graph for this function:

◆ print()

template<typename K , typename V >
void souffle::BaseTable< K, V >::print ( std::ostream &  os)
inline

Definition at line 92 of file Global.h.

92  {
93  std::string longName; /* The long name for this option, e.g. 'option' for '--option'. */
94  char shortName; /* The short name for this option where a non-character option means none will be

References souffle::MainOption::argument, souffle::MainOption::longName, and souffle::MainOption::shortName.

◆ set() [1/2]

template<typename K , typename V >
void souffle::BaseTable< K, V >::set ( const K &  key)
inline

Definition at line 80 of file Global.h.

80  {
81  os << _data << std::endl;
82  }

References souffle::BaseTable< K, V >::_data.

◆ set() [2/2]

template<typename K , typename V >
void souffle::BaseTable< K, V >::set ( const K &  key,
const V &  value 
)
inline

Definition at line 84 of file Global.h.

84  :
85  /* Default object made by empty constructor to return by reference. */
86  const V _default;

◆ unset()

template<typename K , typename V >
void souffle::BaseTable< K, V >::unset ( const K &  key)
inline

Definition at line 88 of file Global.h.

92  {

Field Documentation

◆ _data

template<typename K , typename V >
std::map<K, V> souffle::BaseTable< K, V >::_data
private

◆ _default

template<typename K , typename V >
const V souffle::BaseTable< K, V >::_default
private

The documentation for this class was generated from the following file:
souffle::BaseTable::has
bool has(const K &key) const
Definition: Global.h:71
souffle::BaseTable::_default
const V _default
Definition: Global.h:98
souffle::BaseTable::_data
std::map< K, V > _data
Definition: Global.h:100