diff options
Diffstat (limited to 'cpp/demo/Ice/protobuf/README')
-rw-r--r-- | cpp/demo/Ice/protobuf/README | 103 |
1 files changed, 103 insertions, 0 deletions
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. |