ss_classes.c File Reference

#include "ss_classes.h"

Functions

int init_individual (individual_t *ind)
 Initialize individual for SS.
int init_individual_with_uuid (individual_t *ind, const char *uuid)
 Initialize individual for SS by given uuid.
int ss_insert_individual (individual_t *individual)
 Inserts given individual to SS.
int ss_insert_by_pattern (individual_t *individual, void *pattern)
 Inserts given individual to SS by pattern.
int ss_update_individual (individual_t *individual)
 Updates given individual in SS.
int ss_update_by_pattern (individual_t *individual, void *pattern)
 Updates given individual in SS by pattern.
int ss_exists (individual_t *individual)
 Checks if given individual exists in SS.
int ss_exists_class (class_t *class)
 Checks if any individual of given class exists in SS.
int ss_exists_by_individual_uuid (individual_t *individual)
 Checks if uuid of given individual exists in SS.
int ss_exists_by_uuid (char *uuid)
 Checks if individual with given uuid exists in SS.
int ss_exists_by_pattern (void *pattern)
 Checks if individual matches given pattern exists in SS.
list_t * ss_get_uuids_by_class (class_t *class)
 Finds all individuals of given class in SS.
list_t * ss_get_individuals_by_pattern (individual_t *individual_pattern)
 Finds all individuals matches given pattern in SS.
int ss_remove_individual (individual_t *individual)
 Removes given individual from SS.

Function Documentation

int init_individual ( individual_t ind  ) 

Initialize individual for SS.

This function generate UUID and registry given individuals in SS.

Parameters:
individual_t individual for initialize.
Returns:
0 on success or not otherwise.

int init_individual_with_uuid ( individual_t ind,
const char *  uuid 
)

Initialize individual for SS by given uuid.

This function registry given individuals in SS with given uuid.

Parameters:
individual_t individual for initialize.
const char * uuid of individual.
Returns:
0 on success or not otherwise.

int ss_exists ( individual_t individual  ) 

Checks if given individual exists in SS.

Tries to find individual by given individual data (uuid, properties). Function sets global PetrSU KP Library's errno.

Parameters:
[in] individual_t * individual. Pointer to the individual struct.
Returns:
int. Status (1 if individual exists in SS, otherwise 0).

int ss_exists_by_individual_uuid ( individual_t individual  ) 

Checks if uuid of given individual exists in SS.

Tries to find individual by uuid. Function sets global PetrSU KP Library's errno.

Parameters:
[in] individual_t * individual. Pointer to the individual struct.
Returns:
int. Status (1 if individual exists in SS, otherwise 0).

int ss_exists_by_pattern ( void *  pattern  ) 

Checks if individual matches given pattern exists in SS.

Tries to find individual by pattern. Function sets global PetrSU KP Library's errno.

Parameters:
[in] void *pattern. Pointer to the individual or class struct.
Returns:
int. Status (1 if individual exists in SS, otherwise 0).

int ss_exists_by_uuid ( char *  uuid  ) 

Checks if individual with given uuid exists in SS.

Tries to find individual by uuid. Function sets global PetrSU KP Library's errno.

Parameters:
[in] char *uuid. Char array with uuid.
Returns:
int. Status (1 if individual exists in SS, otherwise 0).

int ss_exists_class ( class_t class  ) 

Checks if any individual of given class exists in SS.

Tries to find individual of given class. Function sets global PetrSU KP Library's errno.

Parameters:
[in] class_t *class. Pointer to the class struct.
Returns:
int. Status (1 if individual exists in SS, otherwise 0).

list_t * ss_get_individuals_by_pattern ( individual_t individual_pattern  ) 

Finds all individuals matches given pattern in SS.

Tries to find individual by pattern. Function sets global PetrSU KP Library's errno.

Parameters:
[in] individual_t * individual_pattern. Pointer to the individual struct (pattern).
Returns:
list_t*. Null if there is no individuals of such class in SS, list of founded individuals otherwise.

list_t * ss_get_uuids_by_class ( class_t class  ) 

Finds all individuals of given class in SS.

Tries to find individual by class. Function sets global PetrSU KP Library's errno.

Parameters:
[in] class_t *class. Pointer to the class struct.
Returns:
list_t*. Null if there is no individuals of such class in SS, list of founded individuals otherwise.

int ss_insert_by_pattern ( individual_t individual,
void *  pattern 
)

Inserts given individual to SS by pattern.

Checks individual correctness: cardinality, property values limitation, and converts the individual to triplets by pattern, which will be placed to SS. Function sets global PetrSU KP Library's errno.

Parameters:
[in] individual_t * individual. Pointer to the individual struct.
[in] void *pattern. Entity contains pattern (individual or class).
Returns:
int. Status of the operation when completed (0 if successfull, otherwise -1).

int ss_insert_individual ( individual_t individual  ) 

Inserts given individual to SS.

Checks individual correctness: cardinality, property values limitation, and converts the individual to triplets, which will be placed to SS. Function sets global PetrSU KP Library's errno.

Parameters:
[in] individual_t * individual. Pointer to the individual struct.
Returns:
int. Status of the operation when completed (0 if successfull, otherwise -1).

int ss_remove_individual ( individual_t individual  ) 

Removes given individual from SS.

Tries to find individuals description(triplets) in the SS, then removes all triplets from SS and from individual, UUID removed too. After work you have empty individual struct. Function sets global PetrSU KP Library's errno.

Parameters:
[in] individual_t * individual. Pointer to the individual struct.
Returns:
int. Status of the operation when completed (0 if successfull, otherwise -1).

int ss_update_by_pattern ( individual_t individual,
void *  pattern 
)

Updates given individual in SS by pattern.

Checks individual correctness: cardinality, property values limitation, and converts the individual to triplets by pattern, which will be updated in SS, other properties (which has’t individual, but that are in SS) will be removed from SS. Function sets global PetrSU KP Library's errno.

Parameters:
[in] individual_t * individual. Pointer to the individual struct.
[in] void * pattern. Pointer to the individual struct that considered as pattern.
Returns:
int. Status of the operation when completed (0 if successfull, otherwise -1).
Checks individual correctness: cardinality, property values limitation, and converts the individual to triplets by pattern, which will be updated in SS, other properties (which has’t individual, but that are in SS) will be removed from SS. Function sets global PetrSU KP Library's errno.

Parameters:
[in] individual_t * individual. Pointer to the individual struct.
Returns:
int. Status of the operation when completed (0 if successfull, otherwise -1).

int ss_update_individual ( individual_t individual  ) 

Updates given individual in SS.

Checks individual correctness: cardinality, property values limitation, and converts the individual to triplets, which will be updated in SS, other properties (which has’t individual, but that are in SS) will be removed from SS. Function sets global PetrSU KP Library's errno.

Parameters:
[in] individual_t * individual. Pointer to the individual struct.
Returns:
int. Status of the operation when completed (0 if successfull, otherwise -1).


doxygen