Table Of Contents

Previous topic

SItemClass Structure

Next topic

SRelation Structure

SRelation

A Relation is a named list of items. An utterance can hold an arbitrary number of relations.

Definitions

speect object SRelation

Inheritance diagram of SObject.SRelation

The SRelation structure.

An Utterance can hold an arbitrary number of Relations.

SRelation Structure

speect class SRelationClass

Inheritance diagram of SObjectClass.SRelationClass

The SRelationClass structure.

SRelationClass Structure

Macros

macro S_RELATION(SELF)

Return the given SRelation child class object as a SRelation object.

Parameters:
  • SELF

    The given object.

Return:

Given object as SRelation* type.

Note:

This casting is not safety checked.

Functions

void SRelationInit(SRelation **self, const char *name, s_erc *error)

Initialize a newly created relation with the given name.

Parameters:
  • self

    The newly created relation to initialize.

  • name

    The name of the relation.

  • error

    Error code.

Note:

If this function fails the relation will be deleted and the self pointer will be set to NULL.

To connect a newly created relation to an utterance call SUtteranceSetRelation.

Mostly for internal use when relations have been created with S_NEW, and not SUtteranceNewRelation.

const char *SRelationName(const SRelation *self, s_erc *error)

Get the name of given relation.

Parameters:
  • self

    The given relation.

  • error

    Error code.

Return:

Pointer to the name of the given relation.

const SUtterance *SRelationUtterance(const SRelation *self, s_erc *error)

Get the utterance of the given relation.

Parameters:
  • self

    The given relation.

  • error

    Error code.

Return:

Pointer to the utterance of the given relation.

SItem *SRelationHead(const SRelation *self, s_erc *error)

Return the item at the head of the given relation.

Parameters:
  • self

    The given relation.

  • error

    Error code.

Return:

Pointer to the head item of the given relation.

SItem *SRelationTail(const SRelation *self, s_erc *error)

Return the item at the tail of the given relation.

Parameters:
  • self

    The given relation.

  • error

    Error code.

Return:

Pointer to the tail item of given relation.

SItem *SRelationAppend(SRelation *self, const SItem *toShare, s_erc *error)

Create a new item and append it to the end of the items in the given relation.

Parameters:
  • self

    The given relation.

  • toShare

    The item with which the newly created item will share it’s content. If NULL then a new content will be created for the appended item.

  • error

    Error code.

Return:

Pointer to the appended item as it is in the given relation.

SItem *SRelationPrepend(SRelation *self, const SItem *toShare, s_erc *error)

Create a new item and prepend it to the front of the items in the given relation.

Parameters:
  • self

    The relation.

  • toShare

    The item with which the newly created item will share it’s content. If NULL then a new content will be created for the prepended item.

  • error

    Error code.

Return:

Pointer to the prepended item as it is in the relation.