BigMemory Max 4.3.2 | Component Documentation | Cross-Language Clients User Guide | BigMemory C++ Client | C++ Client Demo Sample
 
C++ Client Demo Sample
The following sample is provided in the code-samples/cross-lang/example03/ directory of the kit. The demo is a recipe app that includes ingredients, measurements, and instructions. It uses Google Protocol Buffer serialization and consists of the following files:
*main.cpp
*recipe.pb.cc
*recipe.pb.h
*RecipeProtoBufSerializer.cpp
*RecipeProtoBufSerializer.h
To compile and run the demo (Linux):
1. Install the Cross-Language Connector and customize the cross-lang-config.xml file, as described on the Installing and Configuring the BigMemory C++ Client page.
2. Start the server as described on the Installing and Configuring the BigMemory C++ Client page.
Note: If you have already installed the BigMemory Client and Cross-Language Connector, you can run this example by adding the external protobuf dependency. The maven link is
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.5.0</version>
</dependency>
This dependency will need to be in both BigMemory Client and CL Connector classpaths. For the CL Connector, the component that needs to be set is EhcacheThriftConfiguration.Builder().cacheSerializerFactory(RecipeSerializerFactory.class) so that the RecipeSerializerFactory, RecipeProtoBufSerializer, and recipe classes will be in the CL Connector's classpath. For the BigMemory Client, the component that will be run is main.cpp, which requires the main, recipe, and RecipeProtoBufSerializer classes to be on the classpath along with the BigMemory Client dependencies.
3. Run the application. Use G++ to compile and link to platform and serializer libraries. Set the output for console. For example:
g++ -I<BMKIT>/apis/cpp/include -I<GoogleProtocolBufferInclude>
-L<BMKIT>/apis/cpp/<PLATFORM>/<ARCH> -L<GoogleProtocolBufferLib>
-lBigMemoryConnector -lprotobuf *.cc *.cpp -o console

Copyright © 2010 - 2019 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.