yast2-core
Y2ComponentBroker.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | |
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
8 | |
9 | core system |
10 | (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12 
13  File: Y2ComponentBroker.h
14 
15  Author: Mathias Kettner <kettner@suse.de>
16  Maintainer: Thomas Roelz <tom@suse.de>
17 
18 /-*/
19 // -*- c++ -*-
20 
21 #ifndef Y2ComponentBroker_h
22 #define Y2ComponentBroker_h
23 
24 #include <string.h>
25 #include <map>
26 #include <vector>
27 #include <string>
28 
29 using std::vector;
30 using std::map;
31 using std::string;
32 
33 class Y2ComponentCreator;
34 class Y2Component;
35 
92 {
93 public:
98  enum order_t { BUILTIN = 0,
99  PLUGIN = 1,
100  SCRIPT = 2,
102  NETWORK = 4,
103  MAX_ORDER = 5 };
104 
105 private:
106 
107  struct ltstr
108  {
109  bool operator()(const char* s1, const char* s2) const
110  {
111  return strcmp(s1, s2) < 0;
112  }
113  };
114 
115  static map<const char *, const Y2Component *, ltstr> namespaces;
116 
120  static vector<const Y2ComponentCreator *> *creators[MAX_ORDER];
121 
127  static bool stop_register;
128 
134  static map<string, string> namespace_exceptions;
135 
136 public:
149  static void registerComponentCreator(const Y2ComponentCreator *creator, order_t order, bool force=false);
150 
151 private:
160  static Y2Component *createComponent(const char *name, bool look_for_clients);
161 
162 public:
166  static Y2Component *createClient(const char *name);
167 
171  static Y2Component *createServer(const char *name);
172 
179  static Y2Component *getNamespaceComponent(const char *name);
180 
188  static bool registerNamespaceException(const char* name_space, const char* component_name);
189 
190 private:
194  static void initializeLists();
195 };
196 
197 
198 #endif //Y2ComponentBroker_h

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