yast2-core

Y2ComponentBroker.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                                        (C) SuSE GmbH |
00011 \----------------------------------------------------------------------/
00012 
00013    File:       Y2ComponentBroker.h
00014 
00015    Author:     Mathias Kettner <kettner@suse.de>
00016    Maintainer: Thomas Roelz <tom@suse.de>
00017 
00018 /-*/
00019 // -*- c++ -*-
00020 
00021 #ifndef Y2ComponentBroker_h
00022 #define Y2ComponentBroker_h
00023 
00024 #include <string.h>
00025 #include <map>
00026 #include <vector>
00027 #include <string>
00028 
00029 using std::vector;
00030 using std::map;
00031 using std::string;
00032 
00033 class Y2ComponentCreator;
00034 class Y2Component;
00035 
00091 class Y2ComponentBroker
00092 {
00093 public:
00098     enum order_t { BUILTIN          = 0,
00099                    PLUGIN           = 1,
00100                    SCRIPT           = 2,
00101                    EXTERNAL_PROGRAM = 3,
00102                    NETWORK          = 4,
00103                    MAX_ORDER        = 5 };
00104 
00105 private:
00106 
00107     struct ltstr
00108     {
00109         bool operator()(const char* s1, const char* s2) const
00110         {
00111             return strcmp(s1, s2) < 0;
00112         }
00113     };
00114 
00115     static map<const char *, const Y2Component *, ltstr> namespaces;
00116 
00120     static vector<const Y2ComponentCreator *> *creators[MAX_ORDER];
00121 
00127     static bool stop_register;
00128     
00134     static map<string, string> namespace_exceptions;
00135     
00136 public:
00149     static void registerComponentCreator(const Y2ComponentCreator *creator, order_t order, bool force=false);
00150 
00151 private:
00160     static Y2Component *createComponent(const char *name, bool look_for_clients);
00161 
00162 public:
00166     static Y2Component *createClient(const char *name);
00167 
00171     static Y2Component *createServer(const char *name);
00172     
00179     static Y2Component *getNamespaceComponent(const char *name);
00180     
00188     static bool registerNamespaceException(const char* name_space, const char* component_name);
00189 
00190 private:
00194     static void initializeLists();
00195 };
00196 
00197 
00198 #endif //Y2ComponentBroker_h

Generated on a sunny day for yast2-core by doxygen 1.7.3