blob: 216a4cce15d89bc5d00bac679e0fddd1c442e9d0 [file] [log] [blame]
Zane Shelleyb406de42019-09-09 16:10:38 -05001#pragma once
2
3#include <hei_types.hpp>
4
5namespace libhei
6{
7
8/**
9 * @brief This is a simple container for pointers to the user application chip
10 * objects and the associated chip type.
11 */
12class Chip
13{
14 public: // Constructors, destructors, assignment, etc.
15
16 Chip() = default;
17
18 ~Chip() = default;
19
Zane Shelley83da2452019-10-25 15:45:34 -050020 Chip(const Chip &) = default;
Zane Shelleyb406de42019-09-09 16:10:38 -050021
Zane Shelley83da2452019-10-25 15:45:34 -050022 Chip & operator=(const Chip &) = default;
Zane Shelleyb406de42019-09-09 16:10:38 -050023
24 /**
25 * @brief Constructor.
26 * @param i_chip See description for iv_chip.
27 * @param i_type See description for iv_type.
28 */
Zane Shelley83da2452019-10-25 15:45:34 -050029 Chip(void * i_chip, ChipType_t i_type) :
Zane Shelleyb406de42019-09-09 16:10:38 -050030 iv_chip(i_chip), iv_type(i_type)
31 {}
32
33 public: // Accessors
34
35 void * getChip() const { return iv_chip; }
36
37 ChipType_t getType() const { return iv_type; }
38
39 public: // Operators
40
Zane Shelley83da2452019-10-25 15:45:34 -050041 bool operator==(const Chip & r) const
Zane Shelleyb406de42019-09-09 16:10:38 -050042 {
43 return (iv_chip == r.iv_chip) &&
44 (iv_type == r.iv_type);
45 }
46
Zane Shelley83da2452019-10-25 15:45:34 -050047 bool operator<(const Chip & r) const
Zane Shelleyb406de42019-09-09 16:10:38 -050048 {
Zane Shelley83da2452019-10-25 15:45:34 -050049 return (iv_chip < r.iv_chip) ||
50 ((iv_chip == r.iv_chip) && (iv_type < r.iv_type));
Zane Shelleyb406de42019-09-09 16:10:38 -050051 }
52
53 private:
54
55 /**
56 * The user application will provide pointers to user application objects
57 * that represent chips targeted for analysis. The isolator does not know
58 * anything about these objects nor how to use them. The pointers' only
59 * purpose is to eventually get passed back to the user application with
60 * information associated with each chip.
61 */
62 void * iv_chip = nullptr;
63
64 /**
65 * When doing analysis on a chip, the isolator will need to know the chip
66 * type in order to look up the correct information from the Chip Data
67 * Files.
68 */
Zane Shelley0d4f5622019-10-14 13:02:30 -050069 ChipType_t iv_type = CHIP_TYPE_INVALID;
Zane Shelleyb406de42019-09-09 16:10:38 -050070
71}; // end class Chip
72
73} // end namespace libhei