client.cpp

来自「一套Orbacus4.X下有关Corba的学习例程」· C++ 代码 · 共 103 行

CPP
103
字号
#include <OB/CORBA.h>#include <assert.h>#if defined(HAVE_STD_IOSTREAM)using namespace std;#endif#include    "CCS.h"//----------------------------------------------------------------// Show the details for a thermometer or thermostat.static ostream &operator<<(ostream & os, CCS::Thermometer_ptr t){    // MISSING, step 2    return os;}//----------------------------------------------------------------// Show the information in a BtData struct.static ostream &operator<<(ostream & os, const CCS::Thermostat::BtData & btd){    // MISSING, step 5    return os;}//----------------------------------------------------------------// Loop over the sequence of records in an EChange exception and// show the details of each record.static ostream &operator<<(ostream & os, const CCS::Controller::EChange & ec){    // MISSING, step 10    return os;}//----------------------------------------------------------------intmain(int argc, char * argv[]){    int status = 0;    CORBA::ORB_var orb;    try {        // Initialize ORB and check arguments.        orb = CORBA::ORB_init(argc, argv);        if (argc != 3) {            cerr << "Usage: client IOR IOR" << endl;            throw 0;        }        // Get thermostat reference from argv[1]        // and convert to object.        // MISSING, step 1        // Show details of thermostat        // MISSING, step 3        // Change the temperature of the thermostat to a valid        // temperature.        // MISSING, step 4                // Change the temperature to an illegal value and         // show the details of the exception that is thrown.        // MISSING, step 6        // MISSING, step 7        // Get list of devices        // MISSING, step 8                    // MISSING, step 9                // MISSING, step 11    }    catch (const CORBA::Exception& ex) {        cerr << "Uncaught CORBA exception: " << ex << endl;        status = 1;    } catch (...) {        status = 1;    }    if (!CORBA::is_nil(orb)) {        try {            orb -> destroy();        } catch (const CORBA::Exception& ex) {            cerr << ex << endl;            status = 1;        }    }        return status;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?