Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <hei_types.hpp> |
| 4 | |
| 5 | namespace 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 | */ |
| 12 | class Chip |
| 13 | { |
| 14 | public: // Constructors, destructors, assignment, etc. |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 15 | /** |
Zane Shelley | 8453353 | 2020-06-11 15:20:50 -0500 | [diff] [blame] | 16 | * @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 Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 24 | * @brief Constructor. |
| 25 | * @param i_chip See description for iv_chip. |
| 26 | * @param i_type See description for iv_type. |
| 27 | */ |
Zane Shelley | 11b8994 | 2019-11-07 11:07:28 -0600 | [diff] [blame] | 28 | Chip(const void* i_chip, ChipType_t i_type) : |
| 29 | iv_chip(i_chip), iv_type(i_type) |
| 30 | {} |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 31 | |
Zane Shelley | 8c093d8 | 2020-05-04 22:06:52 -0500 | [diff] [blame] | 32 | ~Chip() = default; |
| 33 | |
| 34 | Chip(const Chip&) = default; |
| 35 | |
| 36 | Chip& operator=(const Chip&) = default; |
| 37 | |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 38 | public: // Accessors |
Zane Shelley | 11b8994 | 2019-11-07 11:07:28 -0600 | [diff] [blame] | 39 | const void* getChip() const |
Zane Shelley | 7f7a42d | 2019-10-28 13:28:31 -0500 | [diff] [blame] | 40 | { |
| 41 | return iv_chip; |
| 42 | } |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 43 | |
Zane Shelley | 7f7a42d | 2019-10-28 13:28:31 -0500 | [diff] [blame] | 44 | ChipType_t getType() const |
| 45 | { |
| 46 | return iv_type; |
| 47 | } |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 48 | |
| 49 | public: // Operators |
Zane Shelley | fe27b65 | 2019-10-28 11:33:07 -0500 | [diff] [blame] | 50 | bool operator==(const Chip& r) const |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 51 | { |
Zane Shelley | 7f7a42d | 2019-10-28 13:28:31 -0500 | [diff] [blame] | 52 | return (iv_chip == r.iv_chip) && (iv_type == r.iv_type); |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 53 | } |
| 54 | |
Zane Shelley | fe27b65 | 2019-10-28 11:33:07 -0500 | [diff] [blame] | 55 | bool operator<(const Chip& r) const |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 56 | { |
Zane Shelley | 83da245 | 2019-10-25 15:45:34 -0500 | [diff] [blame] | 57 | return (iv_chip < r.iv_chip) || |
| 58 | ((iv_chip == r.iv_chip) && (iv_type < r.iv_type)); |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 59 | } |
| 60 | |
| 61 | private: |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 62 | /** |
| 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 Shelley | 5a78fa8 | 2022-09-16 16:49:58 -0500 | [diff] [blame^] | 69 | const void* iv_chip = nullptr; |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 70 | |
| 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 Shelley | 5a78fa8 | 2022-09-16 16:49:58 -0500 | [diff] [blame^] | 76 | ChipType_t iv_type = 0; |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 77 | |
| 78 | }; // end class Chip |
| 79 | |
| 80 | } // end namespace libhei |