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, const ValidateLevel &validate_level=ValidateLevel::no_validate) | |
Initialize the VerticesBuilder. More... | |
void | Clear () |
Clear the vertices in this VerciesBuilder. | |
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, 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< GraphInfo > &graph_info, const std::string &label, IdType start_vertex_index=0, const ValidateLevel &validate_level=ValidateLevel::no_validate) |
Construct a VertexBuilder from graph info and vertex label. More... | |
VertexBuilder is designed for building and writing a collection of vertices.
Definition at line 130 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. |
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 143 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 211 of file vertices_builder.h.
|
inline |
Dump the collection into files.
Definition at line 242 of file vertices_builder.h.
|
inline |
Get the current number of vertices in the collection.
Definition at line 235 of file vertices_builder.h.
|
inline |
Get the validate level.
Definition at line 187 of file vertices_builder.h.
|
inlinestatic |
Construct a VertexBuilder from graph info and vertex label.
graph_info | The graph info that describes the graph. |
label | The label of the vertex. |
start_vertex_index | The start index of the vertices collection. |
validate_level | The global validate level for the builder, default is no_validate. |
Definition at line 284 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. |
validate_level | The global validate level for the builder, default is no_validate. |
Definition at line 267 of file vertices_builder.h.
|
inline |
Set the validate level.
validate_level | The validate level to set. |
Definition at line 175 of file vertices_builder.h.