Classes | Namespaces | Macros | Typedefs | Functions
api.h File Reference
#include "context.h"
#include "core/extension.h"
#include "device.h"
#include <type_traits>
#include <iostream>
Include dependency graph for api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  librealsense::arg_streamer< T, S >
 
struct  librealsense::arg_streamer< T *, false >
 
struct  librealsense::arg_streamer< T *, true >
 
class  librealsense::is_streamable< T >
 
struct  rs2_device
 
struct  rs2_notification
 
struct  rs2_raw_data_buffer
 

Namespaces

 librealsense
 

Macros

#define BEGIN_API_CALL   try
 
#define HANDLE_EXCEPTIONS_AND_RETURN(R, ...)   catch(...) { std::ostringstream ss; librealsense::stream_args(ss, #__VA_ARGS__, __VA_ARGS__); librealsense::translate_exception(__FUNCTION__, ss.str(), error); return R; }
 
#define NOARGS_HANDLE_EXCEPTIONS_AND_RETURN(R)   catch(...) { librealsense::translate_exception(__FUNCTION__, "", error); return R; }
 
#define NOARGS_HANDLE_EXCEPTIONS_AND_RETURN_VOID()   catch(...) { librealsense::translate_exception(__FUNCTION__, "", error); }
 
#define NOEXCEPT_RETURN(R, ...)   catch(...) { std::ostringstream ss; librealsense::stream_args(ss, #__VA_ARGS__, __VA_ARGS__); rs2_error* e; librealsense::translate_exception(__FUNCTION__, ss.str(), &e); LOG_WARNING(rs2_get_error_message(e)); rs2_free_error(e); return R; }
 
#define VALIDATE_ENUM(ARG)   if(!librealsense::is_valid(ARG)) { std::ostringstream ss; ss << "invalid enum value for argument \"" #ARG "\""; throw librealsense::invalid_value_exception(ss.str()); }
 
#define VALIDATE_FIXED_SIZE(ARG, SIZE)   if((ARG) != (SIZE)) { std::ostringstream ss; ss << "Unsupported size provided { " << ARG << " }," " expecting { " << SIZE << " }"; throw librealsense::invalid_value_exception(ss.str()); }
 
#define VALIDATE_INTERFACE(X, T)
 
#define VALIDATE_INTERFACE_NO_THROW(X, T)
 
#define VALIDATE_LE(ARG, MAX)   if((ARG) > (MAX)) { std::ostringstream ss; ss << "out of range value for argument \"" #ARG "\""; throw std::runtime_error(ss.str()); }
 
#define VALIDATE_NOT_NULL(ARG)   if(!(ARG)) throw std::runtime_error("null pointer passed for argument \"" #ARG "\"");
 
#define VALIDATE_OPTION(OBJ, OPT_ID)   if(!OBJ->options->supports_option(OPT_ID)) { std::ostringstream ss; ss << "object doesn't support option #" << std::to_string(OPT_ID); throw librealsense::invalid_value_exception(ss.str()); }
 
#define VALIDATE_RANGE(ARG, MIN, MAX)   if((ARG) < (MIN) || (ARG) > (MAX)) { std::ostringstream ss; ss << "out of range value for argument \"" #ARG "\""; throw librealsense::invalid_value_exception(ss.str()); }
 

Typedefs

typedef struct rs2_error rs2_error
 

Functions

std::string api_version_to_string (int version)
 
int lrs_major (int version)
 
int lrs_minor (int version)
 
int lrs_patch (int version)
 
void report_version_mismatch (int runtime, int compiletime)
 
rs2_errorrs2_create_error (const char *what, const char *name, const char *args, rs2_exception_type type)
 
template<class T >
void librealsense::stream_args (std::ostream &out, const char *names, const T &last)
 
template<class T , class... U>
void librealsense::stream_args (std::ostream &out, const char *names, const T &first, const U &...rest)
 
static void librealsense::translate_exception (const char *name, std::string args, rs2_error **error)
 
void verify_version_compatibility (int api_version)
 

Macro Definition Documentation

#define BEGIN_API_CALL   try

Definition at line 397 of file api.h.

#define HANDLE_EXCEPTIONS_AND_RETURN (   R,
  ... 
)    catch(...) { std::ostringstream ss; librealsense::stream_args(ss, #__VA_ARGS__, __VA_ARGS__); librealsense::translate_exception(__FUNCTION__, ss.str(), error); return R; }

Definition at line 399 of file api.h.

#define NOARGS_HANDLE_EXCEPTIONS_AND_RETURN (   R)    catch(...) { librealsense::translate_exception(__FUNCTION__, "", error); return R; }

Definition at line 400 of file api.h.

#define NOARGS_HANDLE_EXCEPTIONS_AND_RETURN_VOID ( )    catch(...) { librealsense::translate_exception(__FUNCTION__, "", error); }

Definition at line 401 of file api.h.

#define NOEXCEPT_RETURN (   R,
  ... 
)    catch(...) { std::ostringstream ss; librealsense::stream_args(ss, #__VA_ARGS__, __VA_ARGS__); rs2_error* e; librealsense::translate_exception(__FUNCTION__, ss.str(), &e); LOG_WARNING(rs2_get_error_message(e)); rs2_free_error(e); return R; }

Definition at line 398 of file api.h.

#define VALIDATE_ENUM (   ARG)    if(!librealsense::is_valid(ARG)) { std::ostringstream ss; ss << "invalid enum value for argument \"" #ARG "\""; throw librealsense::invalid_value_exception(ss.str()); }

Definition at line 407 of file api.h.

#define VALIDATE_FIXED_SIZE (   ARG,
  SIZE 
)    if((ARG) != (SIZE)) { std::ostringstream ss; ss << "Unsupported size provided { " << ARG << " }," " expecting { " << SIZE << " }"; throw librealsense::invalid_value_exception(ss.str()); }

Definition at line 405 of file api.h.

#define VALIDATE_INTERFACE (   X,
 
)
Value:
([&]() -> T* { \
if(p == nullptr) \
throw std::runtime_error("Object does not support \"" #T "\" interface! " ); \
return p; \
})()
GLfloat GLfloat p
Definition: glext.h:12687
#define VALIDATE_INTERFACE_NO_THROW(X, T)
Definition: api.h:411
list X
Definition: rmse.py:131

Definition at line 428 of file api.h.

#define VALIDATE_INTERFACE_NO_THROW (   X,
 
)
Value:
([&]() -> T* { \
T* p = dynamic_cast<T*>(&(*X)); \
if (p == nullptr) \
{ \
auto ext = dynamic_cast<librealsense::extendable_interface*>(&(*X)); \
if (ext == nullptr) return nullptr; \
else \
{ \
if(!ext->extend_to(TypeToExtension<T>::value, (void**)&p)) \
return nullptr; \
return p; \
} \
} \
return p; \
})()
GLfloat GLfloat p
Definition: glext.h:12687
GLfloat value

Definition at line 411 of file api.h.

#define VALIDATE_LE (   ARG,
  MAX 
)    if((ARG) > (MAX)) { std::ostringstream ss; ss << "out of range value for argument \"" #ARG "\""; throw std::runtime_error(ss.str()); }

Definition at line 410 of file api.h.

#define VALIDATE_NOT_NULL (   ARG)    if(!(ARG)) throw std::runtime_error("null pointer passed for argument \"" #ARG "\"");

Definition at line 406 of file api.h.

#define VALIDATE_OPTION (   OBJ,
  OPT_ID 
)    if(!OBJ->options->supports_option(OPT_ID)) { std::ostringstream ss; ss << "object doesn't support option #" << std::to_string(OPT_ID); throw librealsense::invalid_value_exception(ss.str()); }

Definition at line 408 of file api.h.

#define VALIDATE_RANGE (   ARG,
  MIN,
  MAX 
)    if((ARG) < (MIN) || (ARG) > (MAX)) { std::ostringstream ss; ss << "out of range value for argument \"" #ARG "\""; throw librealsense::invalid_value_exception(ss.str()); }

Definition at line 409 of file api.h.

Typedef Documentation

typedef struct rs2_error rs2_error

Definition at line 18 of file api.h.

Function Documentation

std::string api_version_to_string ( int  version)
inline

Definition at line 450 of file api.h.

int lrs_major ( int  version)
inline

Definition at line 437 of file api.h.

int lrs_minor ( int  version)
inline

Definition at line 441 of file api.h.

int lrs_patch ( int  version)
inline

Definition at line 445 of file api.h.

void report_version_mismatch ( int  runtime,
int  compiletime 
)
inline

Definition at line 456 of file api.h.

rs2_error* rs2_create_error ( const char *  what,
const char *  name,
const char *  args,
rs2_exception_type  type 
)

Definition at line 147 of file rs.cpp.

void verify_version_compatibility ( int  api_version)
inline

Definition at line 463 of file api.h.



librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:24