Update copyrights.
[cvc5.git] / src / util / divisible.h
1 /********************* */
2 /*! \file divisible.h
3 ** \verbatim
4 ** Original author: Morgan Deters
5 ** Major contributors: none
6 ** Minor contributors (to current version): none
7 ** This file is part of the CVC4 project.
8 ** Copyright (c) 2009-2014 New York University and The University of Iowa
9 ** See the file COPYING in the top-level source directory for licensing
10 ** information.\endverbatim
11 **
12 ** \brief [[ Add one-line brief description here ]]
13 **
14 ** [[ Add lengthier description here ]]
15 ** \todo document this file
16 **/
17
18 #include "cvc4_public.h"
19
20 #ifndef __CVC4__DIVISIBLE_H
21 #define __CVC4__DIVISIBLE_H
22
23 #include <iostream>
24 #include "util/integer.h"
25 #include "util/exception.h"
26
27 namespace CVC4 {
28
29 /**
30 * The structure representing the divisibility-by-k predicate.
31 */
32 struct CVC4_PUBLIC Divisible {
33 const Integer k;
34
35 Divisible(const Integer& n);
36
37 bool operator==(const Divisible& d) const {
38 return k == d.k;
39 }
40
41 bool operator!=(const Divisible& d) const {
42 return !(*this == d);
43 }
44 };/* struct Divisible */
45
46 /**
47 * Hash function for the Divisible objects.
48 */
49 struct CVC4_PUBLIC DivisibleHashFunction {
50 size_t operator()(const Divisible& d) const {
51 return d.k.hash();
52 }
53 };/* struct DivisibleHashFunction */
54
55 inline std::ostream& operator <<(std::ostream& os, const Divisible& d) CVC4_PUBLIC;
56 inline std::ostream& operator <<(std::ostream& os, const Divisible& d) {
57 return os << "divisible-by-" << d.k;
58 }
59
60 }/* CVC4 namespace */
61
62 #endif /* __CVC4__DIVISIBLE_H */