P4C
The P4 Compiler
Loading...
Searching...
No Matches
formulae.h
1
#ifndef BACKENDS_P4TOOLS_COMMON_LIB_FORMULAE_H_
2
#define BACKENDS_P4TOOLS_COMMON_LIB_FORMULAE_H_
3
4
#include <functional>
5
#include <string>
6
7
#include "ir/ir.h"
8
#include "ir/node.h"
9
#include "lib/exceptions.h"
10
11
namespace
P4::P4Tools
{
12
16
template
<
class
Self,
class
Node = IR::Expression>
17
class
AbstractRepCheckedNode
:
public
ICastable
{
18
protected
:
19
std::reference_wrapper<const Node> node;
20
21
// Implicit conversions to allow implementations to be treated like a Node*.
22
operator
const
Node *()
const
{
return
&node.get(); }
23
const
Node &operator*()
const
{
return
node.get(); }
24
const
Node *operator->()
const
{
return
&node.get(); }
25
28
explicit
AbstractRepCheckedNode
(
const
Node *node, std::string classDesc) : node(*node) {
29
BUG_CHECK(Self::repOk(node),
"%1%: Not a valid %2%."
, node, classDesc);
30
}
31
32
DECLARE_TYPEINFO(
AbstractRepCheckedNode
);
33
};
34
35
}
// namespace P4::P4Tools
36
37
#endif
/* BACKENDS_P4TOOLS_COMMON_LIB_FORMULAE_H_ */
P4::ICastable
Definition
castable.h:36
P4::P4Tools::AbstractRepCheckedNode
Definition
formulae.h:17
P4::P4Tools::AbstractRepCheckedNode::AbstractRepCheckedNode
AbstractRepCheckedNode(const Node *node, std::string classDesc)
Definition
formulae.h:28
P4::P4Tools
Definition
common/compiler/compiler_result.cpp:3
backends
p4tools
common
lib
formulae.h
Generated by
1.12.0