Hazelcast C++ Client
Classes | Public Member Functions | List of all members
hazelcast::cp::atomic_long Class Reference

Client-side Raft-based proxy implementation of atomic long. More...

#include <cp.h>

+ Inheritance diagram for hazelcast::cp::atomic_long:

Public Member Functions

 atomic_long (const std::string &name, client::spi::ClientContext &context, const raft_group_id &group_id, const std::string &object_name)
 
boost::future< int64_t > add_and_get (int64_t delta)
 Atomically adds the given value to the current value. More...
 
boost::future< bool > compare_and_set (int64_t expect, int64_t update)
 Atomically sets the value to the given updated value only if the current value. More...
 
boost::future< int64_t > get_and_decrement ()
 Atomically decrements the current value by one. More...
 
boost::future< int64_t > decrement_and_get ()
 Atomically decrements the current value by one. More...
 
boost::future< int64_t > get ()
 Gets the current value. More...
 
boost::future< int64_t > get_and_add (int64_t delta)
 Atomically adds the given value to the current value. More...
 
boost::future< int64_t > get_and_set (int64_t new_value)
 Atomically sets the given value and returns the old value. More...
 
boost::future< int64_t > increment_and_get ()
 Atomically increments the current value by one. More...
 
boost::future< int64_t > get_and_increment ()
 Atomically increments the current value by one. More...
 
boost::future< void > set (int64_t new_value)
 Atomically sets the given value. More...
 
template<typename F >
boost::future< void > alter (const F &function)
 Alters the currently stored value by applying a function on it. More...
 
template<typename F >
boost::future< int64_t > alter_and_get (const F &function)
 Alters the currently stored value by applying a function on it and gets the result. More...
 
template<typename F >
boost::future< int64_t > get_and_alter (const F &function)
 Alters the currently stored value by applying a function on it on and gets the old value. More...
 
template<typename F , typename R >
boost::future< boost::optional< R > > apply (const F &function)
 Applies a function on the value, the actual stored value will not change. More...
 
- Public Member Functions inherited from hazelcast::cp::cp_proxy
 cp_proxy (const std::string &service_name, const std::string &proxy_name, client::spi::ClientContext *context, const raft_group_id &group_id, const std::string &object_name)
 
const raft_group_idget_group_id () const
 

Additional Inherited Members

- Protected Member Functions inherited from hazelcast::cp::cp_proxy
void on_destroy ()
 
- Protected Attributes inherited from hazelcast::cp::cp_proxy
raft_group_id group_id_
 
std::string object_name_
 

Detailed Description

Client-side Raft-based proxy implementation of atomic long.

Member Function Documentation

◆ add_and_get()

boost::future< int64_t > hazelcast::cp::atomic_long::add_and_get ( int64_t  delta)

Atomically adds the given value to the current value.

Parameters
deltathe value to add to the current value
Returns
the updated value, the given value added to the current value

◆ alter()

template<typename F >
boost::future<void> hazelcast::cp::atomic_long::alter ( const F &  function)
inline

Alters the currently stored value by applying a function on it.

Parameters
functionthe function applied to the currently stored value

◆ alter_and_get()

template<typename F >
boost::future<int64_t> hazelcast::cp::atomic_long::alter_and_get ( const F &  function)
inline

Alters the currently stored value by applying a function on it and gets the result.

Parameters
functionthe function applied to the currently stored value
Returns
the new value

◆ apply()

template<typename F , typename R >
boost::future<boost::optional<R> > hazelcast::cp::atomic_long::apply ( const F &  function)
inline

Applies a function on the value, the actual stored value will not change.

Parameters
functionthe function applied to the value, the value is not changed
<R>the result type of the function
Returns
the result of the function application

◆ compare_and_set()

boost::future< bool > hazelcast::cp::atomic_long::compare_and_set ( int64_t  expect,
int64_t  update 
)

Atomically sets the value to the given updated value only if the current value.

==

the expected value.

Parameters
expectthe expected value
updatethe new value
Returns
true
if successful; or
false
if the actual value was not equal to the expected value.

◆ decrement_and_get()

boost::future< int64_t > hazelcast::cp::atomic_long::decrement_and_get ( )

Atomically decrements the current value by one.

Returns
the updated value, the current value decremented by one

◆ get()

boost::future< int64_t > hazelcast::cp::atomic_long::get ( )

Gets the current value.

Returns
the current value

◆ get_and_add()

boost::future< int64_t > hazelcast::cp::atomic_long::get_and_add ( int64_t  delta)

Atomically adds the given value to the current value.

Parameters
deltathe value to add to the current value
Returns
the old value before the add

◆ get_and_alter()

template<typename F >
boost::future<int64_t> hazelcast::cp::atomic_long::get_and_alter ( const F &  function)
inline

Alters the currently stored value by applying a function on it on and gets the old value.

Parameters
functionthe function applied to the currently stored value
Returns
the old value
Since
3.2

◆ get_and_decrement()

boost::future< int64_t > hazelcast::cp::atomic_long::get_and_decrement ( )

Atomically decrements the current value by one.

Returns
the old value.

◆ get_and_increment()

boost::future< int64_t > hazelcast::cp::atomic_long::get_and_increment ( )

Atomically increments the current value by one.

Returns
the old value

◆ get_and_set()

boost::future< int64_t > hazelcast::cp::atomic_long::get_and_set ( int64_t  new_value)

Atomically sets the given value and returns the old value.

Parameters
newValuethe new value
Returns
the old value

◆ increment_and_get()

boost::future< int64_t > hazelcast::cp::atomic_long::increment_and_get ( )

Atomically increments the current value by one.

Returns
the updated value, the current value incremented by one

◆ set()

boost::future< void > hazelcast::cp::atomic_long::set ( int64_t  new_value)

Atomically sets the given value.

Parameters
newValuethe new value

The documentation for this class was generated from the following files: