Spicy
port.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <utility>
6 
7 #include <hilti/rt/types/port.h>
8 
9 #include <hilti/ast/ctor.h>
10 #include <hilti/ast/types/port.h>
11 
12 namespace hilti {
13 namespace ctor {
14 
16 class Port : public NodeBase, public hilti::trait::isCtor {
17 public:
18  using Value = hilti::rt::Port;
19 
20  Port(const Value& port, Meta m = Meta()) : NodeBase(std::move(m)), _port(port) {}
21 
22  const auto& value() const { return _port; }
23 
24  bool operator==(const Port& other) const { return value() == other.value(); }
25 
27  auto type() const { return type::Port(meta()); }
29  bool isConstant() const { return true; }
31  auto isLhs() const { return false; }
33  auto isTemporary() const { return true; }
35  auto isEqual(const Ctor& other) const { return node::isEqual(this, other); }
37  auto properties() const { return node::Properties{{"port", to_string(_port)}}; }
38 
39 private:
40  Value _port;
41 };
42 
43 } // namespace ctor
44 } // namespace hilti
bool isConstant() const
Definition: port.h:29
Definition: port.h:22
Definition: port.h:16
auto isEqual(const Ctor &other) const
Definition: port.h:35
Definition: meta.h:18
std::map< std::string, node::detail::PropertyValue > Properties
Definition: node.h:83
auto properties() const
Definition: port.h:37
auto isLhs() const
Definition: port.h:31
Definition: ctor.h:15
auto isTemporary() const
Definition: port.h:33
auto & meta() const
Definition: node.h:449
auto type() const
Definition: port.h:27
Definition: node.h:318
Definition: port.h:13