Drake
|
Each cache entry contains: More...
#include <drake/systems/framework/cache3.h>
Public Types | |
using | Calculator = std::function< void(const class AbstractSystem3 &, const class AbstractContext3 &, AbstractValue *)> |
This is the type of a function that unconditionally computes this cache entry's value with respect to the contents of a given Context. More... | |
Public Member Functions | |
CacheEntry () | |
Create an empty cache entry that is not yet committed to a particular kind of abstract value. More... | |
CacheEntry (const AbstractValue &value) | |
Create a cache entry initialized to a copy of the given value . More... | |
CacheEntry (std::unique_ptr< AbstractValue > value) noexcept | |
Create a cache entry that takes over ownership of the given value . More... | |
CacheEntry (const CacheEntry &source) | |
Copy constructor makes a new cache entry that has a copy of the value from source , but is marked "not current" regardless of whether source is current. More... | |
CacheEntry (CacheEntry &&source) noexcept | |
Move constructor moves the value and preserves the is_current status of the source in the destination. More... | |
void | set_calculator (const Calculator &calculator) |
Set the function to be used when we need to recompute this cache entry's value. More... | |
const Calculator & | get_calculator () const |
Set the function to be used when we need to recompute this cache entry's value. More... | |
void | ResetAbstractValue (std::unique_ptr< AbstractValue > value) |
Set the AbstractValue type stored in this CacheEntry by replacing the existing one (if any) with the supplied one. More... | |
void | ResetAbstractValue (const AbstractValue &value) |
Set the AbstractValue type stored in this CacheEntry by replacing the existing one (if any) with a copy of the supplied one. More... | |
void | RealizeCacheEntry (const AbstractSystem3 &system, const AbstractContext3 &context) |
bool | is_current () const |
Return the value of the is_current flag for this cache entry. More... | |
void | set_is_current (bool is_current) |
Mark this entry as current or not; up to caller to do this right. More... | |
const AbstractValue & | get_abstract_value () const |
Return a const reference to the AbstractValue contained in this cache entry, regardless of whether it is current. More... | |
AbstractValue * | get_mutable_abstract_value () |
Return a mutable pointer to the AbstractValue contained in this cache entry, regardless of whether it is current. More... | |
template<class Type > | |
const Type & | get_value () const |
Return a const reference to the value contained in this cache entry, which must be of type Type . More... | |
template<class Type > | |
Type * | get_mutable_value () |
Return a mutable pointer to the value contained in this cache entry, which must be of type Type . More... | |
template<typename T > | |
const VectorInterface< T > & | get_vector_value () const |
template<typename T > | |
const VectorInterface< T > * | get_mutable_vector_value () const |
void | Invalidate () override |
Invalidate this cache entry and notify any downstream listeners. More... | |
Public Member Functions inherited from ValueListenerInterface | |
virtual | ~ValueListenerInterface () |
Each cache entry contains:
A cache entry is both a prerequisite for its downstream value listeners, and a value listener registered with its upstream prerequisites.
using Calculator = std::function<void(const class AbstractSystem3&, const class AbstractContext3&, AbstractValue*)> |
This is the type of a function that unconditionally computes this cache entry's value with respect to the contents of a given Context.
|
inline |
Create an empty cache entry that is not yet committed to a particular kind of abstract value.
|
inlineexplicit |
Create a cache entry initialized to a copy of the given value
.
|
inlineexplicitnoexcept |
Create a cache entry that takes over ownership of the given value
.
|
inline |
Copy constructor makes a new cache entry that has a copy of the value from source
, but is marked "not current" regardless of whether source
is current.
|
inlinenoexcept |
Move constructor moves the value and preserves the is_current
status of the source in the destination.
The source is left empty and not current.
|
inline |
Return a const reference to the AbstractValue contained in this cache entry, regardless of whether it is current.
|
inline |
Set the function to be used when we need to recompute this cache entry's value.
|
inline |
Return a mutable pointer to the AbstractValue contained in this cache entry, regardless of whether it is current.
The value is returned regardless* of whether it is current.
|
inline |
Return a mutable pointer to the value contained in this cache entry, which must be of type Type
.
The value is returned regardless of whether it is current. No invalidation or notification occurs.
std::logic_error | The value did not have type Type . |
|
inline |
|
inline |
Return a const reference to the value contained in this cache entry, which must be of type Type
.
The value is returned regardless of whether it is current.
std::logic_error | The value did not have type Type . |
|
inline |
|
inlineoverridevirtual |
Invalidate this cache entry and notify any downstream listeners.
The value version number is incremented.
Implements ValueListenerInterface.
|
inline |
Return the value of the is_current
flag for this cache entry.
|
inline |
|
inline |
Set the AbstractValue type stored in this CacheEntry by replacing the existing one (if any) with the supplied one.
The CacheEntry takes ownership of the AbstractValue object.
|
inline |
Set the AbstractValue type stored in this CacheEntry by replacing the existing one (if any) with a copy of the supplied one.
|
inline |
Set the function to be used when we need to recompute this cache entry's value.
|
inline |
Mark this entry as current or not; up to caller to do this right.