Created
November 4, 2016 21:09
-
-
Save david-german-tri/c9093c9be532fcd70f1dbb82c6431148 to your computer and use it in GitHub Desktop.
HandlePublish
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auto diagram_context = dynamic_cast<const DiagramContext<T>*>(&context); | |
DRAKE_DEMAND(diagram_context != nullptr); | |
for (const auto& action : sub_actions) { | |
const int index = action.first; | |
const UpdateActions<T>& action_details = action.second; | |
DRAKE_DEMAND(index >= 0 && index < num_subsystems()); | |
const Context<T>* subcontext = | |
diagram_context->GetSubsystemContext(index); | |
DRAKE_DEMAND(subcontext != nullptr); | |
for (const DiscreteEvent<T>& event : action_details.events) { | |
if (event.action == DiscreteEvent<T>::kPublishAction) { | |
sorted_systems_[index]->Publish(*subcontext, event); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment