LightlyEdge C++ SDK
Loading...
Searching...
No Matches
lightly_edge_sdk Namespace Reference

Namespace with core LightlyEdge SDK functionality. More...

Classes

struct  Error
 Error struct to hold error code and message. More...
 
class  Exception
 Exception class for lightly_edge_sdk::value_or_throw function. More...
 
struct  Frame
 Frame data for LightlyEdge. More...
 
class  LightlyEdge
 LightlyEdge. More...
 
struct  SelectInfo
 Selection information about a processed frame. More...
 

Functions

template<typename T >
auto value_or_throw (tl::expected< T, lightly_edge_sdk::Error > &&result) -> T
 Convenience function to unwrap a result of lightly_edge_sdk::LightlyEdge functions.
 
template<>
void value_or_throw (tl::expected< void, lightly_edge_sdk::Error > &&result)
 
auto default_config () -> LightlyEdgeConfig
 
auto cxx_status_to_unexpected (lightly_edge_cxx::CxxStatus &status) -> tl::unexpected< Error >
 

Variables

const size_t BUFFER_MAX_LENGTH = 3000
 
const uint32_t MAX_CLASSIFICATIONS_DEFAULT = 5
 
const int CPP_SDK_ERROR_CODE = 30
 

Detailed Description

Namespace with core LightlyEdge SDK functionality.

Function Documentation

◆ value_or_throw()

template<typename T >
auto lightly_edge_sdk::value_or_throw ( tl::expected< T, lightly_edge_sdk::Error > && result) -> T
inline

Convenience function to unwrap a result of lightly_edge_sdk::LightlyEdge functions.

Extracts and returns the value from a tl::expected<T, lightly_edge_sdk::Error> object using move semantics, or throws lightly_edge_sdk::Exception if it contains an error.

This function can be useful if your application uses exceptions for error handling.

Example usage:

auto lightly_edge = value_or_throw(LightlyEdge::new_from_tar("model.tar"));
// If the result is in a variable, use std::move to avoid copying the value.
auto result = lightly_edge.embed_frame(frame);
auto embedding = value_or_throw(std::move(result));
static auto new_from_tar(const char *archive_path, LightlyEdgeConfig config) -> LightlyEdge
Initialize LightlyEdge with an ort embedding inference backend.
Definition lightly_edge_sdk.h:170
auto value_or_throw(tl::expected< T, lightly_edge_sdk::Error > &&result) -> T
Convenience function to unwrap a result of lightly_edge_sdk::LightlyEdge functions.
Definition lightly_edge_error.h:79
Parameters
resultThe tl::expected object to unwrap.
Returns
The value of the expected object.
Exceptions
lightly_edge_sdk::Exceptionif the expected object contains an error.