17 #include <arrow/api.h>
18 #include <cerata/api.h>
25 #include "fletchgen/bus.h"
26 #include "fletchgen/utils.h"
46 static std::shared_ptr<FletcherSchema>
Make(
const std::shared_ptr<arrow::Schema> &
arrow_schema,
47 const std::string &schema_name =
"");
50 [[nodiscard]] std::shared_ptr<arrow::Schema>
arrow_schema()
const {
return arrow_schema_; }
53 [[nodiscard]] Mode
mode()
const {
return mode_; }
55 [[nodiscard]] std::string
name()
const {
return name_; }
59 std::shared_ptr<arrow::Schema> arrow_schema_;
76 static std::shared_ptr<SchemaSet>
Make(
const std::string &name);
84 [[nodiscard]] std::optional<std::shared_ptr<FletcherSchema>>
GetSchema(
const std::string &name)
const;
86 void AppendSchema(
const std::shared_ptr<arrow::Schema> &schema);
88 [[nodiscard]] std::vector<std::shared_ptr<FletcherSchema>>
schemas()
const {
return schemas_; }
90 [[nodiscard]] std::vector<std::shared_ptr<FletcherSchema>>
read_schemas()
const;
92 [[nodiscard]] std::vector<std::shared_ptr<FletcherSchema>>
write_schemas()
const;
98 std::vector<std::shared_ptr<FletcherSchema>> schemas_;
FletcherSchema(const std::shared_ptr< arrow::Schema > &arrow_schema, const std::string &schema_name="")
Construct a new Fletcher schema.
static std::shared_ptr< FletcherSchema > Make(const std::shared_ptr< arrow::Schema > &arrow_schema, const std::string &schema_name="")
Make a new FletcherSchema, returning a shared pointer to it.
std::shared_ptr< arrow::Schema > arrow_schema() const
Return the Arrow schema that this FletcherSchema was based on.
std::string name() const
Return the name of this FletcherSchema.
Mode mode() const
Return the access mode of the RecordBatch this schema represents.
std::vector< std::shared_ptr< FletcherSchema > > schemas() const
Return all schemas of this schemaset.
std::vector< std::shared_ptr< FletcherSchema > > read_schemas() const
Return all schemas with read mode.
SchemaSet(std::string name)
SchemaSet constructor.
bool RequiresReading() const
Determine whether any schema in this set requires reading from memory.
std::vector< std::shared_ptr< FletcherSchema > > write_schemas() const
Return all schemas with write mode.
void Sort()
Sort the schemas by name, then by read/write mode.
static std::shared_ptr< SchemaSet > Make(const std::string &name)
Make a new, empty SchemaSet, and return a shared pointer to it.
bool HasSchemaWithName(const std::string &name) const
Return true if set contains schema with some name, false otherwise.
void AppendSchema(const std::shared_ptr< arrow::Schema > &schema)
Append a schema.
std::optional< std::shared_ptr< FletcherSchema > > GetSchema(const std::string &name) const
Optionally return a schema with name, if it exists.
bool RequiresWriting() const
Determine whether any schema in this set requires writing to memory.
Contains all classes and functions related to Fletchgen.
Holds bus interface dimensions.