summaryrefslogtreecommitdiff
path: root/TAO/examples
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/examples')
-rw-r--r--TAO/examples/AMI/FL_Callback/Progress_i.cpp4
-rw-r--r--TAO/examples/AMI/FL_Callback/Progress_i.h2
-rw-r--r--TAO/examples/AMI/FL_Callback/progress.cpp4
-rw-r--r--TAO/examples/Advanced/ch_12/Advanced_ch_12.mpc34
-rw-r--r--TAO/examples/Advanced/ch_12/client.cpp20
-rw-r--r--TAO/examples/Advanced/ch_12/icp.cpp36
-rw-r--r--TAO/examples/Advanced/ch_12/icp.h8
-rw-r--r--TAO/examples/Advanced/ch_12/server.cpp5
-rw-r--r--TAO/examples/Advanced/ch_12/server.h2
-rw-r--r--TAO/examples/Advanced/ch_18/Advanced_ch_18.mpc34
-rw-r--r--TAO/examples/Advanced/ch_18/client.cpp27
-rw-r--r--TAO/examples/Advanced/ch_18/icp.cpp38
-rw-r--r--TAO/examples/Advanced/ch_18/icp.h9
-rw-r--r--TAO/examples/Advanced/ch_18/server.cpp9
-rw-r--r--TAO/examples/Advanced/ch_18/server.h3
-rw-r--r--TAO/examples/Advanced/ch_21/Advanced_ch_21.mpc34
-rw-r--r--TAO/examples/Advanced/ch_21/client.cpp17
-rw-r--r--TAO/examples/Advanced/ch_21/icp.cpp30
-rw-r--r--TAO/examples/Advanced/ch_21/icp.h10
-rw-r--r--TAO/examples/Advanced/ch_21/server.cpp9
-rw-r--r--TAO/examples/Advanced/ch_21/server.h7
-rw-r--r--TAO/examples/Advanced/ch_8_and_10/Advanced_ch_8_and_10.mpc17
-rw-r--r--TAO/examples/Advanced/ch_8_and_10/client.cpp51
-rw-r--r--TAO/examples/Advanced/ch_8_and_10/icp.cpp30
-rw-r--r--TAO/examples/Advanced/ch_8_and_10/icp.h2
-rw-r--r--TAO/examples/Advanced/ch_8_and_10/server.cpp2
-rw-r--r--TAO/examples/Simple/Simple_util.cpp2
27 files changed, 262 insertions, 184 deletions
diff --git a/TAO/examples/AMI/FL_Callback/Progress_i.cpp b/TAO/examples/AMI/FL_Callback/Progress_i.cpp
index d998c68fc29..d0994ce93b7 100644
--- a/TAO/examples/AMI/FL_Callback/Progress_i.cpp
+++ b/TAO/examples/AMI/FL_Callback/Progress_i.cpp
@@ -2,8 +2,8 @@
#include "Progress_i.h"
-#include <FL/Fl_Slider.h>
-#include <FL/Fl_Button.h>
+#include <FL/Fl_Slider.H>
+#include <FL/Fl_Button.H>
ACE_RCSID (FL_Cube,
test_i,
diff --git a/TAO/examples/AMI/FL_Callback/Progress_i.h b/TAO/examples/AMI/FL_Callback/Progress_i.h
index 7d9c8fbe9ee..1b17a0b95d5 100644
--- a/TAO/examples/AMI/FL_Callback/Progress_i.h
+++ b/TAO/examples/AMI/FL_Callback/Progress_i.h
@@ -18,7 +18,7 @@
#include "testS.h"
-#include <FL/Fl_Box.h>
+#include <FL/Fl_Box.H>
class Progress_Window : public Fl_Box
{
diff --git a/TAO/examples/AMI/FL_Callback/progress.cpp b/TAO/examples/AMI/FL_Callback/progress.cpp
index 34c6eb68dd1..a1363e7a56d 100644
--- a/TAO/examples/AMI/FL_Callback/progress.cpp
+++ b/TAO/examples/AMI/FL_Callback/progress.cpp
@@ -9,8 +9,8 @@ ACE_RCSID (FL_Callback,
progress,
"$Id$")
-#include <FL/Fl.h>
-#include <FL/Fl_Window.h>
+#include <FL/Fl.H>
+#include <FL/Fl_Window.H>
const ACE_TCHAR *ior_output_file = ACE_TEXT("progress.ior");
int n_iterations = 1000;
diff --git a/TAO/examples/Advanced/ch_12/Advanced_ch_12.mpc b/TAO/examples/Advanced/ch_12/Advanced_ch_12.mpc
new file mode 100644
index 00000000000..468c4508383
--- /dev/null
+++ b/TAO/examples/Advanced/ch_12/Advanced_ch_12.mpc
@@ -0,0 +1,34 @@
+// -*- MPC -*-
+// $Id$
+
+project(*idl) : taoclient {
+ IDL_Files {
+ CCS.idl
+ }
+ custom_only = 1
+}
+
+project(*client) : taoclient {
+ after += *idl
+ source_files {
+ client.cpp
+ CCSC.cpp
+ }
+ IDL_Files {
+ }
+}
+
+project(*server) : taoserver {
+ requires += dummy_label
+ after += *idl
+ source_files {
+ server.cpp
+ icp.cpp
+ CCSC.cpp
+ CCSS.cpp
+ }
+ IDL_Files {
+ }
+}
+
+
diff --git a/TAO/examples/Advanced/ch_12/client.cpp b/TAO/examples/Advanced/ch_12/client.cpp
index 0dab785902d..d6e85f69ef8 100644
--- a/TAO/examples/Advanced/ch_12/client.cpp
+++ b/TAO/examples/Advanced/ch_12/client.cpp
@@ -19,12 +19,8 @@
//
// ============================================================================
-#include "CCSC.h" // ORB-specific
-
-// The following headers are #included automatically by ACE+TAO.
-// Therefore, they don't need to be included explicitly.
-#include <iostream>
-// #include <fstream.h>
+#include "CCSC.h" // ORB-specific
+#include <ace/streams.h>
using namespace std;
@@ -169,7 +165,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
catch (const CORBA::SystemException &se)
{
std::cerr << "Cannot narrow controller reference: "
- //<< se
+ << se
<< std::endl;
throw 0;
}
@@ -205,7 +201,10 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
// Show details for each device.
for ( i = 0; i < list->length (); i++)
- std::cout << list[i];
+ {
+ CCS::Thermometer_ptr ti = list[i];
+ std::cout << ti;
+ }
std::cout << std::endl;
@@ -217,7 +216,8 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
// Check that the location was updated
std::cout << "New details for device "
<< anum << " are:" << std::endl;
- std::cout << list[0u] << std::endl;
+ CCS::Thermometer_ptr tx = list[0u];
+ std::cout << tx << std::endl;
// Find first thermostat in list.
CCS::Thermostat_var tmstat;
@@ -290,7 +290,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
catch (const CORBA::Exception & e)
{
std::cerr << "Uncaught CORBA exception: "
- //<< e
+ << e
<< std::endl;
return 1;
}
diff --git a/TAO/examples/Advanced/ch_12/icp.cpp b/TAO/examples/Advanced/ch_12/icp.cpp
index ed686022691..8b8d4ceaa07 100644
--- a/TAO/examples/Advanced/ch_12/icp.cpp
+++ b/TAO/examples/Advanced/ch_12/icp.cpp
@@ -45,9 +45,9 @@ typedef map<unsigned long, DeviceState> StateMap;
const size_t MAXSTR = 32; // Max len of string including NUL
-const short MIN_TEMP = 40; // 40 F == 4.44 C
-const short MAX_TEMP = 90; // 90 F == 32.22 C
-const short DFLT_TEMP = 68; // 68 F == 20.00 C
+const long MIN_TEMP = 40; // 40 F == 4.44 C
+const long MAX_TEMP = 90; // 90 F == 32.22 C
+const long DFLT_TEMP = 68; // 68 F == 20.00 C
static StateMap dstate; // Map of known devices
@@ -118,15 +118,10 @@ ICP_offline (unsigned long id)
// exact temperature: 40%
static
-short
-vary_temp (short temp)
+long
+vary_temp (long temp)
{
- #if defined (__BORLANDC__) || defined (_MSC_VER)
- long r = ACE_OS::rand() % 50;
- #else
- long r = lrand48() % 50;
- #endif
-
+ long r = ACE_OS::rand() % 50;
long delta;
if (r < 5)
delta = 3;
@@ -137,12 +132,7 @@ vary_temp (short temp)
else
delta = 0;
- #if defined (__BORLANDC__) || defined (_MSC_VER)
- if (ACE_OS::rand() % 2)
- #else
- if (lrand48() % 2)
- #endif
-
+ if (ACE_OS::rand() % 2)
delta = -delta;
return temp + delta;
@@ -179,7 +169,7 @@ private:
// determined by vary_temp ().
static
-short
+long
actual_temp (const StateMap::iterator & pos)
{
long sum = 0;
@@ -245,20 +235,20 @@ ICP_get (unsigned long id,
if (pos->second.type != thermostat)
return -1; // Must be thermostat
ACE_OS::memcpy (value, &pos->second.nominal_temp,
- std::min (len, sizeof (pos->second.nominal_temp)));
+ ace_min (len, sizeof (pos->second.nominal_temp)));
}
else if (ACE_OS::strcmp (attr, "temperature") == 0)
{
- short temp = actual_temp (pos);
- ACE_OS::memcpy (value, &temp, std::min (len, sizeof (temp)));
+ long temp = actual_temp (pos);
+ ACE_OS::memcpy (value, &temp, ace_min (len, sizeof (temp)));
}
else if (ACE_OS::strcmp (attr, "MIN_TEMP") == 0)
{
- ACE_OS::memcpy (value, &MIN_TEMP, std::min (len, sizeof (MIN_TEMP)));
+ ACE_OS::memcpy (value, &MIN_TEMP, ace_min (len, sizeof (MIN_TEMP)));
}
else if (ACE_OS::strcmp (attr, "MAX_TEMP") == 0)
{
- ACE_OS::memcpy (value, &MAX_TEMP, std::min (len, sizeof (MAX_TEMP)));
+ ACE_OS::memcpy (value, &MAX_TEMP, ace_min (len, sizeof (MAX_TEMP)));
}
else
{
diff --git a/TAO/examples/Advanced/ch_12/icp.h b/TAO/examples/Advanced/ch_12/icp.h
index 5029a06803d..fc080d49823 100644
--- a/TAO/examples/Advanced/ch_12/icp.h
+++ b/TAO/examples/Advanced/ch_12/icp.h
@@ -22,7 +22,9 @@
#ifndef _ICP_H
#define _ICP_H
-extern "C"
+#include "ace/OS.h"
+
+extern "C"
{
int ICP_online (unsigned long id); // Add device
int ICP_offline (unsigned long id); // Remove device
@@ -33,11 +35,9 @@ extern "C"
void *value,
size_t len);
// Set attribute
- int ICP_set (unsigned long id,
+ int ICP_set (unsigned long id,
const char *attr,
const void *value);
}
-size_t min(const size_t len1, const size_t len2);
-
#endif /* _ICP_H */
diff --git a/TAO/examples/Advanced/ch_12/server.cpp b/TAO/examples/Advanced/ch_12/server.cpp
index c74036b9b7e..e81977633ce 100644
--- a/TAO/examples/Advanced/ch_12/server.cpp
+++ b/TAO/examples/Advanced/ch_12/server.cpp
@@ -19,8 +19,7 @@
//
// ============================================================================
-#include <iostream>
-#include <fstream>
+#include <ace/streams.h>
#include <strstream>
#include "server.h"
#include <algorithm>
@@ -686,7 +685,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
catch (const CORBA::Exception & e)
{
std::cerr << "Uncaught CORBA exception: "
- //<< e
+ << e
<< std::endl;
return 1;
}
diff --git a/TAO/examples/Advanced/ch_12/server.h b/TAO/examples/Advanced/ch_12/server.h
index 919360f7586..5a5a3729fd2 100644
--- a/TAO/examples/Advanced/ch_12/server.h
+++ b/TAO/examples/Advanced/ch_12/server.h
@@ -27,6 +27,8 @@
#include "assert.h"
#include <map>
#include <list>
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/PortableServer/ServantLocatorC.h"
using namespace std;
diff --git a/TAO/examples/Advanced/ch_18/Advanced_ch_18.mpc b/TAO/examples/Advanced/ch_18/Advanced_ch_18.mpc
new file mode 100644
index 00000000000..c61eb267c20
--- /dev/null
+++ b/TAO/examples/Advanced/ch_18/Advanced_ch_18.mpc
@@ -0,0 +1,34 @@
+// -*- MPC -*-
+// $Id$
+
+project(*idl) : taoclient {
+ IDL_Files {
+ CCS.idl
+ }
+ custom_only = 1
+}
+
+project(*client) : taoclient, naming {
+ after += *idl
+ source_files {
+ client.cpp
+ CCSC.cpp
+ }
+ IDL_Files {
+ }
+}
+
+project(*server) : taoserver, naming, avoids_corba_e_micro, avoids_corba_e_compact {
+ requires += dummy_label
+ after += *idl
+ source_files {
+ server.cpp
+ icp.cpp
+ CCSC.cpp
+ CCSS.cpp
+ }
+ IDL_Files {
+ }
+}
+
+
diff --git a/TAO/examples/Advanced/ch_18/client.cpp b/TAO/examples/Advanced/ch_18/client.cpp
index 1d0b8d50ecf..2b85967e1bc 100644
--- a/TAO/examples/Advanced/ch_18/client.cpp
+++ b/TAO/examples/Advanced/ch_18/client.cpp
@@ -17,11 +17,10 @@
//
// ============================================================================
-#include "CCSC.h" // ORB-specific
-#include "assert.h"
-#include <orbsvcs/CosNamingC.h>
-#include <iostream>
-// #include <fstream.h>
+#include "CCSC.h" // ORB-specific
+#include "assert.h"
+#include <orbsvcs/CosNamingC.h>
+#include <ace/streams.h>
// ----------------------------------------------------------------
using namespace std;
@@ -40,7 +39,7 @@ resolve_init(CORBA::ORB_ptr orb, const char * id)
catch (const CORBA::Exception & e) {
std::cerr << "Cannot get initial reference for "
<< id << ": "
- //<< e
+ << e
<< std::endl;
throw 0;
}
@@ -53,7 +52,7 @@ resolve_init(CORBA::ORB_ptr orb, const char * id)
catch (const CORBA::Exception & e) {
std::cerr << "Cannot narrow reference for "
<< id << ": "
- //<< e
+ << e
<< std::endl;
throw 0;
}
@@ -82,7 +81,7 @@ resolve_name(
}
catch (const CORBA::Exception & e) {
std::cerr << "Cannot resolve binding: "
- //<< e
+ << e
<< std::endl;
throw 0;
}
@@ -97,7 +96,7 @@ resolve_name(
}
catch (const CORBA::Exception & e) {
std::cerr << "Cannot narrow reference: "
- //<< e
+ << e
<< std::endl;
throw 0;
}
@@ -280,7 +279,10 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
list = ctrl->list();
// Show details for each device.
for ( i = 0; i < list->length(); i++)
- std::cout << list[i];
+ {
+ CCS::Thermometer_ptr ti = list[i];
+ std::cout << ti;
+ }
std::cout << std::endl;
// Change the location of first device in the list
@@ -291,7 +293,8 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
// Check that the location was updated
std::cout << "New details for device "
<< anum << " are:" << std::endl;
- std::cout << list[0u] << std::endl;
+ CCS::Thermometer_ptr tx = list[0u];
+ std::cout << tx << std::endl;
// Find first thermostat in list.
CCS::Thermostat_var tmstat;
@@ -352,7 +355,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
}
} catch (const CORBA::Exception & e) {
std::cerr << "Uncaught CORBA exception: "
- //<< e
+ << e
<< std::endl;
return 1;
} catch (...) {
diff --git a/TAO/examples/Advanced/ch_18/icp.cpp b/TAO/examples/Advanced/ch_18/icp.cpp
index a6fc657329c..e8eb768bb3b 100644
--- a/TAO/examples/Advanced/ch_18/icp.cpp
+++ b/TAO/examples/Advanced/ch_18/icp.cpp
@@ -45,9 +45,9 @@ typedef map<unsigned long, DeviceState> StateMap;
const size_t MAXSTR = 32; // Max len of string including NUL
-const short MIN_TEMP = 40; // 40 F == 4.44 C
-const short MAX_TEMP = 90; // 90 F == 32.22 C
-const short DFLT_TEMP = 68; // 68 F == 20.00 C
+const long MIN_TEMP = 40; // 40 F == 4.44 C
+const long MAX_TEMP = 90; // 90 F == 32.22 C
+const long DFLT_TEMP = 68; // 68 F == 20.00 C
static StateMap dstate; // Map of known devices
@@ -123,15 +123,10 @@ ICP_offline(unsigned long id)
// exact temperature: 40%
static
-short
-vary_temp(short temp)
+long
+vary_temp(long temp)
{
- #if defined (__BORLANDC__) || defined (_MSC_VER)
- long r = ACE_OS::rand() % 50;
- #else
- long r = lrand48() % 50;
- #endif
-
+ long r = ACE_OS::rand() % 50;
long delta;
if (r < 5)
delta = 3;
@@ -142,13 +137,8 @@ vary_temp(short temp)
else
delta = 0;
- #if defined (__BORLANDC__) || defined (_MSC_VER)
- if (ACE_OS::rand() % 2)
- #else
- if (lrand48() % 2)
- #endif
-
- delta = -delta;
+ if (ACE_OS::rand() % 2)
+ delta = -delta;
return temp + delta;
}
@@ -193,7 +183,7 @@ private:
// determined by vary_temp().
static
-short
+long
actual_temp(const StateMap::iterator & pos)
{
long sum = 0;
@@ -260,15 +250,15 @@ ICP_get(
return -1; // Must be thermostat
ACE_OS::memcpy(
value, &pos->second.nominal_temp,
- std::min(len, sizeof(pos->second.nominal_temp))
+ ace_min(len, sizeof(pos->second.nominal_temp))
);
} else if (ACE_OS::strcmp(attr, "temperature") == 0) {
- short temp = actual_temp(pos);
- ACE_OS::memcpy(value, &temp, std::min(len, sizeof(temp)));
+ long temp = actual_temp(pos);
+ ACE_OS::memcpy(value, &temp, ace_min(len, sizeof(temp)));
} else if (ACE_OS::strcmp(attr, "MIN_TEMP") == 0) {
- ACE_OS::memcpy(value, &MIN_TEMP, std::min(len, sizeof(MIN_TEMP)));
+ ACE_OS::memcpy(value, &MIN_TEMP, ace_min(len, sizeof(MIN_TEMP)));
} else if (ACE_OS::strcmp(attr, "MAX_TEMP") == 0) {
- ACE_OS::memcpy(value, &MAX_TEMP, std::min(len, sizeof(MAX_TEMP)));
+ ACE_OS::memcpy(value, &MAX_TEMP, ace_min(len, sizeof(MAX_TEMP)));
} else {
return -1; // No such attribute
}
diff --git a/TAO/examples/Advanced/ch_18/icp.h b/TAO/examples/Advanced/ch_18/icp.h
index 69c2dab85f1..fb2d9d182de 100644
--- a/TAO/examples/Advanced/ch_18/icp.h
+++ b/TAO/examples/Advanced/ch_18/icp.h
@@ -17,12 +17,11 @@
//
// ============================================================================
-
-
-
#ifndef _ICP_H
#define _ICP_H
+#include "ace/OS.h"
+
extern "C" {
int ICP_online(unsigned long id); // Add device
int ICP_offline(unsigned long id); // Remove device
@@ -33,12 +32,10 @@ extern "C" {
size_t len
);
int ICP_set( // Set attribute
- unsigned long id,
+ unsigned long id,
const char * attr,
const void * value
);
}
-size_t min(const size_t len1, const size_t len2);
-
#endif /* _ICP_H */
diff --git a/TAO/examples/Advanced/ch_18/server.cpp b/TAO/examples/Advanced/ch_18/server.cpp
index 67e743bcddd..d61fa852c25 100644
--- a/TAO/examples/Advanced/ch_18/server.cpp
+++ b/TAO/examples/Advanced/ch_18/server.cpp
@@ -19,8 +19,7 @@
//
// ============================================================================
-#include <iostream>
-#include <fstream>
+#include <ace/streams.h>
#include <strstream>
#include "server.h"
#include <algorithm>
@@ -46,7 +45,7 @@ resolve_init (CORBA::ORB_ptr orb, const char * id)
catch (const CORBA::Exception & e) {
std::cerr << "Cannot get initial reference for "
<< id << ": "
- //<< e
+ << e
<< std::endl;
throw 0;
}
@@ -59,7 +58,7 @@ resolve_init (CORBA::ORB_ptr orb, const char * id)
catch (const CORBA::Exception & e) {
std::cerr << "Cannot narrow reference for "
<< id << ": "
- //<< e
+ << e
<< std::endl;
throw 0;
}
@@ -761,7 +760,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
}
catch (const CORBA::Exception & e) {
std::cerr << "Uncaught CORBA exception: "
- //<< e
+ << e
<< std::endl;
return 1;
}
diff --git a/TAO/examples/Advanced/ch_18/server.h b/TAO/examples/Advanced/ch_18/server.h
index 0e03514c0a7..fc6f1680259 100644
--- a/TAO/examples/Advanced/ch_18/server.h
+++ b/TAO/examples/Advanced/ch_18/server.h
@@ -28,7 +28,8 @@
#include <map>
#include <list>
#include <assert.h>
-//#include <corba/poaS.h>
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/PortableServer/ServantLocatorC.h"
using namespace std;
diff --git a/TAO/examples/Advanced/ch_21/Advanced_ch_21.mpc b/TAO/examples/Advanced/ch_21/Advanced_ch_21.mpc
new file mode 100644
index 00000000000..740dcb48c2f
--- /dev/null
+++ b/TAO/examples/Advanced/ch_21/Advanced_ch_21.mpc
@@ -0,0 +1,34 @@
+// -*- MPC -*-
+// $Id$
+
+project(*idl) : taoclient {
+ IDL_Files {
+ CCS.idl
+ }
+ custom_only = 1
+}
+
+project(*client) : taoclient, avoids_corba_e_micro, avoids_corba_e_compact {
+ after += *idl
+ source_files {
+ client.cpp
+ CCSC.cpp
+ }
+ IDL_Files {
+ }
+}
+
+project(*server) : taoserver, avoids_corba_e_micro, avoids_corba_e_compact {
+ requires += dummy_label
+ after += *idl
+ source_files {
+ server.cpp
+ icp.cpp
+ CCSC.cpp
+ CCSS.cpp
+ }
+ IDL_Files {
+ }
+}
+
+
diff --git a/TAO/examples/Advanced/ch_21/client.cpp b/TAO/examples/Advanced/ch_21/client.cpp
index 0c5b00344a3..0a45d6ed64e 100644
--- a/TAO/examples/Advanced/ch_21/client.cpp
+++ b/TAO/examples/Advanced/ch_21/client.cpp
@@ -18,9 +18,8 @@
//
// ============================================================================
-#include "CCSC.h" // ORB-specific
-#include <iostream>
-// #include <fstream.h>
+#include "CCSC.h" // ORB-specific
+#include <ace/streams.h>
using namespace std;
@@ -166,7 +165,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
ctrl = CCS::Controller::_narrow(obj.in());
} catch (const CORBA::SystemException &se) {
std::cerr << "Cannot narrow controller reference: "
- //<< se
+ << se
<< std::endl;
throw 0;
}
@@ -199,7 +198,10 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
list = ctrl->list();
// Show details for each device.
for ( i = 0; i < list->length(); i++)
- std::cout << list[i];
+ {
+ CCS::Thermometer_ptr ti = list[i];
+ std::cout << ti;
+ }
std::cout << std::endl;
// Change the location of first device in the list
@@ -210,7 +212,8 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
// Check that the location was updated
std::cout << "New details for device "
<< anum << " are:" << std::endl;
- std::cout << list[0U] << std::endl;
+ CCS::Thermometer_ptr tx = list[0u];
+ std::cout << tx << std::endl;
// Find first thermostat in list.
CCS::Thermostat_var tmstat;
@@ -271,7 +274,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
}
} catch (const CORBA::Exception & e) {
std::cerr << "Uncaught CORBA exception: "
- //<< e
+ << e
<< std::endl;
return 1;
} catch (...) {
diff --git a/TAO/examples/Advanced/ch_21/icp.cpp b/TAO/examples/Advanced/ch_21/icp.cpp
index 3a32948c9b5..4c3bb1c076a 100644
--- a/TAO/examples/Advanced/ch_21/icp.cpp
+++ b/TAO/examples/Advanced/ch_21/icp.cpp
@@ -123,15 +123,10 @@ ICP_offline(unsigned long id)
// exact temperature: 40%
static
-short
-vary_temp(short temp)
+long
+vary_temp(long temp)
{
- #if defined (__BORLANDC__) || defined (_MSC_VER)
- long r = ACE_OS::rand() % 50;
- #else
- long r = lrand48() % 50;
- #endif
-
+ long r = ACE_OS::rand() % 50;
long delta;
if (r < 5)
delta = 3;
@@ -141,12 +136,7 @@ vary_temp(short temp)
delta = 1;
else
delta = 0;
- #if defined (__BORLANDC__) || defined (_MSC_VER)
- if (ACE_OS::rand() % 2)
- #else
- if (lrand48() % 2)
- #endif
-
+ if (ACE_OS::rand() % 2)
delta = -delta;
return temp + delta;
@@ -192,7 +182,7 @@ private:
// determined by vary_temp().
static
-short
+long
actual_temp(const StateMap::iterator & pos)
{
long sum = 0;
@@ -258,15 +248,15 @@ ICP_get(
return -1; // Must be thermostat
ACE_OS::memcpy(
value, &pos->second.nominal_temp,
- std::min(len, sizeof(pos->second.nominal_temp))
+ ace_min(len, sizeof(pos->second.nominal_temp))
);
} else if (ACE_OS::strcmp(attr, "temperature") == 0) {
- short temp = actual_temp(pos);
- ACE_OS::memcpy(value, &temp, std::min(len, sizeof(temp)));
+ long temp = actual_temp(pos);
+ ACE_OS::memcpy(value, &temp, ace_min(len, sizeof(temp)));
} else if (ACE_OS::strcmp(attr, "MIN_TEMP") == 0) {
- ACE_OS::memcpy(value, &MIN_TEMP, std::min(len, sizeof(MIN_TEMP)));
+ ACE_OS::memcpy(value, &MIN_TEMP, ace_min(len, sizeof(MIN_TEMP)));
} else if (ACE_OS::strcmp(attr, "MAX_TEMP") == 0) {
- ACE_OS::memcpy(value, &MAX_TEMP, std::min(len, sizeof(MAX_TEMP)));
+ ACE_OS::memcpy(value, &MAX_TEMP, ace_min(len, sizeof(MAX_TEMP)));
} else {
return -1; // No such attribute
}
diff --git a/TAO/examples/Advanced/ch_21/icp.h b/TAO/examples/Advanced/ch_21/icp.h
index b413a9157df..b93d94193f2 100644
--- a/TAO/examples/Advanced/ch_21/icp.h
+++ b/TAO/examples/Advanced/ch_21/icp.h
@@ -17,13 +17,11 @@
//
// ============================================================================
-
-
-
-
#ifndef _ICP_H
#define _ICP_H
+#include "ace/OS.h"
+
extern "C" {
int ICP_online(unsigned long id); // Add device
int ICP_offline(unsigned long id); // Remove device
@@ -34,14 +32,12 @@ extern "C" {
size_t len
);
int ICP_set( // Set attribute
- unsigned long id,
+ unsigned long id,
const char * attr,
const void * value
);
}
-size_t min(const size_t len1, const size_t len2);
-
#endif /* _ICP_H */
diff --git a/TAO/examples/Advanced/ch_21/server.cpp b/TAO/examples/Advanced/ch_21/server.cpp
index c6f72bf0346..93ab672566a 100644
--- a/TAO/examples/Advanced/ch_21/server.cpp
+++ b/TAO/examples/Advanced/ch_21/server.cpp
@@ -18,8 +18,7 @@
//
// ============================================================================
-#include <iostream>
-#include <fstream>
+#include <ace/streams.h>
#include <strstream>
#include "server.h"
#include <ace/Synch_T.h>
@@ -530,8 +529,8 @@ find (CCS::Controller::SearchSeq & slist)
CCS::Controller::SearchCriterion sc = slist[i].key._d ();
if (sc == CCS::Controller::ASSET) {
// Search for matching asset number.
- bool make = false;
- CCS::AssetType num;
+ bool make = false;
+ CCS::AssetType num = 0;
{
ACE_Guard<ACE_Mutex> guard (m_assets_mutex);
where = m_assets.find (slist[i].key.asset_num ());
@@ -738,7 +737,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
}
catch (const CORBA::Exception & e) {
std::cerr << "Uncaught CORBA exception: "
- //<< e
+ << e
<< std::endl;
return 1;
}
diff --git a/TAO/examples/Advanced/ch_21/server.h b/TAO/examples/Advanced/ch_21/server.h
index c2d94bf18c2..6ddaca5bb97 100644
--- a/TAO/examples/Advanced/ch_21/server.h
+++ b/TAO/examples/Advanced/ch_21/server.h
@@ -30,7 +30,8 @@
#include <list>
#include <map>
#include <assert.h>
-// #include <corba/poaS.h>
+#include "tao/PortableServer/PortableServer.h"
+#include "tao/PortableServer/ServantLocatorC.h"
#include "CCSS.h"
@@ -80,7 +81,7 @@ class Thermostat_impl :
public:
// CORBA operations
virtual CCS::TempType get_nominal();
- virtual CCS::TempType set_nominal(CCS::TempType new_temp));
+ virtual CCS::TempType set_nominal(CCS::TempType new_temp);
// Constructor and destructor
Thermostat_impl(CCS::AssetType anum);
@@ -102,7 +103,7 @@ public:
virtual CCS::Controller::ThermometerSeq* list();
virtual void find(CCS::Controller::SearchSeq & slist);
virtual void change(const CCS::Controller::ThermostatSeq & tlist,
- CORBA::Short delta));
+ CORBA::Short delta);
virtual CCS::Thermometer_ptr create_thermometer(CCS::AssetType anum,
const char* loc);
diff --git a/TAO/examples/Advanced/ch_8_and_10/Advanced_ch_8_and_10.mpc b/TAO/examples/Advanced/ch_8_and_10/Advanced_ch_8_and_10.mpc
index cc64707b833..468c4508383 100644
--- a/TAO/examples/Advanced/ch_8_and_10/Advanced_ch_8_and_10.mpc
+++ b/TAO/examples/Advanced/ch_8_and_10/Advanced_ch_8_and_10.mpc
@@ -1,18 +1,33 @@
// -*- MPC -*-
// $Id$
+project(*idl) : taoclient {
+ IDL_Files {
+ CCS.idl
+ }
+ custom_only = 1
+}
+
project(*client) : taoclient {
- requires += dummy_label
+ after += *idl
source_files {
client.cpp
+ CCSC.cpp
+ }
+ IDL_Files {
}
}
project(*server) : taoserver {
requires += dummy_label
+ after += *idl
source_files {
server.cpp
icp.cpp
+ CCSC.cpp
+ CCSS.cpp
+ }
+ IDL_Files {
}
}
diff --git a/TAO/examples/Advanced/ch_8_and_10/client.cpp b/TAO/examples/Advanced/ch_8_and_10/client.cpp
index 5843c985ac0..8d8203cf140 100644
--- a/TAO/examples/Advanced/ch_8_and_10/client.cpp
+++ b/TAO/examples/Advanced/ch_8_and_10/client.cpp
@@ -118,7 +118,7 @@ set_temp(CCS::Thermostat_ptr tmstat, CCS::TempType new_temp)
return;
CCS::AssetType anum = tmstat->asset_num();
- try
+ try
{
std::cout << "Setting thermostat " << anum
<< " to " << new_temp << " degrees." << std::endl;
@@ -127,8 +127,8 @@ set_temp(CCS::Thermostat_ptr tmstat, CCS::TempType new_temp)
<< old_nominal << std::endl;
std::cout << "New nominal temperature is: "
<< tmstat->get_nominal() << std::endl;
- }
- catch (const CCS::Thermostat::BadTemp & bt)
+ }
+ catch (const CCS::Thermostat::BadTemp & bt)
{
std::cerr << "Setting of nominal temperature failed." << std::endl;
std::cerr << bt.details << std::endl; // Overloaded <<
@@ -140,13 +140,13 @@ set_temp(CCS::Thermostat_ptr tmstat, CCS::TempType new_temp)
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
- try
+ try
{
// Initialize the ORB
CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
// Check arguments
- if (argc != 2)
+ if (argc != 2)
{
std::cerr << "Usage: client IOR_string" << std::endl;
throw 0;
@@ -155,7 +155,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
// Get controller reference from argv
// and convert to object.
CORBA::Object_var obj = orb->string_to_object(argv[1]);
- if (CORBA::is_nil(obj.in()))
+ if (CORBA::is_nil(obj.in()))
{
std::cerr << "Nil controller reference" << std::endl;
throw 0;
@@ -163,18 +163,18 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
// Try to narrow to CCS::Controller.
CCS::Controller_var ctrl;
- try
+ try
{
ctrl = CCS::Controller::_narrow(obj.in());
- }
- catch (const CORBA::SystemException & se)
+ }
+ catch (const CORBA::SystemException & se)
{
std::cerr << "Cannot narrow controller reference: "
- //<< se
+ << se
<< std::endl;
throw 0;
}
- if (CORBA::is_nil(ctrl.in()))
+ if (CORBA::is_nil(ctrl.in()))
{
std::cerr << "Wrong type for controller ref." << std::endl;
throw 0;
@@ -207,23 +207,24 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
// Check that the location was updated
std::cout << "New details for device "
<< anum << " are:" << std::endl;
- std::cout << list[(CORBA::ULong) 0] << std::endl;
+ CCS::Thermometer_ptr tx = list[0u];
+ std::cout << tx << std::endl;
// Find first thermostat in list.
CCS::Thermostat_var tmstat;
for ( CORBA::ULong j = 0;
j < list->length() && CORBA::is_nil(tmstat.in());
- j++)
+ j++)
{
tmstat = CCS::Thermostat::_narrow(list[j]);
}
// Check that we found a thermostat on the list.
- if (CORBA::is_nil(tmstat.in()))
+ if (CORBA::is_nil(tmstat.in()))
{
std::cout << "No thermostat devices in list." << std::endl;
- }
- else
+ }
+ else
{
// Set temperature of thermostat to
// 50 degrees (should work).
@@ -255,7 +256,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
// containing only thermostats.
std::cout << "Increasing thermostats by 40 degrees." << std::endl;
CCS::Controller::ThermostatSeq tss;
- for (CORBA::ULong l = 0; l < list->length(); l++)
+ for (CORBA::ULong l = 0; l < list->length(); l++)
{
tmstat = CCS::Thermostat::_narrow(list[l]);
if (CORBA::is_nil(tmstat.in()))
@@ -266,23 +267,23 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
}
// Try to change all thermostats.
- try
+ try
{
ctrl->change(tss, 40);
- }
- catch (const CCS::Controller::EChange & ec)
+ }
+ catch (const CCS::Controller::EChange & ec)
{
std::cerr << ec; // Overloaded <<
}
- }
- catch (const CORBA::Exception & e)
+ }
+ catch (const CORBA::Exception & e)
{
std::cerr << "Uncaught CORBA exception: "
- //<< e
+ << e
<< std::endl;
return 1;
- }
- catch (...)
+ }
+ catch (...)
{
return 1;
}
diff --git a/TAO/examples/Advanced/ch_8_and_10/icp.cpp b/TAO/examples/Advanced/ch_8_and_10/icp.cpp
index 6ee53cee339..2ccfc38a70e 100644
--- a/TAO/examples/Advanced/ch_8_and_10/icp.cpp
+++ b/TAO/examples/Advanced/ch_8_and_10/icp.cpp
@@ -44,9 +44,9 @@ typedef std::map<unsigned long, DeviceState> StateMap;
const size_t MAXSTR = 32; // Max len of string including NUL
-const short MIN_TEMP = 40; // 40 F == 4.44 C
-const short MAX_TEMP = 90; // 90 F == 32.22 C
-const short DFLT_TEMP = 68; // 68 F == 20.00 C
+const long MIN_TEMP = 40; // 40 F == 4.44 C
+const long MAX_TEMP = 90; // 90 F == 32.22 C
+const long DFLT_TEMP = 68; // 68 F == 20.00 C
static StateMap dstate; // Map of known devices
@@ -122,14 +122,10 @@ ICP_offline(unsigned long id)
// exact temperature: 40%
static
-short
-vary_temp(short temp)
+long
+vary_temp(long temp)
{
-#if defined (__BORLANDC__) || defined (_MSC_VER)
long r = ACE_OS::rand() % 50;
-#else
- long r = lrand48() % 50;
-#endif
long delta;
if (r < 5)
delta = 3;
@@ -139,11 +135,7 @@ vary_temp(short temp)
delta = 1;
else
delta = 0;
-#if defined (__BORLANDC__) || defined (_MSC_VER)
if (ACE_OS::rand() % 2)
-#else
- if (lrand48() % 2)
-#endif
delta = -delta;
return temp + delta;
}
@@ -188,7 +180,7 @@ private:
// determined by vary_temp().
static
-short
+long
actual_temp(const StateMap::iterator & pos)
{
long sum = 0;
@@ -255,15 +247,15 @@ ICP_get(
return -1; // Must be thermostat
ACE_OS::memcpy(
value, &pos->second.nominal_temp,
- std::min(len, sizeof(pos->second.nominal_temp))
+ ace_min(len, sizeof(pos->second.nominal_temp))
);
} else if (ACE_OS::strcmp(attr, "temperature") == 0) {
- short temp = actual_temp(pos);
- ACE_OS::memcpy(value, &temp, std::min(len, sizeof(temp)));
+ long temp = actual_temp(pos);
+ ACE_OS::memcpy(value, &temp, ace_min(len, sizeof(temp)));
} else if (ACE_OS::strcmp(attr, "MIN_TEMP") == 0) {
- ACE_OS::memcpy(value, &MIN_TEMP, std::min(len, sizeof(MIN_TEMP)));
+ ACE_OS::memcpy(value, &MIN_TEMP, ace_min(len, sizeof(MIN_TEMP)));
} else if (ACE_OS::strcmp(attr, "MAX_TEMP") == 0) {
- ACE_OS::memcpy(value, &MAX_TEMP, std::min(len, sizeof(MAX_TEMP)));
+ ACE_OS::memcpy(value, &MAX_TEMP, ace_min(len, sizeof(MAX_TEMP)));
} else {
return -1; // No such attribute
}
diff --git a/TAO/examples/Advanced/ch_8_and_10/icp.h b/TAO/examples/Advanced/ch_8_and_10/icp.h
index 795e527e0b6..a884c51d769 100644
--- a/TAO/examples/Advanced/ch_8_and_10/icp.h
+++ b/TAO/examples/Advanced/ch_8_and_10/icp.h
@@ -38,6 +38,4 @@ extern "C" {
);
}
-size_t min(const size_t len1, const size_t len2);
-
#endif /* _ICP_H */
diff --git a/TAO/examples/Advanced/ch_8_and_10/server.cpp b/TAO/examples/Advanced/ch_8_and_10/server.cpp
index f95cc75a296..1db6a9afcbc 100644
--- a/TAO/examples/Advanced/ch_8_and_10/server.cpp
+++ b/TAO/examples/Advanced/ch_8_and_10/server.cpp
@@ -445,7 +445,7 @@ ACE_TMAIN(int argc, ACE_TCHAR *argv[])
}
catch (const CORBA::Exception & e) {
std::cerr << "Uncaught CORBA exception: "
- //<< e
+ << e
<< std::endl;
return 1;
}
diff --git a/TAO/examples/Simple/Simple_util.cpp b/TAO/examples/Simple/Simple_util.cpp
index ed34fd728e9..56ceefb0546 100644
--- a/TAO/examples/Simple/Simple_util.cpp
+++ b/TAO/examples/Simple/Simple_util.cpp
@@ -166,7 +166,7 @@ Server<Servant>::init (const char *servant_name,
ACE_TEXT ("The IOR is: <%C>\n"),
str.in ()));
- if (this->ins_ && this->test_for_ins (str) != 0)
+ if (this->ins_ && this->test_for_ins (str.in ()) != 0)
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("test_for_ins (): failed\n")),
-1);