properties.c File Reference

Functions for work with properties. More...

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

Functions

int update_property_value_data (prop_val_t *prop_value, void *new_data)
 Update property value.
int set_property_by_name (void *entity, char *propname, void *value)
 Set new property for entity.
int set_property (void *entity, property_t *property, 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.
const prop_val_tget_property (individual_t *ind, const char *propname)
 Get property by name.
const list_t * get_property_node (individual_t *ind, const char *propname)
 Get node of properties list with given property name .
const prop_val_tget_property_with_data (individual_t *ind, const char *propname, void *data)
 Get property value with given data.
list_t * get_properties (individual_t *ind, const char *propname)
 Get all properties with given name.
int update_property (void *entity, const char *propname, void *new_data)
 Update property with given name.
int update_property_with_data (void *entity, const char *propname, const void *old_data, void *new_data)
 Update property using old value.
int unset_property_for_individual (individual_t *ind, char *propname, void *data)
 Unset property value.
const property_tget_property_type (const class_t *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.


Detailed Description

Functions for work with properties.

Alaxandr A. Lomov <lomov@cs.karelia.ru>

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.

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 PetrSU 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 PetrSU KP library.

Function Documentation

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

Get all properties with given name.

Parameters:
ind individual.
propname name of property.
Returns:
properties values list on success or NULL otherwise.

const prop_val_t* get_property ( individual_t ind,
const char *  propname 
)

Get property by name.

Parameters:
ind individual.
propname name of property.
Returns:
0 on success or not otherwise.

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

Get node of properties list with given property name .

Parameters:
ind individual.
propname name of property.
Returns:
node of list on success or NULL otherwise.

const property_t* get_property_type ( const class_t class,
const char *  propname 
)

Get property struct by given name.

Parameters:
class class.
propname name of property.
Returns:
property struct on success or NULL otherwise.

const prop_val_t* get_property_with_data ( individual_t ind,
const char *  propname,
void *  data 
)

Get property value with given data.

Parameters:
ind individual.
propname name of property.
data value of property.
Returns:
property value struct on success or NULL otherwise.

bool is_individual_has_property ( individual_t individual,
property_t prop 
)

Checks property for individual.

Parameters:
individual individual.
prop property.
Returns:
true if individual has property, otherwise false.

int set_property ( void *  entity,
property_t property,
void *  value 
)

Set new property for entity.

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

Parameters:
entity class or individual.
property property.
value value to set.
Returns:
0 on success or not otherwise.

int set_property_by_name ( void *  entity,
char *  propname,
void *  value 
)

Set new property for entity.

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

Parameters:
entity class or individual.
propname name of the property.
value value to set.
Returns:
0 on success or not otherwise.

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:
entity class or individual.
prop_val value to set.
Returns:
0 on success or not otherwise.

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

Unset property value.

Parameters:
ind individual.
propname name of property.
data value of property.
Returns:
0 on success or not otherwise.

int update_property ( void *  entity,
const char *  propname,
void *  new_data 
)

Update property with given name.

Parameters:
ind individual.
propname name of property.
new_data value of property.
Returns:
0 on success or not otherwise.

int update_property_value_data ( prop_val_t prop_value,
void *  new_data 
)

Update property value.

Parameters:
prop_value value of property.
new_data new value of property.
Returns:
0 on success or not otherwise.

int update_property_with_data ( void *  entity,
const char *  propname,
const void *  old_data,
void *  new_data 
)

Update property using old value.

Parameters:
ind individual.
propname name of property.
old_data old value of property.
new_data new value of property.
Returns:
0 on success or not otherwise.


doxygen