checkpoint_signals.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2020 by
  4. * The Salk Institute for Biological Studies
  5. *
  6. * Use of this source code is governed by an MIT-style
  7. * license that can be found in the LICENSE file or at
  8. * https://opensource.org/licenses/MIT.
  9. *
  10. ******************************************************************************/
  11. #ifndef LIBMCELL_API_CHECKPOINT_SIGNALS_H_
  12. #define LIBMCELL_API_CHECKPOINT_SIGNALS_H_
  13. #include "defines.h"
  14. #include <string>
  15. namespace MCell {
  16. namespace API {
  17. class Model;
  18. const int SIGNO_NOT_SIGNALED = -1;
  19. // used as a template argument for CustomFunctionCallEvent
  20. struct CheckpointSaveEventContext {
  21. Model* model;
  22. std::string dir_prefix;
  23. bool append_it_to_dir;
  24. };
  25. // may be called only once
  26. void set_checkpoint_signals(Model* model);
  27. // may be safely called multiple times
  28. void unset_checkpoint_signals(Model* model);
  29. // called from CustomFunctionCallEvent
  30. void save_checkpoint_func(const double time, CheckpointSaveEventContext ctx);
  31. } // namespace API
  32. } // namespace MCell
  33. #endif // LIBMCELL_API_CHECKPOINT_SIGNALS_H_