μHAL (v2.8.17)
Part of the IPbus software repository
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Enumerations | Functions | Variables
pycohal Namespace Reference

Classes

struct  ValVectorIndexingSuite
 Struct containing wrapper functions for list-like indexing of ValVector<uint32_t> in python. More...
 

Enumerations

enum  LogLevel {
  DEBUG , INFO , NOTICE , WARNING ,
  ERROR , FATAL
}
 Log level enum - switch to using enums for setting log-levels in python. More...
 

Functions

void setLogLevelTo (const pycohal::LogLevel &logLevel)
 Wrapper function for uhal::setLogLevelTo - converts pycohal::LogLevel enum values to C++ uhal log-level classes. More...
 
const bool & LoggingIncludes (const pycohal::LogLevel &logLevel)
 Wrapper function for uhal::LoggingIncludes - converts pycohal::LogLevel enum values to C++ uhal log-level classes. More...
 
void wrap_enums (pybind11::module_ &)
 
void wrap_logging_functions (pybind11::module_ &)
 
void wrap_exceptions (pybind11::module_ &)
 Wraps all uHAL exceptions (i.e. creates corresponding Python classes, and regsiters appropriate exception translators) More...
 
uint32_t defs_NOMASK ()
 
template<class T >
std::vector< T > copy_vector (const std::vector< T > &aVec)
 Trivial function that returns copy of vector argument in order to test vector to/from list converters. [Function solely used in unit-tests]. More...
 
template<class T >
std::vector< T > convert_string_to_vector (const std::string &aString)
 Returns vector, generated from splitting string argument using "," as delimeter, and converting string to type via lexical cast. [Function solely used in unit-tests]. More...
 
template<>
std::vector< std::string > convert_string_to_vector (const std::string &aString)
 
bool test_check_uint32_argument (uint32_t aUInt, const py::bytes &uIntString)
 Returns whether uint32 and string arguments represent the same nubmer. Used in tests to check that uint32 arguments don't get altered at python-to-C boundary. More...
 
uint32_t test_convert_str_to_uint32 (const std::string &uIntString)
 Converts string argument to uint32_t, and returns this value. Used in tests to check that uint32 return values don't get altered at C-to-python boundary. More...
 
uhal::ValWord< uint32_t > get_dummy_ValWord (const uint32_t aValue, const bool aValid)
 Returns dummy ValWord instance for testing. More...
 
void create_sigbus_buard ()
 
void wrap_test_functions (py::module_ &aModule)
 Wraps functions that are only sed in unti tests. Puts them in "tests" sub-module. More...
 
std::shared_ptr< uhal::ClientInterfacebuildClient (const std::string &aId, const std::string &aURI)
 Constructs a ClientInterface using the ClientFactory. More...
 
py::bytes hex_string (const uhal::ValWord< uint32_t > &valWord)
 Returns hex string for ValWord<uint32_t> value. More...
 
std::string convert_to_string (const uhal::ValWord< uint32_t > &valWord)
 
std::string convert_to_string (const uhal::ValVector< uint32_t > &valVec)
 

Variables

const auto const_ref_return_policy = py::return_value_policy::copy
 Default return value policy for const references returned attribute 'getter' methods. More...
 
const auto norm_ref_return_policy = py::return_value_policy::reference_internal
 Return value policy for internal references. More...
 

Enumeration Type Documentation

◆ LogLevel

Log level enum - switch to using enums for setting log-levels in python.

Enumerator
DEBUG 
INFO 
NOTICE 
WARNING 
ERROR 
FATAL 

Definition at line 12 of file enums_logging.hpp.

Function Documentation

◆ buildClient()

std::shared_ptr< uhal::ClientInterface > pycohal::buildClient ( const std::string &  aId,
const std::string &  aURI 
)

Constructs a ClientInterface using the ClientFactory.

Definition at line 139 of file cactus_pycohal.cpp.

References uhal::ClientFactory::getClient(), and uhal::ClientFactory::getInstance().

Referenced by PYBIND11_MODULE().

◆ convert_string_to_vector() [1/2]

template<class T >
std::vector< T > pycohal::convert_string_to_vector ( const std::string &  aString)

Returns vector, generated from splitting string argument using "," as delimeter, and converting string to type via lexical cast. [Function solely used in unit-tests].

Definition at line 46 of file cactus_pycohal.cpp.

◆ convert_string_to_vector() [2/2]

template<>
std::vector< std::string > pycohal::convert_string_to_vector ( const std::string &  aString)

Definition at line 66 of file cactus_pycohal.cpp.

◆ convert_to_string() [1/2]

std::string pycohal::convert_to_string ( const uhal::ValVector< uint32_t > &  valVec)

Definition at line 190 of file cactus_pycohal.cpp.

References uhal::ValVector< T >::at(), and uhal::ValVector< T >::size().

◆ convert_to_string() [2/2]

std::string pycohal::convert_to_string ( const uhal::ValWord< uint32_t > &  valWord)

Definition at line 185 of file cactus_pycohal.cpp.

References uhal::ValWord< T >::value().

Referenced by PYBIND11_MODULE().

◆ copy_vector()

template<class T >
std::vector< T > pycohal::copy_vector ( const std::vector< T > &  aVec)

Trivial function that returns copy of vector argument in order to test vector to/from list converters. [Function solely used in unit-tests].

Definition at line 39 of file cactus_pycohal.cpp.

◆ create_sigbus_buard()

void pycohal::create_sigbus_buard ( )

Definition at line 105 of file cactus_pycohal.cpp.

Referenced by wrap_test_functions().

◆ defs_NOMASK()

uint32_t pycohal::defs_NOMASK ( )

Definition at line 32 of file cactus_pycohal.cpp.

References uhal::defs::NOMASK.

Referenced by PYBIND11_MODULE().

◆ get_dummy_ValWord()

uhal::ValWord< uint32_t > pycohal::get_dummy_ValWord ( const uint32_t  aValue,
const bool  aValid 
)

Returns dummy ValWord instance for testing.

Definition at line 96 of file cactus_pycohal.cpp.

References uhal::ValWord< T >::valid(), and uhal::ValWord< T >::value().

Referenced by wrap_test_functions().

◆ hex_string()

py::bytes pycohal::hex_string ( const uhal::ValWord< uint32_t > &  valWord)

Returns hex string for ValWord<uint32_t> value.

Definition at line 145 of file cactus_pycohal.cpp.

References uhal::ValWord< T >::value().

Referenced by PYBIND11_MODULE().

◆ LoggingIncludes()

const bool & pycohal::LoggingIncludes ( const pycohal::LogLevel logLevel)

Wrapper function for uhal::LoggingIncludes - converts pycohal::LogLevel enum values to C++ uhal log-level classes.

Definition at line 43 of file enums_logging.cpp.

References uhal::Debug, DEBUG, uhal::Error, ERROR, uhal::Fatal, FATAL, uhal::Info, INFO, uhal::LoggingIncludes(), uhal::Notice, NOTICE, uhal::Warning, and WARNING.

Referenced by wrap_logging_functions().

◆ setLogLevelTo()

void pycohal::setLogLevelTo ( const pycohal::LogLevel logLevel)

Wrapper function for uhal::setLogLevelTo - converts pycohal::LogLevel enum values to C++ uhal log-level classes.

Definition at line 15 of file enums_logging.cpp.

References uhal::Debug, DEBUG, uhal::Error, ERROR, uhal::Fatal, FATAL, uhal::Info, INFO, uhal::Notice, NOTICE, uhal::setLogLevelTo(), uhal::Warning, and WARNING.

Referenced by wrap_logging_functions().

◆ test_check_uint32_argument()

bool pycohal::test_check_uint32_argument ( uint32_t  aUInt,
const py::bytes &  uIntString 
)

Returns whether uint32 and string arguments represent the same nubmer. Used in tests to check that uint32 arguments don't get altered at python-to-C boundary.

Definition at line 82 of file cactus_pycohal.cpp.

Referenced by wrap_test_functions().

◆ test_convert_str_to_uint32()

uint32_t pycohal::test_convert_str_to_uint32 ( const std::string &  uIntString)

Converts string argument to uint32_t, and returns this value. Used in tests to check that uint32 return values don't get altered at C-to-python boundary.

Definition at line 90 of file cactus_pycohal.cpp.

Referenced by wrap_test_functions().

◆ wrap_enums()

void pycohal::wrap_enums ( pybind11::module_ &  aModule)

◆ wrap_exceptions()

void pycohal::wrap_exceptions ( pybind11::module_ &  aModule)

Wraps all uHAL exceptions (i.e. creates corresponding Python classes, and regsiters appropriate exception translators)

Definition at line 17 of file exceptions.cpp.

Referenced by PYBIND11_MODULE().

◆ wrap_logging_functions()

void pycohal::wrap_logging_functions ( pybind11::module_ &  aModule)

◆ wrap_test_functions()

void pycohal::wrap_test_functions ( py::module_ &  aModule)

Variable Documentation

◆ const_ref_return_policy

const auto pycohal::const_ref_return_policy = py::return_value_policy::copy

Default return value policy for const references returned attribute 'getter' methods.

Definition at line 132 of file cactus_pycohal.cpp.

Referenced by PYBIND11_MODULE().

◆ norm_ref_return_policy

const auto pycohal::norm_ref_return_policy = py::return_value_policy::reference_internal

Return value policy for internal references.

For member functions, it causes python garbage collector to keep 'self' (i.e. this) alive behind-the-scences as long as the returned object still exists. N.B: This return value policy is a safe option, but not necessarily the most optimal.

Definition at line 136 of file cactus_pycohal.cpp.

Referenced by PYBIND11_MODULE().