CYCLUS
Public Types | Public Member Functions | List of all members
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.

class HasResMapAgent : public cyclus::Facility {
public:
Tick() {
cyclus::Material::Ptr best = inventory_["best"];
double invsize = inventory_.quantity();
}
private:
};

Definition at line 41 of file res_map.h.

#include <res_map.h>

Public Types

typedef std::map< K, typename R::Ptr >::const_iterator const_iterator
 
typedef std::map< K, int >::const_iterator const_obj_iterator
 
typedef std::map< K, typename R::Ptr >::iterator iterator
 
typedef std::map< K, typename R::Ptr > map_type
 
typedef std::map< K, int >::iterator obj_iterator
 
typedef std::map< K, int > obj_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
 
void erase (iterator position)
 
map_type::size_type erase (const K &k)
 
void erase (iterator first, iterator last)
 
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

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

Definition at line 52 of file res_map.h.

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.

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

Definition at line 51 of file res_map.h.

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.

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.

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

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

Definition at line 43 of file res_map.h.

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

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

Definition at line 72 of file res_map.h.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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: