yast2-core
Y2CCAgentComponent.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 
3 /*
4  * Author: Arvin Schnell <arvin@suse.de>
5  */
6 
7 
8 #ifndef Y2CCAgentComponent_h
9 #define Y2CCAgentComponent_h
10 
11 
12 #include <vector>
13 #include <y2/Y2ComponentCreator.h>
14 
15 
19 template <class AgentComp> class Y2CCAgentComp : public Y2ComponentCreator
20 {
21 
22 public:
23 
27  Y2CCAgentComp (const char*);
28 
29 
34  for (typename std::vector<AgentComp*>::iterator i = agent_instances.begin();
35  i != agent_instances.end();
36  ++i)
37  delete *i;
38  }
39 
40 
44  bool isServerCreator () const { return true; }
45 
50  Y2Component* create (const char*) const;
51 
55  Y2Component* provideNamespace (const char*) { return NULL; }
56 
57 private:
58 
62  const char* my_name;
63 
67  mutable typename std::vector<AgentComp*> agent_instances;
68 };
69 
70 
71 template <class AgentComp>
74  my_name (my_name)
75 {}
76 
77 
78 template <class AgentComp> Y2Component*
80 {
81  if (strcmp (name, my_name) == 0)
82  {
83  // Agent cannot share one component instance because IniAgent component
84  // contain specific settings for given IniParser and it cannot be shared
85  AgentComp *instance = new AgentComp(my_name);
86  agent_instances.push_back(instance);
87  return instance;
88  }
89 
90  return 0;
91 }
92 
93 
94 #endif // Y2CCAgentComponent_h
std::vector< AgentComp * > agent_instances
Definition: Y2CCAgentComponent.h:67
enters the component to the broker s list in the given order Y2Component int int current_level same as but for external components which may reside in different directories The level identifies the directory prefix from the list defined in pathsearch cc bool false for clients bool true for clients Catalog of component take it if we can stat it and it is not take it if we can t stat it and its line matches in current level only name
Definition: componentcreator.txt:34
Y2Component * provideNamespace(const char *)
Definition: Y2CCAgentComponent.h:55
~Y2CCAgentComp()
Definition: Y2CCAgentComponent.h:33
Many SCR s in WFM Create a new scr instance
Definition: many-scr.txt:7
Communication handle to a YaST2 component.
Definition: Y2Component.h:262
const char * my_name
Definition: Y2CCAgentComponent.h:62
Definition: Y2CCAgentComponent.h:19
Y2Component * create(const char *) const
Definition: Y2CCAgentComponent.h:79
Definition: Y2ComponentBroker.h:91
Can create certain YaST2 components As documented in Y2Component, there are many ways how to realize ...
Definition: Y2ComponentCreator.h:43
bool isServerCreator() const
Definition: Y2CCAgentComponent.h:44
Y2CCAgentComp(const char *)
Definition: Y2CCAgentComponent.h:72

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