1 /*************************************************************************/
2 /*                                                                       */
3 /*                Centre for Speech Technology Research                  */
4 /*                     University of Edinburgh, UK                       */
5 /*                         Copyright (c) 1998                            */
6 /*                        All Rights Reserved.                           */
7 /*  Permission is hereby granted, free of charge, to use and distribute  */
8 /*  this software and its documentation without restriction, including   */
9 /*  without limitation the rights to use, copy, modify, merge, publish,  */
10 /*  distribute, sublicense, and/or sell copies of this work, and to      */
11 /*  permit persons to whom this work is furnished to do so, subject to   */
12 /*  the following conditions:                                            */
13 /*   1. The code must retain the above copyright notice, this list of    */
14 /*      conditions and the following disclaimer.                         */
15 /*   2. Any modifications must be clearly marked as such.                */
16 /*   3. Original authors' names are not deleted.                         */
17 /*   4. The authors' names are not used to endorse or promote products   */
18 /*      derived from this software without specific prior written        */
19 /*      permission.                                                      */
20 /*  THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK        */
21 /*  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING      */
22 /*  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT   */
23 /*  SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE     */
24 /*  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    */
25 /*  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   */
26 /*  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,          */
27 /*  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF       */
28 /*  THIS SOFTWARE.                                                       */
29 /*                                                                       */
30 /*************************************************************************/
31 /*                       Author :  Alan W Black                          */
32 /*                       Date   :  February 1998                         */
33 /* --------------------------------------------------------------------- */
34 /*   Functions for LIST relations                                        */
35 /*                                                                       */
36 /*************************************************************************/
37 #ifndef __EST_RELATION_LIST_H__
38 #define __EST_RELATION_LIST_H__
39 
40 
41 #if 0
42 /**@name Functions for building and traversing list relations
43  */
44 
45 //@{
46 /**@name List traversal functions */
47 //@{
48 
49 /** return next item of <parameter>n</parameter>
50  */
51 inline EST_Item *next(const EST_Item *n) { return n->next(); }
52 
53 /** return previous item of <parameter>n</parameter>
54  */
55 inline EST_Item *prev(const EST_Item *n) { return n->prev(); }
56 
57 /** return last item in <parameter>n</parameter>'s relation
58  */
59 inline EST_Item *last(const EST_Item *n) { return n->last(); }
60 
61 /** return first item in <parameter>n</parameter>'s relation
62  */
63 inline EST_Item *first(const EST_Item *n) { return n->first(); }
64 
65 /** return next item of <parameter>n</parameter> as seen from relation
66 <parameter>relname</parameter> */
67 inline EST_Item *next(const EST_Item *n,const char *relname)
68     { return next(as(n,relname)); }
69 
70 /** return previous item of <parameter>n</parameter> as seen from relation
71 <parameter>relname</parameter> */
72 inline EST_Item *prev(const EST_Item *n,const char *relname)
73     { return prev(as(n,relname)); }
74 
75 /** return first item of <parameter>n</parameter> as seen from relation
76 <parameter>relname</parameter> */
77 inline EST_Item *first(const EST_Item *n,const char *relname)
78     { return first(as(n,relname)); }
79 
80 /** return last item of <parameter>n</parameter> as seen from relation
81 <parameter>relname</parameter> */
82 inline EST_Item *last(const EST_Item *n,const char *relname)
83     { return last(as(n,relname)); }
84 
85 #endif
86 
87 /** Given a node <parameter>l</parameter>, return true if
88     <parameter>c</parameter> after it in a list relation. */
89 int in_list(const EST_Item *c, const  EST_Item *l);
90 
91 
92 /** Add a item after node <parameter>n</parameter>, and return the new
93 item. If <parameter>n</parameter> is the first item in the list, the
94 new item becomes the head of the list, otherwise it is inserted between
95 <parameter>n</parameter> and it's previous current item.
96 If <parameter>p</parameter> is 0, make a new node for the new
97 item, otherwise add <parameter>p</parameter> to this relation as the
98 next item in <parameter>n</parameter>'s relation.  */
99 
100 EST_Item *add_after(const EST_Item *n, EST_Item *p=0);
101 
102 /** Add a item before node <parameter>n</parameter>, and return the new
103 item. If <parameter>n</parameter> is the first item in the list, the
104 new item becomes the head of the list, otherwise it is inserted between
105 <parameter>n</parameter> and it's previous current item.
106 If <parameter>p</parameter> is 0, make a new node for the new
107 item, otherwise add <parameter>p</parameter> to this relation as the
108 previous item in <parameter>n</parameter>'s relation.  */
109 
110 EST_Item *add_before(const EST_Item *n, EST_Item *p=0);
111 
112 /** Remove the given item.
113 */
114 
115 void remove_item_list(EST_Relation *rel, EST_Item *n);
116 
117 //@}
118 //@}
119 #endif
120