FlatCityBuf C++ reader 0.8.0
Native C++17 reader for FlatCityBuf, the cloud-optimized CityJSON format
Loading...
Searching...
No Matches
attribute.hpp File Reference
#include <fcb/generated/header_generated.h>
#include <fcb/key.hpp>
#include <nlohmann/json.hpp>
#include <cstdint>
#include <map>
#include <string>
#include <utility>
#include <vector>
#include <flatbuffers/flatbuffers.h>

Go to the source code of this file.

Classes

struct  fcb::AttributeIndexEntry
 One indexable (column, value) pair pulled out of a feature for the static B+tree builder (M6). More...
 

Namespaces

namespace  fcb
 

Typedefs

using fcb::AttributeSchema = std::map< std::string, std::pair< std::uint16_t, ::ColumnType > >
 Attribute schema: name -> (column index, column type).
 

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)
 Builds the Column vector for Header.columns or CityObject.columns, in ascending column-index order.
 
std::vector< AttributeIndexEntryfcb::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< AttributeIndexEntryfcb::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.