carl  24.04
Computer ARithmetic Library
UFInstanceManager.cpp
Go to the documentation of this file.
1 /**
2  * @file UFInstanceManager.cpp
3  * @author Gereon Kremer <gereon.kremer@cs.rwth-aachen.de>
4  * @author Florian Corzilius <corzilius@cs.rwth-aachen.de>
5  * @since 2014-10-30
6  * @version 2014-10-30
7  */
8 
9 #include "UFInstanceManager.h"
10 
11 namespace carl {
12 UFInstance UFInstanceManager::newUFInstance(std::unique_ptr<UFInstanceContent>&& ufic) {
13  auto iter = mUFInstanceIdMap.find(ufic.get());
14  // Check if this uninterpreted function content has already been created
15  if (iter != mUFInstanceIdMap.end()) {
16  return UFInstance(iter->second);
17  }
18  // Create the uninterpreted function instance
19  mUFInstanceIdMap.emplace(ufic.get(), mUFInstances.size());
20  UFInstance ufi(mUFInstances.size());
21  mUFInstances.emplace_back(std::move(ufic));
22  return ufi;
23 }
24 
26  if (!(ufic.uninterpretedFunction().domain().size() == ufic.args().size())) {
27  return false;
28  }
29  for (std::size_t i = 0; i < ufic.uninterpretedFunction().domain().size(); ++i) {
30  if (!(ufic.uninterpretedFunction().domain().at(i) == ufic.args().at(i).domain())) {
31  return false;
32  }
33  }
34  return true;
35 }
36 } // namespace carl
carl is the main namespace for the library.
Implements an uninterpreted function instance.
Definition: UFInstance.h:25
The actual content of an uninterpreted function instance.
const std::vector< UTerm > & args() const
const UninterpretedFunction & uninterpretedFunction() const
static bool argsCorrect(const UFInstanceContent &ufic)
UFInstance newUFInstance(std::unique_ptr< UFInstanceContent > &&ufic)
Tries to add the given uninterpreted function instance's content to the so far stored uninterpreted f...
std::vector< std::unique_ptr< UFInstanceContent > > mUFInstances
Maps the unique ids to the instantiated uninterpreted function instance's content.
FastPointerMap< UFInstanceContent, std::size_t > mUFInstanceIdMap
Stores all instantiated uninterpreted function instance's contents and maps them to their unique id.
const std::vector< Sort > & domain() const