blob: 3b17164b330d5094372f4be90c83076f12ba6e21 [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.
Zane Shelleyb406de42019-09-09 16:10:38 -050015 Chip() = default;
16
17 ~Chip() = default;
18
Zane Shelleyfe27b652019-10-28 11:33:07 -050019 Chip(const Chip&) = default;
Zane Shelleyb406de42019-09-09 16:10:38 -050020
Zane Shelleyfe27b652019-10-28 11:33:07 -050021 Chip& operator=(const Chip&) = default;
Zane Shelleyb406de42019-09-09 16:10:38 -050022
23 /**
24 * @brief Constructor.
25 * @param i_chip See description for iv_chip.
26 * @param i_type See description for iv_type.
27 */
Zane Shelley11b89942019-11-07 11:07:28 -060028 Chip(const void* i_chip, ChipType_t i_type) :
29 iv_chip(i_chip), iv_type(i_type)
30 {}
Zane Shelleyb406de42019-09-09 16:10:38 -050031
32 public: // Accessors
Zane Shelley11b89942019-11-07 11:07:28 -060033 const void* getChip() const
Zane Shelley7f7a42d2019-10-28 13:28:31 -050034 {
35 return iv_chip;
36 }
Zane Shelleyb406de42019-09-09 16:10:38 -050037
Zane Shelley7f7a42d2019-10-28 13:28:31 -050038 ChipType_t getType() const
39 {
40 return iv_type;
41 }
Zane Shelleyb406de42019-09-09 16:10:38 -050042
43 public: // Operators
Zane Shelleyfe27b652019-10-28 11:33:07 -050044 bool operator==(const Chip& r) const
Zane Shelleyb406de42019-09-09 16:10:38 -050045 {
Zane Shelley7f7a42d2019-10-28 13:28:31 -050046 return (iv_chip == r.iv_chip) && (iv_type == r.iv_type);
Zane Shelleyb406de42019-09-09 16:10:38 -050047 }
48
Zane Shelleyfe27b652019-10-28 11:33:07 -050049 bool operator<(const Chip& r) const
Zane Shelleyb406de42019-09-09 16:10:38 -050050 {
Zane Shelley83da2452019-10-25 15:45:34 -050051 return (iv_chip < r.iv_chip) ||
52 ((iv_chip == r.iv_chip) && (iv_type < r.iv_type));
Zane Shelleyb406de42019-09-09 16:10:38 -050053 }
54
55 private:
Zane Shelleyb406de42019-09-09 16:10:38 -050056 /**
57 * The user application will provide pointers to user application objects
58 * that represent chips targeted for analysis. The isolator does not know
59 * anything about these objects nor how to use them. The pointers' only
60 * purpose is to eventually get passed back to the user application with
61 * information associated with each chip.
62 */
Zane Shelley11b89942019-11-07 11:07:28 -060063 const void* iv_chip = nullptr;
Zane Shelleyb406de42019-09-09 16:10:38 -050064
65 /**
66 * When doing analysis on a chip, the isolator will need to know the chip
67 * type in order to look up the correct information from the Chip Data
68 * Files.
69 */
Zane Shelley0d4f5622019-10-14 13:02:30 -050070 ChipType_t iv_type = CHIP_TYPE_INVALID;
Zane Shelleyb406de42019-09-09 16:10:38 -050071
72}; // end class Chip
73
74} // end namespace libhei