Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FThreadSafeCounter64 Class Reference

#include <ThreadSafeCounter64.h>

Public Types

typedef int64 IntegerType
 

Public Member Functions

 FThreadSafeCounter64 ()
 
 FThreadSafeCounter64 (const FThreadSafeCounter &Other)
 
FThreadSafeCounter64operator= (const FThreadSafeCounter64 &Other)
 
 FThreadSafeCounter64 (int64 Value)
 
int64 Increment ()
 
int64 Add (int64 Amount)
 
int64 Decrement ()
 
int64 Subtract (int64 Amount)
 
int64 Set (int64 Value)
 
int64 Reset ()
 
int64 GetValue () const
 

Private Attributes

volatile int64 Counter
 

Detailed Description

Thread safe counter for 64bit ints

Definition at line 13 of file ThreadSafeCounter64.h.

Member Typedef Documentation

◆ IntegerType

Constructor & Destructor Documentation

◆ FThreadSafeCounter64() [1/3]

FThreadSafeCounter64::FThreadSafeCounter64 ( )
inline

Default constructor.

Initializes the counter to 0.

Definition at line 23 of file ThreadSafeCounter64.h.

◆ FThreadSafeCounter64() [2/3]

FThreadSafeCounter64::FThreadSafeCounter64 ( const FThreadSafeCounter & Other)
inline

Copy Constructor.

If the counter in the Other parameter is changing from other threads, there are no guarantees as to which values you will get up to the caller to not care, synchronize or other way to make those guarantees.

Parameters
OtherThe other thread safe counter to copy

Definition at line 37 of file ThreadSafeCounter64.h.

+ Here is the call graph for this function:

◆ FThreadSafeCounter64() [3/3]

FThreadSafeCounter64::FThreadSafeCounter64 ( int64 Value)
inline

Constructor, initializing counter to passed in value.

Parameters
ValueValue to initialize counter to

Definition at line 56 of file ThreadSafeCounter64.h.

Member Function Documentation

◆ Add()

int64 FThreadSafeCounter64::Add ( int64 Amount)
inline

Adds an amount and returns the old value.

Parameters
AmountAmount to increase the counter by
Returns
the old value
See also
Decrement, Increment, Reset, Set, Subtract

Definition at line 79 of file ThreadSafeCounter64.h.

◆ Decrement()

int64 FThreadSafeCounter64::Decrement ( )
inline

Decrement and return new value.

Returns
the new, decremented value
See also
Add, Increment, Reset, Set, Subtract

Definition at line 90 of file ThreadSafeCounter64.h.

◆ GetValue()

int64 FThreadSafeCounter64::GetValue ( ) const
inline

Gets the current value.

Returns
the current value

Definition at line 135 of file ThreadSafeCounter64.h.

+ Here is the caller graph for this function:

◆ Increment()

int64 FThreadSafeCounter64::Increment ( )
inline

Increment and return new value.

Returns
the new, incremented value
See also
Add, Decrement, Reset, Set, Subtract

Definition at line 67 of file ThreadSafeCounter64.h.

◆ operator=()

FThreadSafeCounter64 & FThreadSafeCounter64::operator= ( const FThreadSafeCounter64 & Other)
inline

Assignment has the same caveats as the copy ctor.

Definition at line 43 of file ThreadSafeCounter64.h.

+ Here is the call graph for this function:

◆ Reset()

int64 FThreadSafeCounter64::Reset ( )
inline

Resets the counter's value to zero.

Returns
the old value.
See also
Add, Decrement, Increment, Set, Subtract

Definition at line 125 of file ThreadSafeCounter64.h.

◆ Set()

int64 FThreadSafeCounter64::Set ( int64 Value)
inline

Sets the counter to a specific value and returns the old value.

Parameters
ValueValue to set the counter to
Returns
The old value
See also
Add, Decrement, Increment, Reset, Subtract

Definition at line 114 of file ThreadSafeCounter64.h.

+ Here is the caller graph for this function:

◆ Subtract()

int64 FThreadSafeCounter64::Subtract ( int64 Amount)
inline

Subtracts an amount and returns the old value.

Parameters
AmountAmount to decrease the counter by
Returns
the old value
See also
Add, Decrement, Increment, Reset, Set

Definition at line 102 of file ThreadSafeCounter64.h.

Member Data Documentation

◆ Counter

volatile int64 FThreadSafeCounter64::Counter
private

Thread-safe counter

Definition at line 142 of file ThreadSafeCounter64.h.


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