Skip to content

Commit b0ad121

Browse files
authored
Merge pull request #10106 from ydb-platform/mergelibs-241004-1426
Library import 241004-1426
2 parents a1e4766 + 492a522 commit b0ad121

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+16676
-1
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#ifndef SIMDJSON_H
2+
#define SIMDJSON_H
3+
4+
/**
5+
* @mainpage
6+
*
7+
* Check the [README.md](https://github.com/simdjson/simdjson/blob/master/README.md#simdjson--parsing-gigabytes-of-json-per-second).
8+
*
9+
* Sample code. See https://github.com/simdjson/simdjson/blob/master/doc/basics.md for more examples.
10+
11+
#include "simdjson.h"
12+
13+
int main(void) {
14+
// load from `twitter.json` file:
15+
simdjson::dom::parser parser;
16+
simdjson::dom::element tweets = parser.load("twitter.json");
17+
std::cout << tweets["search_metadata"]["count"] << " results." << std::endl;
18+
19+
// Parse and iterate through an array of objects
20+
auto abstract_json = R"( [
21+
{ "12345" : {"a":12.34, "b":56.78, "c": 9998877} },
22+
{ "12545" : {"a":11.44, "b":12.78, "c": 11111111} }
23+
] )"_padded;
24+
25+
for (simdjson::dom::object obj : parser.parse(abstract_json)) {
26+
for(const auto key_value : obj) {
27+
cout << "key: " << key_value.key << " : ";
28+
simdjson::dom::object innerobj = key_value.value;
29+
cout << "a: " << double(innerobj["a"]) << ", ";
30+
cout << "b: " << double(innerobj["b"]) << ", ";
31+
cout << "c: " << int64_t(innerobj["c"]) << endl;
32+
}
33+
}
34+
}
35+
*/
36+
37+
#include "simdjson/common_defs.h"
38+
39+
// This provides the public API for simdjson.
40+
// DOM and ondemand are amalgamated separately, in simdjson.h
41+
#include "simdjson/simdjson_version.h"
42+
43+
#include "simdjson/base.h"
44+
45+
#include "simdjson/error.h"
46+
#include "simdjson/error-inl.h"
47+
#include "simdjson/implementation.h"
48+
#include "simdjson/minify.h"
49+
#include "simdjson/padded_string.h"
50+
#include "simdjson/padded_string-inl.h"
51+
#include "simdjson/padded_string_view.h"
52+
#include "simdjson/padded_string_view-inl.h"
53+
54+
#include "simdjson/dom.h"
55+
#include "simdjson/ondemand.h"
56+
57+
#endif // SIMDJSON_H
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#ifndef SIMDJSON_ARM64_ONDEMAND_H
2+
#define SIMDJSON_ARM64_ONDEMAND_H
3+
4+
#include "simdjson/arm64/begin.h"
5+
#include "simdjson/generic/ondemand/amalgamated.h"
6+
#include "simdjson/arm64/end.h"
7+
8+
#endif // SIMDJSON_ARM64_ONDEMAND_H
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#ifndef SIMDJSON_BUILTIN_H
2+
#define SIMDJSON_BUILTIN_H
3+
4+
#include "simdjson/builtin/base.h"
5+
#include "simdjson/builtin/implementation.h"
6+
7+
#include "simdjson/generic/dependencies.h"
8+
9+
#define SIMDJSON_CONDITIONAL_INCLUDE
10+
11+
#if SIMDJSON_BUILTIN_IMPLEMENTATION_IS(arm64)
12+
#include "simdjson/arm64.h"
13+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(fallback)
14+
#include "simdjson/fallback.h"
15+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(haswell)
16+
#include "simdjson/haswell.h"
17+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(icelake)
18+
#include "simdjson/icelake.h"
19+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(ppc64)
20+
#include "simdjson/ppc64.h"
21+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(westmere)
22+
#include "simdjson/westmere.h"
23+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(lsx)
24+
#include "simdjson/lsx.h"
25+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(lasx)
26+
#include "simdjson/lasx.h"
27+
#else
28+
#error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION
29+
#endif
30+
31+
#undef SIMDJSON_CONDITIONAL_INCLUDE
32+
33+
#endif // SIMDJSON_BUILTIN_H
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#ifndef SIMDJSON_BUILTIN_BASE_H
2+
#define SIMDJSON_BUILTIN_BASE_H
3+
4+
#include "simdjson/base.h"
5+
#include "simdjson/implementation_detection.h"
6+
7+
namespace simdjson {
8+
#if SIMDJSON_BUILTIN_IMPLEMENTATION_IS(arm64)
9+
namespace arm64 {}
10+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(fallback)
11+
namespace fallback {}
12+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(haswell)
13+
namespace haswell {}
14+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(icelake)
15+
namespace icelake {}
16+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(ppc64)
17+
namespace ppc64 {}
18+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(westmere)
19+
namespace westmere {}
20+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(lsx)
21+
namespace lsx {}
22+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(lasx)
23+
namespace lasx {}
24+
#else
25+
#error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION
26+
#endif
27+
28+
/**
29+
* Represents the best statically linked simdjson implementation that can be used by the compiling
30+
* program.
31+
*
32+
* Detects what options the program is compiled against, and picks the minimum implementation that
33+
* will work on any computer that can run the program. For example, if you compile with g++
34+
* -march=westmere, it will pick the westmere implementation. The haswell implementation will
35+
* still be available, and can be selected at runtime, but the builtin implementation (and any
36+
* code that uses it) will use westmere.
37+
*/
38+
namespace builtin = SIMDJSON_BUILTIN_IMPLEMENTATION;
39+
} // namespace simdjson
40+
41+
#endif // SIMDJSON_BUILTIN_BASE_H
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#ifndef SIMDJSON_BUILTIN_IMPLEMENTATION_H
2+
#define SIMDJSON_BUILTIN_IMPLEMENTATION_H
3+
4+
#include "simdjson/builtin/base.h"
5+
6+
#include "simdjson/generic/dependencies.h"
7+
8+
#define SIMDJSON_CONDITIONAL_INCLUDE
9+
10+
#if SIMDJSON_BUILTIN_IMPLEMENTATION_IS(arm64)
11+
#include "simdjson/arm64/implementation.h"
12+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(fallback)
13+
#include "simdjson/fallback/implementation.h"
14+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(haswell)
15+
#include "simdjson/haswell/implementation.h"
16+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(icelake)
17+
#include "simdjson/icelake/implementation.h"
18+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(ppc64)
19+
#error #include "simdjson/ppc64/implementation.h"
20+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(westmere)
21+
#include "simdjson/westmere/implementation.h"
22+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(lsx)
23+
#include "simdjson/lsx/implementation.h"
24+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(lasx)
25+
#include "simdjson/lasx/implementation.h"
26+
#else
27+
#error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION
28+
#endif
29+
30+
#undef SIMDJSON_CONDITIONAL_INCLUDE
31+
32+
namespace simdjson {
33+
/**
34+
* Function which returns a pointer to an implementation matching the "builtin" implementation.
35+
* The builtin implementation is the best statically linked simdjson implementation that can be used by the compiling
36+
* program. If you compile with g++ -march=haswell, this will return the haswell implementation.
37+
* It is handy to be able to check what builtin was used: builtin_implementation()->name().
38+
*/
39+
const implementation * builtin_implementation();
40+
} // namespace simdjson
41+
42+
#endif // SIMDJSON_BUILTIN_IMPLEMENTATION_H
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#ifndef SIMDJSON_BUILTIN_ONDEMAND_H
2+
#define SIMDJSON_BUILTIN_ONDEMAND_H
3+
4+
#include "simdjson/builtin.h"
5+
#include "simdjson/builtin/base.h"
6+
7+
#include "simdjson/generic/ondemand/dependencies.h"
8+
9+
#define SIMDJSON_CONDITIONAL_INCLUDE
10+
11+
#if SIMDJSON_BUILTIN_IMPLEMENTATION_IS(arm64)
12+
#include "simdjson/arm64/ondemand.h"
13+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(fallback)
14+
#include "simdjson/fallback/ondemand.h"
15+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(haswell)
16+
#include "simdjson/haswell/ondemand.h"
17+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(icelake)
18+
#include "simdjson/icelake/ondemand.h"
19+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(ppc64)
20+
#error #include "simdjson/ppc64/ondemand.h"
21+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(westmere)
22+
#include "simdjson/westmere/ondemand.h"
23+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(lsx)
24+
#include "simdjson/lsx/ondemand.h"
25+
#elif SIMDJSON_BUILTIN_IMPLEMENTATION_IS(lasx)
26+
#include "simdjson/lasx/ondemand.h"
27+
#else
28+
#error Unknown SIMDJSON_BUILTIN_IMPLEMENTATION
29+
#endif
30+
31+
#undef SIMDJSON_CONDITIONAL_INCLUDE
32+
33+
namespace simdjson {
34+
/**
35+
* @copydoc simdjson::SIMDJSON_BUILTIN_IMPLEMENTATION::ondemand
36+
*/
37+
namespace ondemand = SIMDJSON_BUILTIN_IMPLEMENTATION::ondemand;
38+
} // namespace simdjson
39+
40+
#endif // SIMDJSON_BUILTIN_ONDEMAND_H
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#ifndef SIMDJSON_DOM_H
2+
#define SIMDJSON_DOM_H
3+
4+
#include "simdjson/dom/base.h"
5+
#include "simdjson/dom/array.h"
6+
#include "simdjson/dom/document_stream.h"
7+
#include "simdjson/dom/document.h"
8+
#include "simdjson/dom/element.h"
9+
#include "simdjson/dom/object.h"
10+
#include "simdjson/dom/parser.h"
11+
#include "simdjson/dom/serialization.h"
12+
13+
// Inline functions
14+
#include "simdjson/dom/array-inl.h"
15+
#include "simdjson/dom/document_stream-inl.h"
16+
#include "simdjson/dom/document-inl.h"
17+
#include "simdjson/dom/element-inl.h"
18+
#include "simdjson/dom/object-inl.h"
19+
#include "simdjson/dom/parser-inl.h"
20+
#include "simdjson/internal/tape_ref-inl.h"
21+
#include "simdjson/dom/serialization-inl.h"
22+
23+
#endif // SIMDJSON_DOM_H

0 commit comments

Comments
 (0)