|
inkcpp
|
Handler for a ink snapshot. More...
#include <inkcpp.h>
Public Member Functions | |
| HInkSnapshot * | ink_snapshot_from_file (const char *filename) |
| deserialize snapshot from file. | |
| HInkSnapshot * | ink_snapshot_from_binary (const unsigned char *data, size_t length, bool freeOnDestroy) |
| Construct snapshot from blob. | |
| int | ink_snapshot_num_runners (const HInkSnapshot *self) |
| number of runners which are stored inside this snapshot | |
| void | ink_snapshot_write_to_file (const HInkSnapshot *self, const char *filename) |
| serialize snapshot to file | |
| void | ink_snapshot_get_binary (const HInkSnapshot *self, const unsigned char **data, size_t *data_length) |
| bool | ink_snapshot_can_be_migrated (const HInkSnapshot *self) |
| if this snapshot can be migrated, if the story file changes (slightly). | |
Handler for a ink snapshot.
Each snapshot contains a globals store and all associated runners/threads For convinience there exist ink::runtime::globals_interface::create_snapshot() and runner_interface::create_snapshot() . If the runner is associated to the globals the snapshot will be identical. If multiple runners are associated to the same globals all will be contained, and cann be reconsrtucted with the id parameter of ink::runtime::story::new_runner_from_snapshot() A snapshot can be applied to an identical story file or an simulare if the snapshot is can_be_migrated(). A not migrated snapshot contiouse at exactly the place you are currently at.
A migrated one will "snap bag" to the last knot.
visit counts (e.g. used for once only choices)
| bool ink_snapshot_can_be_migrated | ( | const HInkSnapshot * | self | ) |
if this snapshot can be migrated, if the story file changes (slightly).
| self |
| True | if the snapshot was taken at a simple state which can be migrated. |
| HInkSnapshot * ink_snapshot_from_binary | ( | const unsigned char * | data, |
| size_t | length, | ||
| bool | freeOnDestroy ) |
Construct snapshot from blob.
Memory must be kept valid until the snapshot is deconstructed.
| data | pointer to blob |
| length | number of bytes in blob |
| freeOnDestroy | if the memory should be freed (delete[]) when the snapshot is deconstructed |
| HInkSnapshot * ink_snapshot_from_file | ( | const char * | filename | ) |
deserialize snapshot from file.
| filename | of input file |
| ink_exception | if it fails to open the file |
| void ink_snapshot_get_binary | ( | const HInkSnapshot * | self, |
| const unsigned char ** | data, | ||
| size_t * | data_length ) |
| self | ||
| [out] | data | pointer to snapshot data |
| [out] | data_length | length of snapshot data |
| int ink_snapshot_num_runners | ( | const HInkSnapshot * | self | ) |
number of runners which are stored inside this snapshot
| self |
| void ink_snapshot_write_to_file | ( | const HInkSnapshot * | self, |
| const char * | filename ) |
serialize snapshot to file
| filename | output file filename, if already exist it will be overwritten |
| ink_exception | if it fails to open the file |
| self |