Drake
|
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>
Public Member Functions | |
virtual | ~AbstractContext3 () |
std::unique_ptr< AbstractContext3 > | Clone () 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 CacheEntry * | get_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... | |
CacheEntry * | get_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 CacheEntry & | get_output_entry (int port_num) const |
CacheEntry * | get_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 AbstractContext3 & | get_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... | |
AbstractContext3 * | get_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 AbstractContext3 * | get_parent_context () const |
Returns a const pointer to the parent context that owns this one, or nullptr if this is a root context. More... | |
AbstractContext3 * | get_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 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. More... | |
AbstractSystem3 * | find_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 AbstractContext3 & | get_root_context () const |
Find the root context of the tree of which this subcontext is a member. More... | |
AbstractContext3 * | get_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 AbstractContext3 * | DoClone () 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 |
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.
|
inlinevirtual |
|
protecteddefault |
Create an empty AbstractContext3.
|
inlineprotected |
Copy the base class data members and preserve the input and parameter port values.
|
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.
|
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.
|
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 >.
|
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.
|
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
.
|
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
.
|
inline |
|
inline |
Returns a mutable pointer to the parent context that owns this one, or nullptr
if this is a 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.
|
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.
|
inline |
|
inline |
|
inline |
|
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.
|
inline |
|
inline |
Returns a const pointer to the parent context that owns this one, or nullptr
if this is a root context.
|
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.
|
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.
|
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.
void SetInputPort | ( | const AbstractSystem3 & | system, |
int | port_num | ||
) |
Set the input entry for this port number appropriately, given the corresponding InputPort3 in system
.
|
inline |
Allocate input port entries corresponding to a System3's InputPort3 objects.
These are initially unconnected.
|
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
.
|
friend |