23         if (name_.length() < 2 || !std::isalpha(name_.front())) {
 
   24             throw std::invalid_argument(
 
   25                 "Invalid column name: minimum length of two and start with alpha character.");
 
   31     std::string 
name()
 const { 
return name_; }
 
   35     std::size_t 
size()
 const { 
return data_.size(); }
 
   43     std::size_t 
capacity()
 const { 
return data_.capacity(); }
 
   54     void append_null(
const std::size_t count) { append_null_internal(count); }
 
   82     [[nodiscard]] std::unique_ptr<ColumnType> 
build() {
 
   83         data_.shrink_to_fit();
 
   84         null_bitmap_.shrink_to_fit();
 
   86         if (null_count_ > 0) {
 
   89             return std::make_unique<ColumnType>(std::move(name_), std::move(data_),
 
   90                                                 std::move(null_bitmap_));
 
   94         return std::make_unique<ColumnType>(std::move(name_), std::move(data_));
 
   99     std::vector<value_type> data_{};
 
  100     std::vector<bool> null_bitmap_{};
 
  101     std::size_t null_count_ = 0;
 
  103     void append_null_internal(
const std::size_t length) {
 
  104         null_count_ += length;
 
  105         data_.insert(data_.end(), length, 
value_type{});
 
  106         null_bitmap_.insert(null_bitmap_.end(), length, 
false);
 
  110         data_.push_back(
value);
 
  111         null_bitmap_.push_back(
true);
 
Primitive data type DataTable column builder class.
Definition: column_builder.h:13
 
value_type & operator[](std::size_t index)
Gets the column value at a given index, no boundary checks.
Definition: column_builder.h:71
 
value_type operator[](std::size_t index) const
Gets the column value at a given index, no boundary checks.
Definition: column_builder.h:66
 
void append_null(const std::size_t count)
Append multiple null values.
Definition: column_builder.h:54
 
std::unique_ptr< ColumnType > build()
Builds the column with current data.
Definition: column_builder.h:82
 
std::size_t size() const
Gets the column data size.
Definition: column_builder.h:35
 
std::size_t null_count() const
Gets the number of null values in the column data.
Definition: column_builder.h:39
 
PrimitiveDataTableColumnBuilder(std::string name)
Initialise a new instance of the PrimitiveDataTableColumnBuilder class.
Definition: column_builder.h:22
 
std::string name() const
Gets the column name.
Definition: column_builder.h:31
 
void reserve(std::size_t capacity)
Reserve builder storage capacity.
Definition: column_builder.h:47
 
void append_null()
Append a single null value.
Definition: column_builder.h:50
 
void append(const value_type value)
Definition: column_builder.h:56
 
typename ColumnType::value_type value_type
Definition: column_builder.h:16
 
value_type value(std::size_t index) const
Gets the column value at a given index, no boundary checks.
Definition: column_builder.h:61
 
std::size_t capacity() const
Gets the builder data capacity.
Definition: column_builder.h:43
 
void reset()
Resets the column builder data.
Definition: column_builder.h:74
 
PrimitiveDataTableColumnBuilder()=delete
 
Top-level namespace for Health-GPS Core C++ API.
Definition: analysis.h:7