ss_properties.c File Reference

functions for work with properties throw SS. More...

#include "ss_properties.h"

Functions

int ss_set_property (void *entity, char *propname, void *data)
 Sets property for entity in SS and localy by name.
int ss_set_property_for_individual (individual_t *ind, char *propname, void *data)
int ss_set_property_for_class (class_t *ind, char *propname, void *data)
int ss_set_property_with_value_struct (void *entity, prop_val_t *prop_val)
 Sets property for entity in SS and localy by name.
prop_val_tss_get_property (individual_t *ind, char *propname)
 Gets property for individual from SS by name.
prop_val_tss_get_property_with_data (individual_t *ind, char *propname, void *data)
 Gets first founded property for individual from SS by name and value.
list_t * ss_get_properties (individual_t *ind, char *propname, int max)
 Gets list of properties for individual from SS by name and value.
bool ss_has_property_value (individual_t *ind, char *propname, void *data)
 Checks if individual has property with given value.
int ss_update_property_with_data (individual_t *ind, char *propname, void *old_data, void *new_data)
 Updates property of individual in SS and localy.
int ss_update_properties (individual_t *individual, list_t *properties)
int ss_remove_properties_by_name (individual_t *ind, char *propname)
 Removes all properties with given name for individual in SS and localy.
int ss_remove_property_by_value_struct (individual_t *ind, prop_val_t *prop_val)
 Removes all properties with given name and value for individual in SS and localy.


Detailed Description

functions for work with properties throw SS.

Vanag Pavel <vanag@cs.karelia.ru>

Date:
05 April, 2010
Version:
0.2alpha

LICENSE

PetrSU KP library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

PetrSU KP library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with <program name>; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

DESCRIPTION

This file is part of PetrSU KP library. There are functions for work with properties throw SS.

Function Documentation

list_t * ss_get_properties ( individual_t ind,
char *  propname,
int  max 
)

Gets list of properties for individual from SS by name and value.

Gets the property from the SS by name and value and returns list of properties. Returns all founded but not more then max. Function sets global PetrSU KP Library's errno.

Parameters:
[in] individual_t * ind. Pointer to the individual struct.
[in] char *propname. Pointer to the char array with name.
[in] int max. Maximum returns properties.
Returns:
list_t*. NULL if properties with given name doesn't exists, pointer to list of value structs otherwise.

prop_val_t * ss_get_property ( individual_t ind,
char *  propname 
)

Gets property for individual from SS by name.

Gets the property from the SS by name and returns it. Function sets global PetrSU KP Library's errno.

Parameters:
[in] individual_t * ind. Pointer to the individual struct.
[in] char *propname. Pointer to the char array with name.
Returns:
prop_val_t*. NULL if properties with given name doesn't exists, pointer to value struct otherwise.

prop_val_t * ss_get_property_with_data ( individual_t ind,
char *  propname,
void *  data 
)

Gets first founded property for individual from SS by name and value.

Gets the property from the SS by name and value and returns first founded. Function sets global PetrSU KP Library's errno.

Parameters:
[in] individual_t * ind. Pointer to the individual struct.
[in] char *propname. Pointer to the char array with name.
[in] void *data. Pointer to the value.
Returns:
prop_val_t*. NULL if properties with given name doesn't exists, pointer to value struct otherwise.

bool ss_has_property_value ( individual_t ind,
char *  propname,
void *  data 
)

Checks if individual has property with given value.

Checks if individual has property with given name and value. Function sets global PetrSU KP Library's errno.

Parameters:
[in] individual_t * ind. Pointer to the individual struct.
[in] char *propname. Pointer to the char array with name.
[in] void *data. Pointer to the value.
Returns:
int. 0 if property doesn't exists, 1 otherwise.

int ss_remove_properties_by_name ( individual_t ind,
char *  propname 
)

Removes all properties with given name for individual in SS and localy.

Finds properties with given name for individual and removes it from SS. Then try find all local property with given name and remove it. After all you have a struct without removed properties. Function sets global PetrSU KP Library's errno.

Parameters:
[in] individual_t * ind. Pointer to the individual struct.
[in] char *propname. Char array with name of property.
Returns:
int. Status of the operation when completed (0 if successfull, otherwise -1).

int ss_remove_property_by_value_struct ( individual_t ind,
prop_val_t prop_val 
)

Removes all properties with given name and value for individual in SS and localy.

Get name and value from value struct, finds properties with given name and value for individual and removes it from SS. Then try find all local property with given name and value and remove it. After all you have a struct without removed properties. Function sets global PetrSU KP Library's errno.

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

int ss_set_property ( void *  entity,
char *  propname,
void *  data 
)

Sets property for entity in SS and localy by name.

Checks either entity is individual or class Checks entity correctness: cardinality, property values limitation and sets property for entity in SS and localy. Function sets global PetrSU KP Library's errno.

Parameters:
[in] void *entity. Pointer to the individual struct.
[in] char *propname. Pointer to the char array with name.
[in] void *data. Pointer to the value.
Returns:
int. Status of the operation when completed (0 if successfull, otherwise -1).

int ss_set_property_for_class ( class_t ind,
char *  propname,
void *  data 
)

int ss_set_property_for_individual ( individual_t ind,
char *  propname,
void *  data 
)

int ss_set_property_with_value_struct ( void *  entity,
prop_val_t prop_val 
)

Sets property for entity in SS and localy by name.

Checks either entity is individual or class Checks entity correctness: cardinality, property values limitation and sets property for entity in SS and localy. Function sets global PetrSU KP Library's errno.

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

int ss_update_properties ( individual_t individual,
list_t *  properties 
)

int ss_update_property_with_data ( individual_t ind,
char *  propname,
void *  old_data,
void *  new_data 
)

Updates property of individual in SS and localy.

Checks individual correctness: cardinality, prop- erty values limitation, and converts the individual’s given properties to triplets, which will be updated in SS, other properties not changed in SS. Same localy. Function sets global PetrSU KP Library's errno.

Parameters:
[in] individual_t * ind. Pointer to the individual struct.
[in] char *propname. Char array with name of property.
[in] void *old_data. Pointer to the old value (DATATYPE or OBJECTTYPE).
[in] void *new_data. Pointer to the new value (DATATYPE or OBJECTTYPE).
Returns:
int. Status of the operation when completed (0 if successfull, otherwise -1).


doxygen