Skip to content

Commit 2381640

Browse files
author
devadhe sb
authored
feat(c++): specify underlying types for enums in fwd.h (#811)
* updated types to platform independent types * updated types * removed forward declaration for Type class * Apply clang-format and cpplint fixes * Format C++ code with clang-format-8 * formatted with clang-format-8 to meet github action pipeline
1 parent cf728bf commit 2381640

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

cpp/src/graphar/fwd.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,15 @@ class FileSystem;
7070

7171
/** Type of vertex id or vertex index. */
7272
using IdType = int64_t;
73-
enum class Type;
7473
class DataType;
7574
/** Defines how multiple values are handled for a given property key */
76-
enum Cardinality { SINGLE, LIST, SET };
75+
enum Cardinality : int32_t { SINGLE, LIST, SET };
7776
/** Type of file format */
78-
enum FileType { CSV = 0, PARQUET = 1, ORC = 2, JSON = 3 };
79-
enum SelectType { PROPERTIES = 0, LABELS = 1 };
77+
enum FileType : int32_t { CSV = 0, PARQUET = 1, ORC = 2, JSON = 3 };
78+
enum SelectType : int32_t { PROPERTIES = 0, LABELS = 1 };
8079
/** GetChunkVersion: V1 use scanner, V2 use FileReader */
81-
enum GetChunkVersion { AUTO = 0, V1 = 1, V2 = 2 };
82-
enum class AdjListType : uint8_t;
80+
enum GetChunkVersion : int32_t { AUTO = 0, V1 = 1, V2 = 2 };
81+
enum class AdjListType : int32_t;
8382

8483
template <typename T>
8584
class Array;

cpp/src/graphar/types.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class DataType;
3636
namespace graphar {
3737

3838
/** @brief Main data type enumeration. */
39-
enum class Type {
39+
enum class Type : int32_t {
4040
/** Boolean */
4141
BOOL = 0,
4242

@@ -170,7 +170,7 @@ class Date {
170170
};
171171

172172
/** Adj list type enumeration for adjacency list of graph. */
173-
enum class AdjListType : std::uint8_t {
173+
enum class AdjListType : std::int32_t {
174174
/// collection of edges by source, but unordered, can represent COO format
175175
unordered_by_source = 0b00000001,
176176
/// collection of edges by destination, but unordered, can represent COO

0 commit comments

Comments
 (0)