Edinburgh Speech Tools  2.1-release
EST_Relation_list.h
Go to the documentation of this file.
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 #include "EST_Item.h"
41 
42 #if 0
43 /**@name Functions for building and traversing list relations
44  */
45 
46 //@{
47 /**@name List traversal functions */
48 //@{
49 
50 /** return next item of `n`
51  */
52 inline EST_Item *next(const EST_Item *n) { return n->next(); }
53 
54 /** return previous item of `n`
55  */
56 inline EST_Item *prev(const EST_Item *n) { return n->prev(); }
57 
58 /** return last item in `n`'s relation
59  */
60 inline EST_Item *last(const EST_Item *n) { return n->last(); }
61 
62 /** return first item in `n`'s relation
63  */
64 inline EST_Item *first(const EST_Item *n) { return n->first(); }
65 
66 /** return next item of `n` as seen from relation
67 `relname` */
68 inline EST_Item *next(const EST_Item *n,const char *relname)
69  { return next(as(n,relname)); }
70 
71 /** return previous item of `n` as seen from relation
72 `relname` */
73 inline EST_Item *prev(const EST_Item *n,const char *relname)
74  { return prev(as(n,relname)); }
75 
76 /** return first item of `n` as seen from relation
77 `relname` */
78 inline EST_Item *first(const EST_Item *n,const char *relname)
79  { return first(as(n,relname)); }
80 
81 /** return last item of `n` as seen from relation
82 `relname` */
83 inline EST_Item *last(const EST_Item *n,const char *relname)
84  { return last(as(n,relname)); }
85 
86 #endif
87 
88 /** Given a node `l`, return true if
89  `c` after it in a list relation. */
90 int in_list(const EST_Item *c, const EST_Item *l);
91 
92 
93 /** Add a item after node `n`, and return the new
94 item. If `n` is the first item in the list, the
95 new item becomes the head of the list, otherwise it is inserted between
96 `n` and it's previous current item.
97 If `p` is 0, make a new node for the new
98 item, otherwise add `p` to this relation as the
99 next item in `n`'s relation. */
100 
101 EST_Item *add_after(const EST_Item *n, EST_Item *p=0);
102 
103 /** Add a item before node `n`, and return the new
104 item. If `n` is the first item in the list, the
105 new item becomes the head of the list, otherwise it is inserted between
106 `n` and it's previous current item.
107 If `p` is 0, make a new node for the new
108 item, otherwise add `p` to this relation as the
109 previous item in `n`'s relation. */
110 
111 EST_Item *add_before(const EST_Item *n, EST_Item *p=0);
112 
113 /** Remove the given item.
114 */
115 
116 void remove_item_list(EST_Relation *rel, EST_Item *n);
117 
118 //@}
119 //@}
120 #endif
EST_Item * add_before(const EST_Item *n, EST_Item *p=0)
EST_Item * add_after(const EST_Item *n, EST_Item *p=0)
void remove_item_list(EST_Relation *rel, EST_Item *n)
Definition: item_aux.cc:72
EST_Item * as(const EST_Item *n, const char *relname)
Definition: EST_Item.h:419
EST_Item * last() const
Definition: EST_Item.cc:329
EST_Item * first() const
Definition: EST_Item.cc:339
EST_Item * prev() const
Definition: EST_Item.h:350
int in_list(const EST_Item *c, const EST_Item *l)
Definition: item_aux.cc:47
EST_Item * next() const
Definition: EST_Item.h:348