Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ComposedComponent.h

Go to the documentation of this file.
00001 
00048 #ifndef _AMIRE_COMPONENT_COMPOSED_COMPONENT_H
00049 #define _AMIRE_COMPONENT_COMPOSED_COMPONENT_H
00050 
00051 #include <amire/common/Defines.h>
00052 #include <amire/component/Component.h>
00053 #include <amire/component/ComponentContext.h>
00054 
00055 namespace amire {
00056   namespace component {
00070     class AMIRE_EXPORT_API ConfigurationPropertyExport : public virtual osg::Referenced {
00071     private:
00072       std::string libraryName;
00073 
00074     public:
00075       ConfigurationPropertyExport();
00076       virtual ~ConfigurationPropertyExport();
00077 
00086       virtual osg::ref_ptr<amire::property::StructProperty> newConfigurationProperty(const osg::ref_ptr<const ComposedComponent> &composedComponent) const;
00087 
00094       virtual void updateConfigurationProperty(const osg::ref_ptr<const ComposedComponent> &composedComponent, const osg::ref_ptr<amire::property::StructProperty> &configuration) const;
00095 
00101       virtual void updateComponents(const osg::ref_ptr<ComposedComponent> &composedComponent, const osg::ref_ptr<const amire::property::StructProperty> &configuration) const;
00102 
00106       virtual std::string getName() const;
00107 
00112       const std::string &getLibrary() const;
00113 
00118       void setLibrary(const std::string &libraryName);
00119     };
00120 
00126     class AMIRE_EXPORT_API SlotExport : public virtual EmissionListener {
00127     private:
00128       friend class ComposedComponent;
00129       osg::ref_ptr<Component> component;
00130       osg::ref_ptr<ComposedComponent> composedComponent;
00131       std::string internSlotName;
00132       std::string externSlotName;
00133       int internSlotId;
00134       int externSlotId;
00135       bool outSlot;
00136 
00137     public:
00138       virtual ~SlotExport();
00139       virtual void emitted(const osg::ref_ptr<const Component> &component, int outSlotId, const osg::ref_ptr<const amire::property::Property> &property);
00140 
00144       osg::ref_ptr<const Component> getComponent() const;
00145 
00150       const std::string &getInternSlotName() const;
00151 
00156       const std::string &getExternSlotName() const;
00157 
00161       bool isOutSlot() const;
00162 
00167       bool equals(const osg::ref_ptr<SlotExport> &export);
00168 
00169     private:
00170       SlotExport(const osg::ref_ptr<ComposedComponent> &composedComponent, const osg::ref_ptr<Component> &component, const std::string &internSlotName, const std::string &externSlotName, int internSlotId, int externSlotId, bool outSlot);
00171     };
00172 
00184     class AMIRE_EXPORT_API ComposedComponent : public virtual Component, public virtual ComponentContext {
00185     private:
00186       osg::ref_ptr<ConfigurationPropertyExport> configurationExport;
00187       std::vector<osg::ref_ptr<SlotExport> > inExports;
00188       std::vector<osg::ref_ptr<SlotExport> > outExports;
00189 
00190     public:
00191       ComposedComponent(ComponentManager *componentManager, const std::string &prototypeName = std::string());
00192 
00193       virtual ~ComposedComponent();
00194 
00195       virtual void reinitializeEngine(MREngine *engine);
00196       virtual void functionalCallback(MREngine *engine);
00197       virtual osg::ref_ptr<const Component> getComponentPrototype(const std::string &name);
00198       virtual osg::ref_ptr<const amire::property::StructProperty> getConfigurationProperty() const;
00199       virtual osg::ref_ptr<amire::property::StructProperty> requestConfigurationProperty();
00200 
00204       void setConfigurationPropertyExport(osg::ref_ptr<ConfigurationPropertyExport> configurationExport);
00205 
00209       const osg::ref_ptr<ConfigurationPropertyExport> &getConfigurationPropertyExport() const;
00210 
00231       void add(const osg::ref_ptr<Component> &component);
00232 
00249       void remove(const osg::ref_ptr<Component> &component);
00250 
00254       const std::vector<osg::ref_ptr<SlotExport> > &getInSlotExports() const;
00255 
00259       const std::vector<osg::ref_ptr<SlotExport> > &getOutSlotExports() const;
00260 
00266       void exportInSlot(const osg::ref_ptr<Component> &component, const std::string &inSlotName);
00267 
00273       void exportOutSlot(const osg::ref_ptr<Component> &component, const std::string &outSlotName);
00274 
00279       void exportInSlot(const osg::ref_ptr<Component> &component, const std::string &internInSlotName, const std::string &externInSlotName);
00280 
00285       void exportOutSlot(const osg::ref_ptr<Component> &component, const std::string &internOutSlotName, const std::string &externOutSlotName);
00286 
00293       void unexportInSlot(const osg::ref_ptr<Component> &component, const std::string &internInSlotName);
00294 
00301       void unexportOutSlot(const osg::ref_ptr<Component> &component, const std::string &internOutSlotName);
00302 
00309       void unexportInSlot(const std::string &externInSlotName);
00310 
00317       void unexportOutSlot(const std::string &externOutSlotName);
00318 
00326       void eliminateUnusedExports();
00327 
00335       void updateRequiredExports();
00336 
00341       int getExternOutSlotId(const osg::ref_ptr<const Component> &component, int internOutSlotId) const;
00342 
00347       int getExternInSlotId(const osg::ref_ptr<const Component> &component, int internInSlotId) const;
00348 
00349     protected:
00350       virtual void changedInSlots(const osg::ref_ptr<const Component> &component);
00351       virtual void changedOutSlots(const osg::ref_ptr<const Component> &component);
00352       virtual void removedInSlot(const osg::ref_ptr<const Component> &component, int inSlotId, const std::string &inSlotName);
00353       virtual void removedOutSlot(const osg::ref_ptr<const Component> &component, int outSlotId, const std::string &outSlotName);
00354       virtual void renamedInSlot(const osg::ref_ptr<const Component> &component, int inSlotId, const std::string &oldInSlotName, const std::string &newInSlotName);
00355       virtual void renamedOutSlot(const osg::ref_ptr<const Component> &component, int outSlotId, const std::string &oldOutSlotName, const std::string &newOutSlotName);
00356       virtual void changedInSlotType(const osg::ref_ptr<const Component> &component, int inSlotId, const std::string &inSlotName, const osg::ref_ptr<const amire::property::PropertyType> &oldInSlotType, const osg::ref_ptr<const amire::property::PropertyType> &newInSlotType);
00357       virtual void changedOutSlotType(const osg::ref_ptr<const Component> &component, int outSlotId, const std::string &outSlotName, const osg::ref_ptr<const amire::property::PropertyType> &oldOutSlotType, const osg::ref_ptr<const amire::property::PropertyType> &newOutSlotType);
00358       virtual std::string getQualifier() const;
00359       virtual osg::ref_ptr<Component> clone(ComponentContext* context) const;
00360       virtual void receiveInSlotProperty(int inSlotId, const osg::ref_ptr<const amire::property::Property> &property);
00361       virtual osg::ref_ptr<const amire::property::Property> emitOutSlotProperty(int outSlotId);
00362       virtual void configurationPropertyModified();
00363       virtual void initMetaInformation();
00364 
00365     private:
00366       friend class Component;
00367       friend class SlotExport;
00368 
00369       void emitExportedSlot(int outSlotId, const osg::ref_ptr<const amire::property::Property> &property);
00370     };
00371 
00377     class AMIRE_EXPORT_API RelayComponent : public virtual Component {
00378     private:
00379       osg::ref_ptr<const amire::property::Property> relayProperty;
00380 
00381     public:
00382       RelayComponent(ComponentManager *componentManager);
00383       virtual ~RelayComponent();
00384 
00385     protected:
00386       virtual void receiveInSlotProperty(int inOutSlotId, const osg::ref_ptr<const amire::property::Property> &property);
00387       virtual osg::ref_ptr<const amire::property::Property> emitOutSlotProperty(int outSlotId);
00388       virtual void configurationPropertyModified();
00389     };
00390   }
00391 }
00392 
00393 #endif

Generated on Tue May 20 17:23:52 2003 for AMIRE-Framework by doxygen1.3