RTBKit  0.9
Open-source framework to create real-time ad bidding systems.
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator
Classes | Public Types | Public Member Functions | Public Attributes
Datacratic::TimeoutMap< Key, Value > Struct Template Reference

List of all members.

Classes

struct  Node

Public Types

typedef std::map< Key, NodeNodes
typedef std::multimap< Date,
typename Nodes::iterator > 
Timeouts
typedef Nodes::const_iterator const_iterator
typedef Nodes::iterator iterator

Public Member Functions

 TimeoutMap (double defaultTimeout=-INFINITY)
void doThrowException (const std::string &reason) const
Nodeoperator[] (const Key &key)
Nodeaccess (const Key &key, Date timeout)
Nodeinsert (const Key &key, const Value &value, Date timeout)
Nodeinsert (const Key &key, Value &&value, Date timeout)
Nodeupdate (const Key &key, Value &&value)
Nodeupdate (const Key &key, const Value &value)
void updateTimeout (const Key &key, Date timeout)
template<typename Callback >
void expire (const Callback &callback, Date now=Date::now())
void expire (Date now=Date::now())
bool count (const Key &key) const
Value get (const Key &key) const
iterator find (const Key &key)
const_iterator find (const Key &key) const
iterator begin ()
iterator end ()
const_iterator begin () const
const_iterator end () const
bool erase (const Key &key)
void erase (const typename Nodes::iterator &it)
void updateTimeout (const iterator &it, Date timeout)
size_t size () const
bool empty () const
void clear ()

Public Attributes

double defaultTimeout
boost::function< void(const
std::string &reason)> 
throwException
Nodes nodes
Timeouts timeouts
Date earliest

Detailed Description

template<typename Key, class Value>
struct Datacratic::TimeoutMap< Key, Value >

Definition at line 22 of file timeout_map.h.


Member Typedef Documentation

template<typename Key, class Value>
typedef std::multimap<Date, typename Nodes::iterator> Datacratic::TimeoutMap< Key, Value >::Timeouts

Ordered set of timeouts in submitted for auction loss messages.

Definition at line 216 of file timeout_map.h.


Member Function Documentation

template<typename Key, class Value>
Node& Datacratic::TimeoutMap< Key, Value >::access ( const Key &  key,
Date  timeout 
) [inline]

Return the given key or insert a default value if it doesn't exist. Updates the timeout to the given value.

Definition at line 66 of file timeout_map.h.

template<typename Key, class Value>
bool Datacratic::TimeoutMap< Key, Value >::erase ( const Key &  key) [inline]

Remove the entry for the given key. Returns true if it was erased or false otherwise.

Definition at line 286 of file timeout_map.h.

template<typename Key, class Value>
template<typename Callback >
void Datacratic::TimeoutMap< Key, Value >::expire ( const Callback &  callback,
Date  now = Date::now() 
) [inline]

Call the callback on any which have expired, removing them from the map.

Definition at line 179 of file timeout_map.h.

template<typename Key, class Value>
void Datacratic::TimeoutMap< Key, Value >::expire ( Date  now = Date::now()) [inline]

Remove any which have expired.

Definition at line 201 of file timeout_map.h.

template<typename Key, class Value>
Node& Datacratic::TimeoutMap< Key, Value >::insert ( const Key &  key,
const Value &  value,
Date  timeout 
) [inline]

Insert the given key, value pair with the given timeout. Throws an exception if the key already exists.

Definition at line 85 of file timeout_map.h.

template<typename Key, class Value>
Node& Datacratic::TimeoutMap< Key, Value >::insert ( const Key &  key,
Value &&  value,
Date  timeout 
) [inline]

Insert the given key, value pair with the given timeout. Throws an exception if the key already exists.

Definition at line 108 of file timeout_map.h.

template<typename Key, class Value>
Node& Datacratic::TimeoutMap< Key, Value >::operator[] ( const Key &  key) [inline]

Access the entry for the given node. If it already exists then return the existing entry; otherwise insert it with the default timeout.

Definition at line 47 of file timeout_map.h.

template<typename Key, class Value>
Node& Datacratic::TimeoutMap< Key, Value >::update ( const Key &  key,
Value &&  value 
) [inline]

Update the given key which must already exist.

Definition at line 128 of file timeout_map.h.

template<typename Key, class Value>
Node& Datacratic::TimeoutMap< Key, Value >::update ( const Key &  key,
const Value &  value 
) [inline]

Update the given key which must already exist.

Definition at line 140 of file timeout_map.h.


The documentation for this struct was generated from the following file:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator