usb: getting string descriptors, minor improvements
[quarnos.git] / manes / cds / factory.h
blob9dda463b029f2931feb4724196721864e556c93a
1 /* Quarn OS / Manes
3 * Factory
5 * Copyright (C) 2009 Pawel Dziepak
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef _FACTORY_H_
24 #define _FACTORY_H_
26 #include "type.h"
27 #include "creator.h"
29 namespace manes {
30 namespace cds {
31 /**
32 * @brief Types manager
33 * @details This is main type manager in Manes. At leas one insance
34 * of this class exists and is created by manei. In most cases
35 * construction of such class is performed manually, not using
36 * automatic Manes mechanisms.
37 * @see manei
39 class factory : public creator {
40 public:
41 factory(){}
42 factory(p<type> tpe) : creator(tpe) {}
44 /**
45 * @brief Not supported
47 virtual p<component> new_component(const component_name &name);
49 /**
50 * @brief Get the specified type
52 * @details This function overrides base behavior introducing mechanisms
53 * necessary to correctly store and retrieve types from database.
55 virtual p<component> get_component(const component_name &name);
57 /**
58 * @brief Register type in system.
59 * @details This is a decorator that allows client to get rid
60 * off unecessary code required when any other class instances are
61 * created. In this case there is only need to provide factory
62 * with an existing instance of type class.
63 * @param newtype type to be registered
65 virtual p<component> add_existing(p<component>);
70 #endif