aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/util/testclock.h
blob: 748c239b3095682d9ce7901b3e4cfb9ca564eae4 (plain) (blame)
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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "clock.h"

namespace vespalib {

class InvokeServiceImpl;

/**
 * Self contained clock useable for testing that provides a backing for the vespalib::Clock interface.
 */

class TestClock
{
private:
    std::unique_ptr<InvokeServiceImpl> _ticker;
    Clock _clock;
public:
    TestClock();
    TestClock(const TestClock &) = delete;
    TestClock & operator =(const TestClock &) = delete;
    TestClock(TestClock &&) = delete;
    TestClock & operator =(TestClock &&) = delete;
    ~TestClock();
    const Clock & clock() { return _clock; }
};

}