ComponentInfo.h
1 
27 #ifndef COSMO_COMPONENT_INFO_H
28 #define COSMO_COMPONENT_INFO_H
29 
30 #include <Pt/Cosmo/Api.h>
31 #include <Pt/Cosmo/IComponentPlugin.h>
32 #include <Pt/Cosmo/IComponentDeclaration.h>
33 #include <Pt/Cosmo/IComponentStatus.h>
34 #include <Pt/Cosmo/IEnumerable.h>
35 
36 #include <string>
37 
38 namespace Pt {
39 
40 namespace Cosmo {
41 
42 class IDependencyInfo;
43 
53 {
54  public:
64  : _plugin(plugin)
65  , _decl(decl)
66  , _status(status)
67  { }
68 
71  ComponentInfo(const ComponentInfo&) = delete;
72 
75  virtual ~ComponentInfo()
76  { }
77 
81 
91  {
92  _plugin = plugin;
93  _decl = decl;
94  _status = status;
95  }
96 
99  const IComponentPlugin* plugin() const
100  {
101  return _plugin;
102  }
103 
107  {
108  return _decl;
109  }
110 
113  const IComponentStatus* status() const
114  {
115  return _status;
116  }
117 
120  template<typename I>
121  bool hasInterface() const
122  {
123  return _plugin->hasInterface<I>();
124  }
125 
129  {
130  return _plugin->mode();
131  }
132 
135  bool hasFeatureId(const char* featureId) const
136  {
137  return _plugin->hasFeatureId(featureId);
138  }
139 
143  {
144  return _plugin->featureIds();
145  }
146 
149  const char* classId() const
150  {
151  return _plugin->classId();
152  }
153 
156  const char* info() const
157  {
158  return _plugin->info();
159  }
160 
163  const char* instanceId() const
164  {
165  return _decl->instanceId();
166  }
167 
171  {
172  return _status->dependencies();
173  }
174 
175  private:
176  IComponentPlugin* _plugin;
177  IComponentDeclaration* _decl;
178  IComponentStatus* _status;
179 };
180 
181 } // namespace Cosmo
182 
183 } // namespace Pt
184 
185 #endif // include guard
Core module.
Definition: Allocator.h:33
const IEnumerable< IDependencyInfo > & dependencies() const
Returns the dependency information for this component.
Definition: IComponentStatus.h:56
const IComponentStatus * status() const
Returns the component status.
Definition: ComponentInfo.h:113
const IEnumerable< const char * > & featureIds() const
Returns the implemented feature IDs.
Definition: ComponentInfo.h:142
const IComponentPlugin * plugin() const
Returns the plugin.
Definition: ComponentInfo.h:99
Component information holder.
Definition: ComponentInfo.h:53
ComponentInfo(IComponentPlugin *plugin, IComponentDeclaration *decl, IComponentStatus *status)
Constructor.
Definition: ComponentInfo.h:61
ComponentMode mode() const
Returns the component mode.
Definition: ComponentInfo.h:128
ComponentInfo(const ComponentInfo &)=delete
No copy constructor.
Component plugin interface.
Definition: IComponentPlugin.h:51
const IComponentDeclaration * declaration() const
Returns the instance declaration.
Definition: ComponentInfo.h:106
bool hasFeatureId(const char *featureId) const
Returns true if feature ID is implemented.
Definition: ComponentInfo.h:135
Component status interface.
Definition: IComponentStatus.h:47
bool hasFeatureId(const char *featureId) const
Returns true if the given feature ID is implemented.
Definition: IComponentType.h:116
const char * classId() const
Returns the class ID of the component.
Definition: IComponentType.h:128
void assign(IComponentPlugin *plugin, IComponentDeclaration *decl, IComponentStatus *status)
Reassigns the component information.
Definition: ComponentInfo.h:88
const char * classId() const
Returns the class ID.
Definition: ComponentInfo.h:149
const char * info() const
Returns the info text.
Definition: ComponentInfo.h:156
const char * instanceId() const
Returns the instance ID of the component.
Definition: IComponentDeclaration.h:54
const IEnumerable< IDependencyInfo > & dependencies() const
Returns info about the dependencies.
Definition: ComponentInfo.h:170
const char * info() const
Returns the info string of the component.
Definition: IComponentPlugin.h:136
Component flags.
Definition: ComponentMode.h:45
Component instance declaration.
Definition: IComponentDeclaration.h:45
const IEnumerable< const char * > & featureIds() const
Returns the implemented feature IDs.
Definition: IComponentType.h:122
const char * instanceId() const
Returns the instance ID.
Definition: ComponentInfo.h:163
bool hasInterface() const
Returns true if interface is available.
Definition: ComponentInfo.h:121
ComponentInfo & operator=(const ComponentInfo &)=delete
No copy assignment.
bool hasInterface() const
Returns true if the interface is implemented.
Definition: IComponentType.h:135
ComponentMode mode() const
Returns the component mode.
Definition: IComponentPlugin.h:130
virtual ~ComponentInfo()
Destructor.
Definition: ComponentInfo.h:75