src/cx/tree.h

changeset 1549
72ad8a78378a
parent 1521
493f609665de
equal deleted inserted replaced
1548:12315ee158ad 1549:72ad8a78378a
641 641
642 /** 642 /**
643 * Structure for holding the base data of a tree. 643 * Structure for holding the base data of a tree.
644 */ 644 */
645 struct cx_tree_s { 645 struct cx_tree_s {
646 CX_COLLECTION_BASE;
646 /** 647 /**
647 * The tree class definition. 648 * The tree class definition.
648 */ 649 */
649 const cx_tree_class *cl; 650 const cx_tree_class *cl;
650
651 /**
652 * Allocator to allocate new nodes.
653 */
654 const CxAllocator *allocator;
655 651
656 /** 652 /**
657 * A pointer to the root node. 653 * A pointer to the root node.
658 * 654 *
659 * Will be @c NULL when @c size is 0. 655 * Will be @c NULL when @c size is 0.
669 * Nodes MAY use #cx_tree_node_base_s as the base layout, but do not need to. 665 * Nodes MAY use #cx_tree_node_base_s as the base layout, but do not need to.
670 */ 666 */
671 cx_tree_node_create_func node_create; 667 cx_tree_node_create_func node_create;
672 668
673 /** 669 /**
674 * An optional simple destructor for the tree nodes.
675 */
676 cx_destructor_func simple_destructor;
677
678 /**
679 * An optional advanced destructor for the tree nodes.
680 */
681 cx_destructor_func2 advanced_destructor;
682
683 /**
684 * The pointer to additional data that is passed to the advanced destructor.
685 */
686 void *destructor_data;
687
688 /**
689 * A function to compare two nodes. 670 * A function to compare two nodes.
690 */ 671 */
691 cx_tree_search_func search; 672 cx_tree_search_func search;
692 673
693 /** 674 /**
694 * A function to compare a node with data. 675 * A function to compare a node with data.
695 */ 676 */
696 cx_tree_search_data_func search_data; 677 cx_tree_search_data_func search_data;
697
698 /**
699 * The number of currently stored elements.
700 */
701 size_t size;
702 678
703 /** 679 /**
704 * Offset in the node struct for the parent pointer. 680 * Offset in the node struct for the parent pointer.
705 */ 681 */
706 ptrdiff_t loc_parent; 682 ptrdiff_t loc_parent;

mercurial