<commit_before>



### C++ Client

![](images/enterprise-onlycopy.jpg)


You can use Native C++ Client to connect to Hazelcast nodes and perform almost all operations that a node can perform. Different from nodes, clients do not hold data. It is by default a smart client, i.e. it knows where the data is and asks directly to the correct node. This feature can be disabled (using `ClientConfig::setSmart` method) if you do not want the clients to connect every node.

Features of C++ Clients are:

-	Access to distributed data structures (IMap, IQueue, MultiMap, ITopic, etc.).
-	Access to transactional distributed data structures (TransactionalMap, TransactionalQueue, etc.).
-	Ability to add cluster listeners to a cluster and entry/item listeners to distributed data structures.
-	Distributed synchronization mechanisms with ILock, ISemaphore and ICountDownLatch.

Hazelcast C++ Client is shipped with 32/64 bit, shared and static libraries. Compiled static libraries of dependencies are also available in the release. Dependencies are **zlib** and some of the boost libraries. Below boost libraries are required:

-	`libboost_atomic`
-	`libboost_system`
-	`libboost_chrono`
-	`libboost_thread`
-	`libboost_date_time`

Downloaded release includes the below folders:

-	`docs/ html`, where Doxygen documentation is located.
-	`hazelcast/`
	-	`lib/`, where shared and static library of Hazelcast is located.
	-	`include/`, where client headers are included.
-	`external/`
	-	`lib/`, where compiled static libraries of dependencies is located.
	-	`include/`, where dependency headers are included.

#### Installation
C++ Client is tested on Linux 32/64, Mac 64 and Windows 32/64 bit machines.

##### Linux

For Linux, there are two distributions; 32 bit and 64 bit.

Sample script to build with static library:

`g++ main.cpp -pthread -I./external/include -I./hazelcast/include ./hazelcast/lib libHazelcastClientStatic_64.a ./external/lib/libz.a ./external/lib/libboost_thread.a ./external/lib/libboost_system.a ./external/lib/libboost_date_time.a ./external/lib/libboost_chrono.a ./external/libboost_atomic.a`

Sample script to build with shared library:

`g++ main.cpp -lpthread -Wl,–no-as-needed -lrt -I./external/include -I./hazelcast/include -L./hazelcast/lib -lHazelcastClientShared_64 ./external/lib/libz.a ./external/lib/libboost_thread.a ./external/lib/libboost_system.a ./external/lib/libboost_date_time.a ./external/lib/libboost_chrono.a ./external/lib/libboost_atomic.a`

##### Mac
For Mac, there is only one distribution which is 64 bit.

Sample script to build with static library:

`g++ main.cpp -I./external/include -I./hazelcast/include ./hazelcast/lib libHazelcastClientStatic_64.a ./external/lib/libz.a ./external/lib libboost_thread.a ./external/lib/libboost_system.a ./external/lib libboost_exception.a ./external/lib/libboost_date_time.a ./external/lib libboost_chrono.a ./external/lib/libboost_atomic.a`

Sample script to build with shared library:

`g++ main.cpp -I./external/include -I./hazelcast/include -L./hazelcast/lib -lHazelcastClientShared_64 ./external/lib/libz.a ./external/lib libboost_thread.a ./external/lib/libboost_system.a ./external/lib libboost_exception.a ./external/lib/libboost_date_time.a ./external/lib libboost_chrono.a ./external/lib/libboost_atomic.a`

##### Windows
For Windows, there are two distributions; 32 bit and 64 bit.

#### Code Examples
A Hazelcast node should be running to make below sample codes work.

##### Map Example

	 #include <hazelcast/client/HazelcastAll.h>
     #include <iostream>

     using namespace hazelcast::client;

     int main(){
         ClientConfig clientConfig;
         Address address("localhost", 5701);
         clientConfig.addAddress(address);

         HazelcastClient hazelcastClient(clientConfig);

         IMap<int,int> myMap = hazelcastClient.getMap<int ,int>("myIntMap");
         myMap.put(1,3);
         boost::shared_ptr<int> v = myMap.get(1);
         if(v.get() != NULL){
             //process the item
         }

         return 0;
     }

##### Queue Example<commit_msg>C++ Client section updates<commit_after>



### C++ Client

![](images/enterprise-onlycopy.jpg)


You can use Native C++ Client to connect to Hazelcast nodes and perform almost all operations that a node can perform. Different from nodes, clients do not hold data. It is by default a smart client, i.e. it knows where the data is and asks directly to the correct node. This feature can be disabled (using `ClientConfig::setSmart` method) if you do not want the clients to connect every node.

Features of C++ Clients are:

-	Access to distributed data structures (IMap, IQueue, MultiMap, ITopic, etc.).
-	Access to transactional distributed data structures (TransactionalMap, TransactionalQueue, etc.).
-	Ability to add cluster listeners to a cluster and entry/item listeners to distributed data structures.
-	Distributed synchronization mechanisms with ILock, ISemaphore and ICountDownLatch.


#### How to Setup

Hazelcast C++ Client is shipped with 32/64 bit, shared and static libraries. Compiled static libraries of dependencies are also available in the release. Dependencies are **zlib** and **shared_ptr** from the boost libraries. 


Downloaded release folder consists of:

-	Mac_64/
-	Windows_32/
-	Windows_64/
-	Linux_32/
-	Linux_64/
-	docs/ *(HTML Doxygen documents are here)*


And each of the folders above contains the following:

-	examples/
	-	testApp.exe => example command line client tool to connect hazelcast servers.
	-	TestApp.cpp => code of the example command line tool.

- hazelcast/
	-	lib/ => Contains both shared and static library of hazelcast.
	-	include/ => Contains headers of client

-	external/
	-	lib/ => Contains compiled static libraries of zlib.
	-	include/ => Contains headers of dependencies.(zlib and boost::shared_ptr)



#### Platform Specific Installation Guides
C++ Client is tested on Linux 32/64, Mac 64 and Windows 32/64 bit machines. For each of the headers above, it is assumed that you are in the correct folder for your platform. Folders are Mac_64, Windows_32, Windows_64, Linux_32 or Linux_64.

##### Linux

For Linux, there are two distributions; 32 bit and 64 bit.

Sample script to build with static library:

`g++ main.cpp -pthread -I./external/include -I./hazelcast/include ./hazelcast/lib/libHazelcastClientStatic_64.a ./external/lib/libz.a`

Sample script to build with shared library:

`g++ main.cpp -lpthread -Wl,–no-as-needed -lrt -I./external/include -I./hazelcast/include -L./hazelcast/lib -lHazelcastClientShared_64 ./external/lib/libz.a`

##### Mac
For Mac, there is only one distribution which is 64 bit.

Sample script to build with static library:

`g++ main.cpp -I./external/include -I./hazelcast/include ./hazelcast/lib/libHazelcastClientStatic_64.a ./external/lib/darwin/libz.a`

Sample script to build with shared library:

`g++ main.cpp -I./external/include -I./hazelcast/include -L./hazelcast/lib -lHazelcastClientShared_64 ./external/lib/darwin/libz.a`

##### Windows
For Windows, there are two distributions; 32 bit and 64 bit. Current release have only Visual Studio 2010 compatible libraries. For others, please contact with [<EMAIL>](<EMAIL>).

#### Code Examples
A Hazelcast node should be running to make below sample codes work.

##### Map Example

	 #include <hazelcast/client/HazelcastAll.h>
     #include <iostream>

     using namespace hazelcast::client;

     int main(){
         ClientConfig clientConfig;
         Address address("localhost", 5701);
         clientConfig.addAddress(address);

         HazelcastClient hazelcastClient(clientConfig);

         IMap<int,int> myMap = hazelcastClient.getMap<int ,int>("myIntMap");
         myMap.put(1,3);
         boost::shared_ptr<int> v = myMap.get(1);
         if(v.get() != NULL){
             //process the item
         }

         return 0;
     }

##### Queue Example
{'fraction_non_alphanumeric': 0.10381060893784023, 'fraction_numerical': 0.013166223572604127, 'mean_word_length': 3.787878787878788, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4927752', 'n_tokens_mistral': 2464, 'n_tokens_neox': 2336, 'n_words': 832}