This file is indexed.

/usr/include/tjutils/tjhandler_code.h is in libodin-dev 1.8.4-1ubuntu2.

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
#include <tjutils/tjhandler.h>
#include <tjutils/tjlog.h>


//////////////////////////////////////////////////////////////

template<class I>
Handled<I>::Handled() {}

template<class I>
 Handled<I>::~Handled() {
    Log<HandlerComponent> odinlog("Handled","~Handled");
    for(typename STD_list< const Handler<I>* >::const_iterator it=handlers.begin(); it!=handlers.end(); ++it) {
      (*it)->handled_remove(this); // do not call L::remove here because it will modify handlers list
    }
  }


template<class I>
  const  Handled<I>& Handled<I>::set_handler(const Handler<I>& handler) const {
    handlers.push_back(&handler);
    return *this;
  }

template<class I>
  const  Handled<I>& Handled<I>::erase_handler(const Handler<I>& handler) const {
    handlers.remove(&handler);
    return *this;
  }


/////////////////////////////////////////////


template<class I>
  Handler<I>::Handler() {
    handledobj=0;
  }

template<class I>
  Handler<I>::Handler(const Handler& handler) {
    Handler<I>::operator = (handler);
  }

template<class I>
  Handler<I>& Handler<I>::operator = (const Handler& handler) {
    clear_handledobj();
    I hd=handler.get_handled();
    if(hd) set_handled(hd);
    return *this;
  }


template<class I>
  Handler<I>::~Handler() {
    Log<HandlerComponent> odinlog("Handler","~Handler");
    clear_handledobj();
  }

template<class I>
  const Handler<I>& Handler<I>::clear_handledobj() const {
    Log<HandlerComponent> odinlog("Handler","clear_handledobj");
    ODINLOG(odinlog,normalDebug) << "handledobj=" << (void*)handledobj << STD_endl;
    if(handledobj) handledobj->Handled<I>::erase_handler(*this);
    handledobj=0;
    return *this;
  }

template<class I>
  const Handler<I>& Handler<I>::set_handled(I handled) const {
    Log<HandlerComponent> odinlog("Handler","set_handled");
    ODINLOG(odinlog,normalDebug) << "handled=" << (void*)handled << STD_endl;
    clear_handledobj();
    handled->Handled<I>::set_handler(*this);
    handledobj=handled;
    return *this;
  }



template<class I>
  I Handler<I>::get_handled() const {
    return handledobj;
  }


template<class I>
  const Handler<I>& Handler<I>::handled_remove(Handled<I>* handled) const {
    Log<HandlerComponent> odinlog("Handler","handled_remove");
    I handledtype=static_cast<I>(handled);
    ODINLOG(odinlog,normalDebug) << "handledtype=" << (void*)handledtype << STD_endl;
    if(handledtype) handledobj=0;
    else ODINLOG(odinlog,errorLog) << "Unable to remove handled!" << STD_endl;
    return *this;
  }

////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////



template<class T, bool thread_safe>
  void SingletonHandler<T,thread_safe>::init (const char* unique_label) {
    // NOTE:  Debug uses SingletonHandler -> do not use Debug in here
    singleton_label=new STD_string;
    mutex=0;
    if(thread_safe) mutex=new Mutex();
    (*singleton_label)=unique_label;
    if(!get_external_map_ptr(unique_label)) {
      ptr=new T;
      ptr->set_label(unique_label);
      (*get_singleton_map())[unique_label]=this; // make sure singleton_map is allocated
    } else {
      ptr=0;
    }
  }

template<class T, bool thread_safe>
  void SingletonHandler<T,thread_safe>::destroy () {
    if(ptr) delete ptr; ptr=0;
    delete singleton_label;
   if(mutex) delete mutex;
  }

template<class T, bool thread_safe>
  void SingletonHandler<T,thread_safe>::copy(T& destination) const {
    T* p=get_map_ptr();
    if(p) destination=(*p);
  }


template<class T, bool thread_safe>
  T* SingletonHandler<T,thread_safe>::get_map_ptr() const {
    if(ptr) return ptr; // fast return without touching the map
    if(singleton_map_external) {
      T* ext_ptr=(T*)get_external_map_ptr(*singleton_label);
      if(ext_ptr) ptr=ext_ptr;
    }
    return ptr;
  }