This file is indexed.

/usr/include/x86_64-linux-gnu/qcc/Alarm.h is in liballjoyn-common-dev-1604 16.04a-3.

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
153
154
155
156
/**
 * @file
 *
 * Alarm declaration
 */

/******************************************************************************
 * Copyright AllSeen Alliance. All rights reserved.
 *
 *    Permission to use, copy, modify, and/or distribute this software for any
 *    purpose with or without fee is hereby granted, provided that the above
 *    copyright notice and this permission notice appear in all copies.
 *
 *    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 *    WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 *    MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 *    ANY SPECIAL, DIRECT, 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 _QCC_ALARM_H
#define _QCC_ALARM_H

#include <qcc/platform.h>
#include <qcc/Debug.h>
#include <qcc/atomic.h>

#include <qcc/String.h>
#include <qcc/time.h>
#include <qcc/ManagedObj.h>

#include <Status.h>

namespace qcc {

/** @internal Forward declaration */
class Timer;
class _Alarm;
class TimerImpl;
class TimerThread;

typedef ManagedObj<_Alarm> Alarm;

/**
 * An alarm listener is capable of receiving alarm callbacks
 */
class AlarmListener {
    friend class TimerImpl;
    friend class TimerThread;

  public:
    /**
     * Virtual destructor for derivable class.
     */
    virtual ~AlarmListener() { }

  private:

    /**
     * @param alarm  The alarm that was triggered.
     * @param status The reason the alarm was triggered. This will be either:
     *               #ER_OK               The normal case.
     *               #ER_TIMER_EXITING    The timer thread is exiting.
     */
    virtual void AlarmTriggered(const Alarm& alarm, QStatus reason) = 0;
};

class _Alarm {
    friend class TimerImpl;
    friend class TimerThread;

  public:

    /** Disable timeout value */
    static const uint32_t WAIT_FOREVER = static_cast<uint32_t>(-1);

    /**
     * Create a default (unusable) alarm.
     */
    _Alarm();

    /**
     * Create an alarm that can be added to a Timer.
     *
     * @param relativeTime    Alarm time.
     * @param listener        Object to call when alarm is triggered.
     * @param context         Opaque context passed to listener callback.
     * @param periodMs        Periodicity of alarm in ms or 0 for no repeat.
     * @param limited         Whether this alarm should be counted towards the Timer's max alarm limit
     */
    _Alarm(Timespec<MonotonicTime> relativeTime, AlarmListener* listener, void* context = NULL, uint32_t periodMs = 0, bool limited = true);

    /**
     * Create an alarm that can be added to a Timer.
     *
     * @param relativeTime    Number of ms from now that alarm will trigger.
     * @param listener        Object to call when alarm is triggered.
     * @param context         Opaque context passed to listener callback.
     * @param periodMs        Periodicity of alarm in ms or 0 for no repeat.
     * @param limited         Whether this alarm should be counted towards the Timer's max alarm limit
     */
    _Alarm(uint32_t relativeTime, AlarmListener* listener, void* context = NULL, uint32_t periodMs = 0, bool limited = true);

    /**
     * Create an alarm that immediately calls a listener.
     *
     * @param listener        Object to call
     * @param context         Opaque context passed to listener callback.
     * @param limited         Whether this alarm should be counted towards the Timer's max alarm limit
     */
    _Alarm(AlarmListener* listener, void* context = NULL, bool limited = true);

    /**
     * Get context associated with alarm.
     *
     * @return User defined context.
     */
    void* GetContext(void) const;

    /**
     * Set context associated with alarm.
     */
    void SetContext(void* c) const;

    /**
     * Get the absolute alarmTime in milliseconds
     */
    uint64_t GetAlarmTime() const;

    /**
     * Return true if this Alarm's time is less than the passed in alarm's time
     */
    bool operator<(const _Alarm& other) const;

    /**
     * Return true if two alarm instances are equal.
     */
    bool operator==(const _Alarm& other) const;

  private:

    static volatile int32_t nextId;
    Timespec<MonotonicTime> alarmTime;
    AlarmListener* listener;
    uint32_t periodMs;
    mutable void* context;
    int32_t id;
    const bool limitable;               /*< Whether this alarm needs to be counted towards the Timer's max alarm limit */

    _Alarm& operator=(const _Alarm& other);
};

}

#endif