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
7namespace P4::P4V1 {
8
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_ */
Definition visitor.h:400
Definition getV1ModelVersion.h:11
Definition converters.cpp:28