summaryrefslogtreecommitdiff
path: root/TAO/examples/Advanced/ch_12/CCS.idl
blob: 23f39993b0c820e85fb3f0d861ec7b9a445015c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO/examples/Advanced/ch_12
//
// = FILENAME
//    CCS.idl
//
// = AUTHORS
//   Source code used in TAO has been modified and adapted from the
//   code provided in the book, "Advanced CORBA Programming with C++"
//   by Michi Henning and Steve Vinoski. Copyright
//   1999. Addison-Wesley, Reading, MA.  Used with permission of
//   Addison-Wesley.
//
//   Modified for TAO by Mike Moran <mm4@cs.wustl.edu>
//
// ============================================================================

#pragma prefix "acme.com"

module CCS 
{
  typedef unsigned long AssetType;
  typedef string ModelType;
  typedef short TempType;
  typedef string LocType;

  interface Thermometer 
    {
      readonly attribute ModelType model;
      readonly attribute AssetType asset_num;
      readonly attribute TempType temperature;
      attribute LocType location;

      void remove ();
    };

  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 
    {
      exception DuplicateAsset {};

      Thermometer create_thermometer (in AssetType anum,
                                      in LocType loc)
        raises (DuplicateAsset);

      Thermostat  create_thermostat (in AssetType anum,
                                     in LocType loc,
                                     in TempType temp)
        raises (DuplicateAsset, Thermostat::BadTemp);

      typedef sequence<Thermometer> ThermometerSeq;
      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;
      };

      typedef sequence<SearchType> SearchSeq;

      struct ErrorDetails 
      {
        Thermostat tmstat_ref;
        Thermostat::BtData info;
      };
      typedef sequence<ErrorDetails> ErrSeq;

      exception EChange
        {
          ErrSeq  errors;
        };

      ThermometerSeq list ();
      void find (inout SearchSeq slist);
      void change (in ThermostatSeq tlist, in short delta)
        raises (EChange);        
    };
};