Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > Visual C++
|
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 25th, 2004, 10:49 AM
Registered User
 
Join Date: Oct 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mclavo Send a message via Yahoo to mclavo
Default 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);







Similar Threads
Thread Thread Starter Forum Replies Last Post
Enums VS Structs MoDulus Intro Programming 4 January 19th, 2012 10:42 AM
arrays of structs seymour_glass C# 2 April 2nd, 2007 08:14 PM
SizeOf Structs CDMBR C# 1 February 21st, 2007 06:24 PM
Read IE Data arindambarman .NET Framework 1.x 0 April 6th, 2006 04:45 AM
declaring structs scoobie C++ Programming 3 April 6th, 2006 12:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.