carl  24.04
Computer ARithmetic Library
UFInstance.cpp
Go to the documentation of this file.
1 /**
2  * @file UFInstance.cpp
3  * @author Florian Corzilius <corzilius@cs.rwth-aachen.de>
4  * @since 2014-10-30
5  * @version 2014-10-30
6  */
7 
8 
9 #include "UFInstance.h"
10 
11 #include "UFInstanceManager.h"
12 #include "UVariable.h"
13 
14 #include <iostream>
15 #include <numeric>
16 #include <sstream>
17 #include <vector>
18 
19 namespace carl
20 {
23  }
24 
25  const std::vector<UTerm>& UFInstance::args() const {
27  }
28 
29  std::size_t UFInstance::complexity() const {
30  const auto& a = args();
31  return std::accumulate(
32  a.begin(), a.end(), static_cast<std::size_t>(1),
33  [](std::size_t c, const auto& term){
34  return c + term.complexity();
35  }
36  );
37  }
38 
40  for (const auto& a: args()) {
41  a.gatherVariables(vars);
42  }
43  }
44  void UFInstance::gatherUFs(std::set<UninterpretedFunction>& ufs) const {
45  ufs.insert(uninterpretedFunction());
46  for (const auto& a: args()) {
47  a.gatherUFs(ufs);
48  }
49  }
50 
51  std::ostream& operator<<(std::ostream& os, const UFInstance& ufun) {
52  assert(ufun.id() != 0);
53  os << ufun.uninterpretedFunction().name() << "(";
54  os << carl::stream_joined(", ", ufun.args());
55  os << ")";
56  return os;
57  }
58 }
carl is the main namespace for the library.
std::ostream & operator<<(std::ostream &os, const BasicConstraint< Poly > &c)
Prints the given constraint on the given stream.
auto stream_joined(const std::string &glue, const T &v)
Allows to easily output some container with all elements separated by some string.
static UFInstanceManager & getInstance()
Returns the single instance of this class by reference.
Definition: Singleton.h:45
Implements an uninterpreted function instance.
Definition: UFInstance.h:25
void gatherUFs(std::set< UninterpretedFunction > &ufs) const
Definition: UFInstance.cpp:44
std::size_t complexity() const
Definition: UFInstance.cpp:29
void gatherVariables(carlVariables &vars) const
Definition: UFInstance.cpp:39
const UninterpretedFunction & uninterpretedFunction() const
Definition: UFInstance.cpp:21
std::size_t id() const
Definition: UFInstance.h:44
const std::vector< UTerm > & args() const
Definition: UFInstance.cpp:25
const std::vector< UTerm > & getArgs(const UFInstance &ufi) const
const UninterpretedFunction & getUninterpretedFunction(const UFInstance &ufi) const
Implements an uninterpreted function.
const std::string & name() const