post-processing-filters-list.h
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2019 Intel Corporation. All Rights Reserved.
3 
4 #pragma once
5 
7 #include <list>
8 #include <memory>
9 
10 
11 /*
12  Container for all the filters that are defined. These are added into our list and can be iterated
13  over, without actual knowledge of any implementation.
14 */
16 {
17  typedef std::function<
18  std::shared_ptr< post_processing_filter >()
20  typedef std::list< create_fn > list;
21 
22  static list & get()
23  {
24  static list the_filters;
25  return the_filters;
26  }
27 
28  template< class T >
29  static list::iterator register_filter( std::string const & name )
30  {
31  auto & filters = get();
32  return filters.insert(
33  filters.end(),
34  [name]() -> std::shared_ptr< post_processing_filter >
35  {
36  try
37  {
38  return std::make_shared< T >( name );
39  }
40  catch( std::exception const& e )
41  {
42  LOG_ERROR( "Failed to start " << name << ": " << e.what());
43  }
44  catch( ... )
45  {
46  LOG_ERROR( "Failed to start " << name << ": unknown exception");
47  }
48  return std::shared_ptr< T >();
49  }
50  );
51  }
52 };
53 
GLuint const GLchar * name
GLsizei const GLchar *const * string
static list::iterator register_filter(std::string const &name)
e
Definition: rmse.py:177
std::function< std::shared_ptr< post_processing_filter >) > create_fn
#define LOG_ERROR(...)
Definition: src/types.h:242


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