Wind Yuan | 78ec1f7 | 2015-01-26 16:25:59 +0800 | [diff] [blame] | 1 | /* |
| 2 | * analyzer_loader.h - analyzer loader |
| 3 | * |
| 4 | * Copyright (c) 2015 Intel Corporation |
| 5 | * |
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * you may not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
| 17 | * |
| 18 | * Author: Wind Yuan <feng.yuan@intel.com> |
| 19 | */ |
| 20 | |
| 21 | #ifndef XCAM_ANALYZER_LOADER_H |
| 22 | #define XCAM_ANALYZER_LOADER_H |
| 23 | |
Wind Yuan | 29a49f5 | 2015-01-26 17:57:37 +0800 | [diff] [blame] | 24 | #include <base/xcam_common.h> |
Wind Yuan | 78ec1f7 | 2015-01-26 16:25:59 +0800 | [diff] [blame] | 25 | |
| 26 | namespace XCam { |
| 27 | |
| 28 | class AnalyzerLoader |
| 29 | { |
| 30 | public: |
zongwave | 03954a3 | 2015-09-22 15:40:44 +0800 | [diff] [blame] | 31 | AnalyzerLoader (const char *lib_path, const char *symbol); |
| 32 | virtual ~AnalyzerLoader (); |
Wind Yuan | 78ec1f7 | 2015-01-26 16:25:59 +0800 | [diff] [blame] | 33 | |
zongwave | 03954a3 | 2015-09-22 15:40:44 +0800 | [diff] [blame] | 34 | protected: |
| 35 | void *load_library (const char *lib_path); |
| 36 | void *get_symbol (void* handle); |
| 37 | virtual void *load_symbol (void* handle) = 0; |
| 38 | bool close_handle (); |
| 39 | const char * get_lib_path () const { |
| 40 | return _path; |
| 41 | } |
Wind Yuan | 78ec1f7 | 2015-01-26 16:25:59 +0800 | [diff] [blame] | 42 | |
| 43 | private: |
zongwave | 03954a3 | 2015-09-22 15:40:44 +0800 | [diff] [blame] | 44 | void *open_handle (const char *lib_path); |
Wind Yuan | 78ec1f7 | 2015-01-26 16:25:59 +0800 | [diff] [blame] | 45 | |
| 46 | XCAM_DEAD_COPY(AnalyzerLoader); |
| 47 | |
| 48 | private: |
zongwave | 03954a3 | 2015-09-22 15:40:44 +0800 | [diff] [blame] | 49 | void *_handle; |
| 50 | char *_symbol; |
| 51 | char *_path; |
Wind Yuan | 78ec1f7 | 2015-01-26 16:25:59 +0800 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | }; |
| 55 | |
| 56 | #endif //XCAM_ANALYZER_LOADER_H |