Rosetta 3.3
Public Types | Public Member Functions | Protected Types | Protected Member Functions
basic::datacache::DataCache< Data > Class Template Reference

Indexed storage for objects derived from a ReferenceCountable data type. More...

#include <DataCache.hh>

Inheritance diagram for basic::datacache::DataCache< Data >:
Inheritance graph
[legend]
Collaboration diagram for basic::datacache::DataCache< Data >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef
utility::pointer::owning_ptr
< Data > 
DataOP
typedef
utility::pointer::owning_ptr
< Data const > 
DataCOP
typedef
utility::pointer::access_ptr
< Data > 
DataAP
typedef
utility::pointer::access_ptr
< Data const > 
DataCAP

Public Member Functions

 DataCache ()
 default constructor
 DataCache (size_t const n_slots)
 size constructor
 DataCache (DataCache const &src)
 copy constructor
virtual ~DataCache ()
 destructor
DataCacheoperator= (DataCache const &src)
 copy assignment
size_t size ()
 the number of slots in this cache
void resize (size_t const n_slots)
 resize the cache for the given number of slots
void clear ()
 clear all stored data
void clear (size_t const slot)
 clear the object in a selected slot
bool has (size_t const slot) const
 is there an object in the slot?
Data const & get (size_t const slot) const
 get base class reference to the object stored in the slot
template<typename D >
D const & get (size_t const slot) const
 get derived class reference to the object stored in the slot
Data & get (size_t const slot)
 get base class reference to object stored in the slot
template<typename D >
D & get (size_t const slot)
 get derived class reference to object stored in the slot
DataCOP get_const_ptr (size_t const slot) const
 get base class owning ptr to object stored in the slot
template<typename D >
utility::pointer::owning_ptr
< D const > 
get_const_ptr (size_t const slot) const
 get derived class owning ptr to object stored in the slot
DataOP get_ptr (size_t const slot)
 get base class owning ptr to object stored in the slot
template<typename D >
utility::pointer::owning_ptr< D > get_ptr (size_t const slot)
 get derived class owning ptr to object stored in the slot
Data const * get_raw_const_ptr (size_t const slot) const
 get base class raw ptr to object stored in the slot
template<typename D >
D const * get_raw_const_ptr (size_t const slot) const
 get derived class raw ptr to object stored in the slot
Data * get_raw_ptr (size_t const slot)
 get base class raw ptr to object stored in the slot
template<typename D >
D * get_raw_ptr (size_t const slot)
 get derived class raw ptr to object stored in the slot
void set (size_t const slot, DataOP new_data)
 store data in the given slot

Protected Types

typedef utility::vector1< DataOPDataOPs

Protected Member Functions

DataOPs const & data () const
 get the storage vector
DataOPsdata ()
 get the storage vector

Detailed Description

template<typename Data>
class basic::datacache::DataCache< Data >

Indexed storage for objects derived from a ReferenceCountable data type.

Intended for use as a generic data cache by storing objects derived from a ReferenceCountable data type in a unique slot designated by an integer id (enum, size index, etc.). The DataCache will only store one object per slot/id. For example, see the PoseDataCache used in core::pose::Pose, which is indexed by the enum basic::pose::datacache:CacheableDataType. Currently when data is set(), it is not cloned -- classes deriving from DataCache should remember to overload set() if they need cloning behavior.

Template Parameters:
DataClass derived from utility::pointer::ReferenceCount that defines a virtual clone() method.

Member Typedef Documentation

template<typename Data>
typedef utility::pointer::access_ptr< Data > basic::datacache::DataCache< Data >::DataAP
template<typename Data>
typedef utility::pointer::access_ptr< Data const > basic::datacache::DataCache< Data >::DataCAP
template<typename Data>
typedef utility::pointer::owning_ptr< Data const > basic::datacache::DataCache< Data >::DataCOP
template<typename Data>
typedef utility::pointer::owning_ptr< Data > basic::datacache::DataCache< Data >::DataOP
template<typename Data>
typedef utility::vector1< DataOP > basic::datacache::DataCache< Data >::DataOPs [protected]

Constructor & Destructor Documentation

template<typename Data>
basic::datacache::DataCache< Data >::DataCache ( ) [inline]

default constructor

template<typename Data>
basic::datacache::DataCache< Data >::DataCache ( size_t const  n_slots) [inline]

size constructor

Parameters:
[in]n_typesThe number of slots for this DataCache.
template<typename Data>
basic::datacache::DataCache< Data >::DataCache ( DataCache< Data > const &  src) [inline]

copy constructor

template<typename Data>
virtual basic::datacache::DataCache< Data >::~DataCache ( ) [inline, virtual]

destructor


Member Function Documentation

template<typename Data>
void basic::datacache::DataCache< Data >::clear ( ) [inline]

clear all stored data

template<typename Data>
void basic::datacache::DataCache< Data >::clear ( size_t const  slot) [inline]

clear the object in a selected slot

template<typename Data>
DataOPs const& basic::datacache::DataCache< Data >::data ( ) const [inline, protected]

get the storage vector

template<typename Data>
DataOPs& basic::datacache::DataCache< Data >::data ( ) [inline, protected]

get the storage vector

template<typename Data>
template<typename D >
D const& basic::datacache::DataCache< Data >::get ( size_t const  slot) const [inline]

get derived class reference to the object stored in the slot

Template Parameters:
Dclass derived from Data
template<typename Data>
Data& basic::datacache::DataCache< Data >::get ( size_t const  slot) [inline]

get base class reference to object stored in the slot

template<typename Data>
template<typename D >
D& basic::datacache::DataCache< Data >::get ( size_t const  slot) [inline]

get derived class reference to object stored in the slot

Template Parameters:
Dclass derived from Data
template<typename Data>
Data const& basic::datacache::DataCache< Data >::get ( size_t const  slot) const [inline]

get base class reference to the object stored in the slot

template<typename Data>
DataCOP basic::datacache::DataCache< Data >::get_const_ptr ( size_t const  slot) const [inline]

get base class owning ptr to object stored in the slot

Referenced by basic::datacache::DataCache< CacheableData >::get_const_ptr().

template<typename Data>
template<typename D >
utility::pointer::owning_ptr< D const > basic::datacache::DataCache< Data >::get_const_ptr ( size_t const  slot) const [inline]

get derived class owning ptr to object stored in the slot

Template Parameters:
Dclass derived from Data
template<typename Data>
DataOP basic::datacache::DataCache< Data >::get_ptr ( size_t const  slot) [inline]

get base class owning ptr to object stored in the slot

Referenced by basic::datacache::DataCache< CacheableData >::get_ptr().

template<typename Data>
template<typename D >
utility::pointer::owning_ptr< D > basic::datacache::DataCache< Data >::get_ptr ( size_t const  slot) [inline]

get derived class owning ptr to object stored in the slot

Template Parameters:
Dclass derived from Data
template<typename Data>
template<typename D >
D const* basic::datacache::DataCache< Data >::get_raw_const_ptr ( size_t const  slot) const [inline]

get derived class raw ptr to object stored in the slot

Template Parameters:
Dclass derived from Data
template<typename Data>
Data const* basic::datacache::DataCache< Data >::get_raw_const_ptr ( size_t const  slot) const [inline]

get base class raw ptr to object stored in the slot

Referenced by basic::datacache::DataCache< CacheableData >::get_raw_const_ptr().

template<typename Data>
Data* basic::datacache::DataCache< Data >::get_raw_ptr ( size_t const  slot) [inline]

get base class raw ptr to object stored in the slot

Referenced by basic::datacache::DataCache< CacheableData >::get_raw_ptr().

template<typename Data>
template<typename D >
D* basic::datacache::DataCache< Data >::get_raw_ptr ( size_t const  slot) [inline]

get derived class raw ptr to object stored in the slot

Template Parameters:
Dclass derived from Data
template<typename Data>
bool basic::datacache::DataCache< Data >::has ( size_t const  slot) const [inline]

is there an object in the slot?

template<typename Data>
DataCache& basic::datacache::DataCache< Data >::operator= ( DataCache< Data > const &  src) [inline]

copy assignment

template<typename Data>
void basic::datacache::DataCache< Data >::resize ( size_t const  n_slots) [inline]

resize the cache for the given number of slots

Parameters:
[in]n_slotsThe new number of slots.
template<typename Data>
void basic::datacache::DataCache< Data >::set ( size_t const  slot,
DataOP  new_data 
) [inline]

store data in the given slot

Parameters:
[in]Theslot to use.
[in]observerThe data to store -- data is *not* cloned.
template<typename Data>
size_t basic::datacache::DataCache< Data >::size ( ) [inline]

the number of slots in this cache


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines