DataInPort.py

説明を見る。
00001 #!/usr/bin/env python
00002 # -*- coding: euc-jp -*-
00003 
00004 ##
00005 #  \file DataInPort.py
00006 #  \brief RTC::Port implementation for Data InPort
00007 #  \date $Date: 2007/09/20 $
00008 #  \author Noriaki Ando <n-ando@aist.go.jp> and Shinji Kurihara
00009 # 
00010 #  Copyright (C) 2006-2008
00011 #      Noriaki Ando
00012 #      Task-intelligence Research Group,
00013 #      Intelligent Systems Research Institute,
00014 #      National Institute of
00015 #          Advanced Industrial Science and Technology (AIST), Japan
00016 #      All rights reserved.
00017 
00018 
00019 import OpenRTM
00020 import RTC, RTC__POA
00021 
00022 
00023 
00024 ##
00025 # @if jp
00026 # @class DataInPort
00027 # @brief InPort 用 Port
00028 #
00029 # データ入力ポートの実装クラス。
00030 #
00031 # @since 0.4.0
00032 #
00033 # @else
00034 # @class DataInPort
00035 # @brief InPort abstruct class
00036 # @endif
00037 class DataInPort(OpenRTM.PortBase):
00038   """
00039   """
00040 
00041 
00042 
00043   ##
00044   # @if jp
00045   # @brief コンストラクタ
00046   #
00047   # コンストラクタ
00048   #
00049   # @param self
00050   # @param name ポート名称
00051   # @param inport 当該データ入力ポートに関連付けるInPortオブジェクト
00052   #
00053   # @else
00054   # @brief Constructor
00055   # @endif
00056   def __init__(self, name, inport):
00057     OpenRTM.PortBase.__init__(self, name)
00058 
00059     # PortProfile::properties を設定
00060     self.addProperty("port.port_type", "DataInPort")
00061     self._providers = []
00062     self._providers.append(OpenRTM.InPortCorbaProvider(inport))
00063     self._providers[-1].publishInterfaceProfile(self._profile.properties)
00064     self._consumers = []
00065     self._consumers.append(OpenRTM.OutPortCorbaConsumer(inport))
00066     self._dummy = [1]
00067 
00068 
00069   ##
00070   # @if jp
00071   # @brief Interface情報を公開する
00072   #
00073   # Interface情報を公開する。
00074   # このPortが所有しているプロバイダ(Provider)に関する情報を、
00075   # ConnectorProfile#propertiesに代入する。
00076   #
00077   # @param self
00078   # @param connector_profile コネクタプロファイル
00079   #
00080   # @return ReturnCode_t 型のリターンコード
00081   #
00082   # @else
00083   #
00084   # @endif
00085   def publishInterfaces(self, connector_profile):
00086     if len(self._dummy) != 1:
00087       print "Memory access violation was detected."
00088       print "dummy.size(): ", len(self._dummy)
00089       print "size() should be 1."
00090 
00091     for provider in self._providers:
00092       provider.publishInterface(connector_profile.properties)
00093 
00094     return RTC.RTC_OK
00095       
00096 
00097   ##
00098   # @if jp
00099   # @brief Interfaceに接続する
00100   #
00101   # Interfaceに接続する。
00102   # Portが所有するConsumerに適合するProviderに関する情報を 
00103   # ConnectorProfile#properties から抽出し、
00104   # ConsumerにCORBAオブジェクト参照を設定する。
00105   #
00106   # @param self
00107   # @param connector_profile コネクタ・プロファイル
00108   #
00109   # @return ReturnCode_t 型のリターンコード
00110   #
00111   # @else
00112   #
00113   # @endif
00114   def subscribeInterfaces(self, connector_profile):
00115     for consumer in self._consumers:
00116       consumer.subscribeInterface(connector_profile.properties)
00117 
00118     return RTC.RTC_OK
00119 
00120 
00121   ##
00122   # @if jp
00123   # @brief Interfaceへの接続を解除する
00124   #
00125   # Interfaceへの接続を解除する。
00126   # 与えられたConnectorProfileに関連するConsumerに設定された全てのObjectを
00127   # 解放し接続を解除する。
00128   #
00129   # @param self
00130   # @param connector_profile コネクタ・プロファイル
00131   #
00132   # @else
00133   #
00134   # @endif
00135   def unsubscribeInterfaces(self, connector_profile):
00136     for consumer in self._consumers:
00137       consumer.unsubscribeInterface(connector_profile.properties)
00138     
00139     

OpenRTMに対してMon Mar 17 15:11:05 2008に生成されました。  doxygen 1.5.4