<commit_before>#ifndef CYCLUS_SIM_INIT_H_
#define CYCLUS_SIM_INIT_H_

#include <boost/uuid/uuid_io.hpp>

#include "query_backend.h"
#include "context.h"
#include "timer.h"
#include "recorder.h"

namespace cyclus {

class Context;

/// Handles initialization of a simulation from the output database. After
/// calling Init, Restart, or Branch, the initialized Context, Timer, and
/// Recorder can be retrieved.
///
/// @warning the Init, Restart, and Branch methods are NOT idempotent. Only one
/// simulation should ever be initialized per SimInit object.
///
/// @warning the SimInit class manages the memory of the initialized Context,
/// Timer, and Recorder.
class SimInit {
 public:
  SimInit();

  ~SimInit();

  /// Initialize a simulation with data from b for simulation id in r. SimInit
  /// does not take ownership of the recorder or backend. the configured
  /// context's recorder is set to r.
  void Init(Recorder* r, QueryableBackend* b);

  /// Restarts a simulation from time t with data from b identified by simid.
  /// The newly configured simulation will run with a new simulation id.
  void Restart(QueryableBackend* b, boost::uuids::uuid sim_id, int t);

  /// NOT IMPLEMENTED. Initializes a simulation branched from prev_sim_id at
  /// time t with diverging state described in new_sim_id.
  ///
  /// TODO: implement
  void Branch(QueryableBackend* b, boost::uuids::uuid prev_sim_id, int t,
              boost::uuids::uuid new_sim_id);

  /// Records a snapshot of the current state of the simulation being managed by
  /// ctx into the simulation's output database.
  static void Snapshot(Context* ctx);

  /// Records a snapshot of the agent's current internal state into the
  /// simulation's output database.  Note that this should generally not be
  /// called directly.
  static void SnapAgent(Agent* m);

  /// Returns the initialized context. Note that either Init, Restart, or Branch<commit_msg>added EXPERIMENTAL warning to sim_init restart method<commit_after>#ifndef CYCLUS_SIM_INIT_H_
#define CYCLUS_SIM_INIT_H_

#include <boost/uuid/uuid_io.hpp>

#include "query_backend.h"
#include "context.h"
#include "timer.h"
#include "recorder.h"

namespace cyclus {

class Context;

/// Handles initialization of a simulation from the output database. After
/// calling Init, Restart, or Branch, the initialized Context, Timer, and
/// Recorder can be retrieved.
///
/// @warning the Init, Restart, and Branch methods are NOT idempotent. Only one
/// simulation should ever be initialized per SimInit object.
///
/// @warning the SimInit class manages the memory of the initialized Context,
/// Timer, and Recorder.
class SimInit {
 public:
  SimInit();

  ~SimInit();

  /// Initialize a simulation with data from b for simulation id in r. SimInit
  /// does not take ownership of the recorder or backend. the configured
  /// context's recorder is set to r.
  void Init(Recorder* r, QueryableBackend* b);

  /// EXPERIMENTAL (might not work properly). Restarts a simulation from time t
  /// with data from b identified by simid.  The newly configured simulation
  /// will run with a new simulation id.
  void Restart(QueryableBackend* b, boost::uuids::uuid sim_id, int t);

  /// NOT IMPLEMENTED. Initializes a simulation branched from prev_sim_id at
  /// time t with diverging state described in new_sim_id.
  ///
  /// TODO(rwcarlsen): implement
  void Branch(QueryableBackend* b, boost::uuids::uuid prev_sim_id, int t,
              boost::uuids::uuid new_sim_id);

  /// Records a snapshot of the current state of the simulation being managed by
  /// ctx into the simulation's output database.
  static void Snapshot(Context* ctx);

  /// Records a snapshot of the agent's current internal state into the
  /// simulation's output database.  Note that this should generally not be
  /// called directly.
  static void SnapAgent(Agent* m);

  /// Returns the initialized context. Note that either Init, Restart, or Branch
{'fraction_non_alphanumeric': 0.09439676930843009, 'fraction_numerical': 0.0, 'mean_word_length': 3.5239726027397262, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2304341', 'n_tokens_mistral': 1134, 'n_tokens_neox': 1085, 'n_words': 482}