Kyoto Cabinet: kyotocabinet::AtomicInt64 Class Reference

Kyoto Cabinet

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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.
AtomicInt64 & | operator= (const AtomicInt64 &right)
| Assignment operator from the self type.
AtomicInt64 & | operator= (const int64_t &right)
| Assignment operator from integer.
| operator int64_t () const
| Cast operator to integer.
AtomicInt64 & | operator+= (int64_t right)
| Summation assignment operator by integer.
AtomicInt64 & | operator-= (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

kyotocabinet::AtomicInt64::AtomicInt64 | ( |  | ) | `[explicit]`

Default constructor.

kyotocabinet::AtomicInt64::AtomicInt64 | ( | const AtomicInt64 & | src | ) |

Copy constructor.

Parameters:

  src | the source object.

kyotocabinet::AtomicInt64::AtomicInt64 | ( | int64_t | num | ) |

Constructor.

Parameters:

  num | the initial value.

kyotocabinet::AtomicInt64::~AtomicInt64 | ( |  | ) |

Destructor.

## Member Function Documentation

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

Set the new value.

Parameters:

  val | the new value.

Returns:
  the old value.

int64_t kyotocabinet::AtomicInt64::add | ( | int64_t | val | ) |

Add a value.

Parameters:

  val | the additional value.

Returns:
  the old value.

bool kyotocabinet::AtomicInt64::cas | ( | int64_t | oval,
|  | int64_t | nval
| ) |  |

Perform compare-and-swap.

Parameters:

  oval | the old value.
  nval | the 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:

  right | the right operand.

Returns:
  the reference to itself.

AtomicInt64& kyotocabinet::AtomicInt64::operator= | ( | const int64_t & | right | ) |

Assignment operator from integer.

Parameters:

  right | the 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:

  right | the right operand.

Returns:
  the reference to itself.

AtomicInt64& kyotocabinet::AtomicInt64::operator-= | ( | int64_t | right | ) |

Subtraction assignment operator by integer.

Parameters:

  right | the right operand.

Returns:
  the reference to itself.

int64_t kyotocabinet::AtomicInt64::secure_least | ( | int64_t | val | ) |

Secure the least value.

Parameters:

  val | the least value

Returns:
  the current value.