Component.h
1 
27 #ifndef COSMO_COMPONENT_H
28 #define COSMO_COMPONENT_H
29 
30 #include <Pt/Cosmo/Api.h>
31 #include <Pt/Cosmo/Enumerable.h>
32 
33 #include <string>
34 #include <vector>
35 
36 namespace Pt {
37 
38 namespace Cosmo {
39 
40 class IComponentType;
41 class IComponentDeclaration;
42 
51 class Component
52 {
53  public:
57 
60  Component(const Component&) = delete;
61 
64  virtual ~Component()
65  {}
66 
69  Component& operator=(const Component&) = delete;
70 
79  void init(const IComponentType* type,
80  const IComponentDeclaration* decl);
81 
86  bool hasFeatureId(const char* featureId) const;
87 
90  const char* classId() const;
91 
94  template <typename I>
96 
97  protected:
105  virtual void onInitialize(const IComponentDeclaration& decl)
106  { }
107 
108  private:
109  const IComponentType* _type;
110  const IComponentDeclaration* _decl;
111 };
112 
113 } // namespace Cosmo
114 
115 } // namespace Pt
116 
117 #include <Pt/Cosmo/Component.tpp>
118 
119 #include <Pt/Cosmo/IActivate.h>
120 #include <Pt/Cosmo/IConnect.h>
121 
122 #endif // include guard
I * queryInterface()
Returns the interface or null if not available.
Core module.
Definition: Allocator.h:33
void init(const IComponentType *type, const IComponentDeclaration *decl)
Initializes the component.
Component base class.
Definition: Component.h:52
const char * classId() const
Returns the class ID.
Component interface query.
Definition: IComponentType.h:50
virtual ~Component()
Destructor.
Definition: Component.h:64
bool hasFeatureId(const char *featureId) const
Returns true if the given feature ID is implemented.
Component(const Component &)=delete
No copy constructor.
Component & operator=(const Component &)=delete
No copy assignment.
Component instance declaration.
Definition: IComponentDeclaration.h:45
virtual void onInitialize(const IComponentDeclaration &decl)
Called when the component is initialized.
Definition: Component.h:105
Component()
Constructor.