Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 171 additions & 3 deletions interface/cuvis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,19 @@ namespace cuvis
* */
void refresh();

private:
/** @brief Expert: Return the current handle of the wrapper class */
CUVIS_MESU get_handle() const;
/** @brief Expert: Create a copy of the current handle of the wrapper class and return it.
* This handle needs to be also freed before the resource will be released by the sdk.
*/
CUVIS_MESU get_handle_copy() const;

public:
/** @brief Expert: Create a wrapper class around a handle.
* This only allowed once per handle, otherwise the handle could be freed before all instances of the wrapper class are deleted.
* This can be useful if a previously a handle has been copied and now should be wrapped at another place in a program.
* Most of the time this is not necesarry and the wrapper class can be copied just as well
*/
Measurement(CUVIS_MESU handle);


Expand Down Expand Up @@ -972,6 +984,21 @@ namespace cuvis
*/
std::string get_id() const;

/** @brief Expert: Return the current handle of the wrapper class */
CUVIS_CALIB get_handle() const;
/** @brief Expert: Create a copy of the current handle of the wrapper class and return it.
* This handle needs to be also freed before the resource will be released by the sdk.
*/
CUVIS_CALIB get_handle_copy() const;

public:
/** @brief Expert: Create a wrapper class around a handle.
* This only allowed once per handle, otherwise the handle could be freed before all instances of the wrapper class are deleted.
* This can be useful if a previously a handle has been copied and now should be wrapped at another place in a program.
* Most of the time this is not necesarry and the wrapper class can be copied just as well
*/
Calibration(CUVIS_CALIB handle);

private:
std::shared_ptr<CUVIS_CALIB> _calib;
};
Expand Down Expand Up @@ -1010,6 +1037,21 @@ namespace cuvis
*/
CUVIS_OPERATION_MODE get_operation_mode() const;

/** @brief Expert: Return the current handle of the wrapper class */
CUVIS_SESSION_FILE get_handle() const;
/** @brief Expert: Create a copy of the current handle of the wrapper class and return it.
* This handle needs to be also freed before the resource will be released by the sdk.
*/
CUVIS_SESSION_FILE get_handle_copy() const;

public:
/** @brief Expert: Create a wrapper class around a handle.
* This only allowed once per handle, otherwise the handle could be freed before all instances of the wrapper class are deleted.
* This can be useful if a previously a handle has been copied and now should be wrapped at another place in a program.
* Most of the time this is not necesarry and the wrapper class can be copied just as well
*/
SessionFile(CUVIS_SESSION_FILE handle);

private:
std::shared_ptr<CUVIS_SESSION_FILE> _session;
};
Expand Down Expand Up @@ -1090,6 +1132,21 @@ namespace cuvis
*/
std::string get_calib_id() const;

/** @brief Expert: Return the current handle of the wrapper class */
CUVIS_PROC_CONT get_handle() const;
/** @brief Expert: Create a copy of the current handle of the wrapper class and return it.
* This handle needs to be also freed before the resource will be released by the sdk.
*/
CUVIS_PROC_CONT get_handle_copy() const;

public:
/** @brief Expert: Create a wrapper class around a handle.
* This only allowed once per handle, otherwise the handle could be freed before all instances of the wrapper class are deleted.
* This can be useful if a previously a handle has been copied and now should be wrapped at another place in a program.
* Most of the time this is not necesarry and the wrapper class can be copied just as well
*/
ProcessingContext(CUVIS_PROC_CONT handle);

private:
std::shared_ptr<CUVIS_PROC_CONT> _procCont;
ProcessingArgs _procArgs;
Expand Down Expand Up @@ -1260,7 +1317,21 @@ namespace cuvis
ACQ_STUB_1b(component_integration_time_factor, cuvis_comp_integration_time_factor, double, double);

#undef ACQ_STUB_1b

/** @brief Expert: Return the current handle of the wrapper class */
CUVIS_ACQ_CONT get_handle() const;
/** @brief Expert: Create a copy of the current handle of the wrapper class and return it.
* This handle needs to be also freed before the resource will be released by the sdk.
*/
CUVIS_ACQ_CONT get_handle_copy() const;

public:
/** @brief Expert: Create a wrapper class around a handle.
* This only allowed once per handle, otherwise the handle could be freed before all instances of the wrapper class are deleted.
* This can be useful if a previously a handle has been copied and now should be wrapped at another place in a program.
* Most of the time this is not necesarry and the wrapper class can be copied just as well
*/
AcquisitionContext(CUVIS_ACQ_CONT handle);

private:
std::shared_ptr<CUVIS_ACQ_CONT> _acqCont;
Expand All @@ -1283,6 +1354,21 @@ namespace cuvis
Viewer(ViewArgs const& args);
view_data_t apply(Measurement const& mesu);

/** @brief Expert: Return the current handle of the wrapper class */
CUVIS_VIEWER get_handle() const;
/** @brief Expert: Create a copy of the current handle of the wrapper class and return it.
* This handle needs to be also freed before the resource will be released by the sdk.
*/
CUVIS_VIEWER get_handle_copy() const;

public:
/** @brief Expert: Create a wrapper class around a handle.
* This only allowed once per handle, otherwise the handle could be freed before all instances of the wrapper class are deleted.
* This can be useful if a previously a handle has been copied and now should be wrapped at another place in a program.
* Most of the time this is not necesarry and the wrapper class can be copied just as well
*/
Viewer(CUVIS_VIEWER handle);

private:
std::shared_ptr<CUVIS_VIEWER> _viewer;
static view_data_t create_view_data(CUVIS_VIEW);
Expand Down Expand Up @@ -1459,6 +1545,7 @@ namespace cuvis

refresh();
}

inline Measurement::Measurement(CUVIS_MESU handle)
: _gps_data(std::make_shared<gps_data_t>()),
_string_data(std::make_shared<string_data_t>()),
Expand Down Expand Up @@ -1677,6 +1764,15 @@ namespace cuvis
return res;
}

inline CUVIS_MESU Measurement::get_handle() const { return *_mesu; }

inline CUVIS_MESU Measurement::get_handle_copy() const
{
CUVIS_MESU new_handle;
chk(cuvis_measurement_copy_handle(*_mesu, &new_handle));
return new_handle;
}

inline std::string Calibration::get_id() const
{
CUVIS_CHAR id[CUVIS_MAXBUF];
Expand Down Expand Up @@ -1742,6 +1838,23 @@ namespace cuvis
delete handle;
});
}

inline Calibration::Calibration(CUVIS_CALIB handle)
: _calib(std::shared_ptr<CUVIS_CALIB>(new CUVIS_CALIB{handle}, [](CUVIS_CALIB* handle) {
cuvis_calib_free(handle);
delete handle;
}))
{}

inline CUVIS_CALIB Calibration::get_handle() const { return *_calib; }

inline CUVIS_CALIB Calibration::get_handle_copy() const
{
CUVIS_CALIB new_handle;
chk(cuvis_calib_copy_handle(*_calib, &new_handle));
return new_handle;
}

inline ProcessingContext::ProcessingContext(Calibration const& calib)
{
CUVIS_PROC_CONT procCont;
Expand Down Expand Up @@ -1772,6 +1885,13 @@ namespace cuvis
});
}

inline ProcessingContext::ProcessingContext(CUVIS_CALIB handle)
: _procCont(std::shared_ptr<CUVIS_PROC_CONT>(new CUVIS_PROC_CONT{handle}, [](CUVIS_PROC_CONT* handle) {
cuvis_proc_cont_free(handle);
delete handle;
}))
{}

inline Measurement& ProcessingContext::apply(Measurement& mesu) const
{
chk(cuvis_proc_cont_apply(*_procCont, *mesu._mesu));
Expand Down Expand Up @@ -1840,6 +1960,15 @@ namespace cuvis

inline ProcessingArgs const& ProcessingContext::get_processingArgs() const { return _procArgs; }

inline CUVIS_PROC_CONT ProcessingContext::get_handle() const { return *_procCont; }

inline CUVIS_PROC_CONT ProcessingContext::get_handle_copy() const
{
CUVIS_PROC_CONT new_handle;
chk(cuvis_proc_cont_copy_handle(*_procCont, &new_handle));
return new_handle;
}

inline Worker::Worker(WorkerArgs const& args) : _worker_poll_thread_run(false)

{
Expand Down Expand Up @@ -2120,6 +2249,22 @@ namespace cuvis
});
}

inline Viewer::Viewer(CUVIS_VIEWER handle)
: _viewer(std::shared_ptr<CUVIS_VIEWER>(new CUVIS_VIEWER{handle}, [](CUVIS_VIEWER* handle) {
cuvis_viewer_free(handle);
delete handle;
}))
{}

inline CUVIS_VIEWER Viewer::get_handle() const { return *_viewer; }

inline CUVIS_VIEWER Viewer::get_handle_copy() const
{
CUVIS_VIEWER new_handle;
chk(cuvis_viewer_copy_handle(*_viewer, &new_handle));
return new_handle;
}

inline Viewer::view_data_t Viewer::apply(Measurement const& mesu)
{
CUVIS_VIEW current_view;
Expand Down Expand Up @@ -2193,8 +2338,6 @@ namespace cuvis
}
inline AcquisitionContext::~AcquisitionContext() { reset_state_change_callback(); }

inline CUVIS_ACQ_CONT AcquisitionContext::get_handle() const { return *_acqCont; }

inline AcquisitionContext::AcquisitionContext(Calibration const& calib) : _state_poll_thread_run(false)
{
CUVIS_ACQ_CONT acqCont;
Expand All @@ -2216,6 +2359,22 @@ namespace cuvis
});
}

inline AcquisitionContext::AcquisitionContext(CUVIS_VIEWER handle)
: _acqCont(std::shared_ptr<CUVIS_ACQ_CONT>(new CUVIS_ACQ_CONT{handle}, [](CUVIS_ACQ_CONT* handle) {
cuvis_acq_cont_free(handle);
delete handle;
}))
{}

inline CUVIS_ACQ_CONT AcquisitionContext::get_handle() const { return *_acqCont; }

inline CUVIS_ACQ_CONT AcquisitionContext::get_handle_copy() const
{
CUVIS_ACQ_CONT new_handle;
chk(cuvis_acq_cont_copy_handle(*_acqCont, &new_handle));
return new_handle;
}


inline void AcquisitionContext::register_state_change_callback(state_callback_t callback, bool output_initial_state)
{
Expand Down Expand Up @@ -2700,6 +2859,15 @@ namespace cuvis
return op_mode;
}

inline CUVIS_SESSION_FILE SessionFile::get_handle() const { return *_session; }

inline CUVIS_SESSION_FILE SessionFile::get_handle_copy() const
{
CUVIS_SESSION_FILE new_handle;
chk(cuvis_session_file_copy_handle(*_session, &new_handle));
return new_handle;
}

template <typename data_t>
inline data_t const& common_image_t<data_t>::get(std::size_t x, std::size_t y, std::size_t z) const
{
Expand Down