blob: db5f98e222ed270f42043de2385bb6c17f4ffbf2 [file] [log] [blame]
Wind Yuan78ec1f72015-01-26 16:25:59 +08001/*
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 Yuan29a49f52015-01-26 17:57:37 +080024#include <base/xcam_common.h>
Wind Yuan78ec1f72015-01-26 16:25:59 +080025
26namespace XCam {
27
28class AnalyzerLoader
29{
30public:
zongwave03954a32015-09-22 15:40:44 +080031 AnalyzerLoader (const char *lib_path, const char *symbol);
32 virtual ~AnalyzerLoader ();
Wind Yuan78ec1f72015-01-26 16:25:59 +080033
zongwave03954a32015-09-22 15:40:44 +080034protected:
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 Yuan78ec1f72015-01-26 16:25:59 +080042
43private:
zongwave03954a32015-09-22 15:40:44 +080044 void *open_handle (const char *lib_path);
Wind Yuan78ec1f72015-01-26 16:25:59 +080045
46 XCAM_DEAD_COPY(AnalyzerLoader);
47
48private:
zongwave03954a32015-09-22 15:40:44 +080049 void *_handle;
50 char *_symbol;
51 char *_path;
Wind Yuan78ec1f72015-01-26 16:25:59 +080052};
53
54};
55
56#endif //XCAM_ANALYZER_LOADER_H