Awkward Array: include/awkward/builder/DatetimeBuilder.h Source File

Loading...
Searching...
No Matches
DatetimeBuilder.h
Go to the documentation of this file.
1// BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
2
3#ifndef AWKWARD_DATETIMEBUILDER_H_
4#define AWKWARD_DATETIMEBUILDER_H_
5
6#include "awkward/common.h"
7#include "awkward/BuilderOptions.h"
8#include "awkward/GrowableBuffer.h"
9#include "awkward/builder/Builder.h"
10
11namespace awkward {
12
16 class LIBAWKWARD_EXPORT_SYMBOL DatetimeBuilder: public Builder {
17 public:
21 static const BuilderPtr
22 fromempty(const BuilderOptions& options, const std::string& units);
23
29 DatetimeBuilder(const BuilderOptions& options,
30 GrowableBuffer<int64_t> content,
31 const std::string& units);
32
34 const std::string
35 classname() const override;
36
37 const std::string
38 to_buffers(BuffersContainer& container, int64_t& form_key_id) const override;
39
40 int64_t
41 length() const override;
42
43 void
44 clear() override;
45
49 bool
50 active() const override;
51
52 const BuilderPtr
53 null() override;
54
55 const BuilderPtr
56 boolean(bool x) override;
57
58 const BuilderPtr
59 integer(int64_t x) override;
60
61 const BuilderPtr
62 real(double x) override;
63
64 const BuilderPtr
65 complex(std::complex<double> x) override;
66
67 const BuilderPtr
68 datetime(int64_t x, const std::string& unit) override;
69
70 const BuilderPtr
71 timedelta(int64_t x, const std::string& unit) override;
72
73 const BuilderPtr
74 string(const char* x, int64_t length, const char* encoding) override;
75
76 const BuilderPtr
77 beginlist() override;
78
79 const BuilderPtr
80 endlist() override;
81
82 const BuilderPtr
83 begintuple(int64_t numfields) override;
84
85 const BuilderPtr
86 index(int64_t index) override;
87
88 const BuilderPtr
89 endtuple() override;
90
91 const BuilderPtr
92 beginrecord(const char* name, bool check) override;
93
94 void
95 field(const char* key, bool check) override;
96
97 const BuilderPtr
98 endrecord() override;
99
100 const BuilderOptions&
101 options() const { return options_; }
102
103 const std::string&
104 units() const;
105
106 const GrowableBuffer<int64_t>& buffer() const { return content_; }
107
108 const std::string& unit() const { return units_; }
109
110 private:
111 const BuilderOptions options_;
112 GrowableBuffer<int64_t> content_;
113 const std::string units_;
114 };
115}
116
117#endif // AWKWARD_DATETIMEBUILDER_H_
BuilderOptions.h
Builder.h
GrowableBuffer.h
awkward::BuffersContainer
Abstract class to represent the output of ak.to_buffers. In Python, this would be a dict of NumPy arr...
Definition: Builder.h:20
awkward::Builder
Abstract base class for nodes within an ArrayBuilder that cumulatively discover an array's type and f...
Definition: Builder.h:41
awkward::DatetimeBuilder
Builder node that accumulates integers (int64_t).
Definition: DatetimeBuilder.h:16
awkward::DatetimeBuilder::units
const std::string & units() const
awkward::DatetimeBuilder::real
const BuilderPtr real(double x) override
Adds a real value x to the accumulated data.
awkward::DatetimeBuilder::buffer
const GrowableBuffer< int64_t > & buffer() const
Definition: DatetimeBuilder.h:106
awkward::DatetimeBuilder::endlist
const BuilderPtr endlist() override
Ends a nested list.
awkward::DatetimeBuilder::timedelta
const BuilderPtr timedelta(int64_t x, const std::string &unit) override
Adds a timedelta value x to the accumulated data.
awkward::DatetimeBuilder::field
void field(const char *key, bool check) override
Sets the pointer to a given record field key; the next command will fill that slot.
awkward::DatetimeBuilder::complex
const BuilderPtr complex(std::complex< double > x) override
Adds a complex value x to the accumulated data.
awkward::DatetimeBuilder::index
const BuilderPtr index(int64_t index) override
Sets the pointer to a given tuple field index; the next command will fill that slot.
awkward::DatetimeBuilder::length
int64_t length() const override
Current length of the accumulated array.
awkward::DatetimeBuilder::endrecord
const BuilderPtr endrecord() override
Ends a record.
awkward::DatetimeBuilder::active
bool active() const override
If true, this node has started but has not finished a multi-step command (e.g. beginX ....
awkward::DatetimeBuilder::string
const BuilderPtr string(const char *x, int64_t length, const char *encoding) override
Adds a string value x with a given length and encoding to the accumulated data.
awkward::DatetimeBuilder::options
const BuilderOptions & options() const
Definition: DatetimeBuilder.h:101
awkward::DatetimeBuilder::integer
const BuilderPtr integer(int64_t x) override
Adds an integer value x to the accumulated data.
awkward::DatetimeBuilder::DatetimeBuilder
DatetimeBuilder(const BuilderOptions &options, GrowableBuffer< int64_t > content, const std::string &units)
Create an DatetimeBuilder from a full set of parameters.
awkward::DatetimeBuilder::datetime
const BuilderPtr datetime(int64_t x, const std::string &unit) override
Adds a datetime value x to the accumulated data.
awkward::DatetimeBuilder::beginrecord
const BuilderPtr beginrecord(const char *name, bool check) override
Begins building a record with an optional name.
awkward::DatetimeBuilder::null
const BuilderPtr null() override
Adds a null value to the accumulated data.
awkward::DatetimeBuilder::to_buffers
const std::string to_buffers(BuffersContainer &container, int64_t &form_key_id) const override
Copy the current snapshot into the BuffersContainer and return a Form as a std::string (JSON).
awkward::DatetimeBuilder::unit
const std::string & unit() const
Definition: DatetimeBuilder.h:108
awkward::DatetimeBuilder::fromempty
static const BuilderPtr fromempty(const BuilderOptions &options, const std::string &units)
Create an empty DatetimeBuilder.
awkward::DatetimeBuilder::beginlist
const BuilderPtr beginlist() override
Begins building a nested list.
awkward::DatetimeBuilder::boolean
const BuilderPtr boolean(bool x) override
Adds a boolean value x to the accumulated data.
awkward::DatetimeBuilder::begintuple
const BuilderPtr begintuple(int64_t numfields) override
Begins building a tuple with a fixed number of fields.
awkward::DatetimeBuilder::endtuple
const BuilderPtr endtuple() override
Ends a tuple.
awkward::DatetimeBuilder::classname
const std::string classname() const override
User-friendly name of this class: "DatetimeBuilder".
awkward::DatetimeBuilder::clear
void clear() override
Removes all accumulated data without resetting the type knowledge.
awkward::GrowableBuffer
Discontiguous, one-dimensional buffer (which consists of multiple contiguous, one-dimensional panels)...
Definition: GrowableBuffer.h:174
common.h
LIBAWKWARD_EXPORT_SYMBOL
#define LIBAWKWARD_EXPORT_SYMBOL
Definition: common.h:45
awkward
Definition: BitMaskedArray.h:15
awkward::BuilderPtr
std::shared_ptr< Builder > BuilderPtr
Definition: ArrayBuilder.h:16
awkward::Options
Container for all configuration options needed by ArrayBuilder, GrowableBuffer, LayoutBuilder and the...
Definition: BuilderOptions.h:20