Apache GraphAr C++ Library
The C++ Library for Apache GraphAr
|
VertexBuilder is designed for building and writing a collection of vertices. More...
#include <vertices_builder.h>
Public Member Functions | |
VerticesBuilder (const std::shared_ptr< VertexInfo > &vertex_info, const std::string &prefix, IdType start_vertex_index=0, std::shared_ptr< WriterOptions > writerOptions=nullptr, const ValidateLevel &validate_level=ValidateLevel::no_validate) | |
Initialize the VerticesBuilder. More... | |
void | Clear () |
Clear the vertices in this VerciesBuilder. | |
void | SetWriterOptions (std::shared_ptr< WriterOptions > writer_options) |
Set the writerOptions. More... | |
std::shared_ptr< WriterOptions > | GetWriterOptions () |
Set the writerOptions. More... | |
void | SetValidateLevel (const ValidateLevel &validate_level) |
Set the validate level. More... | |
ValidateLevel | GetValidateLevel () const |
Get the validate level. More... | |
Status | AddVertex (Vertex &v, IdType index=-1, ValidateLevel validate_level=ValidateLevel::default_validate) |
Add a vertex with the given index. More... | |
IdType | GetNum () const |
Get the current number of vertices in the collection. More... | |
Status | Dump () |
Dump the collection into files. More... | |
Static Public Member Functions | |
static Result< std::shared_ptr< VerticesBuilder > > | Make (const std::shared_ptr< VertexInfo > &vertex_info, const std::string &prefix, std::shared_ptr< WriterOptions > writer_options, IdType start_vertex_index=0, const ValidateLevel &validate_level=ValidateLevel::no_validate) |
Construct a VertexBuilder from vertex info. More... | |
static Result< std::shared_ptr< VerticesBuilder > > | Make (const std::shared_ptr< VertexInfo > &vertex_info, const std::string &prefix, IdType start_vertex_index=0, const ValidateLevel &validate_level=ValidateLevel::no_validate) |
static Result< std::shared_ptr< VerticesBuilder > > | Make (const std::shared_ptr< GraphInfo > &graph_info, const std::string &type, std::shared_ptr< WriterOptions > writer_options, IdType start_vertex_index=0, const ValidateLevel &validate_level=ValidateLevel::no_validate) |
Construct a VertexBuilder from graph info and vertex type. More... | |
static Result< std::shared_ptr< VerticesBuilder > > | Make (const std::shared_ptr< GraphInfo > &graph_info, const std::string &type, IdType start_vertex_index=0, const ValidateLevel &validate_level=ValidateLevel::no_validate) |
VertexBuilder is designed for building and writing a collection of vertices.
Definition at line 224 of file vertices_builder.h.
|
inlineexplicit |
Initialize the VerticesBuilder.
vertex_info | The vertex info that describes the vertex type. |
prefix | The absolute prefix. |
start_vertex_index | The start index of the vertices collection. |
writerOptions | The writerOptions provides configuration options for different file format writers. |
validate_level | The global validate level for the writer, with no validate by default. It could be ValidateLevel::no_validate, ValidateLevel::weak_validate or ValidateLevel::strong_validate, but could not be ValidateLevel::default_validate. |
Definition at line 239 of file vertices_builder.h.
|
inline |
Add a vertex with the given index.
The validate_level for this operation could be:
ValidateLevel::default_validate: to use the validate_level of the builder, which set through the constructor or the SetValidateLevel method;
ValidateLevel::no_validate: without validation;
ValidateLevel::weak_validate: to validate if the start index and the vertex index is valid, and the data in builder is not saved;
ValidateLevel::strong_validate: besides weak_validate, also validate the schema of the vertex is consistent with the info defined.
v | The vertex to add. |
index | The given index, -1 means the next unused index. |
validate_level | The validate level for this operation, which is the builder's validate level by default. |
Definition at line 328 of file vertices_builder.h.
|
inline |
Dump the collection into files.
Definition at line 359 of file vertices_builder.h.
|
inline |
Get the current number of vertices in the collection.
Definition at line 352 of file vertices_builder.h.
|
inline |
Get the validate level.
Definition at line 304 of file vertices_builder.h.
|
inline |
Set the writerOptions.
writerOptions | The writerOptions provides configuration options for different file format writers. |
Definition at line 283 of file vertices_builder.h.
|
inlinestatic |
Construct a VertexBuilder from graph info and vertex type.
graph_info | The graph info that describes the graph. |
type | The type of the vertex. |
start_vertex_index | The start index of the vertices collection. |
writerOptions | The writerOptions provides configuration options for different file format writers. |
validate_level | The global validate level for the builder, default is no_validate. |
Definition at line 416 of file vertices_builder.h.
|
inlinestatic |
Construct a VertexBuilder from vertex info.
vertex_info | The vertex info that describes the vertex type. |
prefix | The absolute prefix. |
start_vertex_index | The start index of the vertices collection. |
writerOptions | The writerOptions provides configuration options for different file format writers. |
validate_level | The global validate level for the builder, default is no_validate. |
Definition at line 387 of file vertices_builder.h.
|
inline |
Set the validate level.
validate_level | The validate level to set. |
Definition at line 292 of file vertices_builder.h.
|
inline |
Set the writerOptions.
Definition at line 273 of file vertices_builder.h.