summaryrefslogtreecommitdiffabout
path: root/include/sitecing/sitespace.h
blob: 38fafe43aab442c0a95684b8651896de59d2be80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef __SITECING_SITESPACE_H
#define __SITECING_SITESPACE_H

#include <string>
#include <map>
#include <list>
#include "sitecing/component_factory.h"
#include "sitecing/component_so.h"
#include "sitecing/configuration.h"

/**
 * @file
 * @brief The sitespace class declaration.
 */

namespace sitecing {
    using namespace std;

    /**
     * The class responsible for handling the whole environment (as far as I can
     * remember).
     */
    class sitespace {
	public:
	    /**
	     * The type for the map of components from the component name/path
	     * to the loaded component objects.
	     */
	    typedef map<string,component_so*> components_t;
	    /**
	     * The type for listing the components.
	     */
	    typedef list<component_so*> sentenced_t;
	    /**
	     * The main configuration object.
	     */
	    configuration& config;
	    /**
	     * The components producing factory.
	     */
	    component_factory factory;
	    /**
	     * The components loaded.
	     */
	    components_t components;
	    /**
	     * The list of components sentenced to death.
	     */
	    sentenced_t sentenced;

	    /**
	     * Create an object in accordance with the configuration parsed.
	     * @param c the coniguration container.
	     */
	    sitespace(configuration& c);
	    ~sitespace();

	    /**
	     * Fetch the component, providing it with the interface object
	     * pointer.
	     * @param c the component name.
	     * @param scif the interface object.
	     * @return the component fetches.
	     */
	    so_component fetch(const string& c,sitecing_interface* scif);

	private:
	    /**
	     * Execute the death sentence as much as we can.
	     */
	    void execute_sentenced();
    };

}

#endif /* __SITECING_SITESPACE_H */