00001 // License: Apache 2.0. See LICENSE file in root directory. 00002 // Copyright(c) 2015 Intel Corporation. All Rights Reserved. 00003 00004 #pragma once 00005 #ifndef LIBREALSENSE_CONTEXT_H 00006 #define LIBREALSENSE_CONTEXT_H 00007 00008 #include "types.h" 00009 #include "uvc.h" 00010 00011 struct rs_context_base : rs_context 00012 { 00013 std::shared_ptr<rsimpl::uvc::context> context; 00014 std::vector<std::shared_ptr<rs_device>> devices; 00015 00016 rs_context_base(); 00017 ~rs_context_base(); 00018 00019 static rs_context* acquire_instance(); 00020 static void release_instance(); 00021 00022 size_t get_device_count() const override; 00023 rs_device * get_device(int index) const override; 00024 private: 00025 static int ref_count; 00026 static std::mutex instance_lock; 00027 static rs_context* instance; 00028 static std::string api_version; 00029 }; 00030 00031 #endif