summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/eiotas_particle.h6
-rw-r--r--src/lib/eiotas_particle.c33
2 files changed, 39 insertions, 0 deletions
diff --git a/src/include/eiotas_particle.h b/src/include/eiotas_particle.h
index 1b309a0..4ebe415 100644
--- a/src/include/eiotas_particle.h
+++ b/src/include/eiotas_particle.h
@@ -45,4 +45,10 @@ void eiotas_particle_free(Eiotas_Particle *particle);
Eiotas_Particle* eiotas_particle_alloc();
+EAPI void eiotas_particle_reset(Eiotas_Particle *particle);
+
+EAPI void eiotas_particle_init(Eiotas_Particle *particle, Eiotas_Iota *iota);
+
+EAPI void eiotas_particle_merge(Eiotas_Particle *particle, Eiotas_Particle *p);
+
#endif // __EIOTAS_PARTICLE_H__
diff --git a/src/lib/eiotas_particle.c b/src/lib/eiotas_particle.c
index 079caf1..4927e90 100644
--- a/src/lib/eiotas_particle.c
+++ b/src/lib/eiotas_particle.c
@@ -56,3 +56,36 @@ void eiotas_particle_free(Eiotas_Particle *particle)
free(particle);
}
+EAPI void eiotas_particle_reset(Eiotas_Particle *particle)
+{
+ unsigned int i;
+ char *s;
+ Eiotas_Particle *p;
+ Eina_Inlist *li;
+ Eina_Array_Iterator it;
+
+ particle->ts = 0;
+ particle->src = NULL;
+ particle->dst = NULL;
+ EINA_ARRAY_ITER_NEXT(particle->dsts, i, s, it) free(s);
+ eina_array_clean(particle->dsts);
+ eina_hash_free_buckets(particle->payload);
+ EINA_INLIST_FOREACH_SAFE(particle->merged, li, p) eiotas_particle_free(p);
+ particle->merged = NULL;
+ EINA_ARRAY_ITER_NEXT(particle->link_fields, i, s, it) free(s);
+ eina_array_clean(particle->link_fields);
+ if(particle->link_value) eina_stringshare_del(particle->link_value);
+ particle->link_value = NULL;
+}
+
+EAPI void eiotas_particle_init(Eiotas_Particle *particle, Eiotas_Iota *iota)
+{
+ particle->src = iota;
+ particle->ts = time(NULL);
+}
+
+EAPI void eiotas_particle_merge(Eiotas_Particle *particle, Eiotas_Particle *p)
+{
+ particle->merged = eina_inlist_append(particle->merged, EINA_INLIST_GET(p));
+}
+