structs - read in from data.
Hello,
I don't know if you still assist in help but hopefully you do. Below I have a snippet of code in C++ thats an API, a .h file and well I am new to this and I was told to "read in from data". From what I have below, I have 2 structs and 2 calls at the end. Can you help me out as to how I would fill in data with the information given below. I hope I have not confused you. But in any case I would greatly appreciate a response to this question. Thank you anyone for your assistance and patience.
I also have an attached file to it.
Sincerely,
Marcos Clavo
p.s.
here is the data, and below the data is the code.
code(1111, 1155, 1221, 1266, 1332, 1377, 1443, 1488, 1511, 1555, 1621, 1666, 1732, 1777, 1782, 1788)
frequency(A, B, C, D, E, F, G, H, J, K, L, M, N, P, Q, R)
//---------code begins-----------------
// Information about a laser code
// range read in from the MPS
struct LaserCodeRange_t
{
// Lower bound of code range
unsigned lowerCode;
// Upper bound of code range
unsigned upperCode;
// Status string displayed next to
// the range on the display
std::string status;
LaserCodeRange_t() : lowerCode(0), upperCode(0) {}
LaserCodeRange_t(
unsigned lowerBound,
unsigned upperBound,
const std::string& rangeStatus) :
lowerCode(lowerBound),
upperCode(upperBound),
status(rangeStatus) {}
};
// Container type for laser code
// ranges
typedef std::vector<LaserCodeRange_t> LaserCodeRangeCont_t;
// Information about a particular
// laser code
struct LaserCode_t
{
unsigned frequency;
bool LRFDAvailability;
bool LSTAvailability;
LaserCode_t() :
frequency(0),
LRFDAvailability(true),
LSTAvailability(true) {}
LaserCode_t(unsigned freq,
bool LRFDAvail,
bool LSTAvail) :
frequency(freq),
LRFDAvailability(LRFDAvail),
LSTAvailability(LSTAvail) {}
};
// Container type for laser codes
typedef std::map<char, LaserCode_t> LaserCodeCont_t;
//------------------------
//------------------------
void AddLaserCodeRange(
unsigned lowerCode,
unsigned upperCode,
const std::string& status = "");
void SetLaserCode(
char code,
unsigned frequency,
bool LRFDAvailability,
bool LSTAvailability);
//-------------------------------------------------------------------
std::istream& operator>>(std::istream& instr, AH64_WPN::LaserChannel_t& m);
//-------------------------------------------------------------------
std::ostream& operator<<(std::ostream& outstr, AH64_WPN::LaserChannel_t m);
|