Drake
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);

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 ()=default
 
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>. More...
 
virtual void VisitDiagram (const Diagram< T > &diagram)=0
 This method will be called by System<T>::accept() if the System is a Diagram<T>. More...
 
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]

SystemVisitor ( const SystemVisitor< T > &  )
delete

◆ SystemVisitor() [2/3]

SystemVisitor ( SystemVisitor< T > &&  )
delete

◆ ~SystemVisitor()

virtual ~SystemVisitor ( )
virtualdefault

◆ SystemVisitor() [3/3]

SystemVisitor ( )
protecteddefault

Member Function Documentation

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ VisitDiagram()

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()

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: