Skip to content

Commit 1c4eeba

Browse files
committed
Add namespaces
1 parent 6a737f5 commit 1c4eeba

File tree

5 files changed

+700
-682
lines changed

5 files changed

+700
-682
lines changed

include/serialize.hpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
#pragma once
22

33
#include <vector>
4+
45
#include "sparrow.hpp"
56

67
#include "config/config.hpp"
78

8-
//TODO split serialize/deserialize fcts in two different files or just rename the current one?
9-
template <typename T>
10-
SPARROW_IPC_API std::vector<uint8_t> serialize_primitive_array(const sparrow::primitive_array<T>& arr);
9+
namespace sparrow_ipc
10+
{
11+
//TODO split serialize/deserialize fcts in two different files or just rename the current one?
12+
template <typename T>
13+
SPARROW_IPC_API std::vector<uint8_t> serialize_primitive_array(const sparrow::primitive_array<T>& arr);
1114

12-
template <typename T>
13-
SPARROW_IPC_API sparrow::primitive_array<T> deserialize_primitive_array(const std::vector<uint8_t>& buffer);
15+
template <typename T>
16+
SPARROW_IPC_API sparrow::primitive_array<T> deserialize_primitive_array(const std::vector<uint8_t>& buffer);
17+
}

include/utils.hpp

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,22 @@
55
#include <string_view>
66
#include <utility>
77

8-
// TODO what to do with namespace?
9-
// TODO add tests for these?
10-
// TODO add namespace ? sparrow-ipc / detail or utils?
11-
#include "config/config.hpp"
12-
13-
// Aligns a value to the next multiple of 8, as required by the Arrow IPC format for message bodies.
14-
SPARROW_IPC_API int64_t align_to_8(int64_t n);
8+
#include "Schema_generated.h"
159

16-
// Parse the format string
17-
SPARROW_IPC_API std::optional<int32_t> parse_format(std::string_view format_str, std::string_view sep);
10+
#include "config/config.hpp"
1811

19-
SPARROW_IPC_API std::pair<org::apache::arrow::flatbuf::Type, flatbuffers::Offset<void>>
20-
get_flatbuffer_decimal_type(flatbuffers::FlatBufferBuilder& builder, std::string_view format_str, int32_t bitWidth);
12+
// TODO add tests
13+
// TODO in that case define #ifdef TESTING for the fcts here to be testable and available in anonymous namespaces
14+
namespace sparrow_ipc
15+
{
16+
namespace utils
17+
{
18+
// Aligns a value to the next multiple of 8, as required by the Arrow IPC format for message bodies
19+
SPARROW_IPC_API int64_t align_to_8(int64_t n);
2120

22-
SPARROW_IPC_API std::pair<org::apache::arrow::flatbuf::Type, flatbuffers::Offset<void>>
23-
get_flatbuffer_type(flatbuffers::FlatBufferBuilder& builder, std::string_view format_str);
21+
// Creates a Flatbuffers type from a format string
22+
// This function maps a sparrow data type to the corresponding Flatbuffers type
23+
SPARROW_IPC_API std::pair<org::apache::arrow::flatbuf::Type, flatbuffers::Offset<void>>
24+
get_flatbuffer_type(flatbuffers::FlatBufferBuilder& builder, std::string_view format_str);
25+
}
26+
}

0 commit comments

Comments
 (0)