Last active
September 7, 2023 16:11
-
-
Save battleguard/284b08c9054dbf7c43c0d199abfe0d39 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
struct FuncHolder | |
{ | |
std::function<void(double)> mFunc; | |
}; | |
py::class_<FuncHolder> funcHolder(aModule, "FuncHolder"); | |
aModule.def("AddCallback", [](std::function<void(double)> func, py::list aHolder) | |
{ | |
FuncHolder* holder = new FuncHolder{ func }; | |
aHolder.append(holder); | |
}); |
This file contains hidden or 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
def run_example2(): | |
callback_list = [] | |
def advance_time(sim_time: float): | |
print(callback_list) | |
afsim.AddCallback(advance_time, callback_list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment