Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

DataInPort.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00020 /*
00021  * $Log: DataInPort.h,v $
00022  * Revision 1.6  2007/01/21 17:16:58  n-ando
00023  * Invalid kanji code was deleted.
00024  *
00025  * Revision 1.5  2007/01/21 09:43:22  n-ando
00026  * - A bug about memory access violation to m_providers still exists.
00027  *   This bug arises on Fedora5/gcc4 environment.
00028  *   To escape the bug temporarily dummy variable (m_dummy) is defined.
00029  * - Some functors were moved to cpp file.
00030  *
00031  * Revision 1.4  2007/01/14 22:57:48  n-ando
00032  * A bug fix about template argument for buffer-type in constructor.
00033  *
00034  * Revision 1.3  2007/01/12 14:29:48  n-ando
00035  * A trivial bug fix.
00036  *
00037  * Revision 1.2  2007/01/06 17:43:39  n-ando
00038  * The behavior on notify_connect() and notify_disconnect() are now
00039  * implemented in protected functions(ex. publisherInterfaces()).
00040  *
00041  * Revision 1.1  2006/12/02 18:27:49  n-ando
00042  * The first commitment.
00043  *
00044  *
00045  */
00046 
00047 #ifndef DataInPort_h
00048 #define DataInPort_h
00049 
00050 #include <rtm/PortBase.h>
00051 #include <rtm/BufferBase.h>
00052 #include <rtm/InPortCorbaProvider.h>
00053 #include <rtm/OutPortCorbaConsumer.h>
00054 #include <rtm/NVUtil.h>
00055 #include <rtm/InPort.h>
00056 #include <stdio.h>
00057 
00058 namespace RTC
00059 {
00070   class DataInPort
00071     : public virtual PortBase
00072   {
00073 
00074   public:
00075     template <class DataType, template <class DataType> class Buffer>
00076     DataInPort(const char* name, InPort<DataType, Buffer>& inport)
00077       : PortBase(name)
00078     {
00079       // PortProfile::properties を設定
00080       addProperty("port.port_type", "DataInPort");
00081 
00082       m_providers.push_back(new InPortCorbaProvider<DataType>(inport));
00083       m_providers.back()->publishInterfaceProfile(m_profile.properties);
00084       m_consumers.push_back(new OutPortCorbaConsumer<DataType>(inport));
00085       m_dummy.push_back(1);
00086     }
00087 
00088     virtual ~DataInPort();
00089 
00090   protected:
00091     virtual ReturnCode_t
00092     publishInterfaces(ConnectorProfile& connector_profile);
00093 
00094     virtual ReturnCode_t
00095     subscribeInterfaces(const ConnectorProfile& connector_profile);
00096 
00097     virtual void
00098     unsubscribeInterfaces(const ConnectorProfile& connector_profile);
00099     
00100     struct publish;
00101     struct subscribe;
00102     struct unsubscribe;
00103 
00104   private:
00105     /*
00106      * Bug
00107      *
00108      * Fedora5/gcc4.1.1. にて DataInPort の先頭領域のメモリ破壊が
00109      * 起こっている模様。
00110      * (gdbでかなり粘って追ってみたが断念)
00111      * もともともは std::vector<InPortProvider*> m_providers が先頭
00112      * このままだと、
00113      * $vec->_M_impl._M_start:  begin() に相当?
00114      * $vec->_M_impl._M_finish: end() に相当?
00115      * においてい _M_start が不可解な位置を指すため、
00116      * m_providers に対して for_each を適用するとSegvで落ちる。
00117      *
00118      * FreeBSD6.0/gcc3.4.4ではこの現象は発生せず。
00119      */
00120     std::vector<int> m_dummy;
00121     std::vector<InPortProvider*> m_providers;
00122     std::vector<OutPortConsumer*> m_consumers;
00123   };
00124 }; // namespace RTC
00125 
00126 #endif // DataInPort_h

Generated on Tue May 29 16:45:37 2007 for OpenRTM by  doxygen 1.4.1