quechua / include / modules.h

 * Quechua - the lightweight data mining framework
 * Copyright (C) 2012 Marek Denis <quechua@octogan.net>
 * This program 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 3 of the License, or
 * (at your option) any later version.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.

#ifndef MODULES_H
#define	MODULES_H

#include <cassert>

#include <glibmm/init.h>
#include <glibmm/module.h>

#include "types.h"
#include "log.h"
#include "interface.h"

class Module {
    string_t name;
    string_t path;
    g_module *module;
    Module(const string_t& name, const string_t& path,g_module* module);
    virtual ~Module(); 

    const string_t& get_name() const;
    const string_t& get_path() const;
    bool get_symbol(const string_t& symbol_name,void*& symbol);
    g_module* get_module() const;


typedef std::map<string_t,Module*> map_module;
typedef map_module::iterator map_module_it;

Channel* const register_flow_in_channels(const setting_t&,Workflow*,
                               channels_map* channels);
void unregister_flow_from_channels(Workflow* flow, Channel* channel);
Logger* const register_flow_in_loggers(const setting_t& flow_settings,Workflow* flow, 
                              loggers_map* loggers);
void unregister_flow_from_loggers(Workflow* flow, Logger* logger);

class Modules {
    Modules(const string_t& path_prefix_) : path_prefix(path_prefix_)
    virtual ~Modules() {
        LOG(INFO) << "Destroying modules";
        map_module::iterator it,end;
        it = modules.begin();
        end =modules.end();
            delete it->second;

    bool load_modules(const configuration_t& config);
    bool load_components(const configuration_t& config);
    bool add_module(const string_t& mod_name, const string_t& library_file);
    bool module_loaded(const string_t& modname);
    Algorithm* load_algorithm(const string_t& algorithm_name,
                              const setting_t& algorithm_settings);
    Processor* load_processor(const string_t& processor_name,
                              const setting_t& processor_settings);
    size_t size();

    string_t path_prefix;
    map_module modules;

    Module* load_module_s(const string_t& kName);

    bool load_channels(const setting_t& channel_settings);
    bool load_loggers(const setting_t& logger_settings);
    bool load_workflows(const setting_t& flow_settings);

#endif	/* MODULES_H */
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.