Kyoto Cabinet
Public Member Functions
kyotocabinet::AtomicInt64 Class Reference

Integer with atomic operations. More...

#include <kcthread.h>

List of all members.

Public Member Functions

 AtomicInt64 ()
 Default constructor.
 AtomicInt64 (const AtomicInt64 &src)
 Copy constructor.
 AtomicInt64 (int64_t num)
 Constructor.
 ~AtomicInt64 ()
 Destructor.
int64_t set (int64_t val)
 Set the new value.
int64_t add (int64_t val)
 Add a value.
bool cas (int64_t oval, int64_t nval)
 Perform compare-and-swap.
int64_t get () const
 Get the current value.
AtomicInt64operator= (const AtomicInt64 &right)
 Assignment operator from the self type.
AtomicInt64operator= (const int64_t &right)
 Assignment operator from integer.
 operator int64_t () const
 Cast operator to integer.
AtomicInt64operator+= (int64_t right)
 Summation assignment operator by integer.
AtomicInt64operator-= (int64_t right)
 Subtraction assignment operator by integer.
int64_t secure_least (int64_t val)
 Secure the least value.

Detailed Description

Integer with atomic operations.


Constructor & Destructor Documentation

Default constructor.

Copy constructor.

Parameters:
srcthe source object.

Constructor.

Parameters:
numthe initial value.

Destructor.


Member Function Documentation

int64_t kyotocabinet::AtomicInt64::set ( int64_t  val)

Set the new value.

Parameters:
valthe new value.
Returns:
the old value.
int64_t kyotocabinet::AtomicInt64::add ( int64_t  val)

Add a value.

Parameters:
valthe additional value.
Returns:
the old value.
bool kyotocabinet::AtomicInt64::cas ( int64_t  oval,
int64_t  nval 
)

Perform compare-and-swap.

Parameters:
ovalthe old value.
nvalthe new value.
Returns:
true on success, or false on failure.
int64_t kyotocabinet::AtomicInt64::get ( ) const

Get the current value.

Returns:
the current value.
AtomicInt64& kyotocabinet::AtomicInt64::operator= ( const AtomicInt64 right)

Assignment operator from the self type.

Parameters:
rightthe right operand.
Returns:
the reference to itself.
AtomicInt64& kyotocabinet::AtomicInt64::operator= ( const int64_t &  right)

Assignment operator from integer.

Parameters:
rightthe right operand.
Returns:
the reference to itself.
kyotocabinet::AtomicInt64::operator int64_t ( ) const

Cast operator to integer.

Returns:
the current value.
AtomicInt64& kyotocabinet::AtomicInt64::operator+= ( int64_t  right)

Summation assignment operator by integer.

Parameters:
rightthe right operand.
Returns:
the reference to itself.
AtomicInt64& kyotocabinet::AtomicInt64::operator-= ( int64_t  right)

Subtraction assignment operator by integer.

Parameters:
rightthe right operand.
Returns:
the reference to itself.
int64_t kyotocabinet::AtomicInt64::secure_least ( int64_t  val)

Secure the least value.

Parameters:
valthe least value
Returns:
the current value.