Home | History | Annotate | Download | only in xcore
      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 (at) intel.com>
     19  */
     20 
     21 #ifndef XCAM_ANALYZER_LOADER_H
     22 #define XCAM_ANALYZER_LOADER_H
     23 
     24 #include <base/xcam_common.h>
     25 
     26 namespace XCam {
     27 
     28 class AnalyzerLoader
     29 {
     30 public:
     31     AnalyzerLoader (const char *lib_path, const char *symbol);
     32     virtual ~AnalyzerLoader ();
     33 
     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     }
     42 
     43 private:
     44     void *open_handle (const char *lib_path);
     45 
     46     XCAM_DEAD_COPY(AnalyzerLoader);
     47 
     48 private:
     49     void *_handle;
     50     char *_symbol;
     51     char *_path;
     52 };
     53 
     54 };
     55 
     56 #endif //XCAM_ANALYZER_LOADER_H
     57