A loaded ink story.
More...
#include <story.h>
|
static story * | from_file (const char *filename) |
| Creates a new story object from a file.
|
|
static story * | from_binary (unsigned char *data, size_t length, bool freeOnDestroy=true) |
| Create a new story object from binary buffer.
|
|
A loaded ink story.
Created by loading a binary ink story into memory. Once loaded, the story class can create "runners" which execute story code. A story can have any number of runners, which can optionally share globals (variables, visit counts, etc). through the globals object. By default, each runner gets its own newly created globals store.
- See also
- ink::runtime::runner_interface
-
ink::runtime::globals_interface
◆ from_binary()
static story * ink::runtime::story::from_binary |
( |
unsigned char * | data, |
|
|
size_t | length, |
|
|
bool | freeOnDestroy = true ) |
|
static |
Create a new story object from binary buffer.
No extensions required. Creates the story from binary data already loaded into memory. By default, the story will free this buffer when it is destroyed.
- Parameters
-
data | binary data |
length | of the binary data in bytes |
freeOnDestroy | if true, free this buffer once the story is destroyed |
- Returns
- new story object
◆ from_file()
static story * ink::runtime::story::from_file |
( |
const char * | filename | ) |
|
|
static |
Creates a new story object from a file.
Requires STL or other extension which allows files to be loaded and read. Will allocate all the data necessary to load the file and close it.
- Parameters
-
filename | filename of the binary ink data |
- Returns
- new story object
◆ new_globals()
virtual globals ink::runtime::story::new_globals |
( |
| ) |
|
|
pure virtual |
Creates a new global store.
Creates a new global store that can be passed in when creating new runners for this story. Note: Can not be used for other stories. It is tied to this story.
- Returns
- managed pointer to a new global store
◆ new_globals_from_snapshot()
virtual globals ink::runtime::story::new_globals_from_snapshot |
( |
const snapshot & | obj | ) |
|
|
pure virtual |
Reconstructs globals from snapshot.
- Parameters
-
◆ new_runner()
virtual runner ink::runtime::story::new_runner |
( |
globals | store = nullptr | ) |
|
|
pure virtual |
Creates a new runner.
Creates a new runner whose initial instruction pointer is the first instruction in this story. If no global store is passed, a new one will be created for the runner.
- Parameters
-
store | globals to use for the runner |
- Returns
- managed pointer to a new runner
◆ new_runner_from_snapshot()
virtual runner ink::runtime::story::new_runner_from_snapshot |
( |
const snapshot & | obj, |
|
|
globals | store = nullptr, |
|
|
unsigned | runner_id = 0 ) |
|
pure virtual |
reconstruct runner from a snapshot
- Attention
- runner must be snap_shotted from the same story
-
if globals is explicit set, make sure the globals are from the same snapshot as
-
if you snap_shotted a multiple runner with shared global please reconstruct it in the same fashion
- Parameters
-
obj | |
store | can be set if explicit access to globals is required or multiple runner with a shared global are used |
runner_id | if the snapshot was of a multiple runner one global situation load first the global, and then each runner with global set and increasing idx |
The documentation for this class was generated from the following file: