diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2004-01-08 20:30:11 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2004-01-08 20:30:11 +0000 |
commit | b1dbeb6f37b58668a3658b0e3e099007f9c5f9db (patch) | |
tree | 0569f7b266178823125d0abab464b630d12d22dc /TAO/examples | |
parent | d4ea07d90a99893db32f41cbb4a3e42232409d82 (diff) | |
download | ATCD-b1dbeb6f37b58668a3658b0e3e099007f9c5f9db.tar.gz |
ChangeLogTag: Thu Jan 8 20:30:09 UTC 2004 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'TAO/examples')
-rw-r--r-- | TAO/examples/Advanced/ch_8_and_10/icp.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/TAO/examples/Advanced/ch_8_and_10/icp.cpp b/TAO/examples/Advanced/ch_8_and_10/icp.cpp index ffb36aeb8db..f089d99aa2c 100644 --- a/TAO/examples/Advanced/ch_8_and_10/icp.cpp +++ b/TAO/examples/Advanced/ch_8_and_10/icp.cpp @@ -75,7 +75,7 @@ ICP_online(unsigned long id) StateMap::iterator pos = dstate.find(id); if (pos != dstate.end()) return -1; // Already exists - + // Fill in state. DeviceState ds; ds.type = (id % 2) ? thermometer : thermostat; @@ -125,7 +125,7 @@ static short vary_temp(short temp) { - long r = lrand48() % 50; + long r = rand() % 50; long delta; if (r < 5) delta = 3; @@ -135,7 +135,7 @@ vary_temp(short temp) delta = 1; else delta = 0; - if (lrand48() % 2) + if (rand() % 2) delta = -delta; return temp + delta; } @@ -169,7 +169,7 @@ private: // actual_temp() is a helper function to determine the actual // temperature returned by a particular thermometer or thermostat. // The pos argument indicates the device. -// +// // The function locates all thermostats that are in the same room // as the device denoted by pos and computes the average of all // the thermostats' nominal temperatures. (If no thermostats are @@ -288,7 +288,7 @@ ICP_set(unsigned long id, const char * attr, const void * value) (const char *)value, MAXSTR - 1 ); } else if (strcmp(attr, "nominal_temp") == 0) { - if (pos->second.type != thermostat) + if (pos->second.type != thermostat) return -1; // Must be thermostat short temp; memcpy(&temp, value, sizeof(temp)); |