Drake
AbstractContext3 Class Referenceabstract

An abstract superclass for the Context3 objects for dynamical systems, encapsulating functionality that is independent of the numerical scalar type in use. More...

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

Inheritance diagram for AbstractContext3:

Public Member Functions

virtual ~AbstractContext3 ()
 
std::unique_ptr< AbstractContext3Clone () const
 Returns a deep copy of this Context3. More...
 
void SetNumInputPorts (int num_ports)
 Allocate input port entries corresponding to a System3's InputPort3 objects. More...
 
void SetNumOutputPorts (int num_ports)
 Allocate output port entries corresponding to a System3's OutputPort3 objects. More...
 
DRAKESYSTEMFRAMEWORK_EXPORT void SetInputPort (const AbstractSystem3 &system, int port_num)
 Set the input entry for this port number appropriately, given the corresponding InputPort3 in system. More...
 
DRAKESYSTEMFRAMEWORK_EXPORT void SetOutputPort (const AbstractSystem3 &system, int port_num)
 Set the output entry for this port number appropriately, given the corresponding OutputPort3 in system. More...
 
int get_num_input_ports () const
 
int get_num_output_ports () const
 
int get_num_cache_entries () const
 
const CacheEntryget_input_entry (int port_num) const
 Return a const pointer to the cache entry that is providing the value for the given input port, if this port is connected. More...
 
CacheEntryget_mutable_input_entry (int port_num) const
 Return a mutable pointer to the cache entry that is providing the value for the given input port, if this port is connected. More...
 
const CacheEntryget_output_entry (int port_num) const
 
CacheEntryget_mutable_output_entry (int port_num) const
 
System diagram methods
int AddSubcontext (std::unique_ptr< AbstractContext3 > subcontext)
 Add a subcontext as a child of this context. More...
 
int get_num_subcontexts () const
 Returns the current number of subcontexts contained in this context. More...
 
const AbstractContext3get_subcontext (int index) const
 Returns a const reference to one of the contained subcontexts, using the index reflecting the order in which it was added. More...
 
AbstractContext3get_mutable_subcontext (int index)
 Returns a mutable pointer to one of the contained subcontexts, using the index reflecting the order in which it was added. More...
 
const AbstractContext3get_parent_context () const
 Returns a const pointer to the parent context that owns this one, or nullptr if this is a root context. More...
 
AbstractContext3get_mutable_parent_context ()
 Returns a mutable pointer to the parent context that owns this one, or nullptr if this is a root context. More...
 
int get_subcontext_num () const
 If this context is a subcontext of a parent context, return the subcontext number by which that parent knows us. More...
 
const AbstractSystem3find_my_subsystem (const AbstractSystem3 &some_subsystem) const
 Get const access to this subcontext's subsystem given const access to any other subcontext's subsystem in the same system diagram. More...
 
AbstractSystem3find_my_mutable_subsystem (AbstractSystem3 *some_subsystem) const
 Get mutable access to this subcontext's subsystem given mutable access to any other subcontext's subsystem in the same system diagram. More...
 
const AbstractContext3get_root_context () const
 Find the root context of the tree of which this subcontext is a member. More...
 
AbstractContext3get_mutable_root_context ()
 Get a mutable pointer to the root context of the tree of which this subcontext is a member. More...
 

Protected Member Functions

 AbstractContext3 ()=default
 Create an empty AbstractContext3. More...
 
 AbstractContext3 (const AbstractContext3 &source)
 Copy the base class data members and preserve the input and parameter port values. More...
 
virtual AbstractContext3DoClone () const =0
 Create a copy of the concrete Context3 object, using the AbstractContext3 copy constructor to deal with base class copying. More...
 

Friends

class AbstractSystem3
 

Detailed Description

An abstract superclass for the Context3 objects for dynamical systems, encapsulating functionality that is independent of the numerical scalar type in use.

That includes the concepts of input and output, whose values appear as AbstractValue objects here, as well as the concept of values being out-of-date and needing to be "realized" by opaque functions that understand the specific types involved.

Constructor & Destructor Documentation

virtual ~AbstractContext3 ( )
inlinevirtual
AbstractContext3 ( )
protecteddefault

Create an empty AbstractContext3.

AbstractContext3 ( const AbstractContext3 source)
inlineprotected

Copy the base class data members and preserve the input and parameter port values.

Member Function Documentation

int AddSubcontext ( std::unique_ptr< AbstractContext3 subcontext)
inline

Add a subcontext as a child of this context.

This must be done to exactly mirror the system/subsystem structure of the compatible system and is intended only for internal use.

std::unique_ptr<AbstractContext3> Clone ( ) const
inline

Returns a deep copy of this Context3.

The clone's time, input ports, and parameter ports will hold deep copies of the values that appeared on those ports at the time the clone was created. That ensures that the complete computation context is preserved.

virtual AbstractContext3* DoClone ( ) const
protectedpure virtual

Create a copy of the concrete Context3 object, using the AbstractContext3 copy constructor to deal with base class copying.

Implemented in Context3< T >.

AbstractSystem3* find_my_mutable_subsystem ( AbstractSystem3 some_subsystem) const
inline

Get mutable access to this subcontext's subsystem given mutable access to any other subcontext's subsystem in the same system diagram.

Note that you don't need mutable access to the subcontext to get mutable access to its subsystem.

const AbstractSystem3 & find_my_subsystem ( const AbstractSystem3 some_subsystem) const

Get const access to this subcontext's subsystem given const access to any other subcontext's subsystem in the same system diagram.

Here is the call graph for this function:

const CacheEntry* get_input_entry ( int  port_num) const
inline

Return a const pointer to the cache entry that is providing the value for the given input port, if this port is connected.

Otherwise returns nullptr.

CacheEntry* get_mutable_input_entry ( int  port_num) const
inline

Return a mutable pointer to the cache entry that is providing the value for the given input port, if this port is connected.

Otherwise returns nullptr.

CacheEntry* get_mutable_output_entry ( int  port_num) const
inline

Here is the caller graph for this function:

AbstractContext3* get_mutable_parent_context ( )
inline

Returns a mutable pointer to the parent context that owns this one, or nullptr if this is a root context.

AbstractContext3* get_mutable_root_context ( )
inline

Get a mutable pointer to the root context of the tree of which this subcontext is a member.

Never returns nullptr. See get_root_context() for more information.

AbstractContext3* get_mutable_subcontext ( int  index)
inline

Returns a mutable pointer to one of the contained subcontexts, using the index reflecting the order in which it was added.

This does not cause any invalidation or notifications.

Here is the caller graph for this function:

int get_num_cache_entries ( ) const
inline
int get_num_input_ports ( ) const
inline

Here is the caller graph for this function:

int get_num_output_ports ( ) const
inline
int get_num_subcontexts ( ) const
inline

Returns the current number of subcontexts contained in this context.

This is also the index that will be assigned to the next subcontext that is added here.

const CacheEntry& get_output_entry ( int  port_num) const
inline
const AbstractContext3* get_parent_context ( ) const
inline

Returns a const pointer to the parent context that owns this one, or nullptr if this is a root context.

Here is the caller graph for this function:

const AbstractContext3& get_root_context ( ) const
inline

Find the root context of the tree of which this subcontext is a member.

Searches up the tree so run time is roughly log(N) for an N-subcontext tree starting at a leaf.

Here is the call graph for this function:

Here is the caller graph for this function:

const AbstractContext3& get_subcontext ( int  index) const
inline

Returns a const reference to one of the contained subcontexts, using the index reflecting the order in which it was added.

Note that cache entries are still mutable in a const Context3.

Here is the caller graph for this function:

int get_subcontext_num ( ) const
inline

If this context is a subcontext of a parent context, return the subcontext number by which that parent knows us.

Returns -1 if this is a root context.

Here is the caller graph for this function:

void SetInputPort ( const AbstractSystem3 system,
int  port_num 
)

Set the input entry for this port number appropriately, given the corresponding InputPort3 in system.

Here is the call graph for this function:

Here is the caller graph for this function:

void SetNumInputPorts ( int  num_ports)
inline

Allocate input port entries corresponding to a System3's InputPort3 objects.

These are initially unconnected.

void SetNumOutputPorts ( int  num_ports)
inline

Allocate output port entries corresponding to a System3's OutputPort3 objects.

These initially have no memory allocated for their values.

void SetOutputPort ( const AbstractSystem3 system,
int  port_num 
)

Set the output entry for this port number appropriately, given the corresponding OutputPort3 in system.

Here is the call graph for this function:

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class AbstractSystem3
friend

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