Internalfunctions - SmartSlog KP Library
Macros | Functions
properties.h File Reference

Functions for work with properties. More...

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

Go to the source code of this file.

Macros

#define SSLOG_EXTERN

Functions

SSLOG_EXTERN const property_tsslog_get_property_type (const class_t *ont_class, const char *propname)
 Get property struct by given name.
SSLOG_EXTERN int sslog_add_property (void *entity, property_t *property, const void *value)
 Set new property for entity.
SSLOG_EXTERN int sslog_add_property_with_value_struct (void *entity, const prop_val_t *prop_val)
SSLOG_EXTERN const prop_val_tsslog_get_property (individual_t *ind, const char *propname)
 Gets first found property by 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_update_value_struct (prop_val_t *prop_value, void *new_data)
 Update property 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 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.

Alaksandr 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

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


Macro Definition Documentation

#define SSLOG_EXTERN

Function Documentation

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.
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 int sslog_add_property_with_value_struct ( void *  entity,
const prop_val_t prop_val 
)
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.