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 | /** |
| 16 | * @brief Constructor. |
| 17 | * @param i_chip See description for iv_chip. |
| 18 | * @param i_type See description for iv_type. |
| 19 | */ |
Zane Shelley | 11b8994 | 2019-11-07 11:07:28 -0600 | [diff] [blame] | 20 | Chip(const void* i_chip, ChipType_t i_type) : |
| 21 | iv_chip(i_chip), iv_type(i_type) |
| 22 | {} |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 23 | |
Zane Shelley | 8c093d8 | 2020-05-04 22:06:52 -0500 | [diff] [blame] | 24 | ~Chip() = default; |
| 25 | |
| 26 | Chip(const Chip&) = default; |
| 27 | |
| 28 | Chip& operator=(const Chip&) = default; |
| 29 | |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 30 | public: // Accessors |
Zane Shelley | 11b8994 | 2019-11-07 11:07:28 -0600 | [diff] [blame] | 31 | const void* getChip() const |
Zane Shelley | 7f7a42d | 2019-10-28 13:28:31 -0500 | [diff] [blame] | 32 | { |
| 33 | return iv_chip; |
| 34 | } |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 35 | |
Zane Shelley | 7f7a42d | 2019-10-28 13:28:31 -0500 | [diff] [blame] | 36 | ChipType_t getType() const |
| 37 | { |
| 38 | return iv_type; |
| 39 | } |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 40 | |
| 41 | public: // Operators |
Zane Shelley | fe27b65 | 2019-10-28 11:33:07 -0500 | [diff] [blame] | 42 | bool operator==(const Chip& r) const |
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 | return (iv_chip == r.iv_chip) && (iv_type == r.iv_type); |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 45 | } |
| 46 | |
Zane Shelley | fe27b65 | 2019-10-28 11:33:07 -0500 | [diff] [blame] | 47 | bool operator<(const Chip& r) const |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 48 | { |
Zane Shelley | 83da245 | 2019-10-25 15:45:34 -0500 | [diff] [blame] | 49 | return (iv_chip < r.iv_chip) || |
| 50 | ((iv_chip == r.iv_chip) && (iv_type < r.iv_type)); |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | private: |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 54 | /** |
| 55 | * The user application will provide pointers to user application objects |
| 56 | * that represent chips targeted for analysis. The isolator does not know |
| 57 | * anything about these objects nor how to use them. The pointers' only |
| 58 | * purpose is to eventually get passed back to the user application with |
| 59 | * information associated with each chip. |
| 60 | */ |
Zane Shelley | 8c093d8 | 2020-05-04 22:06:52 -0500 | [diff] [blame] | 61 | const void* iv_chip; |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 62 | |
| 63 | /** |
| 64 | * When doing analysis on a chip, the isolator will need to know the chip |
| 65 | * type in order to look up the correct information from the Chip Data |
| 66 | * Files. |
| 67 | */ |
Zane Shelley | 8c093d8 | 2020-05-04 22:06:52 -0500 | [diff] [blame] | 68 | ChipType_t iv_type; |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 69 | |
| 70 | }; // end class Chip |
| 71 | |
| 72 | } // end namespace libhei |