⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 thermometer.h

📁 ACE源码
💻 H
字号:
/* -*- C++ -*- */
// Thermometer.h,v 1.2 2004/01/01 23:03:38 shuston Exp

#ifndef THERMOMETER_H
#define THERMOMETER_H

#include "ace/OS_NS_stdlib.h"
#include "ace/Log_Msg.h"

class Thermometer
{
public:
  Thermometer (const char *addr)
    : addr_(addr), threshold_(5)
  { }

  float temperature (void)
  {
    int success = ACE_OS::rand () % 10;
    if (success < this->threshold_)
      {
        this->threshold_ = 7;
        return -1.0;
      }

    this->threshold_ = 3;
    int itemp = 80 + ACE_OS::rand () % 10; // 80 <= t <= 90
    return (float)itemp;
  }

  const char *address (void)
  {
    return this->addr_;
  }

  void reset (void)
  {
    this->threshold_ = 4;
    ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Resetting thermometer %C\n"),
                this->address ()));
  }

private:
  const char *addr_;
  int threshold_;
};

#endif /* THERMOMETER_H */

⌨️ 快捷键说明

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