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 | Chip() = default; |
| 16 | |
| 17 | ~Chip() = default; |
| 18 | |
Zane Shelley | fe27b65 | 2019-10-28 11:33:07 -0500 | [diff] [blame] | 19 | Chip(const Chip&) = default; |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 20 | |
Zane Shelley | fe27b65 | 2019-10-28 11:33:07 -0500 | [diff] [blame] | 21 | Chip& operator=(const Chip&) = default; |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 22 | |
| 23 | /** |
| 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 | |
| 32 | public: // Accessors |
Zane Shelley | 11b8994 | 2019-11-07 11:07:28 -0600 | [diff] [blame] | 33 | const void* getChip() const |
Zane Shelley | 7f7a42d | 2019-10-28 13:28:31 -0500 | [diff] [blame] | 34 | { |
| 35 | return iv_chip; |
| 36 | } |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 37 | |
Zane Shelley | 7f7a42d | 2019-10-28 13:28:31 -0500 | [diff] [blame] | 38 | ChipType_t getType() const |
| 39 | { |
| 40 | return iv_type; |
| 41 | } |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 42 | |
| 43 | public: // Operators |
Zane Shelley | fe27b65 | 2019-10-28 11:33:07 -0500 | [diff] [blame] | 44 | bool operator==(const Chip& r) const |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 45 | { |
Zane Shelley | 7f7a42d | 2019-10-28 13:28:31 -0500 | [diff] [blame] | 46 | return (iv_chip == r.iv_chip) && (iv_type == r.iv_type); |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 47 | } |
| 48 | |
Zane Shelley | fe27b65 | 2019-10-28 11:33:07 -0500 | [diff] [blame] | 49 | bool operator<(const Chip& r) const |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 50 | { |
Zane Shelley | 83da245 | 2019-10-25 15:45:34 -0500 | [diff] [blame] | 51 | return (iv_chip < r.iv_chip) || |
| 52 | ((iv_chip == r.iv_chip) && (iv_type < r.iv_type)); |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | private: |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 56 | /** |
| 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 Shelley | 11b8994 | 2019-11-07 11:07:28 -0600 | [diff] [blame] | 63 | const void* iv_chip = nullptr; |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 64 | |
| 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 Shelley | 0d4f562 | 2019-10-14 13:02:30 -0500 | [diff] [blame] | 70 | ChipType_t iv_type = CHIP_TYPE_INVALID; |
Zane Shelley | b406de4 | 2019-09-09 16:10:38 -0500 | [diff] [blame] | 71 | |
| 72 | }; // end class Chip |
| 73 | |
| 74 | } // end namespace libhei |