summaryrefslogtreecommitdiff
path: root/cpp/demo/Ice/protobuf
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/demo/Ice/protobuf')
-rw-r--r--cpp/demo/Ice/protobuf/.depend0
-rw-r--r--cpp/demo/Ice/protobuf/.gitignore9
-rw-r--r--cpp/demo/Ice/protobuf/Client.cpp116
-rw-r--r--cpp/demo/Ice/protobuf/Hello.ice29
-rw-r--r--cpp/demo/Ice/protobuf/HelloI.cpp27
-rw-r--r--cpp/demo/Ice/protobuf/HelloI.h23
-rwxr-xr-xcpp/demo/Ice/protobuf/Ice.protobuf.client.vcproj267
-rwxr-xr-xcpp/demo/Ice/protobuf/Ice.protobuf.server.vcproj271
-rwxr-xr-xcpp/demo/Ice/protobuf/Ice.protobuf.sln29
-rw-r--r--cpp/demo/Ice/protobuf/Makefile66
-rw-r--r--cpp/demo/Ice/protobuf/Makefile.mak74
-rw-r--r--cpp/demo/Ice/protobuf/Person.proto16
-rw-r--r--cpp/demo/Ice/protobuf/README103
-rw-r--r--cpp/demo/Ice/protobuf/Server.cpp44
-rw-r--r--cpp/demo/Ice/protobuf/config.client23
-rw-r--r--cpp/demo/Ice/protobuf/config.server24
-rwxr-xr-xcpp/demo/Ice/protobuf/expect.py30
17 files changed, 1151 insertions, 0 deletions
diff --git a/cpp/demo/Ice/protobuf/.depend b/cpp/demo/Ice/protobuf/.depend
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/cpp/demo/Ice/protobuf/.depend
diff --git a/cpp/demo/Ice/protobuf/.gitignore b/cpp/demo/Ice/protobuf/.gitignore
new file mode 100644
index 00000000000..0c7a711fcec
--- /dev/null
+++ b/cpp/demo/Ice/protobuf/.gitignore
@@ -0,0 +1,9 @@
+// Generated by makegitignore.py
+
+// IMPORTANT: Do not edit this file -- any edits made here will be lost!
+client
+server
+Hello.cpp
+Hello.h
+Person.pb.cpp
+Person.pb.h
diff --git a/cpp/demo/Ice/protobuf/Client.cpp b/cpp/demo/Ice/protobuf/Client.cpp
new file mode 100644
index 00000000000..0baae8f5248
--- /dev/null
+++ b/cpp/demo/Ice/protobuf/Client.cpp
@@ -0,0 +1,116 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <Hello.h>
+
+using namespace std;
+using namespace Demo;
+
+class HelloClient : public Ice::Application
+{
+public:
+
+ HelloClient();
+
+ virtual int run(int, char*[]);
+
+private:
+
+ void menu();
+};
+
+int
+main(int argc, char* argv[])
+{
+ HelloClient app;
+ return app.main(argc, argv, "config.client");
+}
+
+HelloClient::HelloClient() :
+ //
+ // Since this is an interactive demo we don't want any signal
+ // handling.
+ //
+ Ice::Application(Ice::NoSignalHandling)
+{
+}
+
+int
+HelloClient::run(int argc, char* argv[])
+{
+ if(argc > 1)
+ {
+ cerr << appName() << ": too many arguments" << endl;
+ return EXIT_FAILURE;
+ }
+
+ HelloPrx hello = HelloPrx::checkedCast(communicator()->propertyToProxy("Hello.Proxy"));
+ if(!hello)
+ {
+ cerr << argv[0] << ": invalid proxy" << endl;
+ return EXIT_FAILURE;
+ }
+
+ tutorial::Person p;
+ p.set_id(1);
+ p.set_name("Fred Jones");
+ p.set_email("fred@jones.com");
+
+ menu();
+
+ char c;
+ do
+ {
+ try
+ {
+ cout << "==> ";
+ cin >> c;
+ if(c == 't')
+ {
+ hello->sayHello(p);
+ }
+ else if(c == 's')
+ {
+ hello->shutdown();
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu();
+ }
+ else
+ {
+ cout << "unknown command `" << c << "'" << endl;
+ menu();
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ }
+ }
+ while(cin.good() && c != 'x');
+
+ return EXIT_SUCCESS;
+}
+
+void
+HelloClient::menu()
+{
+ cout <<
+ "usage:\n"
+ "t: send greeting\n"
+ "s: shutdown server\n"
+ "x: exit\n"
+ "?: help\n";
+}
diff --git a/cpp/demo/Ice/protobuf/Hello.ice b/cpp/demo/Ice/protobuf/Hello.ice
new file mode 100644
index 00000000000..3453d0a9fa9
--- /dev/null
+++ b/cpp/demo/Ice/protobuf/Hello.ice
@@ -0,0 +1,29 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef HELLO_ICE
+#define HELLO_ICE
+
+[["cpp:include:Person.pb.h"]]
+
+module Demo
+{
+
+["cpp:protobuf:tutorial::Person", "java:protobuf:tutorial.PersonPB.Person", "python:protobuf:Person_pb2.Person"]
+sequence<byte> Person;
+
+interface Hello
+{
+ idempotent void sayHello(Person p);
+ void shutdown();
+};
+
+};
+
+#endif
diff --git a/cpp/demo/Ice/protobuf/HelloI.cpp b/cpp/demo/Ice/protobuf/HelloI.cpp
new file mode 100644
index 00000000000..7ea465805f6
--- /dev/null
+++ b/cpp/demo/Ice/protobuf/HelloI.cpp
@@ -0,0 +1,27 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <IceUtil/IceUtil.h>
+#include <Ice/Ice.h>
+#include <HelloI.h>
+
+using namespace std;
+
+void
+HelloI::sayHello(const tutorial::Person& p, const Ice::Current&)
+{
+ cout << "Hello World from " << p.DebugString() << endl;
+}
+
+void
+HelloI::shutdown(const Ice::Current& c)
+{
+ cout << "Shutting down..." << endl;
+ c.adapter->getCommunicator()->shutdown();
+}
diff --git a/cpp/demo/Ice/protobuf/HelloI.h b/cpp/demo/Ice/protobuf/HelloI.h
new file mode 100644
index 00000000000..e82667964ab
--- /dev/null
+++ b/cpp/demo/Ice/protobuf/HelloI.h
@@ -0,0 +1,23 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef HELLO_I_H
+#define HELLO_I_H
+
+#include <Hello.h>
+
+class HelloI : public Demo::Hello
+{
+public:
+
+ virtual void sayHello(const tutorial::Person& p, const Ice::Current&);
+ virtual void shutdown(const Ice::Current&);
+};
+
+#endif
diff --git a/cpp/demo/Ice/protobuf/Ice.protobuf.client.vcproj b/cpp/demo/Ice/protobuf/Ice.protobuf.client.vcproj
new file mode 100755
index 00000000000..2a3f84ca9e6
--- /dev/null
+++ b/cpp/demo/Ice/protobuf/Ice.protobuf.client.vcproj
@@ -0,0 +1,267 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="Ice.protobuf.client"
+ ProjectGUID="{DCB7823F-3422-4953-98B3-168624FE3725}"
+ RootNamespace="Iceprotobufclient"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)"
+ IntermediateDirectory="$(SolutionDir)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="., ..\..\..\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="0"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="iced.lib iceutild.lib setargv.obj libprotobufd.lib"
+ OutputFile="client.exe"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="..\..\..\lib"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)"
+ IntermediateDirectory="$(SolutionDir)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="., ..\..\..\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="0"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="ice.lib iceutil.lib setargv.obj libprotobuf.lib"
+ OutputFile="client.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="..\..\..\lib"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\Client.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Hello.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Person.pb.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\Hello.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Person.pb.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ <File
+ RelativePath=".\Hello.ice"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="if exist ../../../slice (set sliceDir=../../../slice) else set sliceDir=../../../../slice&#x0D;&#x0A;..\..\..\bin\slice2cpp.exe -I%sliceDir% Hello.ice&#x0D;&#x0A;"
+ Outputs="Hello.cpp Hello.h"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="if exist ../../../slice (set sliceDir=../../../slice) else set sliceDir=../../../../slice&#x0D;&#x0A;..\..\..\bin\slice2cpp.exe -I%sliceDir% Hello.ice&#x0D;&#x0A;"
+ Outputs="Hello.cpp Hello.h"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\Person.proto"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="protoc --cpp_out=. Person.proto&#x0D;&#x0A;move Person.pb.cc Person.pb.cpp&#x0D;&#x0A;"
+ Outputs="Person.pb.cpp Person.pb.h"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="protoc --cpp_out=. Person.proto&#x0D;&#x0A;move Person.pb.cc Person.pb.cpp&#x0D;&#x0A;"
+ Outputs="Person.pb.cpp Person.pb.h"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/cpp/demo/Ice/protobuf/Ice.protobuf.server.vcproj b/cpp/demo/Ice/protobuf/Ice.protobuf.server.vcproj
new file mode 100755
index 00000000000..ea63b1f8e06
--- /dev/null
+++ b/cpp/demo/Ice/protobuf/Ice.protobuf.server.vcproj
@@ -0,0 +1,271 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="Ice.protobuf.server"
+ ProjectGUID="{F32F46FF-5503-4639-9F9D-43477C6DA3BD}"
+ RootNamespace="Iceprotobufserver"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)"
+ IntermediateDirectory="$(SolutionDir)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="., ..\..\..\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="0"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="iced.lib iceutild.lib setargv.obj libprotobufd.lib"
+ OutputFile="server.exe"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="..\..\..\lib"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)"
+ IntermediateDirectory="$(SolutionDir)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="., ..\..\..\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="0"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="Ice.lib IceUtil.lib setargv.obj libprotobuf.lib"
+ OutputFile="server.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="..\..\..\lib"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ EmbedManifest="false"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\Hello.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\HelloI.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Person.pb.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Server.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\Hello.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Person.pb.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ <File
+ RelativePath=".\Hello.ice"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="if exist ../../../slice (set sliceDir=../../../slice) else set sliceDir=../../../../slice&#x0D;&#x0A;..\..\..\bin\slice2cpp.exe -I%sliceDir% Hello.ice&#x0D;&#x0A;"
+ Outputs="Hello.cpp Hello.h"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="if exist ../../../slice (set sliceDir=../../../slice) else set sliceDir=../../../../slice&#x0D;&#x0A;..\..\..\bin\slice2cpp.exe -I%sliceDir% Hello.ice&#x0D;&#x0A;"
+ Outputs="Hello.cpp Hello.h"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\Person.proto"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="protoc --cpp_out=. Person.proto&#x0D;&#x0A;move Person.pb.cc Person.pb.cpp&#x0D;&#x0A;"
+ Outputs="Person.pb.cpp Person.pb.h"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="protoc --cpp_out=. Person.proto&#x0D;&#x0A;move Person.pb.cc Person.pb.cpp&#x0D;&#x0A;"
+ Outputs="Person.pb.cpp Person.pb.h"
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/cpp/demo/Ice/protobuf/Ice.protobuf.sln b/cpp/demo/Ice/protobuf/Ice.protobuf.sln
new file mode 100755
index 00000000000..557ba920445
--- /dev/null
+++ b/cpp/demo/Ice/protobuf/Ice.protobuf.sln
@@ -0,0 +1,29 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ice.protobuf.client", "Ice.protobuf.client.vcproj", "{DCB7823F-3422-4953-98B3-168624FE3725}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F32F46FF-5503-4639-9F9D-43477C6DA3BD} = {F32F46FF-5503-4639-9F9D-43477C6DA3BD}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Ice.protobuf.server", "Ice.protobuf.server.vcproj", "{F32F46FF-5503-4639-9F9D-43477C6DA3BD}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {DCB7823F-3422-4953-98B3-168624FE3725}.Debug|Win32.ActiveCfg = Debug|Win32
+ {DCB7823F-3422-4953-98B3-168624FE3725}.Debug|Win32.Build.0 = Debug|Win32
+ {DCB7823F-3422-4953-98B3-168624FE3725}.Release|Win32.ActiveCfg = Release|Win32
+ {DCB7823F-3422-4953-98B3-168624FE3725}.Release|Win32.Build.0 = Release|Win32
+ {F32F46FF-5503-4639-9F9D-43477C6DA3BD}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F32F46FF-5503-4639-9F9D-43477C6DA3BD}.Debug|Win32.Build.0 = Debug|Win32
+ {F32F46FF-5503-4639-9F9D-43477C6DA3BD}.Release|Win32.ActiveCfg = Release|Win32
+ {F32F46FF-5503-4639-9F9D-43477C6DA3BD}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/cpp/demo/Ice/protobuf/Makefile b/cpp/demo/Ice/protobuf/Makefile
new file mode 100644
index 00000000000..33f02dcecb5
--- /dev/null
+++ b/cpp/demo/Ice/protobuf/Makefile
@@ -0,0 +1,66 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+#
+# If protobuf is not installed in a standard location where the
+# compiler can find it, set PROTOBUF_HOME to the protobuf installation
+# directory.
+#
+PROTOBUF_HOME ?= /usr/local
+
+top_srcdir = ../../..
+
+CLIENT = client
+SERVER = server
+
+TARGETS = $(CLIENT) $(SERVER)
+
+OBJS = Hello.o \
+ Person.pb.o
+
+COBJS = Client.o
+
+SOBJS = HelloI.o \
+ Server.o
+
+SRCS = $(OBJS:.o=.cpp) \
+ $(COBJS:.o=.cpp) \
+ $(SOBJS:.o=.cpp)
+
+SLICE_SRCS = Hello.ice
+PROTO_SRCS = Person.proto
+
+include $(top_srcdir)/config/Make.rules
+
+CPPFLAGS := -I$(PROTOBUF_HOME)/include -I. $(CPPFLAGS)
+LIBS := $(LIBS) -L$(PROTOBUF_HOME)/lib -lprotobuf
+
+$(CLIENT): $(OBJS) $(COBJS)
+ rm -f $@
+ $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(COBJS) $(LIBS)
+
+$(SERVER): $(OBJS) $(SOBJS)
+ rm -f $@
+ $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(SOBJS) $(LIBS)
+
+%..pb.h %.pb.cpp: %.proto
+ rm -f $(*F).pb.h $(*F).pb.cpp
+ $(PROTOBUF_HOME)/bin/protoc --cpp_out=. $(*F).proto
+ mv $(*F).pb.cc $(*F).pb.cpp
+
+depend::
+ for i in $(PROTO_SRCS); do \
+ echo "$${i%.proto}.pb.cpp: $$i" >> .depend; \
+ done
+
+clean::
+ rm -f $(addsuffix .pb.cpp, $(basename $(notdir $(PROTO_SRCS))))
+ rm -f $(addsuffix .pb.h, $(basename $(notdir $(PROTO_SRCS))))
+
+include .depend
diff --git a/cpp/demo/Ice/protobuf/Makefile.mak b/cpp/demo/Ice/protobuf/Makefile.mak
new file mode 100644
index 00000000000..612b36cce0a
--- /dev/null
+++ b/cpp/demo/Ice/protobuf/Makefile.mak
@@ -0,0 +1,74 @@
+#**********************************************************************
+#
+# Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+#
+# If protobuf is not installed in a standard location where the
+# compiler can find it, set PROTOBUF_HOME to the protobuf installation
+# directory.
+#
+!if "$(PROTOBUF_HOME)" == ""
+PROTOBUF_HOME = c:\protobuf
+!endif
+
+top_srcdir = ..\..\..
+
+CLIENT = client.exe
+SERVER = server.exe
+
+TARGETS = $(CLIENT) $(SERVER)
+
+OBJS = Hello.obj \
+ Person.pb.obj
+
+COBJS = Client.obj
+
+SOBJS = HelloI.obj \
+ Server.obj
+
+SRCS = $(OBJS:.obj=.cpp) \
+ $(COBJS:.obj=.cpp) \
+ $(SOBJS:.obj=.cpp)
+
+!include $(top_srcdir)/config/Make.rules.mak
+
+# Need to use -W0 to gid rid of ugly warnings from generated protobuf file as
+# well as prevent compile failure on x64 due to warnings from protobuf headers
+CPPFLAGS = -I$(PROTOBUF_HOME)\include -I. $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN -W0
+
+LIBS = $(LIBS) /libpath:$(PROTOBUF_HOME)\lib libprotobuf$(LIBSUFFIX).lib
+
+!if "$(GENERATE_PDB)" == "yes"
+CPDBFLAGS = /pdb:$(CLIENT:.exe=.pdb)
+SPDBFLAGS = /pdb:$(SERVER:.exe=.pdb)
+!endif
+
+$(CLIENT): $(OBJS) $(COBJS)
+ $(LINK) $(LD_EXEFLAGS) $(CPDBFLAGS) $(SETARGV) $(OBJS) $(COBJS) $(PREOUT)$@ $(PRELIBS)$(LIBS)
+ @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \
+ $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest
+
+$(SERVER): $(OBJS) $(SOBJS)
+ $(LINK) $(LD_EXEFLAGS) $(SPDBFLAGS) $(SETARGV) $(OBJS) $(SOBJS) $(PREOUT)$@ $(PRELIBS)$(LIBS)
+ @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \
+ $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest
+
+# A generic rule would be nicer, but since protoc generates .pb.cpp
+# it is not possible with nmake.
+Person.pb.cpp: Person.proto
+ del /q Person.pb.h Person.pb.cpp
+ $(PROTOBUF_HOME)\bin\protoc --cpp_out=. Person.proto
+ move Person.pb.cc Person.pb.cpp
+
+Person.pb.h: Person.pb.cpp
+
+clean::
+ del /q Hello.cpp Hello.h
+ del /q Person.pb.h Person.pb.cpp
+
+!include .depend
diff --git a/cpp/demo/Ice/protobuf/Person.proto b/cpp/demo/Ice/protobuf/Person.proto
new file mode 100644
index 00000000000..b68990dbc48
--- /dev/null
+++ b/cpp/demo/Ice/protobuf/Person.proto
@@ -0,0 +1,16 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package tutorial;
+
+message Person {
+ required int32 id = 1;
+ required string name = 2;
+ optional string email = 3;
+}
diff --git a/cpp/demo/Ice/protobuf/README b/cpp/demo/Ice/protobuf/README
new file mode 100644
index 00000000000..0d5acf15057
--- /dev/null
+++ b/cpp/demo/Ice/protobuf/README
@@ -0,0 +1,103 @@
+This demo shows how to integrate Google Protocol Buffers with Ice.
+
+The Protocol Buffers distribution and documentation can be found at
+
+ http://code.google.com/apis/protocolbuffers/
+
+This demo was tested with Protocol Buffers version 2.0.3.
+
+We have added new metadata that makes it possible for you to specify
+protocol buffers message types in your Slice definitions, with Ice
+handling the serialization chores for you automatically. The metadata,
+which may only be used on a sequence<byte> type, has the following
+syntax in C++:
+
+ cpp:protobuf[:protoc-generated-class]
+
+For example:
+
+ ["cpp:protobuf:tutorial::Person"] sequence<byte> Person;
+
+The type name specified in this example, tutorial::Person, corresponds
+to the C++ class generated by the Protocol Buffers compiler (protoc)
+for the definition shown below:
+
+ package tutorial;
+ message Person { ... };
+
+If the metadata omits the type name, the Slice compiler assumes that
+the message type resides in the same namespace as the Slice type. For
+example, consider this Slice definition:
+
+ module Demo
+ {
+
+ ["cpp:protobuf"] sequence<byte> Person;
+
+ };
+
+In this case the Slice compiler assumes that the message type
+corresponds to the C++ type Demo::Person, as shown in the following
+definition:
+
+ package Demo;
+ message Person { ... };
+
+C++ users must also add another metadata directive so that the header
+file generated by the protocol buffers compiler is included properly.
+This metadata directive must appear before any other Slice definitions
+and has the following syntax:
+
+ [["cpp:include:Person.pb.h"]]
+
+If building on Windows, you should first see the `Windows Notes'
+section below.
+
+If building from a source distribution or the demo package, please
+review Makefile or Makefile.mak in this directory and adjust the value
+of PROTOBUF_HOME to reflect the installation directory of Protocol
+Buffers on your system.
+
+If building with the Visual Studio IDE, open the Ice.protobuf.sln
+solution and choose
+
+ Tools->Options->Projects and Solutions->VC++ Directories
+
+Add the Protocol Buffers bin directory to "Executable Files", the
+include directory to "Include files", and the lib directory to
+"Library files". Then select the target configuration (Debug or
+Release), right-click on the solution in the Solution Explorer window
+and select "Build Solution".
+
+To run the demo, first start the server:
+
+ $ server
+
+In a separate window, start the client:
+
+ $ client
+
+
+Windows Notes
+-------------
+
+The Procotol Buffers source package doesn't support automatic
+installation. The build system for this demo (Makefile.mak and
+Ice.protobuf.sln) assumes that you have compiled and manually
+installed Protocol Buffers using the following directory structure:
+
+%PROTOBUF_HOME%\bin
+
+ Contains protoc.exe
+
+%PROTOBUF_HOME%\lib
+
+ Contains libprotobuf.lib and libprotobufd.lib, the release and
+ debug static libraries, respectively. (The debug library was
+ renamed to libprotobufd.lib.)
+
+%PROTOBUF_HOME%\include
+
+ Contains the output of the extract_includes.bat batch file that
+ copies the include files contained in the Protocol Buffers
+ distribution.
diff --git a/cpp/demo/Ice/protobuf/Server.cpp b/cpp/demo/Ice/protobuf/Server.cpp
new file mode 100644
index 00000000000..e39445cd890
--- /dev/null
+++ b/cpp/demo/Ice/protobuf/Server.cpp
@@ -0,0 +1,44 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <HelloI.h>
+
+using namespace std;
+
+class HelloServer : public Ice::Application
+{
+public:
+
+ virtual int run(int, char*[]);
+};
+
+int
+main(int argc, char* argv[])
+{
+ HelloServer app;
+ return app.main(argc, argv, "config.server");
+}
+
+int
+HelloServer::run(int argc, char* argv[])
+{
+ if(argc > 1)
+ {
+ cerr << appName() << ": too many arguments" << endl;
+ return EXIT_FAILURE;
+ }
+
+ Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Hello");
+ Demo::HelloPtr hello = new HelloI;
+ adapter->add(hello, communicator()->stringToIdentity("hello"));
+ adapter->activate();
+ communicator()->waitForShutdown();
+ return EXIT_SUCCESS;
+}
diff --git a/cpp/demo/Ice/protobuf/config.client b/cpp/demo/Ice/protobuf/config.client
new file mode 100644
index 00000000000..a02cab0f4cb
--- /dev/null
+++ b/cpp/demo/Ice/protobuf/config.client
@@ -0,0 +1,23 @@
+#
+# The client reads this property to create the reference to the
+# "hello" object in the server.
+#
+Hello.Proxy=hello:tcp -p 10000
+
+#
+# Network Tracing
+#
+# 0 = no network tracing
+# 1 = trace connection establishment and closure
+# 2 = like 1, but more detailed
+# 3 = like 2, but also trace data transfer
+#
+#Ice.Trace.Network=1
+
+#
+# Protocol Tracing
+#
+# 0 = no protocol tracing
+# 1 = trace protocol messages
+#
+#Ice.Trace.Protocol=1
diff --git a/cpp/demo/Ice/protobuf/config.server b/cpp/demo/Ice/protobuf/config.server
new file mode 100644
index 00000000000..309db9731b2
--- /dev/null
+++ b/cpp/demo/Ice/protobuf/config.server
@@ -0,0 +1,24 @@
+#
+# The server creates one single object adapter with the name
+# "Hello". The following line sets the endpoints for this
+# adapter.
+#
+Hello.Endpoints=tcp -p 10000
+
+#
+# Network Tracing
+#
+# 0 = no network tracing
+# 1 = trace connection establishment and closure
+# 2 = like 1, but more detailed
+# 3 = like 2, but also trace data transfer
+#
+#Ice.Trace.Network=1
+
+#
+# Protocol Tracing
+#
+# 0 = no protocol tracing
+# 1 = trace protocol messages
+#
+#Ice.Trace.Protocol=1
diff --git a/cpp/demo/Ice/protobuf/expect.py b/cpp/demo/Ice/protobuf/expect.py
new file mode 100755
index 00000000000..eab2c166f54
--- /dev/null
+++ b/cpp/demo/Ice/protobuf/expect.py
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import sys, os
+
+path = [ ".", "..", "../..", "../../..", "../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ]
+if len(path) == 0:
+ raise "can't find toplevel directory!"
+sys.path.append(path[0])
+
+from demoscript import *
+from demoscript.Ice import protobuf
+
+server = Util.spawn('./server --Ice.PrintAdapterReady --Ice.Warn.Connections=0')
+server.expect('.* ready')
+client = Util.spawn('./client --Ice.Warn.Connections=0')
+client.expect('.*==>')
+
+protobuf.run(client, server)