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  }
30  callback_invocation_holder & operator=( const callback_invocation_holder & ) = delete;
31 
33  : invocation( other.invocation )
34  , owner( other.owner )
35  {
36  other.invocation = nullptr;
37  }
38 
39  callback_invocation_holder( callback_invocation * invocation, callbacks_heap * owner )
40  : invocation( invocation )
41  , owner( owner )
42  {
43  }
44 
46  {
47  if( invocation )
48  owner->deallocate( invocation );
49  }
50 
52  {
53  invocation = other.invocation;
54  owner = other.owner;
55  other.invocation = nullptr;
56  return *this;
57  }
58 
59  operator bool() { return invocation != nullptr; }
60 
61 private:
63  callbacks_heap * owner;
64 };
65 
66 
67 } // namespace librealsense
std::chrono::high_resolution_clock::time_point started
small_heap< callback_invocation, 1 > callbacks_heap
std::chrono::high_resolution_clock::time_point ended
callback_invocation_holder(callback_invocation *invocation, callbacks_heap *owner)
callback_invocation_holder(callback_invocation_holder &&other)
callback_invocation_holder & operator=(callback_invocation_holder &&other)


librealsense2
Author(s): LibRealSense ROS Team
autogenerated on Thu Dec 22 2022 03:41:42