Fleet  0.0.9
Inference in the LOT
EnumerationInference.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "FleetStatistics.h"
4 #include "IntegerizedStack.h"
5 
16 template<typename Grammar_t, typename... ARGS>
18 public:
19  Grammar_t* grammar;
20 
21  EnumerationInterface(Grammar_t* g) : grammar(g) {
22 
23  }
24 
31  virtual Node toNode(IntegerizedStack& is, ARGS... args) {
32  throw NotImplementedError("*** Subclasses must implement toNode");
33  }
34 
41  virtual Node toNode(enumerationidx_t z, ARGS... args) {
42  IntegerizedStack is(z);
43  return toNode(is, args...);
44  }
45 
51  virtual enumerationidx_t toInteger(const Node& n, ARGS... args) {
52  throw NotImplementedError("*** Subclasses must implement toInteger(Node&)");
53  }
54 
55 };
56 
Definition: Node.h:22
Definition: EnumerationInference.h:17
EnumerationInterface(Grammar_t *g)
Definition: EnumerationInference.h:21
virtual enumerationidx_t toInteger(const Node &n, ARGS... args)
Convert a node to an integer (should be the inverse of toNode)
Definition: EnumerationInference.h:51
Grammar_t * grammar
Definition: EnumerationInference.h:19
virtual Node toNode(IntegerizedStack &is, ARGS... args)
Subclass must implement for IntegerizedStack.
Definition: EnumerationInference.h:31
Definition: Errors.h:7
size_t enumerationidx_t
Definition: IntegerizedStack.h:3
Definition: IntegerizedStack.h:12
virtual Node toNode(enumerationidx_t z, ARGS... args)
Expand an integer to a node using this nonterminal type.
Definition: EnumerationInference.h:41