proxygen
folly::Data Class Reference

#include <FlatCombiningExamples.h>

Public Member Functions

 Data (size_t size)
 
uint64_t getVal ()
 
void add (uint64_t val)
 
uint64_t fetchAdd (uint64_t val)
 

Private Attributes

size_t size_
 
std::unique_ptr< Line[]> x_
 

Detailed Description

Definition at line 32 of file FlatCombiningExamples.h.

Constructor & Destructor Documentation

folly::Data::Data ( size_t  size)
inlineexplicit

Definition at line 34 of file FlatCombiningExamples.h.

References x_.

34  : size_(size) {
35  x_ = std::make_unique<Line[]>(size_);
36  }
std::unique_ptr< Line[]> x_
constexpr auto size(C const &c) -> decltype(c.size())
Definition: Access.h:45

Member Function Documentation

void folly::Data::add ( uint64_t  val)
inline

Definition at line 48 of file FlatCombiningExamples.h.

References i, uint64_t, val, and x_.

48  {
49  uint64_t oldval = x_[0].val_;
50  for (size_t i = 0; i < size_; ++i) {
51  assert(x_[i].val_ == oldval);
52  x_[i].val_ = oldval + val;
53  }
54  }
std::unique_ptr< Line[]> x_
double val
Definition: String.cpp:273
uint64_t folly::Data::fetchAdd ( uint64_t  val)
inline

Definition at line 56 of file FlatCombiningExamples.h.

References i, uint64_t, val, and x_.

56  {
57  uint64_t res = x_[0].val_;
58  for (size_t i = 0; i < size_; ++i) {
59  assert(x_[i].val_ == res);
60  x_[i].val_ += val;
61  }
62  return res;
63  }
std::unique_ptr< Line[]> x_
double val
Definition: String.cpp:273
uint64_t folly::Data::getVal ( )
inline

Definition at line 38 of file FlatCombiningExamples.h.

References i, uint64_t, val, and x_.

38  {
39  uint64_t val = x_[0].val_;
40  for (size_t i = 1; i < size_; ++i) {
41  assert(x_[i].val_ == val);
42  }
43  return val;
44  }
std::unique_ptr< Line[]> x_
double val
Definition: String.cpp:273

Member Data Documentation

size_t folly::Data::size_
private

Definition at line 66 of file FlatCombiningExamples.h.

std::unique_ptr<Line[]> folly::Data::x_
private

Definition at line 67 of file FlatCombiningExamples.h.


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