GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/expr/emptybag.cpp Lines: 9 21 42.9 %
Date: 2021-03-22 Branches: 7 16 43.8 %

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