Component.h
1
26
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
36namespace Pt {
37
38namespace Cosmo {
39
40class IComponentType;
42
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
Component()
Constructor.
virtual ~Component()
Destructor.
Definition Component.h:64
bool hasFeatureId(const char *featureId) const
Returns true if the given feature ID is implemented.
const char * classId() const
Returns the class ID.
I * queryInterface()
Returns the interface or null if not available.
Component(const Component &)=delete
No copy constructor.
Component & operator=(const Component &)=delete
No copy assignment.
virtual void onInitialize(const IComponentDeclaration &decl)
Called when the component is initialized.
Definition Component.h:105
void init(const IComponentType *type, const IComponentDeclaration *decl)
Initializes the component.
Component instance declaration.
Definition IComponentDeclaration.h:45
Component interface query.
Definition IComponentType.h:50
Cosmo Component Model.
Definition Api.h:53
Core module.
Definition Allocator.h:33