inkcpp
Loading...
Searching...
No Matches
HInkSnapshot Class Reference

Handler for a ink snapshot. More...

#include <inkcpp.h>

Public Member Functions

HInkSnapshotink_snapshot_from_file (const char *filename)
 deserialize snapshot from file.
 
HInkSnapshotink_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)
 

Detailed Description

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()

Todo
Currently the id is equal to the creation order, a way to name the single runner/threads is WIP

Member Function Documentation

◆ ink_snapshot_from_binary()

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.

Parameters
datapointer to blob
lengthnumber of bytes in blob
freeOnDestroyif the memory should be freed (delete[]) when the snapshot is deconstructed
Returns
newly created snapshot

◆ ink_snapshot_from_file()

HInkSnapshot * ink_snapshot_from_file ( const char * filename)

deserialize snapshot from file.

Parameters
filenameof input file
Exceptions
ink_exceptionif it fails to open the file
Attention
only supported if build with STL libraries.
See also
ink_snapshot_from_binary()

◆ ink_snapshot_get_binary()

void ink_snapshot_get_binary ( const HInkSnapshot * self,
const unsigned char ** data,
size_t * data_length )
Parameters
self
[out]datapointer to snapshot data
[out]data_lengthlength of snapshot data

◆ ink_snapshot_num_runners()

int ink_snapshot_num_runners ( const HInkSnapshot * self)

number of runners which are stored inside this snapshot

Parameters
self

◆ ink_snapshot_write_to_file()

void ink_snapshot_write_to_file ( const HInkSnapshot * self,
const char * filename )

serialize snapshot to file

Parameters
filenameoutput file filename, if already exist it will be overwritten
Exceptions
ink_exceptionif it fails to open the file
Parameters
self
Attention
only supported if build with STL libraries.
See also
ink_snapshot_get_binary()

The documentation for this class was generated from the following file: