classes.h File Reference

#include "structures.h"
#include "utils/kp_debug.h"

Go to the source code of this file.

Functions

individual_tnew_individual (const class_t *classtype)
 Create new individual.
list_t * get_superclasses (const class_t *class)
 Returns a list of superclasses.
int is_subclassof (const class_t *class, const class_t *super_class)
 Checks is class has superclass.
int is_classtype_of (const individual_t *individual, const class_t *prent_class)
 Checks type of individual.
int count_references_to_individual (individual_t *individual)
 Count references to given individual.
int set_uuid (individual_t *ind, const char *uuid)
 Set UUID.
int add_entity_to_repository (void *entity)
 Add entity to repository.
int add_class_to_repository (class_t *class)
 Add class to class repository.
int add_property_to_repository (property_t *property)
 Add property to property repository.
void remove_entity_from_repository (void *entity)
 Remove entity from repository.
void clean_repositories ()
const property_tget_property_from_repository_by_name (const char *name)
 Get property from repository by given name.
const class_tget_class_from_repository_by_classtype (const char *classtype)
 Get class from repository by given classtype.
const individual_tget_individual_from_repository_by_uuid (const char *uuid)
 Get individuals from repository by given uuid.
const list_t * get_individuals_from_repository_by_classtype (const char *classtype)
 Get individuals from repository by given classtype.


Function Documentation

int add_class_to_repository ( class_t class  ) 

Add class to class repository.

It set error and return it on failure.

Parameters:
class class for insert.
Returns:
ERROR_NO on success or not otherwise.

int add_entity_to_repository ( void *  entity  ) 

Add entity to repository.

It set error and return it on failure. You need to add individual, if you create it manuly. Function

See also:
new_individual() add individual to repository automatically.
Parameters:
entity individual, property or class.
Returns:
ERROR_NO on success or not otherwise.

int add_property_to_repository ( property_t property  ) 

Add property to property repository.

It set error and return it on failure.

Parameters:
property for insert.
Returns:
ERROR_NO on success or not otherwise.

void clean_repositories (  ) 

int count_references_to_individual ( individual_t individual  ) 

Count references to given individual.

It gets other individuals and search references to individual from their properties.

Parameters:
individual individual for count.
Returns:
count of references.

const class_t* get_class_from_repository_by_classtype ( const char *  classtype  ) 

Get class from repository by given classtype.

Parameters:
classtype name of classtype.
Returns:
class from repository or NULL if it not found.

const individual_t* get_individual_from_repository_by_uuid ( const char *  uuid  ) 

Get individuals from repository by given uuid.

Parameters:
uuid individual's uuid.
Returns:
individual or NULL if it not found.

const list_t* get_individuals_from_repository_by_classtype ( const char *  classtype  ) 

Get individuals from repository by given classtype.

Parameters:
classtype name of classtype.
Returns:
individuals list or NULL if not found. Do not free list.

const property_t* get_property_from_repository_by_name ( const char *  name  ) 

Get property from repository by given name.

Parameters:
name property name.
Returns:
property from repository or NULL if it not found.

list_t* get_superclasses ( const class_t class  ) 

Returns a list of superclasses.

Parameters:
class class.
Returns:
list of superclasses on success or NULL otherwise.

int is_classtype_of ( const individual_t individual,
const class_t class 
)

Checks type of individual.

Parameters:
individual object of some class for check.
class allaged class of individual.
Returns:
returns 1 if the individual is object of given class.

int is_subclassof ( const class_t subclass,
const class_t superclass 
)

Checks is class has superclass.

Parameters:
class class for check.
superclass alleged superclass of class.
Returns:
1 if the class is a subclass of superclass, -1 on error, .

individual_t* new_individual ( const class_t class  ) 

Create new individual.

Create new individual without UUID.

Parameters:
classtype type of class.
Returns:
individual of given class type on success or NULL otherwise.

void remove_entity_from_repository ( void *  entity  ) 

Remove entity from repository.

Parameters:
entity individual, class or property.

int set_uuid ( individual_t ind,
const char *  uuid 
)

Set UUID.

Set new UUID for individuals. You need reinit individual to work with SS.

Parameters:
ind individual.
uuid UUID.
Returns:
ERROR_NO on success or error code otherwise.


doxygen