Edinburgh Speech Tools  2.4-release
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Pages
EST_Item_Content.h
1 /*************************************************************************/
2 /* */
3 /* Centre for Speech Technology Research */
4 /* University of Edinburgh, UK */
5 /* Copyright (c) 1995,1996 */
6 /* All Rights Reserved. */
7 /* */
8 /* Permission is hereby granted, free of charge, to use and distribute */
9 /* this software and its documentation without restriction, including */
10 /* without limitation the rights to use, copy, modify, merge, publish, */
11 /* distribute, sublicense, and/or sell copies of this work, and to */
12 /* permit persons to whom this work is furnished to do so, subject to */
13 /* the following conditions: */
14 /* 1. The code must retain the above copyright notice, this list of */
15 /* conditions and the following disclaimer. */
16 /* 2. Any modifications must be clearly marked as such. */
17 /* 3. Original authors' names are not deleted. */
18 /* 4. The authors' names are not used to endorse or promote products */
19 /* derived from this software without specific prior written */
20 /* permission. */
21 /* */
22 /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */
23 /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */
24 /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */
25 /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */
26 /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */
27 /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */
28 /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */
29 /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */
30 /* THIS SOFTWARE. */
31 /* */
32 /*************************************************************************/
33 /* Author : Alan W Black */
34 /* Date : May 1998 */
35 /*-----------------------------------------------------------------------*/
36 /* */
37 /* The shared part of an EST_Item, containing the linguistic */
38 /* contents, such as part of speech, stress etc. Basically holds a */
39 /* list of feature value pairs are required. */
40 /* */
41 /* This class is effectively private to the EST_Item class and */
42 /* shouldn't be referenced outside that clase */
43 /* */
44 /*=======================================================================*/
45 #ifndef __EST_ITEM_CONTENT_H__
46 #define __EST_ITEM_CONTENT_H__
47 
48 #include "EST_String.h"
49 #include "EST_Features.h"
50 
51 VAL_REGISTER_CLASS_DCLS(icontent,EST_Item_Content)
52 VAL_REGISTER_CLASS_DCLS(item,EST_Item)
53 class EST_Item;
54 
55 /** A class for containing individual linguistic features and references
56 to relations.
57 
58 This class contents the potentially shared part of an \Ref{EST_Item}.
59 It contains a list of features allowing string names to be related to
60 string, floats, ints and arbitrary objects. It also contains a reference
61 list to the \Ref{EST_Item}s indexed by the relation names.
62 
63 This class should not normally be accessed by anyone other than the
64 \Ref{EST_Item}.
65 
66 */
68  private:
69  void copy(const EST_Item_Content &x);
70  public:
71 
72  /**@name Constructor Functions */
73  //@{
74  /// Default constructor
76  /// Copy constructor
77  EST_Item_Content(const EST_Item_Content &content) { copy(content); }
78  /// destructor
79  ~EST_Item_Content();
80  //@}
81 
82  /// General features for this item
84 
85  /** return the name of the item, e.g. the name of the phone or the
86  text of the word*/
87 
88  // this should be changed back to a reference once we figure
89  // out how to do it.
90  const EST_String name() const {return f.S("name");}
91 
92  /// set name
93  void set_name(const EST_String &s) {f.set("name",s);}
94 
95  // Links to ling_items that share this information
97 
98  EST_Item_Content& operator = (const EST_Item_Content& a);
99  friend ostream& operator << (ostream &s, const EST_Item_Content &a);
100 
101  /**@name Relation related member functions */
102  //@{
103 
104  EST_Item *Relation(const char *name)
105  {
106  EST_Item *d = 0;
107  return ::item(relations.val_def(name,est_val(d)));
108  }
109 
110  int in_relation(const EST_String &name) const
111  { return relations.present(name); }
112  // Unreference this ling_content from the named relation
113  int unref_relation(const EST_String &relname);
114  // Unreference this ling_content from all relations and delete
115  int unref_and_delete();
116  //@}
117 
118  friend class EST_Item;
119 };
120 
121 #endif
122