FBBuilder#

class numpy::FBBuilder#

numpy C++ class.

Example#

#include <numpy/np_ndarray.h>
using namespace numpy;

// Use FBBuilder
FBBuilder obj;
// ... operations ...

Other Methods#

Signature

Return Type

Location

Example

int32_t current_offset() const

int32_t

df_dataframe.h:21581

void pad(size_t alignment)

void

df_dataframe.h:21545

View

pad(4)

df_dataframe.h:21550

View

pad(4)

df_dataframe.h:21559

View

void write_i16(int16_t val)

void

df_dataframe.h:21563

void write_i32(int32_t val)

void

df_dataframe.h:21568

void write_i64(int64_t val)

void

df_dataframe.h:21575

int32_t write_string(const std::string& s)

int32_t

df_dataframe.h:21549

Code Examples#

The following examples are extracted from the test suite.

pad (np_test_1_all.cpp:18733)
18723    std::cout << "========= testPadding =======================";
18724
18725    // Create test array
18726    auto array = createInt32Array({ 2, 2 }, 0);
18727    array.setElementAt({ 0, 0 }, 1);
18728    array.setElementAt({ 0, 1 }, 2);
18729    array.setElementAt({ 1, 0 }, 3);
18730    array.setElementAt({ 1, 1 }, 4);
18731
18732    // Test constant padding
18733    auto padded_const = pad(array, 1, "constant", 0);
18734    if (!(padded_const.getShape()[0] == 4)) {
18735        std::string description = std::string("testPadding():") + __FILE__ + ":" + std::to_string(__LINE__) + ": !(padded_const.getShape()[0] == 4)";
18736        std::cout << std::string("[FAIL] ") + description << std::endl;
18737        throw std::runtime_error(description);
18738    }
18739    if (!(padded_const.getShape()[1] == 4)) {
18740        std::string description = std::string("testPadding():") + __FILE__ + ":" + std::to_string(__LINE__) + ": !(padded_const.getShape()[1] == 4)";
18741        std::cout << std::string("[FAIL] ") + description << std::endl;
18742        throw std::runtime_error(description);
18743    }
pad (np_test_1_all.cpp:18733)
18723    std::cout << "========= testPadding =======================";
18724
18725    // Create test array
18726    auto array = createInt32Array({ 2, 2 }, 0);
18727    array.setElementAt({ 0, 0 }, 1);
18728    array.setElementAt({ 0, 1 }, 2);
18729    array.setElementAt({ 1, 0 }, 3);
18730    array.setElementAt({ 1, 1 }, 4);
18731
18732    // Test constant padding
18733    auto padded_const = pad(array, 1, "constant", 0);
18734    if (!(padded_const.getShape()[0] == 4)) {
18735        std::string description = std::string("testPadding():") + __FILE__ + ":" + std::to_string(__LINE__) + ": !(padded_const.getShape()[0] == 4)";
18736        std::cout << std::string("[FAIL] ") + description << std::endl;
18737        throw std::runtime_error(description);
18738    }
18739    if (!(padded_const.getShape()[1] == 4)) {
18740        std::string description = std::string("testPadding():") + __FILE__ + ":" + std::to_string(__LINE__) + ": !(padded_const.getShape()[1] == 4)";
18741        std::cout << std::string("[FAIL] ") + description << std::endl;
18742        throw std::runtime_error(description);
18743    }
pad (np_test_1_all.cpp:18733)
18723    std::cout << "========= testPadding =======================";
18724
18725    // Create test array
18726    auto array = createInt32Array({ 2, 2 }, 0);
18727    array.setElementAt({ 0, 0 }, 1);
18728    array.setElementAt({ 0, 1 }, 2);
18729    array.setElementAt({ 1, 0 }, 3);
18730    array.setElementAt({ 1, 1 }, 4);
18731
18732    // Test constant padding
18733    auto padded_const = pad(array, 1, "constant", 0);
18734    if (!(padded_const.getShape()[0] == 4)) {
18735        std::string description = std::string("testPadding():") + __FILE__ + ":" + std::to_string(__LINE__) + ": !(padded_const.getShape()[0] == 4)";
18736        std::cout << std::string("[FAIL] ") + description << std::endl;
18737        throw std::runtime_error(description);
18738    }
18739    if (!(padded_const.getShape()[1] == 4)) {
18740        std::string description = std::string("testPadding():") + __FILE__ + ":" + std::to_string(__LINE__) + ": !(padded_const.getShape()[1] == 4)";
18741        std::cout << std::string("[FAIL] ") + description << std::endl;
18742        throw std::runtime_error(description);
18743    }