GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/util/divisible.h Lines: 5 7 71.4 %
Date: 2021-09-16 Branches: 0 0 0.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Morgan Deters, Mathias Preiner
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8
 * in the top-level source directory and their institutional affiliations.
9
 * All rights reserved.  See the file COPYING in the top-level source
10
 * directory for licensing information.
11
 * ****************************************************************************
12
 *
13
 * [[ Add one-line brief description here ]]
14
 *
15
 * [[ Add lengthier description here ]]
16
 * \todo document this file
17
 */
18
19
#include "cvc5_public.h"
20
21
#ifndef CVC5__DIVISIBLE_H
22
#define CVC5__DIVISIBLE_H
23
24
#include <iosfwd>
25
#include <ostream>
26
#include <stddef.h>
27
28
#include "util/integer.h"
29
30
namespace cvc5 {
31
32
/**
33
 * The structure representing the divisibility-by-k predicate.
34
 */
35
36
struct Divisible
36
{
37
  const Integer k;
38
39
  Divisible(const Integer& n);
40
41
24
  bool operator==(const Divisible& d) const {
42
24
    return k == d.k;
43
  }
44
45
  bool operator!=(const Divisible& d) const {
46
    return !(*this == d);
47
  }
48
}; /* struct Divisible */
49
50
/**
51
 * Hash function for the Divisible objects.
52
 */
53
struct DivisibleHashFunction
54
{
55
60
  size_t operator()(const Divisible& d) const {
56
60
    return d.k.hash();
57
  }
58
}; /* struct DivisibleHashFunction */
59
60
inline std::ostream& operator<<(std::ostream& os, const Divisible& d);
61
inline std::ostream& operator <<(std::ostream& os, const Divisible& d) {
62
  return os << "divisible-by-" << d.k;
63
}
64
65
}  // namespace cvc5
66
67
#endif /* CVC5__DIVISIBLE_H */