P4C
The P4 Compiler
Loading...
Searching...
No Matches
getV1ModelVersion.h
1
#ifndef _FRONTENDS_P4_GETV1MODELVERSION_H_
2
#define _FRONTENDS_P4_GETV1MODELVERSION_H_
3
4
#include "ir/ir.h"
5
#include "ir/visitor.h"
6
7
namespace
P4::P4V1
{
8
11
class
GetV1ModelVersion
:
public
Inspector
{
12
bool
preorder(
const
IR::Declaration_Constant *dc)
override
{
13
if
(dc->name ==
"__v1model_version"
) {
14
const
auto
*val = dc->initializer->to<IR::Constant>();
15
version =
static_cast<
unsigned
>
(val->value);
16
}
17
return
false
;
18
}
19
bool
preorder(
const
IR::Declaration *)
override
{
return
false
; }
20
21
public
:
22
unsigned
version = 0;
23
};
24
25
}
// namespace P4::P4V1
26
27
#endif
/* _FRONTENDS_P4_GETV1MODELVERSION_H_ */
P4::Inspector
Definition
visitor.h:400
P4::P4V1::GetV1ModelVersion
Definition
getV1ModelVersion.h:11
P4::P4V1
Definition
converters.cpp:28
frontends
p4
getV1ModelVersion.h
Generated by
1.12.0