int visual_hashlist_init (VisHashlist *hashlist, VisCollectionDestroyerFunc destroyer, int size) { visual_return_val_if_fail (hashlist != NULL, -VISUAL_ERROR_HASHLIST_NULL); /* Do the VisObject initialization */ visual_object_clear (VISUAL_OBJECT (hashlist)); visual_object_set_dtor (VISUAL_OBJECT (hashlist), visual_collection_dtor); visual_object_set_allocated (VISUAL_OBJECT (hashlist), FALSE); /* Set the VisCollection data */ visual_collection_set_destroyer (VISUAL_COLLECTION (hashlist), destroyer); visual_collection_set_destroy_func (VISUAL_COLLECTION (hashlist), hashlist_destroy); visual_collection_set_size_func (VISUAL_COLLECTION (hashlist), hashlist_size); visual_collection_set_iter_func (VISUAL_COLLECTION (hashlist), hashlist_iter); /* Set the VisHashlist data */ visual_hashlist_set_size (hashlist, size); hashlist->list = visual_list_new (NULL); hashlist->index = visual_hashmap_new (NULL); /* FIXME create in set_limits, rehash if not NULL */ visual_hashmap_set_table_size (hashlist->index, size); /* <- also */ return VISUAL_OK; }
/* Object destructors */ static int avs_data_serialize_container_dtor (VisObject *object) { AVSSerializeContainer *scont = AVS_SERIALIZE_CONTAINER (object); visual_collection_set_destroyer (VISUAL_COLLECTION (&scont->layout), visual_object_collection_destroyer); visual_collection_destroy (VISUAL_COLLECTION (&scont->layout)); return TRUE; }
/** * Creates a new VisParamContainer structure. * * @return A newly allocated VisParamContainer structure. */ VisParamContainer *visual_param_container_new () { VisParamContainer *paramcontainer; paramcontainer = visual_mem_new0 (VisParamContainer, 1); /* Do the VisObject initialization */ visual_object_initialize (VISUAL_OBJECT (paramcontainer), TRUE, param_container_dtor); visual_collection_set_destroyer (VISUAL_COLLECTION (¶mcontainer->entries), visual_object_collection_destroyer); return paramcontainer; }
/** * Creates a new VisParamEntry structure. * * @param name The name that is assigned to the VisParamEntry. * * @return A newly allocated VisParamEntry structure. */ VisParamEntry *visual_param_entry_new (char *name) { VisParamEntry *param; param = visual_mem_new0 (VisParamEntry, 1); /* Do the VisObject initialization */ visual_object_initialize (VISUAL_OBJECT (param), TRUE, param_entry_dtor); visual_param_entry_set_name (param, name); visual_collection_set_destroyer (VISUAL_COLLECTION (¶m->callbacks), visual_object_collection_destroyer); return param; }