retdec
reference_type.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_CTYPES_REFERENCE_TYPE_H
8 #define RETDEC_CTYPES_REFERENCE_TYPE_H
9 
10 #include <memory>
11 
12 #include "retdec/ctypes/context.h"
13 #include "retdec/ctypes/type.h"
14 
15 namespace retdec {
16 namespace ctypes {
17 
21 class ReferenceType: public Type
22 {
23 public:
24  static std::shared_ptr<ReferenceType> create(
25  const std::shared_ptr<Context> &context,
26  const std::shared_ptr<Type> &referencedType,
27  unsigned bitWidth = 0
28  );
29 
30  std::shared_ptr<Type> getReferencedType() const;
31 
32  bool isReference() const override;
33 
36  virtual void accept(Visitor *v) override;
38 
39 private:
40  explicit ReferenceType(const std::shared_ptr<Type> &referencedType, unsigned bitWidth = 0);
41 
42 private:
43  std::shared_ptr<Type> referencedType;
44 };
45 
46 } // namespace ctypes
47 } // namespace retdec
48 
49 #endif //RETDEC_CTYPES_REFERENCE_TYPE_H
A representation of L-Value and R-Value reference types.
Definition: reference_type.h:22
static std::shared_ptr< ReferenceType > create(const std::shared_ptr< Context > &context, const std::shared_ptr< Type > &referencedType, unsigned bitWidth=0)
Definition: reference_type.cpp:38
bool isReference() const override
Definition: reference_type.cpp:67
std::shared_ptr< Type > getReferencedType() const
Returns referencedType.
Definition: reference_type.cpp:59
virtual void accept(Visitor *v) override
Visitor pattern implementation.
Definition: reference_type.cpp:72
std::shared_ptr< Type > referencedType
Definition: reference_type.h:43
ReferenceType(const std::shared_ptr< Type > &referencedType, unsigned bitWidth=0)
Constructs new reference type.
Definition: reference_type.cpp:19
A base class of all C types.
Definition: type.h:22
unsigned bitWidth
Definition: type.h:49
A base class of all C-types' visitors.
Definition: visitor.h:33
Container for all C functions and types.
A base class of all C types.
Definition: archive_wrapper.h:19