Since k-s is on the road this days, we'd better write some code ourselves.
This is array counterpart of eina_value_struct_value_get(), and retrieves
an item from an Eina_Value_Array as an Eina_Value.
Code writing the setter is welcome.
Patch by: "Raphael Kubo da Costa" <kubo@profusion.mobi>
SVN revision: 68581
Added the events: loaded and unloaded to notify eina_model_load() and
eina_model_unload() were called.
To be more specific, the interfaces used by EINA_MODEL_TYPE_MIXIN
(Eina_Model_Interface_Properties and Eina_Model_Interface_Children)
also do:
* properties,loaded
* properties,unloaded
* children,loaded
* children,unloaded
SVN revision: 68035
HUMAN_POOPER_IFACE must have ANIMAL_POOPER_IFACE as parent interface,
otherwise the order will be incorrect.
The test were also improved in other ways:
* use ck_assert_int_eq() instead of fail_if()... it prints the incorrect value
* check refcount
* unref models
* shutdown eina
SVN revision: 68034
We should lookup then in forward order, as they are sorted from
most-specific first, with parents at the end.
This breaks test, will fix in the last commit (3/3).
SVN revision: 68032
array, list, struct and others set() now copies the values. These
values can be created by user, in this case string is just a stack
object and not a real eina_stringshare.
To cope with it, add the string instead of referencing it. Bit slower,
but nicer behavior.
SVN revision: 67886
I did a bad decision to steal memory for Array, List, Hash and Struct
types, it was nice to not have to copy it internally, but breaks when
one needs to set a new value that was set elsewhere. What did not
happen with string, integers and other basic types.
This was exposed by Raphael Kubo using eina_model_property_set() with
complex types (Array, List and Hash) and it was not possible to
correctly set such properties.
Now it's all set, but the behavior changed and the memory is not
stolen and released anymore. Test eina_test_value.c was changed to
reflect it.
SVN revision: 67843
if user get and then set the same value, we should not crash and this
may happen with previous code as the old
string/array/value/list... were released, then you ended with the
released memory still being pointed.
SVN revision: 67841
We should not flush and then setup the memory, instead we leave
vset/pset functions do their own stuff to clean previous data, if any.
SVN revision: 67840
Let's try to help debug by allowing extended reference management that
takes in account an identifier. This identifier is accounted on xref
and xunref and must match.
xrefs_get will return the list of such references, for debugging purposes.
eina_models_list_get() was added to return all live models, just
tracked when EINA_MODEL_DEBUG is enabled.
eina_models_usage_dump() was added and use the same infrastructure as
eina_models_list_get() and eina_model_xrefs_get() to aid debugging :-)
SVN revision: 67821
He worked previously with documentation, now is helping me with
Eina_Model and will keep adding some examples and fixes here and
there.
SVN revision: 67798
Same as the previous commit about "Type" this time about Interface.
This will also hopefully remove the likelihood for hacks.
Previous functions are still available as method_offset_resolve.
SVN revision: 67786
val->value.ptr is just valid on 64bits platforms, as on 32bits both
pointers of the Eina_Value_Struct fits in the 8bytes of val->value.buf.
Always use the function to correctly retrieve it.
SVN revision: 67764
Make it possible to resolve foo (the last item).
struct _My_Object_Type
{
Eina_Model_Type parent_class;
...
void (*foo)(Eina_Model *, int);
};
SVN revision: 67733
1. consider case where the struct was not set for flush and others;
2. flush previous struct on pset;
3. setup the new struct members memory on pset;
4. always use ops->alloc and ops->free if they are provided;
SVN revision: 67662
It's interchangeable with const char *, it's juts there as a visual hint
for functions expecting stringshared values. Docs are not enough...
SVN revision: 67641
Thanks to Tasn review it was noticed that subclasses using "const void *value"
with sub-structure would have to resolve their methods manually, quite bad.
Then the extension will happen with structures inside structures, as
previously used in Evas_Smart_Class. To allow the system to resolve
the methods and keep it, it is now specificed the type_size.
A new function is added to help extensions:
eina_model_type_method_resolve(), together with few helper macros.
To allow Eina_Model_Type to be augmented with more methods without
breaking the ABI, 4 slots are left there. We expect we got it right
from beginning and these will never be used, but we can never be sure
;-)
Last but not least, similar changes were done to Eina_Model_Interface
for consistency matters.
SVN revision: 67635
It is common to already known the member, then no need to query
it. This provides optimized retrieval for people that can manage it.
SVN revision: 67538
this is a killer, should be very efficient in memory and speed to
set/get items: instead of a hash of properties, keep them in a C
struct!
The constraint is that properties have fixed types defined at compile
time and cannot be deleted, but this is expected in many cases (ie:
esql rows).
SVN revision: 67517
Don't print messages from share common, that way we have no way to
know where it happens, moreover the binshare values may lack trailing
'\0'.
Also makes no sense to share the log domain. With separate domains we
can be more selective in what we log/debug.
SVN revision: 67418
This is a simple to use generic hierarchical data access. It includes
properties, children, reference counting and notifications (callbacks).
It can be understood in the same lines as GObject or PyObject, but I
believe the best usage is just to provide data models, not generic
Object Oriented Programming in C.
It misses most of documentation, although the important bits are
there. Need help here :-/
SVN revision: 67405
they are not so expensive and will help detect bugs.
also, safety can be disabled at compile time... if performance is so
critical.
SVN revision: 67393
library files should ALWAYS include config.h, they should not include
Eina.h using "<Eina.h>" to avoid messing with system's version.
Last but definitely not least: include safety checks BEFORE your local
header, otherwise the macros EINA_ARG_NONNULL() will remove every
check for null pointers! eina_safety_checks.h redefines it to empty so
compiler does not optimize these things.
SVN revision: 67392
This removes the annoying:
make[2]: warning: jobserver unavailable: using -j1. Add `+' to parent make rule.
and with the package name I can upload it easily to somewhere else.
SVN revision: 67343
NOTE: it is worth enabling it and see EINA_LOG_INFO displaying how much memory
we are wasting. Should help tune our memory allocator usage.
SVN revision: 67296
be 1.1 (or 1.5) for the last release. too late. THIS is why i'm sick
and tired of all the bloody separate libs that have to be versiioned
and build and released separately. :( too many places to go fix up per
release.
SVN revision: 67284
efficient storage with named access, can specify compare, alloc, free
and other operations for even better management.
no changelog/news as this is under eina_value, all new for 1.2 release.
SVN revision: 67155
Nice type that even supports configurable operations such as compare,
free, copy and to_string.
the usual is also supported: provide no ops (operations) and memory
will be left untouched.
nice feature to dump as string :-)
SVN revision: 67109
Similar to list and array, but takes string keys instead of position.
It can convert to string, I've added tests for it, but hash algorithm
changes may break the simple comparison I did... and I don't want to
parse the string to be more accurate.
SVN revision: 67103
Similar to array, but less efficient as uses list nodes. If possible
values are stored on list->data itself, otherwise they are allocated
and the pointer goes as list->data.
SVN revision: 67096
Should be more portable and work with C++.
NOTE: I still see an aliasing break in eina_value_pset, but wasn't
able to figure how to solve it.
SVN revision: 67065
eina value is a generic value storage, it's quite efficient to space
(16 bytes) and speed (inlines for basic types).
It's basically a structure describing how to manage memory
(Eina_Value_Type), with default implementation for char, short, int,
long, int64_t (and unsigned variants), float, double, stringshare and
string.
If a type 'value_size' is smaller than 8 bytes, it's stored
inline. Otherwise a value is allocated and managed.
Most of the methods are inline, with special handling for char, short,
int... Then no extra calls are made, allowing the compiler to optimize
them.
For array of a single type it is recommend to use Eina_Value_Array, as
it will efficiently store and access members (just a char if subtype
is EINA_VALUE_TYPE_CHAR, etc).
It can copy itself, compare itself. Including arrays.
It would be nice to have something that converts between EET and this.
SVN revision: 67035
It is an inline array, that is, the members are actually in the
allocated buffer, as opposed to a pointer to its data.
It can be used to manage array of integers, floats or other structures
without fragmenting memory.
The lookups should be fast as memory is linear, then CPU prefetch can
kick in and bring data to cache before it's used.
SVN revision: 67003
We must check for cflags/ldflags and evil/escape libs before looking
for headers (like sys/mman.h) because they could be provided by one
of those libs. We must also set CFLAGS/LDFLAGS/LIBS variables to the
EINA_CFLAGS/EINA_LDFLAGS/EINA_LIBS vars so they get picked up properly
SVN revision: 66954