GCC Code Coverage Report
Directory: . Exec Total Coverage
File: build-coverage/deps/include/poly/polyxx/assignment.h Lines: 1 1 100.0 %
Date: 2021-05-22 Branches: 0 0 0.0 %

Line Exec Source
1
#pragma once
2
3
#include <iosfwd>
4
5
#include "../assignment.h"
6
#include "context.h"
7
#include "value.h"
8
#include "variable.h"
9
10
namespace poly {
11
12
  /**
13
   * Implements a wrapper for lp_assignment_t.
14
   */
15
  class Assignment {
16
    /** The actual assignment. */
17
    lp_assignment_t mAssignment;
18
19
   public:
20
    /** Construct an empty assignment with a custom context. */
21
    Assignment(const Context& c);
22
    /** Construct an empty assignment. */
23
4914
    Assignment() : Assignment(Context::get_context()) {}
24
    /** Custom destructor. */
25
    ~Assignment();
26
27
    /** Get a non-const pointer to the internal lp_assignment_t. Handle with
28
     * care!
29
     */
30
    lp_assignment_t* get_internal();
31
    /** Get a const pointer to the internal lp_assignment_t. */
32
    const lp_assignment_t* get_internal() const;
33
34
    /** Assign variable to the given value. */
35
    void set(const Variable& var, const Value& value);
36
    /** Unassign the given variable. */
37
    void unset(const Variable& var);
38
    /** Check whether the variable is assigned. */
39
    bool has(const Variable& var) const;
40
    /** Retrieve a value from the Assignment. */
41
    const Value& get(const Variable& var) const;
42
    /** Clear the assignment. */
43
    void clear();
44
  };
45
46
  /** Stream the given Assignment to an output stream. */
47
  std::ostream& operator<<(std::ostream& os, const Assignment& a);
48
49
}  // namespace poly