Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Advanced CORBA Programming wit C++ - M. Henning, S. Vinoski.pdf
Скачиваний:
57
Добавлен:
24.05.2014
Размер:
5 Mб
Скачать

IT-SC book: Advanced CORBA® Programming with C++

5.4 The Complete Specification

All that remains is to combine the preceding pieces of IDL into a single specification. As good IDL citizens, we wrap everything in a module called CCS and use a pragma to establish a unique prefix for repository IDs:

#pragma prefix "acme.com"

 

module CCS {

AssetType;

typedef unsigned long

typedef string

ModelType;

typedef short

TempType;

typedef string

LocType;

interface Thermometer {

model;

readonly attribute ModelType

readonly attribute AssetType

asset_num;

readonly attribute TempType

temperature;

attribute LocType

location;

};

 

 

interface Thermostat : Thermometer {

 

struct BtData {

 

TempType

requested;

 

TempType

min_permitted;

 

TempType

max_permitted;

 

string

error_msg;

 

};

 

 

exception BadTemp { BtData details; };

TempType

get_nominal();

 

TempType

set_nominal(in TempType new_temp)

};

raises(BadTemp);

 

 

 

interface Controller {

ThermometerSeq;

typedef sequence<Thermometer>

typedef sequence<Thermostat>

ThermostatSeq;

enum SearchCriterion { ASSET, LOCATION, MODEL }; union KeyType switch(SearchCriterion) {

case ASSET:

AssetType asset_num; case LOCATION:

LocType loc; case MODEL:

ModelType model_desc;

};

struct SearchType { KeyType key; Thermometer device;

};

 

SearchSeq;

typedef sequence<SearchType>

struct ErrorDetails {

tmstat_ref;

Thermostat

Thermostat::BtData

info;

 

};

 

ErrSeq;

typedef sequence<ErrorDetails>

exception EChange {

 

 

ErrSeq errors;

};

129

IT-SC book: Advanced CORBA® Programming with C++

ThermometerSeq

list();

void

find(inout SearchSeq slist);

void

change(

 

in ThermostatSeq tlist, in short delta

 

) raises(EChange);

};

};

130