GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/expr/dtype_selector.h Lines: 1 1 100.0 %
Date: 2021-03-22 Branches: 2 4 50.0 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file dtype_selector.h
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Andrew Reynolds, Morgan Deters, Tim King
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 representing a datatype selector.
13
 **/
14
15
#include "cvc4_private.h"
16
17
#ifndef CVC4__EXPR__DTYPE_SELECTOR_H
18
#define CVC4__EXPR__DTYPE_SELECTOR_H
19
20
#include <string>
21
#include "expr/node.h"
22
#include "expr/type_node.h"
23
24
namespace CVC4 {
25
26
class DatatypeConstructorArg;
27
class DType;
28
class DTypeConstructor;
29
30
/**
31
 * A datatype selector for a constructor argument (i.e., a datatype field).
32
 */
33
24919
class DTypeSelector
34
{
35
  friend class DatatypeConstructorArg;
36
  friend class DTypeConstructor;
37
  friend class DType;
38
39
 public:
40
  /** constructor */
41
  DTypeSelector(std::string name, Node selector);
42
43
  /** Get the name of this constructor argument. */
44
  const std::string& getName() const;
45
46
  /**
47
   * Get the selector for this constructor argument; this call is
48
   * only permitted after resolution.
49
   */
50
  Node getSelector() const;
51
52
  /**
53
   * Get the associated constructor for this constructor argument;
54
   * this call is only permitted after resolution.
55
   */
56
  Node getConstructor() const;
57
58
  /**
59
   * Get the type of the selector for this constructor argument.
60
   */
61
  TypeNode getType() const;
62
63
  /**
64
   * Get the range type of this argument.
65
   */
66
  TypeNode getRangeType() const;
67
68
  /**
69
   * Returns true iff this constructor argument has been resolved.
70
   */
71
  bool isResolved() const;
72
73
  /** prints this datatype constructor argument to stream */
74
  void toStream(std::ostream& out) const;
75
76
 private:
77
  /** the name of this selector */
78
  std::string d_name;
79
  /** the selector expression */
80
  Node d_selector;
81
  /**
82
   * The constructor associated with this selector. This field is initialized
83
   * by the constructor of this selector during a call to
84
   * DTypeConstructor::resolve.
85
   */
86
  Node d_constructor;
87
  /** whether this class has been resolved */
88
  bool d_resolved;
89
};
90
91
std::ostream& operator<<(std::ostream& os, const DTypeSelector& arg);
92
93
}  // namespace CVC4
94
95
#endif