Drake
FixedInputPortValue Class Reference

A FixedInputPortValue encapsulates a vector or abstract value for use as an internal value source for one of a System's input ports. More...

#include <drake/systems/framework/fixed_input_port_value.h>

Public Member Functions

 FixedInputPortValue (std::unique_ptr< AbstractValue > value)
 Constructs an abstract-valued FixedInputPortValue from a value of arbitrary type. More...
 
 ~FixedInputPortValue ()=default
 
const AbstractValueget_value () const
 Returns a reference to the contained abstract value. More...
 
template<typename T >
const BasicVector< T > & get_vector_value () const
 Returns a reference to the contained BasicVector<T> or throws an exception if this doesn't contain an object of that type. More...
 
AbstractValueGetMutableData ()
 Returns a pointer to the data inside this FixedInputPortValue, and notifies the dependent input port that the value has changed. More...
 
template<typename T >
BasicVector< T > * GetMutableVectorData ()
 Returns a pointer to the data inside this FixedInputPortValue, and notifies the dependent input port that the value has changed, invalidating downstream computations. More...
 
int64_t serial_number () const
 Returns the serial number of the contained value. More...
 
const ContextBaseget_owning_context () const
 Returns a const reference to the context that owns this object. More...
 
Does not allow move or assignment; copy is private.
 FixedInputPortValue (FixedInputPortValue &&)=delete
 
FixedInputPortValueoperator= (const FixedInputPortValue &)=delete
 
FixedInputPortValueoperator= (FixedInputPortValue &&)=delete
 

Friends

class detail::ContextBaseFixedInputAttorney
 
class copyable_unique_ptr< FixedInputPortValue >
 

Detailed Description

A FixedInputPortValue encapsulates a vector or abstract value for use as an internal value source for one of a System's input ports.

The semantics are identical to a Parameter. We assign a DependencyTracker to this object and subscribe the InputPort to it when that port is fixed. Any modification to the value here issues a notification to its dependent, and increments a serial number kept here.

Constructor & Destructor Documentation

FixedInputPortValue ( std::unique_ptr< AbstractValue value)
inlineexplicit

Constructs an abstract-valued FixedInputPortValue from a value of arbitrary type.

Takes ownership of the given value and sets the serial number to 1. The value must not be null.

~FixedInputPortValue ( )
default

Member Function Documentation

const ContextBase& get_owning_context ( ) const
inline

Returns a const reference to the context that owns this object.

const AbstractValue& get_value ( ) const
inline

Returns a reference to the contained abstract value.

Here is the caller graph for this function:

const BasicVector<T>& get_vector_value ( ) const
inline

Returns a reference to the contained BasicVector<T> or throws an exception if this doesn't contain an object of that type.

Here is the caller graph for this function:

AbstractValue * GetMutableData ( )

Returns a pointer to the data inside this FixedInputPortValue, and notifies the dependent input port that the value has changed.

To ensure invalidation notifications are delivered, callers should call this method every time they wish to update the stored value. In particular, callers MUST NOT write through the returned pointer if there is any possibility this FixedInputPortValue has been accessed since the last time this method was called.

BasicVector<T>* GetMutableVectorData ( )
inline

Returns a pointer to the data inside this FixedInputPortValue, and notifies the dependent input port that the value has changed, invalidating downstream computations.

Throws std::bad_cast if the data is not vector data.

To ensure invalidation notifications are delivered, callers should call this method every time they wish to update the stored value. In particular, callers MUST NOT write through the returned pointer if there is any possibility this FixedInputPortValue has been accessed since the last time this method was called.

Template Parameters
TElement type of the input port's vector value. Must be a valid Eigen scalar.

Here is the caller graph for this function:

FixedInputPortValue& operator= ( const FixedInputPortValue )
delete
FixedInputPortValue& operator= ( FixedInputPortValue &&  )
delete
int64_t serial_number ( ) const
inline

Returns the serial number of the contained value.

This counts up every time the contained value changes, or when mutable access is granted.

Friends And Related Function Documentation

friend class copyable_unique_ptr< FixedInputPortValue >
friend
friend class detail::ContextBaseFixedInputAttorney
friend

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