plugins_manager.h 2.36 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/* ALTA --- Analysis of Bidirectional Reflectance Distribution Functions

   Copyright (C) 2015 CNRS
   Copyright (C) 2013, 2014 Inria

   This file is part of ALTA.

   This Source Code Form is subject to the terms of the Mozilla Public
   License, v. 2.0.  If a copy of the MPL was not distributed with this
   file, You can obtain one at http://mozilla.org/MPL/2.0/.  */

12
#pragma once
13 14 15 16

#include <map>
#include <string>

17
#include "args.h"
18 19 20 21
#include "function.h"
#include "data.h"
#include "fitter.h"
#include "args.h"
22
#include "clustering.h"
23
#include "ptr.h"
24

Laurent Belcour's avatar
Laurent Belcour committed
25 26 27
/*! \class plugins_manager
 *  \brief This class permits to load plugin from shared library files.
 *  \ingroup core
28 29
 *
 *  \details
Laurent Belcour's avatar
Laurent Belcour committed
30 31
 *  This class handles the loading of plugins and insure that they can
 *  talk to each others through coordinates transforms.
32
 */
33 34 35 36
class plugins_manager
{
	public: //functions

Laurent Belcour's avatar
Laurent Belcour committed
37 38
		//! \brief get an instance of the function that is defined in the plugin with
		//! filename n. Return null if no one exist.
Laurent Belcour's avatar
Laurent Belcour committed
39 40
		//!
		//! \details
41
		//! This function attemps to load the shared object file specified in the
Laurent Belcour's avatar
Laurent Belcour committed
42
		//! <code>--func filename</code>.
43
		static function* get_function(const arguments& args) ;
44 45

		//! \brief load a function from the ALTA input file.
46
		static function* get_function(const std::string& filename);
47

Laurent Belcour's avatar
Laurent Belcour committed
48 49
		//! \brief get an instance of the data that is defined in the plugin with
		//! filename n. Return null if no one exist.
50
		static ptr<data> get_data(const std::string& n) ;
51

Laurent Belcour's avatar
Laurent Belcour committed
52 53
		//! \brief get an instance of the fitter that is defined in the plugin with
		//! filename n. Return null if no one exist.
54
		static ptr<fitter> get_fitter(const std::string& n) ;
55
		
Laurent Belcour's avatar
Laurent Belcour committed
56 57 58 59 60

		//! \brief check if a data object and a function object are compatibles.
		//! this has to be done before fitting to ensure that the
		//! parametrizations spaces are the same.
		//! \todo specify an output parametrization for the function ?
61
		static void check_compatibility(ptr<data>& d, const ptr<function>& f,
Laurent Belcour's avatar
Laurent Belcour committed
62 63
				const arguments& args) ;

64

65
		//! \brief Provide a measure of how much memory there is on the system.
66 67
		//! \details It permits to know is one can allocate more memory for a fitting
		//! procedure for example.
68
		static size_t get_system_memory() ;
69

70 71
	private: //data

72 73 74 75
		// Object provider prototypes
		typedef function* (*FunctionPrototype)();
		typedef fitter*   (*FitterPrototype)();
		typedef data*     (*DataPrototype)();
76
} ;