callback-invocation.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2021 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 
6 #include "small-heap.h"
7 
8 #include <chrono>
9 
10 
11 namespace librealsense {
12 
13 
15 {
16  std::chrono::high_resolution_clock::time_point started;
17  std::chrono::high_resolution_clock::time_point ended;
18 };
19 
21 
23 {
25  : invocation( nullptr )
26  , owner( nullptr )
27  {
28  }
31 
33  : invocation( other.invocation )
34  , owner( other.owner )
35  {
36  other.invocation = nullptr;
37  }
38 
41  , owner( owner )
42  {
43  }
44 
46  {
47  if( invocation && owner )
48  {
49  try
50  {
52  }
53  catch( const std::exception & e )
54  {
55  LOG_DEBUG( "Error while callback holder deallocation: " << e.what() );
56  }
57  }
58  }
59 
61  {
62  invocation = other.invocation;
63  owner = other.owner;
64  other.invocation = nullptr;
65  return *this;
66  }
67 
68  operator bool() { return invocation != nullptr; }
69 
70 private:
73 };
74 
75 
76 } // namespace librealsense
librealsense
Definition: algo.h:18
librealsense::callback_invocation_holder::operator=
callback_invocation_holder & operator=(const callback_invocation_holder &)=delete
librealsense::small_heap::deallocate
void deallocate(T *item)
Definition: small-heap.h:55
librealsense::callback_invocation::ended
std::chrono::high_resolution_clock::time_point ended
Definition: callback-invocation.h:17
LOG_DEBUG
#define LOG_DEBUG(...)
Definition: easyloggingpp.h:70
librealsense::callback_invocation_holder
Definition: callback-invocation.h:22
librealsense::callbacks_heap
small_heap< callback_invocation, 1 > callbacks_heap
Definition: callback-invocation.h:20
librealsense::callback_invocation_holder::owner
callbacks_heap * owner
Definition: callback-invocation.h:72
librealsense::callback_invocation
Definition: callback-invocation.h:14
librealsense::small_heap< callback_invocation, 1 >
librealsense::callback_invocation_holder::callback_invocation_holder
callback_invocation_holder()
Definition: callback-invocation.h:24
librealsense::callback_invocation_holder::~callback_invocation_holder
~callback_invocation_holder()
Definition: callback-invocation.h:45
librealsense::callback_invocation_holder::callback_invocation_holder
callback_invocation_holder(callback_invocation *invocation, callbacks_heap *owner)
Definition: callback-invocation.h:39
librealsense::callback_invocation_holder::operator=
callback_invocation_holder & operator=(callback_invocation_holder &&other)
Definition: callback-invocation.h:60
rmse.e
e
Definition: rmse.py:177
librealsense::callback_invocation_holder::invocation
callback_invocation * invocation
Definition: callback-invocation.h:71
small-heap.h
librealsense::callback_invocation_holder::callback_invocation_holder
callback_invocation_holder(callback_invocation_holder &&other)
Definition: callback-invocation.h:32
librealsense::callback_invocation::started
std::chrono::high_resolution_clock::time_point started
Definition: callback-invocation.h:16


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Fri Aug 2 2024 08:30:01