3#ifndef AWKWARD_LAYOUTBUILDER_H_
4#define AWKWARD_LAYOUTBUILDER_H_
18#define AWKWARD_LAYOUTBUILDER_DEFAULT_OPTIONS awkward::BuilderOptions(1024, 1)
22 namespace LayoutBuilder {
31 template <std::
size_t ENUM,
typename BUILDER>
39 return std::to_string(
index);
54 template <
typename PRIMITIVE>
87 extend(PRIMITIVE* ptr,
size_t size)
noexcept {
88 data_.extend(ptr, size);
87 extend(PRIMITIVE* ptr,
size_t size)
noexcept {
…}
100 parameters_ = parameter;
119 return data_.length();
132 names_nbytes[
"node" + std::to_string(id_) +
"-data"] = data_.nbytes();
141 to_buffers(std::map<std::string, void*>& buffers)
const noexcept {
142 data_.concatenate(
reinterpret_cast<PRIMITIVE*
>(
143 buffers[
"node" + std::to_string(id_) +
"-data"]));
141 to_buffers(std::map<std::string, void*>& buffers)
const noexcept {
…}
150 to_buffer(
void* buffer,
const char* name)
const noexcept {
151 if (std::string(name) == std::string(
"node" + std::to_string(id_) +
"-data")) {
152 data_.concatenate(
reinterpret_cast<PRIMITIVE*
>(buffer));
162 data_.concatenate(
reinterpret_cast<PRIMITIVE*
>(
163 buffers[
"node" + std::to_string(id_) +
"-data"]));
170 std::stringstream form_key;
171 form_key <<
"node" << id_;
173 std::string params(
"");
174 if (parameters_ ==
"") {
176 params = std::string(
", \"parameters\": { " + parameters_ +
" }");
179 if (std::is_arithmetic<PRIMITIVE>::value) {
180 return "{ \"class\": \"NumpyArray\", \"primitive\": \"" +
181 type_to_name<PRIMITIVE>() +
"\"" + params +
182 ", \"form_key\": \"" + form_key.str() +
"\" }";
184 return "{ \"class\": \"NumpyArray\", \"primitive\": \"" +
185 type_to_name<PRIMITIVE>() +
"\"" + params +
186 ", \"form_key\": \"" + form_key.str() +
"\" }";
188 throw std::runtime_error(
"type " +
189 std::string(
typeid(PRIMITIVE).name()) +
199 std::string parameters_;
219 template <
typename PRIMITIVE,
typename BUILDER>
260 offsets_.append(content_.length());
272 parameters_ = parameter;
294 return offsets_.length() - 1;
300 if ((int64_t)content_.length() != (int64_t)offsets_.last()) {
301 std::stringstream out;
302 out <<
"ListOffset node" << id_ <<
"has content length "
303 << content_.length() <<
"but last offset " << offsets_.last()
305 error.append(out.str());
309 return content_.is_valid(error);
318 names_nbytes[
"node" + std::to_string(id_) +
"-offsets"] =
320 content_.buffer_nbytes(names_nbytes);
329 to_buffers(std::map<std::string, void*>& buffers)
const noexcept {
330 offsets_.concatenate(
reinterpret_cast<PRIMITIVE*
>(
331 buffers[
"node" + std::to_string(id_) +
"-offsets"]));
332 content_.to_buffers(buffers);
329 to_buffers(std::map<std::string, void*>& buffers)
const noexcept {
…}
340 to_buffer(
void* buffer,
const char* name)
const noexcept {
341 if (std::string(name) == std::string(
"node" + std::to_string(id_) +
"-offsets")) {
342 offsets_.concatenate(
reinterpret_cast<PRIMITIVE*
>(buffer));
344 content_.to_buffer(buffer, name);
353 offsets_.concatenate(
reinterpret_cast<PRIMITIVE*
>(
354 buffers[
"node" + std::to_string(id_) +
"-offsets"]));
355 content_.to_char_buffers(buffers);
362 std::stringstream form_key;
363 form_key <<
"node" << id_;
364 std::string params(
"");
365 if (parameters_ ==
"") {
367 params = std::string(
", \"parameters\": { " + parameters_ +
" }");
369 return "{ \"class\": \"ListOffsetArray\", \"offsets\": \"" +
370 type_to_numpy_like<PRIMITIVE>() +
371 "\", \"content\": " + content_.form() + params +
372 ", \"form_key\": \"" + form_key.str() +
"\" }";
385 std::string parameters_;
443 return "{ \"class\": \"EmptyArray\" }";
461 template <
class MAP = std::map<std::
size_t, std::
string>,
462 typename... BUILDERS>
468 template <std::
size_t INDEX>
475 map_fields(std::index_sequence_for<BUILDERS...>());
485 : content_names_(user_defined_field_id_to_name_map) {
486 assert(content_names_.size() == fields_count_);
492 const std::vector<std::string>
494 if (content_names_.empty()) {
497 std::vector<std::string> result;
498 for (
auto it : content_names_) {
499 result.emplace_back(it.second);
511 content_names_ = user_defined_field_id_to_name_map;
515 template <std::
size_t INDEX>
516 typename RecordFieldType<INDEX>::Builder&
518 return std::get<INDEX>(
contents).builder;
530 parameters_ = parameter;
538 for (
size_t i = 0; i < fields_count_; i++) {
551 for (
size_t i = 0; i < fields_count_; i++) {
561 return (std::get<0>(
contents).builder.length());
567 auto index_sequence((std::index_sequence_for<BUILDERS...>()));
570 std::vector<size_t> lengths = field_lengths(index_sequence);
571 for (
size_t i = 0; i < lengths.size(); i++) {
575 else if (
length != (int64_t)lengths[i]) {
576 std::stringstream out;
577 out <<
"Record node" << id_ <<
" has field \""
578 <<
fields().at(i) <<
"\" length " << lengths[i]
579 <<
" that differs from the first length " <<
length <<
"\n";
580 error.append(out.str());
586 std::vector<bool> valid_fields = field_is_valid(index_sequence, error);
587 return std::none_of(std::cbegin(valid_fields),
588 std::cend(valid_fields),
589 std::logical_not<bool>());
597 for (
size_t i = 0; i < fields_count_; i++) {
599 content.builder.buffer_nbytes(names_nbytes);
610 to_buffers(std::map<std::string, void*>& buffers)
const noexcept {
611 for (
size_t i = 0; i < fields_count_; i++) {
610 to_buffers(std::map<std::string, void*>& buffers)
const noexcept {
…}
622 to_buffer(
void* buffer,
const char* name)
const noexcept {
623 for (
size_t i = 0; i < fields_count_; i++) {
625 content.builder.to_buffer(buffer, name);
636 for (
size_t i = 0; i < fields_count_; i++) {
638 content.builder.to_char_buffers(buffers);
647 std::stringstream form_key;
648 form_key <<
"node" << id_;
649 std::string params(
"");
650 if (parameters_ ==
"") {
652 params = std::string(
"\"parameters\": { " + parameters_ +
" }, ");
654 std::stringstream out;
655 out <<
"{ \"class\": \"RecordArray\", \"contents\": { ";
656 for (
size_t i = 0; i < fields_count_; i++) {
660 auto contents_form = [&](
auto&
content) {
662 << (!content_names_.empty() ? content_names_.at(
content.
index)
670 out << params <<
"\"form_key\": \"" << form_key.str() <<
"\" }";
680 template <std::size_t... S>
682 map_fields(std::index_sequence<S...>)
noexcept {
683 fields_ = std::vector<std::string>(
684 {std::string(std::get<S>(
contents).index_as_field())...});
689 template <std::size_t... S>
691 field_lengths(std::index_sequence<S...>)
const noexcept {
692 return std::vector<size_t>({std::get<S>(
contents).builder.length()...});
696 template <std::size_t... S>
698 field_is_valid(std::index_sequence<S...>, std::string& error)
const
700 return std::vector<bool>(
701 {std::get<S>(
contents).builder.is_valid(error)...});
705 std::vector<std::string> fields_;
711 std::string parameters_;
717 static constexpr size_t fields_count_ =
sizeof...(BUILDERS);
726 template <
typename... BUILDERS>
728 using TupleContents =
typename std::tuple<BUILDERS...>;
730 template <std::
size_t INDEX>
731 using TupleContentType = std::tuple_element_t<INDEX, TupleContents>;
741 template <std::
size_t INDEX>
742 TupleContentType<INDEX>&
756 parameters_ = parameter;
764 for (
size_t i = 0; i < fields_count_; i++) {
776 for (
size_t i = 0; i < fields_count_; i++) {
792 auto index_sequence((std::index_sequence_for<BUILDERS...>()));
795 std::vector<size_t> lengths = content_lengths(index_sequence);
796 for (
size_t i = 0; i < lengths.size(); i++) {
798 length = (int64_t)lengths[i];
800 else if (
length != (int64_t)lengths[i]) {
801 std::stringstream out;
802 out <<
"Record node" << id_ <<
" has index \"" << i <<
"\" length "
803 << lengths[i] <<
" that differs from the first length "
805 error.append(out.str());
811 std::vector<bool> valid_fields =
812 content_is_valid(index_sequence, error);
813 return std::none_of(std::cbegin(valid_fields),
814 std::cend(valid_fields),
815 std::logical_not<bool>());
823 for (
size_t i = 0; i < fields_count_; i++) {
825 content.buffer_nbytes(names_nbytes);
836 to_buffers(std::map<std::string, void*>& buffers)
const noexcept {
837 for (
size_t i = 0; i < fields_count_; i++) {
836 to_buffers(std::map<std::string, void*>& buffers)
const noexcept {
…}
848 to_buffer(
void* buffer,
const char* name)
const noexcept {
849 for (
size_t i = 0; i < fields_count_; i++) {
851 content.to_buffer(buffer, name);
862 for (
size_t i = 0; i < fields_count_; i++) {
864 content.to_char_buffers(buffers);
873 std::stringstream form_key;
874 form_key <<
"node" << id_;
875 std::string params(
"");
876 if (parameters_ ==
"") {
878 params = std::string(
"\"parameters\": { " + parameters_ +
" }, ");
880 std::stringstream out;
881 out <<
"{ \"class\": \"RecordArray\", \"contents\": [";
882 for (
size_t i = 0; i < fields_count_; i++) {
886 auto contents_form = [&out](
auto&
content) {
892 out << params <<
"\"form_key\": \"" << form_key.str() <<
"\" }";
902 template <std::size_t... S>
904 content_lengths(std::index_sequence<S...>)
const noexcept {
905 return std::vector<size_t>({std::get<S>(
contents).length()...});
909 template <std::size_t... S>
911 content_is_valid(std::index_sequence<S...>, std::string& error)
const
913 return std::vector<bool>({std::get<S>(
contents).is_valid(error)...});
917 std::vector<int64_t> field_index_;
920 std::string parameters_;
926 static constexpr size_t fields_count_ =
sizeof...(BUILDERS);
942 template <
unsigned SIZE,
typename BUILDER>
979 parameters_ = parameter;
1006 if (content_.length() != length_ * size_) {
1007 std::stringstream out;
1008 out <<
"Regular node" << id_ <<
"has content length "
1009 << content_.length() <<
", but length " << length_ <<
" and size "
1011 error.append(out.str());
1015 return content_.is_valid(error);
1024 content_.buffer_nbytes(names_nbytes);
1033 to_buffers(std::map<std::string, void*>& buffers)
const noexcept {
1034 content_.to_buffers(buffers);
1042 content_.to_buffer(buffer, name);
1051 content_.to_char_buffers(buffers);
1058 std::stringstream form_key;
1059 form_key <<
"node" << id_;
1060 std::string params(
"");
1061 if (parameters_ ==
"") {
1063 params = std::string(
", \"parameters\": { " + parameters_ +
" }");
1065 return "{ \"class\": \"RegularArray\", \"content\": " +
1066 content_.form() +
", \"size\": " + std::to_string(size_) +
1067 params +
", \"form_key\": \"" + form_key.str() +
"\" }";
1075 std::string parameters_;
1084 size_t size_ = SIZE;
1098 template <
typename PRIMITIVE,
typename BUILDER>
1133 last_valid_ = content_.length();
1134 index_.append(last_valid_);
1144 size_t start = content_.length();
1145 size_t stop = start + size;
1146 last_valid_ = stop - 1;
1147 for (
size_t i = start; i < stop; i++) {
1164 for (
size_t i = 0; i < size; i++) {
1178 parameters_ = parameter;
1186 content_.set_id(
id);
1201 return index_.length();
1207 if (content_.length() != last_valid_ + 1) {
1208 std::stringstream out;
1209 out <<
"IndexedOption node" << id_ <<
" has content length "
1210 << content_.length() <<
" but last valid index is " << last_valid_
1212 error.append(out.str());
1216 return content_.is_valid(error);
1225 names_nbytes[
"node" + std::to_string(id_) +
"-index"] = index_.nbytes();
1226 content_.buffer_nbytes(names_nbytes);
1235 to_buffers(std::map<std::string, void*>& buffers)
const noexcept {
1236 index_.concatenate(
reinterpret_cast<PRIMITIVE*
>(
1237 buffers[
"node" + std::to_string(id_) +
"-index"]));
1238 content_.to_buffers(buffers);
1247 if (std::string(name) == std::string(
"node" + std::to_string(id_) +
"-index")) {
1248 index_.concatenate(
reinterpret_cast<PRIMITIVE*
>(buffer));
1250 content_.to_buffer(buffer, name);
1259 index_.concatenate(
reinterpret_cast<PRIMITIVE*
>(
1260 buffers[
"node" + std::to_string(id_) +
"-index"]));
1261 content_.to_char_buffers(buffers);
1268 std::stringstream form_key;
1269 form_key <<
"node" << id_;
1270 std::string params(
"");
1271 if (parameters_ ==
"") {
1273 params = std::string(
", \"parameters\": { " + parameters_ +
" }");
1275 return "{ \"class\": \"IndexedOptionArray\", \"index\": \"" +
1276 type_to_numpy_like<PRIMITIVE>() +
1277 "\", \"content\": " + content_.form() + params +
1278 ", \"form_key\": \"" + form_key.str() +
"\" }";
1291 std::string parameters_;
1311 template <
typename BUILDER>
1335 parameters_ = parameter;
1343 content_.set_id(
id);
1355 return content_.length();
1361 return content_.is_valid(error);
1369 content_.buffer_nbytes(names_nbytes);
1378 to_buffers(std::map<std::string, void*>& buffers)
const noexcept {
1379 content_.to_buffers(buffers);
1387 content_.to_buffer(buffer, name);
1396 content_.to_char_buffers(buffers);
1403 std::stringstream form_key;
1404 form_key <<
"node" << id_;
1405 std::string params(
"");
1406 if (parameters_ ==
"") {
1408 params = std::string(
", \"parameters\": { " + parameters_ +
" }");
1410 return "{ \"class\": \"UnmaskedArray\", \"content\": " +
1411 content_.form() + params +
", \"form_key\": \"" +
1412 form_key.str() +
"\" }";
1420 std::string parameters_;
1442 template <
bool VALID_WHEN,
typename BUILDER>
1481 mask_.
append(valid_when_);
1492 for (
size_t i = 0; i < size; i++) {
1493 mask_.
append(valid_when_);
1503 mask_.
append(!valid_when_);
1514 for (
size_t i = 0; i < size; i++) {
1515 mask_.
append(!valid_when_);
1529 parameters_ = parameter;
1537 content_.set_id(
id);
1557 if (content_.length() != mask_.
length()) {
1558 std::stringstream out;
1559 out <<
"ByteMasked node" << id_ <<
"has content length "
1560 << content_.length() <<
"but mask length " << mask_.
length()
1562 error.append(out.str());
1566 return content_.is_valid(error);
1575 names_nbytes[
"node" + std::to_string(id_) +
"-mask"] = mask_.
nbytes();
1576 content_.buffer_nbytes(names_nbytes);
1585 to_buffers(std::map<std::string, void*>& buffers)
const noexcept {
1587 buffers[
"node" + std::to_string(id_) +
"-mask"]));
1588 content_.to_buffers(buffers);
1597 if (std::string(name) == std::string(
"node" + std::to_string(id_) +
"-mask")) {
1598 mask_.
concatenate(
reinterpret_cast<int8_t*
>(buffer));
1600 content_.to_buffer(buffer, name);
1610 buffers[
"node" + std::to_string(id_) +
"-mask"]));
1611 content_.to_char_buffers(buffers);
1618 std::stringstream form_key, form_valid_when;
1619 form_key <<
"node" << id_;
1620 form_valid_when << std::boolalpha << valid_when_;
1621 std::string params(
"");
1622 if (parameters_ ==
"") {
1624 params = std::string(
", \"parameters\": { " + parameters_ +
" }");
1626 return "{ \"class\": \"ByteMaskedArray\", \"mask\": \"i8\", "
1628 content_.form() +
", \"valid_when\": " + form_valid_when.str() +
1629 params +
", \"form_key\": \"" + form_key.str() +
"\" }";
1642 std::string parameters_;
1648 bool valid_when_ = VALID_WHEN;
1667 template <
bool VALID_WHEN,
bool LSB_ORDER,
typename BUILDER>
1674 current_byte_(uint8_t(0)),
1675 current_byte_ref_(mask_.append_and_get_ref(current_byte_)),
1680 for (
size_t i = 0; i < 8; i++) {
1684 for (
size_t i = 0; i < 8; i++) {
1685 cast_[i] = 128 >> i;
1697 current_byte_(uint8_t(0)),
1698 current_byte_ref_(mask_.append_and_get_ref(current_byte_)),
1703 for (
size_t i = 0; i < 8; i++) {
1707 for (
size_t i = 0; i < 8; i++) {
1708 cast_[i] = 128 >> i;
1739 current_byte_ |= cast_[current_index_];
1752 for (
size_t i = 0; i < size; i++) {
1775 for (
size_t i = 0; i < size; i++) {
1790 parameters_ = parameter;
1798 content_.set_id(
id);
1815 return mask_.
length() > 0 ?
1816 (mask_.
length() - 1) * 8 + current_index_ : current_index_;
1822 if (content_.length() !=
length()) {
1823 std::stringstream out;
1824 out <<
"BitMasked node" << id_ <<
"has content length "
1825 << content_.length() <<
"but bit mask length " << mask_.
length()
1827 error.append(out.str());
1831 return content_.is_valid(error);
1840 names_nbytes[
"node" + std::to_string(id_) +
"-mask"] = mask_.
nbytes();
1841 content_.buffer_nbytes(names_nbytes);
1850 to_buffers(std::map<std::string, void*>& buffers)
const noexcept {
1852 buffers[
"node" + std::to_string(id_) +
"-mask"]), 0, 1);
1853 mask_.
append(
reinterpret_cast<uint8_t*
>(
1854 buffers[
"node" + std::to_string(id_) +
"-mask"]), mask_.
length() - 1, 0, 1);
1855 content_.to_buffers(buffers);
1864 if (std::string(name) == std::string(
"node" + std::to_string(id_) +
"-mask")) {
1866 mask_.
append(
reinterpret_cast<uint8_t*
>(buffer), mask_.
length() - 1, 0, 1);
1868 content_.to_buffer(buffer, name);
1878 buffers[
"node" + std::to_string(id_) +
"-mask"]), 0, 1);
1879 mask_.
append(
reinterpret_cast<uint8_t*
>(
1880 buffers[
"node" + std::to_string(id_) +
"-mask"]), mask_.
length() - 1, 0, 1);
1881 content_.to_char_buffers(buffers);
1888 std::stringstream form_key, form_valid_when, form_lsb_order;
1889 form_key <<
"node" << id_;
1890 form_valid_when << std::boolalpha << valid_when_;
1891 form_lsb_order << std::boolalpha << lsb_order_;
1892 std::string params(
"");
1893 if (parameters_ ==
"") {
1895 params = std::string(
", \"parameters\": { " + parameters_ +
" }");
1897 return "{ \"class\": \"BitMaskedArray\", \"mask\": \"u8\", "
1899 content_.form() +
", \"valid_when\": " + form_valid_when.str() +
1900 ", \"lsb_order\": " + form_lsb_order.str() + params +
1901 ", \"form_key\": \"" + form_key.str() +
"\" }";
1910 if (current_index_ == 8) {
1912 current_byte_ = uint8_t(0);
1924 current_index_ += 1;
1926 current_byte_ref_ = current_byte_;
1928 current_byte_ref_ = ~current_byte_;
1935 GrowableBuffer<uint8_t> mask_;
1941 std::string parameters_;
1947 uint8_t current_byte_;
1950 uint8_t& current_byte_ref_;
1953 size_t current_index_;
1959 bool valid_when_ = VALID_WHEN;
1963 bool lsb_order_ = LSB_ORDER;
1981 template <
typename TAGS,
typename INDEX,
typename... BUILDERS>
1986 template <std::
size_t I>
1996 for (
size_t i = 0; i < contents_count_; i++) {
1997 last_valid_index_[i] = -1;
2011 for (
size_t i = 0; i < contents_count_; i++) {
2012 last_valid_index_[i] = -1;
2016 template <std::
size_t I>
2019 return std::get<I>(contents_);
2024 template <std::
size_t TAG>
2027 auto& which_content = std::get<TAG>(contents_);
2028 INDEX next_index = which_content.length();
2030 TAGS tag = (TAGS)TAG;
2031 last_valid_index_[tag] = next_index;
2033 index_.
append(next_index);
2035 return which_content;
2047 parameters_ = parameter;
2055 auto contents_id = [&id](
auto&
content) {
2058 for (
size_t i = 0; i < contents_count_; i++) {
2059 visit_at(contents_, i, contents_id);
2069 for (
size_t i = 0; i < contents_count_; i++) {
2070 last_valid_index_[i] = -1;
2074 auto clear_contents = [](
auto&
content) {
2077 for (
size_t i = 0; i < contents_count_; i++) {
2078 visit_at(contents_, i, clear_contents);
2091 auto index_sequence((std::index_sequence_for<BUILDERS...>()));
2093 std::vector<size_t> lengths = content_lengths(index_sequence);
2094 for (
size_t tag = 0; tag < contents_count_; tag++) {
2095 if (lengths[tag] != last_valid_index_[tag] + 1) {
2096 std::stringstream out;
2097 out <<
"Union node" << id_ <<
" has content length " << lengths[tag]
2098 <<
" but index length " << last_valid_index_[tag] <<
"\n";
2099 error.append(out.str());
2105 std::vector<bool> valid_contents =
2106 content_is_valid(index_sequence, error);
2107 return std::none_of(std::cbegin(valid_contents),
2108 std::cend(valid_contents),
2109 std::logical_not<bool>());
2117 auto index_sequence((std::index_sequence_for<BUILDERS...>()));
2119 names_nbytes[
"node" + std::to_string(id_) +
"-tags"] = tags_.
nbytes();
2120 names_nbytes[
"node" + std::to_string(id_) +
"-index"] = index_.
nbytes();
2122 for (
size_t i = 0; i < contents_count_; i++) {
2124 content.buffer_nbytes(names_nbytes);
2135 to_buffers(std::map<std::string, void*>& buffers)
const noexcept {
2136 auto index_sequence((std::index_sequence_for<BUILDERS...>()));
2139 buffers[
"node" + std::to_string(id_) +
"-tags"]));
2141 buffers[
"node" + std::to_string(id_) +
"-index"]));
2143 for (
size_t i = 0; i < contents_count_; i++) {
2156 auto index_sequence((std::index_sequence_for<BUILDERS...>()));
2158 if (std::string(name) == std::string(
"node" + std::to_string(id_) +
"-tags")) {
2159 tags_.
concatenate(
reinterpret_cast<TAGS*
>(buffer));
2161 else if (std::string(name) == std::string(
"node" + std::to_string(id_) +
"-index")) {
2162 index_.
concatenate(
reinterpret_cast<INDEX*
>(buffer));
2165 for (
size_t i = 0; i < contents_count_; i++) {
2167 content.to_buffer(buffer, name);
2178 auto index_sequence((std::index_sequence_for<BUILDERS...>()));
2181 buffers[
"node" + std::to_string(id_) +
"-tags"]));
2183 buffers[
"node" + std::to_string(id_) +
"-index"]));
2185 for (
size_t i = 0; i < contents_count_; i++) {
2187 content.to_char_buffers(buffers);
2196 std::stringstream form_key;
2197 form_key <<
"node" << id_;
2198 std::string params(
"");
2199 if (parameters_ ==
"") {
2201 params = std::string(
", \"parameters\": { " + parameters_ +
" }");
2203 std::stringstream out;
2204 out <<
"{ \"class\": \"UnionArray\", \"tags\": \"" +
2205 type_to_numpy_like<TAGS>() +
"\", \"index\": \"" +
2206 type_to_numpy_like<INDEX>() +
"\", \"contents\": [";
2207 for (
size_t i = 0; i < contents_count_; i++) {
2211 auto contents_form = [&](
auto&
content) {
2214 visit_at(contents_, i, contents_form);
2217 out << params <<
"\"form_key\": \"" << form_key.str() <<
"\" }";
2224 template <std::size_t... S>
2226 content_lengths(std::index_sequence<S...>)
const {
2227 return std::vector<size_t>({std::get<S>(contents_).length()...});
2231 template <std::size_t... S>
2233 content_is_valid(std::index_sequence<S...>, std::string& error)
const {
2234 return std::vector<bool>({std::get<S>(contents_).is_valid(error)...});
2240 GrowableBuffer<TAGS> tags_;
2245 GrowableBuffer<INDEX> index_;
2251 std::string parameters_;
2257 size_t last_valid_index_[
sizeof...(BUILDERS)];
2260 static constexpr size_t contents_count_ =
sizeof...(BUILDERS);
22 namespace LayoutBuilder {
…}
#define AWKWARD_LAYOUTBUILDER_DEFAULT_OPTIONS
Object of BuilderOptions which sets the values of the default options.
Definition LayoutBuilder.h:18
virtual const std::string to_buffers(BuffersContainer &container, int64_t &form_key_id) const =0
Copy the current snapshot into the BuffersContainer and return a Form as a std::string (JSON).
virtual void clear()=0
Removes all accumulated data without resetting the type knowledge.
virtual const BuilderPtr index(int64_t index)=0
Sets the pointer to a given tuple field index; the next command will fill that slot.
Discontiguous, one-dimensional buffer (which consists of multiple contiguous, one-dimensional panels)...
Definition GrowableBuffer.h:233
void concatenate_from(PRIMITIVE *external_pointer, size_t to, size_t from) const noexcept
Copies and concatenates all accumulated data from multiple panels to one contiguously allocated exter...
Definition GrowableBuffer.h:517
size_t nbytes() const
Currently used number of bytes.
Definition GrowableBuffer.h:440
void concatenate(PRIMITIVE *external_pointer) const noexcept
Copies and concatenates all accumulated data from multiple panels to one contiguously allocated exter...
Definition GrowableBuffer.h:492
PRIMITIVE & append_and_get_ref(PRIMITIVE datum)
Like append, but the type signature returns the reference to PRIMITIVE.
Definition GrowableBuffer.h:484
size_t length() const
Currently used number of elements.
Definition GrowableBuffer.h:408
void append(PRIMITIVE datum)
Inserts one datum into the panel, possibly triggering allocation of a new panel.
Definition GrowableBuffer.h:450
void clear()
Discards accumulated data, the #reserved returns to options.initial(), and a new #ptr is allocated.
Definition GrowableBuffer.h:421
Builds a BitMaskedArray in which mask values are packed into a bitmap.
Definition LayoutBuilder.h:1668
bool valid_when() const noexcept
Determines when the builder content are valid.
Definition LayoutBuilder.h:1721
void clear() noexcept
Discards the accumulated mask and clears the content of the builder.
Definition LayoutBuilder.h:1804
bool lsb_order() const noexcept
Determines whether the position of each bit is in Least-Significant Bit order (LSB) or not.
Definition LayoutBuilder.h:1728
BUILDER & append_invalid() noexcept
Sets current_byte_ and cast_ default to null, no change in current_byte_.
Definition LayoutBuilder.h:1762
BUILDER & extend_valid(size_t size) noexcept
Sets size number of bits in the mask. If current_byte_ and cast_: 0 indicates null,...
Definition LayoutBuilder.h:1751
std::string form() const noexcept
Generates a unique description of the builder and its contents in the form of a JSON-like string.
Definition LayoutBuilder.h:1887
const std::string & parameters() const noexcept
Parameters for the builder form.
Definition LayoutBuilder.h:1783
void set_parameters(std::string parameter) noexcept
Sets the form parameters.
Definition LayoutBuilder.h:1789
BUILDER & content() noexcept
Returns the reference to the builder content.
Definition LayoutBuilder.h:1715
size_t length() const noexcept
Current length of the mask buffer.
Definition LayoutBuilder.h:1814
void to_char_buffers(std::map< std::string, uint8_t * > &buffers) const noexcept
Copies and concatenates all the accumulated data in the builder to a map of user-allocated buffers.
Definition LayoutBuilder.h:1876
void set_id(size_t &id) noexcept
Assigns a unique ID to each node.
Definition LayoutBuilder.h:1795
bool is_valid(std::string &error) const noexcept
Checks for validity and consistency.
Definition LayoutBuilder.h:1821
BitMasked(const awkward::BuilderOptions &options)
Creates a new BitMasked layout builder by allocating a new mask buffer, taking options from BuilderOp...
Definition LayoutBuilder.h:1695
BUILDER & append_valid() noexcept
Sets a bit in the mask. If current_byte_ and cast_: 0 indicates null, 1 indicates valid and vice vers...
Definition LayoutBuilder.h:1737
void buffer_nbytes(std::map< std::string, size_t > &names_nbytes) const noexcept
Retrieves the names and sizes (in bytes) of the buffers used in the builder and its contents.
Definition LayoutBuilder.h:1838
BUILDER & extend_invalid(size_t size) noexcept
Sets current_byte_ and cast_ default to null, no change in current_byte_.
Definition LayoutBuilder.h:1774
void to_buffer(void *buffer, const char *name) const noexcept
Copies and concatenates the accumulated data in the builder buffer to a user-defined pointer if the g...
Definition LayoutBuilder.h:1863
BitMasked()
Creates a new BitMasked layout builder by allocating a new mask buffer, using AWKWARD_LAYOUTBUILDER_D...
Definition LayoutBuilder.h:1672
void to_buffers(std::map< std::string, void * > &buffers) const noexcept
Copies and concatenates all the accumulated data in each of the buffers of the builder and its conten...
Definition LayoutBuilder.h:1850
Builds a ByteMaskedArray using a mask which is an array of booleans that determines whether the corre...
Definition LayoutBuilder.h:1443
bool valid_when() const noexcept
Determines when the builder content are valid.
Definition LayoutBuilder.h:1472
void clear() noexcept
Discards the accumulated mask and clears the content of the builder.
Definition LayoutBuilder.h:1543
BUILDER & append_invalid() noexcept
Inserts !valid_when in the mask.
Definition LayoutBuilder.h:1502
BUILDER & extend_valid(size_t size) noexcept
Inserts size number of valid_when in the mask.
Definition LayoutBuilder.h:1491
std::string form() const noexcept
Generates a unique description of the builder and its contents in the form of a JSON-like string.
Definition LayoutBuilder.h:1617
const std::string & parameters() const noexcept
Parameters for the builder form.
Definition LayoutBuilder.h:1522
ByteMasked()
Creates a new ByteMasked layout builder by allocating a new mask buffer, using AWKWARD_LAYOUTBUILDER_...
Definition LayoutBuilder.h:1447
void set_parameters(std::string parameter) noexcept
Sets the form parameters.
Definition LayoutBuilder.h:1528
BUILDER & content() noexcept
Returns the reference to the builder content.
Definition LayoutBuilder.h:1466
ByteMasked(const awkward::BuilderOptions &options)
Creates a new ByteMasked layout builder by allocating a new mask buffer, taking options from BuilderO...
Definition LayoutBuilder.h:1458
size_t length() const noexcept
Current length of the mask buffer.
Definition LayoutBuilder.h:1550
void to_char_buffers(std::map< std::string, uint8_t * > &buffers) const noexcept
Copies and concatenates all the accumulated data in the builder to a map of user-allocated buffers.
Definition LayoutBuilder.h:1608
void set_id(size_t &id) noexcept
Assigns a unique ID to each node.
Definition LayoutBuilder.h:1534
bool is_valid(std::string &error) const noexcept
Checks for validity and consistency.
Definition LayoutBuilder.h:1556
BUILDER & append_valid() noexcept
Inserts valid_when in the mask.
Definition LayoutBuilder.h:1480
void buffer_nbytes(std::map< std::string, size_t > &names_nbytes) const noexcept
Retrieves the names and sizes (in bytes) of the buffers used in the builder and its contents.
Definition LayoutBuilder.h:1573
BUILDER & extend_invalid(size_t size) noexcept
Inserts size number of !valid_when in the mask.
Definition LayoutBuilder.h:1513
void to_buffer(void *buffer, const char *name) const noexcept
Copies and concatenates the accumulated data in the builder buffer to a user-defined pointer if the g...
Definition LayoutBuilder.h:1596
void to_buffers(std::map< std::string, void * > &buffers) const noexcept
Copies and concatenates all the accumulated data in each of the buffers of the builder and its conten...
Definition LayoutBuilder.h:1585
Builds an EmptyArray which has no content in it. It is used whenever an array's type is not known bec...
Definition LayoutBuilder.h:396
void clear() noexcept
Definition LayoutBuilder.h:408
bool is_valid(std::string &) const noexcept
Checks for validity and consistency.
Definition LayoutBuilder.h:418
std::string form() const noexcept
Generates a unique description of the builder and its contents in the form of a JSON-like string.
Definition LayoutBuilder.h:442
void to_buffers(std::map< std::string, void * > &) const noexcept
Definition LayoutBuilder.h:427
void to_buffer(void *, const char *) const noexcept
Definition LayoutBuilder.h:430
Empty()
Creates a new Empty layout builder.
Definition LayoutBuilder.h:399
void set_id(size_t &) noexcept
Definition LayoutBuilder.h:405
size_t length() const noexcept
Current length of the content.
Definition LayoutBuilder.h:412
void buffer_nbytes(std::map< std::string, size_t > &) const noexcept
Definition LayoutBuilder.h:423
void to_char_buffers(std::map< std::string, uint8_t * > &) const noexcept
Copies and concatenates all the accumulated data in the builder to a map of user-allocated buffers.
Definition LayoutBuilder.h:437
Helper class for sending a pair of field names (as enum) and field type as template parameters in Rec...
Definition LayoutBuilder.h:32
std::string index_as_field() const
Converts index as field string.
Definition LayoutBuilder.h:38
BUILDER Builder
Definition LayoutBuilder.h:34
const std::size_t index
The index of a Record field.
Definition LayoutBuilder.h:43
Builder builder
The content type of field in a Record.
Definition LayoutBuilder.h:45
Builds an IndexedOptionArray which consists of an index buffer. The negative values in the index are ...
Definition LayoutBuilder.h:1099
void clear() noexcept
Discards the accumulated index and clears the content of the builder. Also, last valid returns to -1.
Definition LayoutBuilder.h:1192
void extend_invalid(size_t size) noexcept
Inserts -1 in the index buffer size number of times.
Definition LayoutBuilder.h:1163
BUILDER & extend_valid(size_t size) noexcept
Inserts size number of valid index in the index buffer and returns the reference to the builder conte...
Definition LayoutBuilder.h:1143
std::string form() const noexcept
Generates a unique description of the builder and its contents in the form of a JSON-like string.
Definition LayoutBuilder.h:1267
const std::string & parameters() const noexcept
Parameters for the builder form.
Definition LayoutBuilder.h:1171
void set_parameters(std::string parameter) noexcept
Sets the form parameters.
Definition LayoutBuilder.h:1177
IndexedOption(const awkward::BuilderOptions &options)
Creates a new IndexedOption layout builder by allocating a new index buffer, taking options from Buil...
Definition LayoutBuilder.h:1116
BUILDER & content() noexcept
Returns the reference to the builder content.
Definition LayoutBuilder.h:1125
size_t length() const noexcept
Current length of the index buffer.
Definition LayoutBuilder.h:1200
void to_char_buffers(std::map< std::string, uint8_t * > &buffers) const noexcept
Copies and concatenates all the accumulated data in the builder to a map of user-allocated buffers.
Definition LayoutBuilder.h:1258
void set_id(size_t &id) noexcept
Assigns a unique ID to each node.
Definition LayoutBuilder.h:1183
bool is_valid(std::string &error) const noexcept
Checks for validity and consistency.
Definition LayoutBuilder.h:1206
IndexedOption()
Creates a new IndexedOption layout builder by allocating a new index buffer, using AWKWARD_LAYOUTBUIL...
Definition LayoutBuilder.h:1103
BUILDER & append_valid() noexcept
Inserts the last valid index in the index buffer and returns the reference to the builder content.
Definition LayoutBuilder.h:1132
void buffer_nbytes(std::map< std::string, size_t > &names_nbytes) const noexcept
Retrieves the names and sizes (in bytes) of the buffers used in the builder and its contents.
Definition LayoutBuilder.h:1223
void append_invalid() noexcept
Inserts -1 in the index buffer.
Definition LayoutBuilder.h:1155
void to_buffer(void *buffer, const char *name) const noexcept
Copies and concatenates the accumulated data in the builder buffer to a user-defined pointer if the g...
Definition LayoutBuilder.h:1246
void to_buffers(std::map< std::string, void * > &buffers) const noexcept
Copies and concatenates all the accumulated data in each of the buffers of the builder and its conten...
Definition LayoutBuilder.h:1235
Builds a ListOffsetArray which describes unequal-length lists (often called a "jagged" or "ragged" ar...
Definition LayoutBuilder.h:220
void clear() noexcept
Discards the accumulated offsets and clears the builder content.
Definition LayoutBuilder.h:285
BUILDER & begin_list() noexcept
Begins a list and returns the reference to the builder content.
Definition LayoutBuilder.h:252
ListOffset()
Creates a new ListOffset layout builder by allocating a new offset buffer, using AWKWARD_LAYOUTBUILDE...
Definition LayoutBuilder.h:224
std::string form() const noexcept
Generates a unique description of the builder and its contents in the form of a JSON-like string.
Definition LayoutBuilder.h:361
const std::string & parameters() const noexcept
Parameters for the builder form.
Definition LayoutBuilder.h:265
void set_parameters(std::string parameter) noexcept
Sets the form parameters.
Definition LayoutBuilder.h:271
BUILDER & content() noexcept
Returns the reference to the builder content.
Definition LayoutBuilder.h:246
size_t length() const noexcept
Current length of the content.
Definition LayoutBuilder.h:293
void to_char_buffers(std::map< std::string, uint8_t * > &buffers) const noexcept
Copies and concatenates all the accumulated data in the builder to a map of user-allocated buffers.
Definition LayoutBuilder.h:352
void set_id(size_t &id) noexcept
Assigns a unique ID to each node.
Definition LayoutBuilder.h:277
bool is_valid(std::string &error) const noexcept
Checks for validity and consistency.
Definition LayoutBuilder.h:299
void end_list() noexcept
Ends a list and appends the current length of the list contents in the offsets buffer.
Definition LayoutBuilder.h:259
void buffer_nbytes(std::map< std::string, size_t > &names_nbytes) const noexcept
Retrieves the names and sizes (in bytes) of the buffers used in the builder and its contents.
Definition LayoutBuilder.h:316
void to_buffer(void *buffer, const char *name) const noexcept
Copies and concatenates the accumulated data in the builder buffer to a user-defined pointer if the g...
Definition LayoutBuilder.h:340
ListOffset(const awkward::BuilderOptions &options)
Creates a new ListOffset layout builder by allocating a new offset buffer, taking options from Builde...
Definition LayoutBuilder.h:237
void to_buffers(std::map< std::string, void * > &buffers) const noexcept
Copies and concatenates all the accumulated data in each of the buffers of the builder and its conten...
Definition LayoutBuilder.h:329
Builds a NumpyArray which describes multi-dimensional data of PRIMITIVE type.
Definition LayoutBuilder.h:55
void clear() noexcept
Discards the accumulated data in the builder.
Definition LayoutBuilder.h:112
bool is_valid(std::string &) const noexcept
Checks for validity and consistency.
Definition LayoutBuilder.h:124
Numpy(const awkward::BuilderOptions &options)
Creates a new Numpy layout builder by allocating a new buffer, taking options from BuilderOptions for...
Definition LayoutBuilder.h:71
const std::string & parameters() const noexcept
Parameters for the builder form.
Definition LayoutBuilder.h:93
void set_parameters(std::string parameter) noexcept
Sets the form parameters.
Definition LayoutBuilder.h:99
size_t length() const noexcept
Current length of the data.
Definition LayoutBuilder.h:118
void to_char_buffers(std::map< std::string, uint8_t * > &buffers) const noexcept
Copies and concatenates all the accumulated data in the builder to a map of user-allocated buffers.
Definition LayoutBuilder.h:161
void append(PRIMITIVE x) noexcept
Inserts a PRIMITIVE type data.
Definition LayoutBuilder.h:79
Numpy()
Creates a new Numpy layout builder by allocating a new buffer, using AWKWARD_LAYOUTBUILDER_DEFAULT_OP...
Definition LayoutBuilder.h:59
void set_id(size_t &id) noexcept
Assigns a unique ID to each node.
Definition LayoutBuilder.h:105
void buffer_nbytes(std::map< std::string, size_t > &names_nbytes) const noexcept
Retrieves the name and size (in bytes) of the buffer.
Definition LayoutBuilder.h:130
void extend(PRIMITIVE *ptr, size_t size) noexcept
Inserts an entire array of PRIMITIVE type data.
Definition LayoutBuilder.h:87
void to_buffer(void *buffer, const char *name) const noexcept
Copies and concatenates the accumulated data in the builder buffer to a user-defined pointer if the g...
Definition LayoutBuilder.h:150
void to_buffers(std::map< std::string, void * > &buffers) const noexcept
Copies and concatenates all the accumulated data in the builder to a user-defined pointer.
Definition LayoutBuilder.h:141
std::string form() const
Generates a unique description of the builder and its contents in the form of a JSON-like string.
Definition LayoutBuilder.h:169
Builds a RecordArray which represents an array of records, which can be of same or different types....
Definition LayoutBuilder.h:463
void clear() noexcept
Clears the builder contents.
Definition LayoutBuilder.h:550
Record()
Creates a new Record layout builder.
Definition LayoutBuilder.h:472
MAP UserDefinedMap
Definition LayoutBuilder.h:466
std::string form() const noexcept
Generates a unique description of the builder and its contents in the form of a JSON-like string.
Definition LayoutBuilder.h:646
RecordFieldType< INDEX >::Builder & content() noexcept
Returns the reference to the builder contents at INDEX.
Definition LayoutBuilder.h:517
std::tuple_element_t< INDEX, RecordContents > RecordFieldType
Definition LayoutBuilder.h:469
Record(UserDefinedMap user_defined_field_id_to_name_map)
Creates a new Record layout builder, taking a user-defined map with enumerated type field ID as keys ...
Definition LayoutBuilder.h:484
const std::string & parameters() const noexcept
Parameters for the builder form.
Definition LayoutBuilder.h:523
typename std::tuple< BUILDERS... > RecordContents
Definition LayoutBuilder.h:465
void set_parameters(std::string parameter) noexcept
Sets the form parameters.
Definition LayoutBuilder.h:529
size_t length() const noexcept
Current number of records in first field.
Definition LayoutBuilder.h:560
void to_char_buffers(std::map< std::string, uint8_t * > &buffers) const noexcept
Copies and concatenates all the accumulated data in the builder to a map of user-allocated buffers.
Definition LayoutBuilder.h:635
void set_id(size_t &id) noexcept
Assigns a unique ID to each node.
Definition LayoutBuilder.h:535
bool is_valid(std::string &error) const noexcept
Checks for validity and consistency.
Definition LayoutBuilder.h:566
void buffer_nbytes(std::map< std::string, size_t > &names_nbytes) const noexcept
Retrieves the names and sizes (in bytes) of the buffers used in the builder and its contents.
Definition LayoutBuilder.h:595
void set_fields(MAP user_defined_field_id_to_name_map) noexcept
Sets the field names.
Definition LayoutBuilder.h:510
void to_buffer(void *buffer, const char *name) const noexcept
Copies and concatenates the accumulated data in the buffers of the builder contents to user-defined p...
Definition LayoutBuilder.h:622
const std::vector< std::string > fields() const noexcept
Returns a vector of strings sontaining all the field names.
Definition LayoutBuilder.h:493
void to_buffers(std::map< std::string, void * > &buffers) const noexcept
Copies and concatenates all the accumulated data in each of the buffers of the builder and its conten...
Definition LayoutBuilder.h:610
RecordContents contents
The contents of the RecordArray.
Definition LayoutBuilder.h:675
Builds a RegularArray that describes lists that have the same length, a single integer size....
Definition LayoutBuilder.h:943
void clear() noexcept
Clears the builder content.
Definition LayoutBuilder.h:992
BUILDER & begin_list() noexcept
Begins a list and returns the reference to the content of the builder.
Definition LayoutBuilder.h:960
std::string form() const noexcept
Generates a unique description of the builder and its contents in the form of a JSON-like string.
Definition LayoutBuilder.h:1057
const std::string & parameters() const noexcept
Parameters for the builder form.
Definition LayoutBuilder.h:972
void set_parameters(std::string parameter) noexcept
Sets the form parameters.
Definition LayoutBuilder.h:978
BUILDER & content() noexcept
Returns the reference to the builder content.
Definition LayoutBuilder.h:953
size_t length() const noexcept
Current number of lists of length SIZE.
Definition LayoutBuilder.h:999
void to_char_buffers(std::map< std::string, uint8_t * > &buffers) const noexcept
Copies and concatenates all the accumulated data in the builder to a map of user-allocated buffers.
Definition LayoutBuilder.h:1050
void set_id(size_t &id) noexcept
Assigns a unique ID to each node.
Definition LayoutBuilder.h:984
bool is_valid(std::string &error) const noexcept
Checks for validity and consistency.
Definition LayoutBuilder.h:1005
void end_list() noexcept
Ends a list and increments the number of lists.
Definition LayoutBuilder.h:966
void buffer_nbytes(std::map< std::string, size_t > &names_nbytes) const noexcept
Retrieves the names and sizes (in bytes) of the buffers used in the builder and its contents.
Definition LayoutBuilder.h:1022
void to_buffer(void *buffer, const char *name) const noexcept
Copies and concatenates the accumulated data in the buffers of the builder content to user-defined po...
Definition LayoutBuilder.h:1041
Regular()
Creates a new Regular layout builder.
Definition LayoutBuilder.h:946
void to_buffers(std::map< std::string, void * > &buffers) const noexcept
Copies and concatenates all the accumulated data in each of the buffers of the builder and its conten...
Definition LayoutBuilder.h:1033
Builds a RecordArray which represents an array of tuples which can be of same or different types with...
Definition LayoutBuilder.h:727
void clear() noexcept
Clears the builder contents.
Definition LayoutBuilder.h:775
TupleContents contents
The contents of the RecordArray without fields.
Definition LayoutBuilder.h:897
std::string form() const noexcept
Generates a unique description of the builder and its contents in the form of a JSON-like string.
Definition LayoutBuilder.h:872
Tuple()
Creates a new Tuple layout builder.
Definition LayoutBuilder.h:735
const std::string & parameters() const noexcept
Parameters for the builder form.
Definition LayoutBuilder.h:749
void set_parameters(std::string parameter) noexcept
Sets the form parameters.
Definition LayoutBuilder.h:755
size_t length() const noexcept
Current number of records in the first index of the tuple.
Definition LayoutBuilder.h:785
void to_char_buffers(std::map< std::string, uint8_t * > &buffers) const noexcept
Copies and concatenates all the accumulated data in the builder to a map of user-allocated buffers.
Definition LayoutBuilder.h:861
TupleContentType< INDEX > & content() noexcept
Returns the reference to the builder contents at INDEX.
Definition LayoutBuilder.h:743
void set_id(size_t &id) noexcept
Assigns a unique ID to each node.
Definition LayoutBuilder.h:761
bool is_valid(std::string &error) const noexcept
Checks for validity and consistency.
Definition LayoutBuilder.h:791
void buffer_nbytes(std::map< std::string, size_t > &names_nbytes) const noexcept
Retrieves the names and sizes (in bytes) of the buffers used in the builder and its contents.
Definition LayoutBuilder.h:821
void to_buffer(void *buffer, const char *name) const noexcept
Copies and concatenates the accumulated data in the buffers of the builder contents to user-defined p...
Definition LayoutBuilder.h:848
void to_buffers(std::map< std::string, void * > &buffers) const noexcept
Copies and concatenates all the accumulated data in each of the buffers of the builder and its conten...
Definition LayoutBuilder.h:836
Builds a UnionArray which represents data drawn from an ordered list of contents, which can have diff...
Definition LayoutBuilder.h:1982
void clear() noexcept
Discards the accumulated tags and index, and clears the builder contents.
Definition LayoutBuilder.h:2068
Union(const awkward::BuilderOptions &options)
Creates a new Union layout builder by allocating new tags and index buffers, taking options from Buil...
Definition LayoutBuilder.h:2006
typename std::tuple< BUILDERS... > Contents
Definition LayoutBuilder.h:1984
std::tuple_element_t< I, Contents > ContentType
Definition LayoutBuilder.h:1987
ContentType< TAG > & append_content() noexcept
Inserts the current tag in the tags buffer and the next index in the index buffer and returns the ref...
Definition LayoutBuilder.h:2026
std::string form() const noexcept
Generates a unique description of the builder and its contents in the form of a JSON-like string.
Definition LayoutBuilder.h:2195
const std::string & parameters() const noexcept
Parameters for the builder form.
Definition LayoutBuilder.h:2040
void set_parameters(std::string parameter) noexcept
Sets the form parameters.
Definition LayoutBuilder.h:2046
size_t length() const noexcept
Current length of the tags buffer.
Definition LayoutBuilder.h:2084
void to_char_buffers(std::map< std::string, uint8_t * > &buffers) const noexcept
Copies and concatenates all the accumulated data in the builder to a map of user-allocated buffers.
Definition LayoutBuilder.h:2177
Union()
Creates a new Union layout builder by allocating new tags and index buffers, using AWKWARD_LAYOUTBUIL...
Definition LayoutBuilder.h:1991
ContentType< I > & content() noexcept
Definition LayoutBuilder.h:2018
void set_id(size_t &id) noexcept
Assigns a unique ID to each node.
Definition LayoutBuilder.h:2052
bool is_valid(std::string &error) const noexcept
Checks for validity and consistency.
Definition LayoutBuilder.h:2090
void buffer_nbytes(std::map< std::string, size_t > &names_nbytes) const noexcept
Retrieves the names and sizes (in bytes) of the buffers used in the builder and its contents.
Definition LayoutBuilder.h:2115
void to_buffer(void *buffer, const char *name) const noexcept
Copies and concatenates the accumulated data in the builder buffers to user-defined pointers if the g...
Definition LayoutBuilder.h:2155
void to_buffers(std::map< std::string, void * > &buffers) const noexcept
Copies and concatenates all the accumulated data in each of the buffers of the builder and its conten...
Definition LayoutBuilder.h:2135
Builds an UnmaskedArray which the values are never, in fact, missing. It exists to satisfy systems th...
Definition LayoutBuilder.h:1312
void clear() noexcept
Clears the builder content.
Definition LayoutBuilder.h:1348
Unmasked()
Creates a new Unmasked layout builder.
Definition LayoutBuilder.h:1315
std::string form() const noexcept
Generates a unique description of the builder and its contents in the form of a JSON-like string.
Definition LayoutBuilder.h:1402
const std::string & parameters() const noexcept
Parameters for the builder form.
Definition LayoutBuilder.h:1328
void set_parameters(std::string parameter) noexcept
Sets the form parameters.
Definition LayoutBuilder.h:1334
BUILDER & content() noexcept
Returns the reference to the builder content.
Definition LayoutBuilder.h:1322
size_t length() const noexcept
Current length of the content.
Definition LayoutBuilder.h:1354
void to_char_buffers(std::map< std::string, uint8_t * > &buffers) const noexcept
Copies and concatenates all the accumulated data in the builder to a map of user-allocated buffers.
Definition LayoutBuilder.h:1395
void set_id(size_t &id) noexcept
Assigns a unique ID to each node.
Definition LayoutBuilder.h:1340
bool is_valid(std::string &error) const noexcept
Checks for validity and consistency.
Definition LayoutBuilder.h:1360
void buffer_nbytes(std::map< std::string, size_t > &names_nbytes) const noexcept
Retrieves the names and sizes (in bytes) of the buffers used in the builder and its contents.
Definition LayoutBuilder.h:1367
void to_buffer(void *buffer, const char *name) const noexcept
Copies and concatenates the accumulated data in the buffers of the builder content to user-defined po...
Definition LayoutBuilder.h:1386
void to_buffers(std::map< std::string, void * > &buffers) const noexcept
Copies and concatenates all the accumulated data in each of the buffers of the builder and its conten...
Definition LayoutBuilder.h:1378
Definition ArrayBuilder.h:14
void visit_at(std::tuple< CONTENTs... > const &contents, size_t index, FUNCTION fun)
Visits the tuple contents at index.
Definition utils.h:263
Container for all configuration options needed by ArrayBuilder, GrowableBuffer, LayoutBuilder and the...
Definition BuilderOptions.h:20
std::map< std::size_t, std::string > UserDefinedMap
Definition test_1494-layout-builder.cpp:39