CYCLUS
Loading...
Searching...
No Matches
cyclus::toolkit::ResMap< K, R > Class Template Reference

Detailed Description

template<class K, class R>
class cyclus::toolkit::ResMap< K, R >

ResMap container for the management of resources.

It allows you to associate keys with individual resources. The keys are often strings or ints and the ResMap enables you to add whatever semantic meaning that you want to these keys.

Typically, a ResMap will be a member variable of an archetype class. Resources can be added, removed, and retrieved from it as needed.

public:
Tick() {
cyclus::Material::Ptr best = inventory_["best"];
double invsize = inventory_.quantity();
}
private:
};
The Facility class is the abstract class/interface used by all facility agents.
Definition facility.h:68
boost::shared_ptr< Material > Ptr
Definition material.h:75
ResMap container for the management of resources.
Definition res_map.h:41
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters

Definition at line 41 of file res_map.h.

#include <res_map.h>

Public Types

typedef std::map< K, typenameR::Ptr >::const_iterator const_iterator
 
typedef std::map< K, int >::const_iterator const_obj_iterator
 
typedef std::map< K, typenameR::Ptr >::iterator iterator
 
typedef std::map< K, typename R::Ptr > map_type
 
typedef std::map< K, int >::iterator obj_iterator
 
typedef std::map< K, intobj_type
 

Public Member Functions

iterator begin ()
 
const_iterator begin () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
void clear ()
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
map_type::size_type erase (const K &k)
 
void erase (iterator first, iterator last)
 
void erase (iterator position)
 
obj_typeobj_ids ()
 
void obj_ids (obj_type oi)
 
R::Ptr & operator[] (const K &k)
 
const R::Ptr & operator[] (const K &k) const
 
R::Ptr Pop (const K key)
 
double quantity ()
 
 ResMap ()
 
std::vector< Resource::PtrResValues ()
 
void ResValues (std::vector< Resource::Ptr > vals)
 
int size () const
 
std::vector< typename R::Ptr > Values ()
 
void Values (std::vector< typename R::Ptr > vals)
 
virtual ~ResMap ()
 

Member Typedef Documentation

◆ const_iterator

template<class K , class R >
typedef std::map<K,typenameR::Ptr>::const_iterator cyclus::toolkit::ResMap< K, R >::const_iterator

Definition at line 52 of file res_map.h.

◆ const_obj_iterator

template<class K , class R >
typedef std::map<K,int>::const_iterator cyclus::toolkit::ResMap< K, R >::const_obj_iterator

Definition at line 56 of file res_map.h.

◆ iterator

template<class K , class R >
typedef std::map<K,typenameR::Ptr>::iterator cyclus::toolkit::ResMap< K, R >::iterator

Definition at line 51 of file res_map.h.

◆ map_type

template<class K , class R >
typedef std::map<K, typename R::Ptr> cyclus::toolkit::ResMap< K, R >::map_type

Definition at line 50 of file res_map.h.

◆ obj_iterator

template<class K , class R >
typedef std::map<K,int>::iterator cyclus::toolkit::ResMap< K, R >::obj_iterator

Definition at line 55 of file res_map.h.

◆ obj_type

template<class K , class R >
typedef std::map<K, int> cyclus::toolkit::ResMap< K, R >::obj_type

Definition at line 54 of file res_map.h.

Constructor & Destructor Documentation

◆ ResMap()

template<class K , class R >
cyclus::toolkit::ResMap< K, R >::ResMap ( )
inline

Definition at line 43 of file res_map.h.

◆ ~ResMap()

template<class K , class R >
virtual cyclus::toolkit::ResMap< K, R >::~ResMap ( )
inlinevirtual

Definition at line 48 of file res_map.h.

Member Function Documentation

◆ begin() [1/2]

template<class K , class R >
iterator cyclus::toolkit::ResMap< K, R >::begin ( )
inline

Returns an iterator to the begining of the map.

Definition at line 106 of file res_map.h.

◆ begin() [2/2]

template<class K , class R >
const_iterator cyclus::toolkit::ResMap< K, R >::begin ( ) const
inline

Returns a const iterator to the begining of the map.

Definition at line 112 of file res_map.h.

◆ cbegin()

template<class K , class R >
const_iterator cyclus::toolkit::ResMap< K, R >::cbegin ( ) const
inline

Returns a const iterator to the begining of the map.

Definition at line 115 of file res_map.h.

◆ cend()

template<class K , class R >
const_iterator cyclus::toolkit::ResMap< K, R >::cend ( ) const
inline

Returns a const iterator to the end of the map.

Definition at line 127 of file res_map.h.

◆ clear()

template<class K , class R >
void cyclus::toolkit::ResMap< K, R >::clear ( )
inline

Removes all elements from the map.

Definition at line 149 of file res_map.h.

◆ empty()

template<class K , class R >
bool cyclus::toolkit::ResMap< K, R >::empty ( ) const
inline

Returns true if there are no resources in the map.

Definition at line 87 of file res_map.h.

◆ end() [1/2]

template<class K , class R >
iterator cyclus::toolkit::ResMap< K, R >::end ( )
inline

Returns an iterator to the end of the map.

Definition at line 118 of file res_map.h.

◆ end() [2/2]

template<class K , class R >
const_iterator cyclus::toolkit::ResMap< K, R >::end ( ) const
inline

Returns a const iterator to the end of the map.

Definition at line 124 of file res_map.h.

◆ erase() [1/3]

template<class K , class R >
map_type::size_type cyclus::toolkit::ResMap< K, R >::erase ( const K & k)
inline

Removes an element from the map, given its key.

Definition at line 136 of file res_map.h.

◆ erase() [2/3]

template<class K , class R >
void cyclus::toolkit::ResMap< K, R >::erase ( iterator first,
iterator last )
inline

Removes elements along a range from the first to last position in the map.

Definition at line 143 of file res_map.h.

◆ erase() [3/3]

template<class K , class R >
void cyclus::toolkit::ResMap< K, R >::erase ( iterator position)
inline

Removes an element at a given position in the map.

Definition at line 130 of file res_map.h.

◆ obj_ids() [1/2]

template<class K , class R >
obj_type & cyclus::toolkit::ResMap< K, R >::obj_ids ( )
inline

Definition at line 72 of file res_map.h.

◆ obj_ids() [2/2]

template<class K , class R >
void cyclus::toolkit::ResMap< K, R >::obj_ids ( obj_type oi)
inline

Definition at line 81 of file res_map.h.

◆ operator[]() [1/2]

template<class K , class R >
R::Ptr & cyclus::toolkit::ResMap< K, R >::operator[] ( const K & k)
inline

Returns a reference to a resource pointer given a key.

Definition at line 94 of file res_map.h.

◆ operator[]() [2/2]

template<class K , class R >
const R::Ptr & cyclus::toolkit::ResMap< K, R >::operator[] ( const K & k) const
inline

Returns a reference to a resource pointer given a key.

Definition at line 100 of file res_map.h.

◆ Pop()

template<class K , class R >
R::Ptr cyclus::toolkit::ResMap< K, R >::Pop ( const K key)
inline

Retrieves and removes the value associated with the provided key.

Definition at line 201 of file res_map.h.

◆ quantity()

template<class K , class R >
double cyclus::toolkit::ResMap< K, R >::quantity ( )
inline

Returns the total quantity of resources in the map.

Definition at line 66 of file res_map.h.

◆ ResValues() [1/2]

template<class K , class R >
std::vector< Resource::Ptr > cyclus::toolkit::ResMap< K, R >::ResValues ( )
inline

Returns a vector resource pointers for the values in the map.

Definition at line 174 of file res_map.h.

◆ ResValues() [2/2]

template<class K , class R >
void cyclus::toolkit::ResMap< K, R >::ResValues ( std::vector< Resource::Ptr > vals)
inline

Sets the resource values of map based on their object ids.

Thus the objs_ids member must be set. This is primarily for restart capabilities and is not recomended for day-to-day use.

Definition at line 196 of file res_map.h.

◆ size()

template<class K , class R >
int cyclus::toolkit::ResMap< K, R >::size ( ) const
inline

Returns the total number of resources in the map.

Definition at line 63 of file res_map.h.

◆ Values() [1/2]

template<class K , class R >
std::vector< typename R::Ptr > cyclus::toolkit::ResMap< K, R >::Values ( )
inline

Returns a vector of the values in the map.

Definition at line 160 of file res_map.h.

◆ Values() [2/2]

template<class K , class R >
void cyclus::toolkit::ResMap< K, R >::Values ( std::vector< typename R::Ptr > vals)
inline

Sets the values of map based on their object ids.

Thus the objs_ids member must be set. This is primarily for restart capabilities and is not recomended for day-to-day use.

Definition at line 179 of file res_map.h.


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