Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / examples / APG / Naming / Thermometer.h
blob2c4c4a0233b8c863bb5990606a405c314816e7f9
1 /* -*- C++ -*- */
2 #ifndef THERMOMETER_H
3 #define THERMOMETER_H
5 #include "ace/OS_NS_stdlib.h"
6 #include "ace/Log_Msg.h"
8 class Thermometer
10 public:
11 Thermometer (const char *addr)
12 : addr_(addr), threshold_(5)
13 { }
15 float temperature ()
17 int success = ACE_OS::rand () % 10;
18 if (success < this->threshold_)
20 this->threshold_ = 7;
21 return -1.0;
24 this->threshold_ = 3;
25 int itemp = 80 + ACE_OS::rand () % 10; // 80 <= t <= 90
26 return (float)itemp;
29 const char *address ()
31 return this->addr_;
34 void reset ()
36 this->threshold_ = 4;
37 ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Resetting thermometer %C\n"),
38 this->address ()));
41 private:
42 const char *addr_;
43 int threshold_;
46 #endif /* THERMOMETER_H */