blob: cc8995f1d01e4f5c3a69850777f5516b4d0ff1ff [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 /**
Zane Shelley84533532020-06-11 15:20:50 -050016 * @brief Default contructor.
17 *
18 * In general the default constructor should not be used, but it is needed
19 * for some STL functions.
20 */
21 Chip() = default;
22
23 /**
Zane Shelleyb406de42019-09-09 16:10:38 -050024 * @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
Zane Shelley8c093d82020-05-04 22:06:52 -050032 ~Chip() = default;
33
34 Chip(const Chip&) = default;
35
36 Chip& operator=(const Chip&) = default;
37
Zane Shelleyb406de42019-09-09 16:10:38 -050038 public: // Accessors
Zane Shelley11b89942019-11-07 11:07:28 -060039 const void* getChip() const
Zane Shelley7f7a42d2019-10-28 13:28:31 -050040 {
41 return iv_chip;
42 }
Zane Shelleyb406de42019-09-09 16:10:38 -050043
Zane Shelley7f7a42d2019-10-28 13:28:31 -050044 ChipType_t getType() const
45 {
46 return iv_type;
47 }
Zane Shelleyb406de42019-09-09 16:10:38 -050048
49 public: // Operators
Zane Shelleyfe27b652019-10-28 11:33:07 -050050 bool operator==(const Chip& r) const
Zane Shelleyb406de42019-09-09 16:10:38 -050051 {
Zane Shelley7f7a42d2019-10-28 13:28:31 -050052 return (iv_chip == r.iv_chip) && (iv_type == r.iv_type);
Zane Shelleyb406de42019-09-09 16:10:38 -050053 }
54
Zane Shelleyfe27b652019-10-28 11:33:07 -050055 bool operator<(const Chip& r) const
Zane Shelleyb406de42019-09-09 16:10:38 -050056 {
Zane Shelley83da2452019-10-25 15:45:34 -050057 return (iv_chip < r.iv_chip) ||
58 ((iv_chip == r.iv_chip) && (iv_type < r.iv_type));
Zane Shelleyb406de42019-09-09 16:10:38 -050059 }
60
61 private:
Zane Shelleyb406de42019-09-09 16:10:38 -050062 /**
63 * The user application will provide pointers to user application objects
64 * that represent chips targeted for analysis. The isolator does not know
65 * anything about these objects nor how to use them. The pointers' only
66 * purpose is to eventually get passed back to the user application with
67 * information associated with each chip.
68 */
Zane Shelley8c093d82020-05-04 22:06:52 -050069 const void* iv_chip;
Zane Shelleyb406de42019-09-09 16:10:38 -050070
71 /**
72 * When doing analysis on a chip, the isolator will need to know the chip
73 * type in order to look up the correct information from the Chip Data
74 * Files.
75 */
Zane Shelley8c093d82020-05-04 22:06:52 -050076 ChipType_t iv_type;
Zane Shelleyb406de42019-09-09 16:10:38 -050077
78}; // end class Chip
79
80} // end namespace libhei