Rosetta  2019.07
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Private Types | Private Attributes | List of all members
basic::datacache::DataCache< Data > Class Template Reference

forward declaration for DataCache More...

#include <DataCache.hh>

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

Public Types

typedef
utility::pointer::shared_ptr
< Data > 
DataOP
 
typedef
utility::pointer::shared_ptr
< Data const > 
DataCOP
 
typedef
utility::pointer::weak_ptr
< Data > 
DataAP
 
typedef
utility::pointer::weak_ptr
< Data const > 
DataCAP
 
- Public Types inherited from utility::pointer::ReferenceCount
typedef platform::Size Size
 
typedef platform::Size size_type
 

Public Member Functions

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

Protected Types

typedef utility::vector1< DataOPDataOPs
 

Protected Member Functions

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

Private Types

typedef
utility::pointer::ReferenceCount 
Super
 

Private Attributes

DataOPs data_
 stores data via unique integer index More...
 

Detailed Description

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

forward declaration for DataCache

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::weak_ptr< Data > basic::datacache::DataCache< Data >::DataAP
template<typename Data>
typedef utility::pointer::weak_ptr< Data const > basic::datacache::DataCache< Data >::DataCAP
template<typename Data>
typedef utility::pointer::shared_ptr< Data const > basic::datacache::DataCache< Data >::DataCOP
template<typename Data>
typedef utility::pointer::shared_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 ( std::size_t  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>
basic::datacache::DataCache< Data >::~DataCache ( )
overridedefault

destructor

Member Function Documentation

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

clear all stored data

Referenced by pyrosetta.bindings.pose.ResidueLabelAccessor::discard().

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

clear the object in a selected slot

Referenced by pyrosetta.bindings.pose.ResidueLabelAccessor::discard().

template<typename Data>
DataOPs const& basic::datacache::DataCache< Data >::data ( ) const
inlineprotected

get the storage vector

template<typename Data>
DataOPs& basic::datacache::DataCache< Data >::data ( )
inlineprotected

get the storage vector

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

get base class reference to the object stored in the slot

template<typename Data>
template<typename D >
D const& basic::datacache::DataCache< Data >::get ( std::size_t  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 ( std::size_t  slot)
inline

get base class reference to object stored in the slot

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

get derived class reference to object stored in the slot

Template Parameters
Dclass derived from Data
template<typename Data>
DataCOP basic::datacache::DataCache< Data >::get_const_ptr ( std::size_t  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::shared_ptr< D const > basic::datacache::DataCache< Data >::get_const_ptr ( std::size_t  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 ( std::size_t  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::shared_ptr< D > basic::datacache::DataCache< Data >::get_ptr ( std::size_t  slot)
inline

get derived class owning 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 ( std::size_t  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>
template<typename D >
D const* basic::datacache::DataCache< Data >::get_raw_const_ptr ( std::size_t  slot) const
inline

get derived class raw ptr to object stored in the slot

Template Parameters
Dclass derived from Data
template<typename Data>
Data* basic::datacache::DataCache< Data >::get_raw_ptr ( std::size_t  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 ( std::size_t  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 ( std::size_t  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 ( std::size_t  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 ( std::size_t  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 ( ) const
inline

the number of slots in this cache

Member Data Documentation

template<typename Data>
DataOPs basic::datacache::DataCache< Data >::data_
private

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