GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/expr/emptybag.cpp Lines: 9 21 42.9 %
Date: 2021-08-16 Branches: 6 12 50.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Mudathir Mohamed
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
 * A class for empty bags.
14
 */
15
16
#include "expr/emptybag.h"
17
18
#include <iostream>
19
20
#include "expr/type_node.h"
21
22
namespace cvc5 {
23
24
std::ostream& operator<<(std::ostream& out, const EmptyBag& asa)
25
{
26
  return out << "emptybag(" << asa.getType() << ')';
27
}
28
29
8106
size_t EmptyBagHashFunction::operator()(const EmptyBag& es) const
30
{
31
8106
  return std::hash<TypeNode>()(es.getType());
32
}
33
34
/**
35
 * Constructs an emptybag of the specified type. Note that the argument
36
 * is the type of the bag itself, NOT the type of the elements.
37
 */
38
1674
EmptyBag::EmptyBag(const TypeNode& bagType) : d_type(new TypeNode(bagType)) {}
39
40
3200
EmptyBag::EmptyBag(const EmptyBag& es) : d_type(new TypeNode(es.getType())) {}
41
42
EmptyBag& EmptyBag::operator=(const EmptyBag& es)
43
{
44
  (*d_type) = es.getType();
45
  return *this;
46
}
47
48
4874
EmptyBag::~EmptyBag() {}
49
19462
const TypeNode& EmptyBag::getType() const { return *d_type; }
50
3282
bool EmptyBag::operator==(const EmptyBag& es) const
51
{
52
3282
  return getType() == es.getType();
53
}
54
55
bool EmptyBag::operator!=(const EmptyBag& es) const { return !(*this == es); }
56
bool EmptyBag::operator<(const EmptyBag& es) const
57
{
58
  return getType() < es.getType();
59
}
60
61
bool EmptyBag::operator<=(const EmptyBag& es) const
62
{
63
  return getType() <= es.getType();
64
}
65
66
bool EmptyBag::operator>(const EmptyBag& es) const { return !(*this <= es); }
67
bool EmptyBag::operator>=(const EmptyBag& es) const { return !(*this < es); }
68
29340
}  // namespace cvc5