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

Connection.h

Go to the documentation of this file.
00001 
00048 #ifndef _AMIRE_COMPONENT_CONNECTION_H
00049 #define _AMIRE_COMPONENT_CONNECTION_H
00050 
00051 #include <amire/common/Defines.h>
00052 #include <amire/component/Component.h>
00053 #include <amire/component/ComponentState.h>
00054 
00055 namespace amire {
00056   namespace component {
00057     class AMIRE_EXPORT_API Component;
00058     class AMIRE_EXPORT_API Connection;
00059 
00064     class AMIRE_EXPORT_API ConnectionFilter : public virtual osg::Referenced {
00065     public:
00066       ConnectionFilter();
00067 
00068       virtual ~ConnectionFilter();
00069 
00074       virtual bool accept(const osg::ref_ptr<Connection> &connection) const;
00075 
00079       virtual const std::string &getName() const = 0;
00080     };
00081 
00090     class AMIRE_EXPORT_API Connection : public virtual osg::Referenced {
00091     private:
00092       osg::ref_ptr<Component> emitter;
00093       osg::ref_ptr<Component> receiver;
00094       int outSlotId;
00095       int inSlotId;
00096       osg::ref_ptr<const ConnectionFilter> filter;
00097       mutable std::string inSlotName;
00098       mutable std::string outSlotName;
00099       mutable bool valid;
00100       mutable bool deleted;
00101 
00102     public:
00103       virtual ~Connection();
00104 
00108       const osg::ref_ptr<const ConnectionFilter> &getFilter() const;
00109 
00113       const osg::ref_ptr<Component> &getEmitter() const;
00114 
00118       const osg::ref_ptr<Component> &getReceiver() const;
00119 
00123       int getOutSlotId() const;
00124 
00128       int getInSlotId() const;
00129 
00133       bool isValid() const;
00134 
00138       bool isDeleted() const;
00139 
00143       const std::string &getEmitterName() const;
00144 
00148       const std::string &getReceiverName() const;
00149 
00153       const std::string &getOutSlotName() const;
00154 
00158       const std::string &getInSlotName() const;
00159 
00160     private:
00161       friend class Component;
00162       friend class ComposedComponent;
00163 
00164       Connection(const osg::ref_ptr<Component> &emitter, const osg::ref_ptr<Component> &receiver, int outSlotId, int inSlotId, const osg::ref_ptr<const ConnectionFilter> &pfilter = NULL);
00165 
00166       void setDeleted(bool deleted = true) const;
00167       void validate() const;
00168       void receive(const osg::ref_ptr<const amire::property::Property> &property);
00169     };
00170 
00174     typedef STD_HASH_MAP(std::string, osg::ref_ptr<ConnectionFilter> ,
00175                          amire::common::HashCompareString) ConnectionFilterMap;
00176   }
00177 }
00178 
00179 #endif

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