Hyperon C
Loading...
Searching...
No Matches
Space Implementation Interface

Functions for implementing a custom space in C. More...

Classes

struct  space_params_t
 Data associated with this particular space, including the space's payload and observers. More...
struct  space_api_t
 A table of functions to define the behavior of a Space implemented in C. More...

Functions

void space_params_notify_all_observers (const struct space_params_t *params, const struct space_event_t *event)
 Notifies all associated observers of an event.
struct space_event_t space_event_new_add (atom_t atom)
 Creates a new space_event_t representing an Add event.
struct space_event_t space_event_new_remove (atom_t atom)
 Creates a new space_event_t representing a Remove event.
struct space_event_t space_event_new_replace (atom_t pattern, atom_t tmpl)
 Creates a new space_event_t representing a Replace event.
void space_event_free (struct space_event_t event)
 Frees a space_event_t

Detailed Description

Functions for implementing a custom space in C.

This interface allows a custom space to be defined with C. This allows for different space back-ends, such as a distributed database, or different space topologies, such as the multidimensional latent space of word2vec.

Function Documentation

◆ space_event_free()

void space_event_free ( struct space_event_t event)

Frees a space_event_t

Parameters
[in]eventThe space_event_t to free

◆ space_event_new_add()

struct space_event_t space_event_new_add ( atom_t atom)

Creates a new space_event_t representing an Add event.

Parameters
[in]atomThe atom that is being added to the Space, to embed into the event
Returns
The newly created space_event_t
Note
The caller must take ownership responsibility for the returned space_event_t and it must be freed with space_event_free()
Warning
This function takes ownership of the atom parameter, so it must not be subsequently access or freed

◆ space_event_new_remove()

struct space_event_t space_event_new_remove ( atom_t atom)

Creates a new space_event_t representing a Remove event.

Parameters
[in]atomThe atom that is being removed from the Space, to embed into the event
Returns
The newly created space_event_t
Note
The caller must take ownership responsibility for the returned space_event_t and it must be freed with space_event_free()
Warning
This function takes ownership of the atom parameter, so it must not be subsequently access or freed

◆ space_event_new_replace()

struct space_event_t space_event_new_replace ( atom_t pattern,
atom_t tmpl )

Creates a new space_event_t representing a Replace event.

Parameters
[in]patternThe atom that is being matched in the Space, to embed into the event
[in]tmplThe atom that is being used to construct new atoms in the Space, to embed into the event
Returns
The newly created space_event_t
Note
The caller must take ownership responsibility for the returned space_event_t and it must be freed with space_event_free()
Warning
This function takes ownership of both the pattern and the tmpl parameter, so neither may be subsequently access nor freed

◆ space_params_notify_all_observers()

void space_params_notify_all_observers ( const struct space_params_t * params,
const struct space_event_t * event )

Notifies all associated observers of an event.

Parameters
[in]paramsA pointer to the space's params
[in]eventA pointer to the event, to broadcast to all observers of the Space