FlatCityBuf C++ reader 0.10.0
Native C++17 reader for FlatCityBuf, the cloud-optimized CityJSON format
Loading...
Searching...
No Matches
attribute.cpp File Reference
#include <fcb/writer/attribute.hpp>
#include <algorithm>
#include <cstring>
#include <limits>
#include <optional>
#include <type_traits>

Go to the source code of this file.

Namespaces

namespace  fcb

Functions

void fcb::add_attributes (AttributeSchema &schema, const nlohmann::ordered_json &attrs)
 Adds every member of a JSON object to schema, assigning each new, non-null name the next free column index, in the order attrs's own members appear (see the ordered_json note above) – NOT alphabetically.
std::size_t fcb::attr_size (::ColumnType coltype, const nlohmann::ordered_json &colval)
 Byte width one value of coltype occupies in the attribute blob, EXCLUDING the 2-byte column-index prefix every record also carries.
std::vector< std::uint8_t > fcb::encode_attributes_with_schema (const nlohmann::ordered_json &attr, const AttributeSchema &schema)
 Encodes attr (a CityJSON attributes object) against schema: repeated [u16 LE column index][value] records, one per schema member present and non-null in attr, in ascending column-index order (NOT attr's own JSON key order).
::flatbuffers::Offset<::flatbuffers::Vector<::flatbuffers::Offset<::Column > > > fcb::to_columns (::flatbuffers::FlatBufferBuilder &fbb, const AttributeSchema &schema, std::optional< std::uint16_t > id_column=std::nullopt)
 Builds the Column vector for Header.columns or CityObject.columns, in ascending column-index order.
std::optional< std::uint16_t > fcb::id_column_index (const std::optional< std::uint16_t > &id_index, const AttributeSchema &schema)
 The index of the City Object id column: the next free one when id_index asks for an id index and schema has no column of that name, which would otherwise keep it.
std::vector< AttributeIndexEntry > fcb::cityfeature_to_id_index_entries (const nlohmann::ordered_json &city_feature, std::uint16_t index)
 One index entry per City Object of city_feature, keyed by the object's id, for the id column at index, in id order.
std::vector< AttributeIndexEntry > fcb::attribute_to_index_entries (const nlohmann::ordered_json &attr, const AttributeSchema &schema, const std::vector< std::string > &indexing_attr)
 Extracts index entries for indexing_attr from one CityJSON attributes object.
std::vector< AttributeIndexEntry > fcb::cityfeature_to_index_entries (const nlohmann::ordered_json &city_feature, const AttributeSchema &schema, const std::vector< std::string > &indexing_attr)
 Same, over every object in one CityJSONFeature's CityObjects, visited in ascending object-id order (not JSON key order, which need not be stable) so that duplicate-key payload ordering in the eventual B+tree is reproducible.