cppyabm  1.0.17
An agent-based library to integrate C++ and Python
Classes | Macros | Enumerations | Functions
test_numpy_dtypes.cpp File Reference
#include "pybind11_tests.h"
#include <pybind11/numpy.h>

Go to the source code of this file.

Classes

struct  SimpleStruct
 
struct  SimpleStructReordered
 
struct  PartialStruct
 
struct  PartialNestedStruct
 
struct  UnboundStruct
 
struct  StringStruct
 
struct  ComplexStruct
 
struct  ArrayStruct
 
struct  A
 
struct  B
 

Macros

#define PYBIND11_PACKED(cls)   __pragma(pack(push, 1)) cls __pragma(pack(pop))
 
#define SET_TEST_VALS(s, i)
 

Enumerations

enum  E1 : int64_t { E1::A = -1, E1::B = 1 }
 
enum  E2 : uint8_t { X = 1, Y = 2 }
 

Functions

std::ostream & operator<< (std::ostream &os, const SimpleStruct &v)
 
 PYBIND11_PACKED (struct PackedStruct { bool bool_;uint32_t uint_;float float_;long double ldbl_;})
 
std::ostream & operator<< (std::ostream &os, const PackedStruct &v)
 
 PYBIND11_PACKED (struct NestedStruct { SimpleStruct a;PackedStruct b;})
 
std::ostream & operator<< (std::ostream &os, const NestedStruct &v)
 
std::ostream & operator<< (std::ostream &os, const ComplexStruct &v)
 
 PYBIND11_PACKED (struct StructWithUglyNames { int8_t __x__;uint64_t __y__;})
 
 PYBIND11_PACKED (struct EnumStruct { E1 e1;E2 e2;})
 
std::ostream & operator<< (std::ostream &os, const StringStruct &v)
 
std::ostream & operator<< (std::ostream &os, const ArrayStruct &v)
 
std::ostream & operator<< (std::ostream &os, const EnumStruct &v)
 
template<typename T >
py::array mkarray_via_buffer (size_t n)
 
template<typename S >
py::array_t< S, 0 > create_recarray (size_t n)
 
template<typename S >
py::list print_recarray (py::array_t< S, 0 > arr)
 
py::array_t< int32_t, 0 > test_array_ctors (int i)
 
py::list test_dtype_ctors ()
 
 TEST_SUBMODULE (numpy_dtypes, m)
 

Macro Definition Documentation

◆ PYBIND11_PACKED

#define PYBIND11_PACKED (   cls)    __pragma(pack(push, 1)) cls __pragma(pack(pop))

Definition at line 17 of file test_numpy_dtypes.cpp.

◆ SET_TEST_VALS

#define SET_TEST_VALS (   s,
 
)
Value:
do { \
s.bool_ = (i) % 2 != 0; \
s.uint_ = (uint32_t) (i); \
s.float_ = (float) (i) * 1.5f; \
s.ldbl_ = (long double) (i) * -2.5L; } while (0)

Definition at line 150 of file test_numpy_dtypes.cpp.

Enumeration Type Documentation

◆ E1

enum E1 : int64_t
strong
Enumerator

Definition at line 101 of file test_numpy_dtypes.cpp.

◆ E2

enum E2 : uint8_t
Enumerator

Definition at line 102 of file test_numpy_dtypes.cpp.

Function Documentation

◆ create_recarray()

template<typename S >
py::array_t<S, 0> create_recarray ( size_t  n)

Definition at line 156 of file test_numpy_dtypes.cpp.

◆ mkarray_via_buffer()

template<typename T >
py::array mkarray_via_buffer ( size_t  n)

Definition at line 143 of file test_numpy_dtypes.cpp.

◆ operator<<() [1/7]

std::ostream& operator<< ( std::ostream &  os,
const ArrayStruct v 
)

Definition at line 117 of file test_numpy_dtypes.cpp.

◆ operator<<() [2/7]

std::ostream& operator<< ( std::ostream &  os,
const ComplexStruct v 
)

Definition at line 85 of file test_numpy_dtypes.cpp.

◆ operator<<() [3/7]

std::ostream& operator<< ( std::ostream &  os,
const EnumStruct &  v 
)

Definition at line 138 of file test_numpy_dtypes.cpp.

◆ operator<<() [4/7]

std::ostream& operator<< ( std::ostream &  os,
const NestedStruct &  v 
)

Definition at line 55 of file test_numpy_dtypes.cpp.

◆ operator<<() [5/7]

std::ostream& operator<< ( std::ostream &  os,
const PackedStruct &  v 
)

Definition at line 46 of file test_numpy_dtypes.cpp.

◆ operator<<() [6/7]

std::ostream& operator<< ( std::ostream &  os,
const SimpleStruct v 
)

Definition at line 28 of file test_numpy_dtypes.cpp.

◆ operator<<() [7/7]

std::ostream& operator<< ( std::ostream &  os,
const StringStruct v 
)

Definition at line 109 of file test_numpy_dtypes.cpp.

◆ print_recarray()

template<typename S >
py::list print_recarray ( py::array_t< S, 0 >  arr)

Definition at line 167 of file test_numpy_dtypes.cpp.

◆ PYBIND11_PACKED() [1/4]

PYBIND11_PACKED ( struct EnumStruct { E1 e1;E2 e2;}  )

◆ PYBIND11_PACKED() [2/4]

PYBIND11_PACKED ( struct NestedStruct { SimpleStruct a;PackedStruct b;}  )

◆ PYBIND11_PACKED() [3/4]

PYBIND11_PACKED ( struct PackedStruct { bool bool_;uint32_t uint_;float float_;long double ldbl_;}  )

◆ PYBIND11_PACKED() [4/4]

PYBIND11_PACKED ( struct StructWithUglyNames { int8_t __x__;uint64_t __y__;}  )

◆ test_array_ctors()

py::array_t<int32_t, 0> test_array_ctors ( int  i)

Definition at line 179 of file test_numpy_dtypes.cpp.

◆ test_dtype_ctors()

py::list test_dtype_ctors ( )

Definition at line 236 of file test_numpy_dtypes.cpp.

◆ TEST_SUBMODULE()

TEST_SUBMODULE ( numpy_dtypes  ,
 
)

Definition at line 257 of file test_numpy_dtypes.cpp.

test_multiple_inheritance.i
i
Definition: test_multiple_inheritance.py:22