2006-08-03 00:06:20 +02:00
|
|
|
// src/python_cpu_policy_manager.hh - Copyright 2005, 2006, University
|
2006-02-17 17:08:54 +01:00
|
|
|
// of Padova, dept. of Pure and Applied
|
|
|
|
// Mathematics
|
|
|
|
//
|
|
|
|
// This file is part of SGPEMv2.
|
|
|
|
//
|
|
|
|
// This is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// SGPEMv2 is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with SGPEMv2; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
2006-08-03 00:06:20 +02:00
|
|
|
#ifndef PYTHON_CPU_POLICY_MANAGER_HH
|
|
|
|
#define PYTHON_CPU_POLICY_MANAGER_HH 1
|
2006-02-17 17:08:54 +01:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <Python.h>
|
|
|
|
|
2006-08-02 23:57:36 +02:00
|
|
|
#include "cpu_policy_manager.hh"
|
2006-08-03 00:06:20 +02:00
|
|
|
#include "python_cpu_policy.hh"
|
2006-02-17 17:08:54 +01:00
|
|
|
|
|
|
|
namespace sgpem
|
|
|
|
{
|
2006-08-02 23:57:36 +02:00
|
|
|
//class CPUPolicyManager;
|
|
|
|
class PythonCPUPolicyManager;
|
2006-02-23 19:55:14 +01:00
|
|
|
|
|
|
|
/** \brief Manages Python user-implemented policies
|
|
|
|
*
|
|
|
|
* This singleton manages the creation and destruction
|
|
|
|
* of a Python policy.
|
|
|
|
*/
|
2006-08-02 23:57:36 +02:00
|
|
|
class SG_DLLEXPORT PythonCPUPolicyManager : public CPUPolicyManager
|
2006-02-21 11:31:01 +01:00
|
|
|
{
|
2006-02-23 19:55:14 +01:00
|
|
|
public:
|
2006-08-02 23:57:36 +02:00
|
|
|
PythonCPUPolicyManager();
|
|
|
|
~PythonCPUPolicyManager();
|
2006-02-23 19:55:14 +01:00
|
|
|
|
|
|
|
/** \brief Initialize the Python interpreter.
|
|
|
|
*
|
|
|
|
* If the interpreter has already been initialized, it terminates it, cleanups old policies,
|
|
|
|
* and restarts it.
|
|
|
|
*/
|
2006-02-21 11:31:01 +01:00
|
|
|
void init();
|
2006-02-23 19:55:14 +01:00
|
|
|
|
2006-08-02 23:57:36 +02:00
|
|
|
const std::vector<CPUPolicy*>& get_avail_policies();
|
2006-06-29 10:44:30 +02:00
|
|
|
|
2006-03-08 17:47:39 +01:00
|
|
|
protected:
|
2006-08-02 23:57:36 +02:00
|
|
|
/** The selected and active PyhonCPUPolicy object. */
|
2006-06-12 15:16:10 +02:00
|
|
|
void collect_policies();
|
2006-06-29 10:44:30 +02:00
|
|
|
|
2006-08-09 16:38:45 +02:00
|
|
|
private:
|
2006-08-02 23:57:36 +02:00
|
|
|
PythonCPUPolicyManager(const PythonCPUPolicyManager&);
|
|
|
|
PythonCPUPolicyManager& operator=(const PythonCPUPolicyManager&);
|
2006-02-21 11:31:01 +01:00
|
|
|
|
|
|
|
bool _initialized;
|
|
|
|
};
|
2006-02-17 17:08:54 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2006-02-19 23:36:24 +01:00
|
|
|
|