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. |
| 15 | |
| 16 | Chip() = default; |
| 17 | |
| 18 | ~Chip() = default; |
| 19 | |
| 20 | Chip( const Chip & ) = default; |
| 21 | |
| 22 | Chip & operator=( const Chip & ) = default; |
| 23 | |
| 24 | /** |
| 25 | * @brief Constructor. |
| 26 | * @param i_chip See description for iv_chip. |
| 27 | * @param i_type See description for iv_type. |
| 28 | */ |
| 29 | Chip( void * i_chip, ChipType_t i_type ) : |
| 30 | iv_chip(i_chip), iv_type(i_type) |
| 31 | {} |
| 32 | |
| 33 | public: // Accessors |
| 34 | |
| 35 | void * getChip() const { return iv_chip; } |
| 36 | |
| 37 | ChipType_t getType() const { return iv_type; } |
| 38 | |
| 39 | public: // Operators |
| 40 | |
| 41 | bool operator==( const Chip & r ) const |
| 42 | { |
| 43 | return (iv_chip == r.iv_chip) && |
| 44 | (iv_type == r.iv_type); |
| 45 | } |
| 46 | |
| 47 | bool operator<( const Chip & r ) const |
| 48 | { |
| 49 | return ( iv_chip < r.iv_chip ) || |
| 50 | ( (iv_chip == r.iv_chip) && |
| 51 | (iv_type < r.iv_type) ); |
| 52 | } |
| 53 | |
| 54 | private: |
| 55 | |
| 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 | */ |
| 63 | void * iv_chip = nullptr; |
| 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 | */ |
| 70 | ChipType_t iv_type = DEFAULT_CHIP_TYPE; |
| 71 | |
| 72 | }; // end class Chip |
| 73 | |
| 74 | } // end namespace libhei |
| 75 | |