ICG 2
Electric Boogaloo
LookupNameByAddressAndType.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 
6 
8 
9  struct Result {
10  Result () : success(false) {}
11 
12  bool success;
13  std::string name;
14  };
15 
17 
18  public:
19  LookupNameByAddressVisitor(std::string starting_name, void * starting_address, void * lookup_address, std::shared_ptr<const DataType> const search_type);
20 
21  // Visitor Interface
22 
23  virtual bool visitPrimitiveDataType(std::shared_ptr<const PrimitiveDataType> node) override;
24  virtual bool visitCompositeType(std::shared_ptr<const CompositeDataType> node) override;
25  virtual bool visitArrayType(std::shared_ptr<const ArrayDataType> node) override;
26  virtual bool visitPointerType(std::shared_ptr<const PointerDataType> node) override;
27  virtual bool visitEnumeratedType(std::shared_ptr<const EnumDataType> node) override;
28  virtual bool visitStringType (std::shared_ptr<const StringDataType> node) override;
29  virtual bool visitSequenceType (std::shared_ptr<const SequenceDataType> node) override;
30 
31  // LookupAddress Interface
32  std::string getResult();
33 
34 
35  private:
36  // Visitor State
37 
38  // We don't actually care about the absolute address, only the offset within the type
39  long search_offset;
40 
41  // Const all around
42  std::shared_ptr<const DataType> const search_type;
43 
44  // Result variable
45  MutableVariableName name_stack;
46 
47  // Helper
48  bool typeCheck(std::shared_ptr<const DataType> node);
49  bool visitLeaf(std::shared_ptr<const DataType> node);
50  };
51 }
Abstract base class for a DataTypeVisitor.
Definition: DataTypeVisitor.hpp:20
Definition: LookupNameByAddressAndType.hpp:16
virtual bool visitSequenceType(std::shared_ptr< const SequenceDataType > node) override
Definition: LookupNameByAddressAndType.cpp:134
LookupNameByAddressVisitor(std::string starting_name, void *starting_address, void *lookup_address, std::shared_ptr< const DataType > const search_type)
Definition: LookupNameByAddressAndType.cpp:9
virtual bool visitEnumeratedType(std::shared_ptr< const EnumDataType > node) override
Definition: LookupNameByAddressAndType.cpp:125
virtual bool visitArrayType(std::shared_ptr< const ArrayDataType > node) override
Definition: LookupNameByAddressAndType.cpp:74
virtual bool visitStringType(std::shared_ptr< const StringDataType > node) override
Definition: LookupNameByAddressAndType.cpp:130
virtual bool visitCompositeType(std::shared_ptr< const CompositeDataType > node) override
Definition: LookupNameByAddressAndType.cpp:22
virtual bool visitPointerType(std::shared_ptr< const PointerDataType > node) override
Definition: LookupNameByAddressAndType.cpp:120
virtual bool visitPrimitiveDataType(std::shared_ptr< const PrimitiveDataType > node) override
Definition: LookupNameByAddressAndType.cpp:116
std::string getResult()
Definition: LookupNameByAddressAndType.cpp:161
Definition: MutableVariableName.hpp:9
Definition: LookupNameByAddressAndType.hpp:7
Definition: LookupNameByAddressAndType.hpp:9
bool success
Definition: LookupNameByAddressAndType.hpp:12
Result()
Definition: LookupNameByAddressAndType.hpp:10
std::string name
Definition: LookupNameByAddressAndType.hpp:13