This file is indexed.

/usr/include/speech_tools/EST_THandle.h is in libestools-dev 1:2.4~release-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
 /************************************************************************/
 /*                                                                      */
 /*                Centre for Speech Technology Research                 */
 /*                     University of Edinburgh, UK                      */
 /*                       Copyright (c) 1996,1997                        */
 /*                        All Rights Reserved.                          */
 /*                                                                      */
 /*  Permission is hereby granted, free of charge, to use and distribute */
 /*  this software and its documentation without restriction, including  */
 /*  without limitation the rights to use, copy, modify, merge, publish, */
 /*  distribute, sublicense, and/or sell copies of this work, and to     */
 /*  permit persons to whom this work is furnished to do so, subject to  */
 /*  the following conditions:                                           */
 /*   1. The code must retain the above copyright notice, this list of   */
 /*      conditions and the following disclaimer.                        */
 /*   2. Any modifications must be clearly marked as such.               */
 /*   3. Original authors' names are not deleted.                        */
 /*   4. The authors' names are not used to endorse or promote products  */
 /*      derived from this software without specific prior written       */
 /*      permission.                                                     */
 /*                                                                      */
 /*  THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK       */
 /*  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING     */
 /*  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT  */
 /*  SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE    */
 /*  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES   */
 /*  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN  */
 /*  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,         */
 /*  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF      */
 /*  THIS SOFTWARE.                                                      */
 /*                                                                      */
 /*************************************************************************/

#ifndef __EST_THANDLE_H__
#define __EST_THANDLE_H__

#include <iostream>

using namespace std;

#include "EST_bool.h"

/** A `smart' pointer which does reference counting.
  *
  * Behaves almost like a pointer as far as naive code is concerned, but
  * keeps count of how many handles are holding on to the contents
  * and deletes it when there are none.
  *
  * You need to be careful there are no dumb C++ pointers to things which
  * are being handled this way.
  *
  * Things to be handled should implement the same interface as EST_Handleable
  * (either by taking that as a superclass or by reimplementing it) and in
  * addition define {\tt object_ptr()}. See EST_TBox for an example.
  *
  * There are two parameter types. In most cases the thing which contains the
  * reference count and the data it represents will be the same object, but
  * in the case of boxed values it may not be, so you can specify the type
  * of both independently.
  * 
  * @see EST_Handleable
  * @see EST_TBox
  * @see EST_THandle:example
  * 
  * @author Richard Caley <rjc@cstr.ed.ac.uk>
  * @version $Id: EST_THandle.h,v 1.5 2006/07/19 21:52:12 awb Exp $
  */


template<class BoxT, class ObjectT>
class EST_THandle {

private:
  BoxT *ptr;

public:

  EST_THandle(void) { ptr = (BoxT *)NULL; }
    
  EST_THandle(BoxT *p) { if ((ptr=p)) p->inc_refcount(); }

  EST_THandle(const EST_THandle &cp) {
    ptr=cp.ptr;
    if (ptr)
      ptr->inc_refcount();
  }
  
  ~EST_THandle(void) {
    if (ptr)
      ptr->dec_refcount();
    if (ptr && ptr->is_unreferenced())
      delete ptr;
  }
  
  bool null() const { return ptr == NULL; }

  int shareing(void) const { return ptr?(ptr->refcount() > 1):0; }

  EST_THandle &operator = (EST_THandle h) {
    // doing it in this order means self assignment is safe.
    if (h.ptr)
      (h.ptr)->inc_refcount();
    if (ptr)
      ptr->dec_refcount();
    if (ptr && ptr->is_unreferenced())
      delete ptr;
    ptr=h.ptr;
    return *this;
  }

  // If they manage to get hold of one...
  // Actually usually used to assign NULL and so (possibly) deallocate
  // the object currently pointed to.
  EST_THandle &operator = (BoxT *t_ptr) {
    // doing it in this order means self assignment is safe.
    if (t_ptr)
      t_ptr->inc_refcount();
    if (ptr)
      ptr->dec_refcount();
    if (ptr && ptr->is_unreferenced())
      delete ptr;
    ptr=t_ptr;
    return *this;
  }
 
    operator ObjectT *() {
      return ptr?(ptr->object_ptr()):(ObjectT *)NULL;
    }

    operator const ObjectT *() const {
      return ptr?(ptr->object_ptr()):(const ObjectT *)NULL;
    }

  
  int operator == (const BoxT *p) const { return ptr == p; }
  int operator != (const BoxT *p) const { return !(*this == p); }

  const ObjectT& operator *() const { return *(ptr->object_ptr()); }
  ObjectT& operator *() { return *(ptr->object_ptr()); }
  const ObjectT* operator ->() const { return (ptr->object_ptr()); }
  ObjectT* operator ->() { return (ptr->object_ptr()); }

  friend int operator == (const EST_THandle< BoxT, ObjectT > &a, const EST_THandle< BoxT, ObjectT > & b)
    {return a.ptr==b.ptr; }
  friend int operator != (const EST_THandle< BoxT, ObjectT > &a, const EST_THandle< BoxT, ObjectT > & b)
    { return !( a==b ); }

  friend ostream & operator << (ostream &s, const EST_THandle< BoxT, ObjectT > &a)
    { return s << "HANDLE"; }
};

#endif