Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Examples

Y2CCAgentComponent.h

Go to the documentation of this file.
00001 // -*- c++ -*-
00002 
00003 /*
00004  *  Author: Arvin Schnell <arvin@suse.de>
00005  */
00006 
00007 
00008 #ifndef Y2CCAgentComponent_h
00009 #define Y2CCAgentComponent_h
00010 
00011 
00012 #include <y2/Y2ComponentCreator.h>
00013 
00014 
00018 template <class AgentComp> class Y2CCAgentComp : public Y2ComponentCreator
00019 {
00020 
00021 public:
00022 
00026     Y2CCAgentComp (const char*);
00027 
00031     bool isServerCreator () const { return true; }
00032 
00037     Y2Component* create (const char*) const;
00038     
00042     Y2Component* provideNamespace (const char*) { return NULL; }
00043 
00044 private:
00045 
00049     const char* my_name;
00050 
00051 };
00052 
00053 
00054 template <class AgentComp>
00055 Y2CCAgentComp<AgentComp>::Y2CCAgentComp (const char* my_name)
00056     : Y2ComponentCreator (Y2ComponentBroker::BUILTIN),
00057       my_name (my_name)
00058 {
00059 }
00060 
00061 
00062 template <class AgentComp> Y2Component*
00063 Y2CCAgentComp<AgentComp>::create (const char* name) const
00064 {
00065     if (strcmp (name, my_name) == 0)
00066         return new AgentComp (my_name);
00067 
00068     return 0;
00069 }
00070 
00071 
00072 #endif // Y2CCAgentComponent_h

Generated on Fri Nov 9 18:15:22 2007 for yast2-core by doxygen 1.3.6