Internalfunctions - SmartSlog KP Library
Functions
properties.c File Reference

Functions for work with properties. More...

#include <string.h>
#include "structures.h"
#include "properties.h"
#include "utils/list.h"

Functions

int sslog_update_value_struct (prop_val_t *prop_value, void *new_data)
 Update property value.
int set_property_by_name (individual_t *ind, char *propname, void *value)
SSLOG_EXTERN int sslog_add_property (void *entity, property_t *prop, const void *value)
 Set new property for entity.
int set_property_with_prop_val (void *entity, const prop_val_t *prop_val)
 Set property with ginen prop_val_t struct.
SSLOG_EXTERN const prop_val_tsslog_get_property (individual_t *ind, const char *propname)
 Gets first found property by name.
const list_t * get_property_node (individual_t *ind, const char *propname)
 Gets firts foundnode of properties list with given property name.
SSLOG_EXTERN const prop_val_tsslog_get_property_by_value (individual_t *ind, const char *propname, void *data)
 Get property value with given data.
SSLOG_EXTERN list_t * sslog_get_property_all (individual_t *ind, const char *propname)
 Get all properties with given name.
SSLOG_EXTERN int sslog_update_property (void *entity, const char *propname, void *new_data)
 Update property with given name.
SSLOG_EXTERN int sslog_update_property_with_value (void *entity, const char *propname, const void *old_data, void *new_data)
 Update property using old value.
SSLOG_EXTERN int sslog_remove_property (individual_t *ind, property_t *prop)
SSLOG_EXTERN int sslog_remove_property_with_value (individual_t *ind, property_t *prop, void *data)
 Unset property value.
SSLOG_EXTERN const property_tsslog_get_property_type (const class_t *ont_class, const char *propname)
 Get property struct by given name.
bool is_individual_has_property (individual_t *individual, property_t *prop)
 Checks property for individual. (Not implemented)
SSLOG_EXTERN bool sslog_is_object_property (property_t *prop)
bool is_prop_values_equal (prop_val_t *a, prop_val_t *b)
 Checks equality of given properties values.
bool is_prop_names_equal (prop_val_t *a, prop_val_t *b)
 Checks equality of properties names of the given properties values.

Detailed Description

Functions for work with properties.

Alaxandr A. Lomov lomov.nosp@m.@cs..nosp@m.karel.nosp@m.ia.r.nosp@m.u

Date:
11 December, 2010

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.

SmartSlog 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 SmartSlog KP Library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

DESCRIPTION

Contains functions for work with properties. This file is part of SmartSlog KP Library.


Function Documentation

const list_t* get_property_node ( individual_t ind,
const char *  propname 
)

Gets firts foundnode of properties list with given property name.

Parameters:
indindividual.
propnamename of property.
Returns:
node of list on success or NULL otherwise.
bool is_individual_has_property ( individual_t individual,
property_t prop 
)

Checks property for individual. (Not implemented)

Parameters:
individualindividual.
propproperty.
Returns:
true if individual has property, otherwise false.
bool is_prop_names_equal ( prop_val_t a,
prop_val_t b 
)

Checks equality of properties names of the given properties values.

It checks names, about field and types.

Parameters:
aone property value.
banother property value.
Returns:
true if equals or false otherwise.
bool is_prop_values_equal ( prop_val_t a,
prop_val_t b 
)

Checks equality of given properties values.

It checks names, about field, types and values.

Parameters:
aone property value.
banother property value.
Returns:
true if equals or false otherwise.
int set_property_by_name ( individual_t ind,
char *  propname,
void *  value 
)
int set_property_with_prop_val ( void *  entity,
const prop_val_t prop_val 
)

Set property with ginen prop_val_t struct.

Set property for one individuals or for all individuals from class.

Parameters:
entityclass or individual.
prop_valvalue to set.
Returns:
0 on success or not otherwise.
SSLOG_EXTERN int sslog_add_property ( void *  entity,
property_t prop,
const void *  value 
)

Set new property for entity.

Sets property for one individual or whole class (not implemented yet). Create new value from given if setting data property, or assigns given value(individual) to property.

Parameters:
indindividual or class.
propertyproperty.
valuevalue to set.
Returns:
ERROR_NO on success or not otherwise.
SSLOG_EXTERN const prop_val_t* sslog_get_property ( individual_t ind,
const char *  propname 
)

Gets first found property by name.

Parameters:
indindividual.
propnamename of property.
Returns:
property value structure on success or NULL if there is no such property.
SSLOG_EXTERN list_t* sslog_get_property_all ( individual_t ind,
const char *  propname 
)

Get all properties with given name.

Parameters:
indindividual.
propnamename of property.
Returns:
properties values list on success or NULL otherwise.
SSLOG_EXTERN const prop_val_t* sslog_get_property_by_value ( individual_t ind,
const char *  propname,
void *  data 
)

Get property value with given data.

Parameters:
indindividual.
propnamename of property.
datavalue of property.
Returns:
property value struct on success or NULL otherwise.
SSLOG_EXTERN const property_t* sslog_get_property_type ( const class_t ont_class,
const char *  propname 
)

Get property struct by given name.

Parameters:
ont_classclass.
propnamename of property.
Returns:
property struct on success or NULL otherwise.
SSLOG_EXTERN bool sslog_is_object_property ( property_t prop)
SSLOG_EXTERN int sslog_remove_property ( individual_t ind,
property_t prop 
)
SSLOG_EXTERN int sslog_remove_property_with_value ( individual_t ind,
property_t prop,
void *  data 
)

Unset property value.

Parameters:
indindividual.
propnamename of property.
datavalue of property.
Returns:
0 on success or not otherwise.
SSLOG_EXTERN int sslog_update_property ( void *  entity,
const char *  propname,
void *  new_data 
)

Update property with given name.

Parameters:
indindividual.
propnamename of property.
new_datavalue of property.
Returns:
0 on success or not otherwise.
SSLOG_EXTERN int sslog_update_property_with_value ( void *  entity,
const char *  propname,
const void *  old_data,
void *  new_data 
)

Update property using old value.

Parameters:
indindividual.
propnamename of property.
old_dataold value of property.
new_datanew value of property.
Returns:
0 on success or not otherwise.
SSLOG_EXTERN int sslog_update_value_struct ( prop_val_t prop_value,
void *  new_data 
)

Update property value.

Parameters:
prop_valuevalue of property.
new_datanew value of property.
Returns:
0 on success or not otherwise.