Drake
Drake C++ Documentation
Loading...
Searching...
No Matches
SystemVisitor< T > Class Template Referenceabstract

Detailed Description

template<typename T>
class drake::systems::SystemVisitor< T >

Provides a "Visitor Pattern" for System and Diagram.

Rather than adding more virtual methods to the System base class, or performing a dynamic_cast to test if a System is a Diagram, you may use the visitor pattern enabled by this class, e.g.:

template <typename T>
class MySystemVisitor : public SystemVisitor {
...
}
MySystemVisitor<T> visitor;
system.Accept(visitor);
SystemVisitor(const SystemVisitor &)=delete

will call the correct Visit overload.

Note
This method does not recurse through the subsystems of a Diagram, but that is easy to do: just call Diagram::GetSystems() in your visitor and then call Accept on the subsystems.
Template Parameters
TThe scalar type, which must be one of the default scalars.

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

Public Member Functions

virtual ~SystemVisitor ()
virtual void VisitSystem (const System< T > &system)=0
 This method will be called by System<T>::accept() if the System is not a Diagram<T>.
virtual void VisitDiagram (const Diagram< T > &diagram)=0
 This method will be called by System<T>::accept() if the System is a Diagram<T>.
Does not allow copy, move, or assignment
 SystemVisitor (const SystemVisitor &)=delete
SystemVisitoroperator= (const SystemVisitor &)=delete
 SystemVisitor (SystemVisitor &&)=delete
SystemVisitoroperator= (SystemVisitor &&)=delete

Protected Member Functions

 SystemVisitor ()=default

Constructor & Destructor Documentation

◆ SystemVisitor() [1/3]

template<typename T>
SystemVisitor ( const SystemVisitor< T > & )
delete

◆ SystemVisitor() [2/3]

template<typename T>
SystemVisitor ( SystemVisitor< T > && )
delete

◆ ~SystemVisitor()

template<typename T>
virtual ~SystemVisitor ( )
virtual

◆ SystemVisitor() [3/3]

template<typename T>
SystemVisitor ( )
protecteddefault

Member Function Documentation

◆ operator=() [1/2]

template<typename T>
SystemVisitor & operator= ( const SystemVisitor< T > & )
delete

◆ operator=() [2/2]

template<typename T>
SystemVisitor & operator= ( SystemVisitor< T > && )
delete

◆ VisitDiagram()

template<typename T>
virtual void VisitDiagram ( const Diagram< T > & diagram)
pure virtual

This method will be called by System<T>::accept() if the System is a Diagram<T>.

◆ VisitSystem()

template<typename T>
virtual void VisitSystem ( const System< T > & system)
pure virtual

This method will be called by System<T>::accept() if the System is not a Diagram<T>.


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