OutPortConnector.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: euc-jp -*-
00003 
00004 
00005 ##
00006 #
00007 # @file OutPortConnector.py
00008 # @brief OutPort Connector class
00009 # @date $Date$
00010 # @author Noriaki Ando <n-ando@aist.go.jp> and Shinji Kurihara
00011 #
00012 # Copyright (C) 2009
00013 #     Noriaki Ando
00014 #     Task-intelligence Research Group,
00015 #     Intelligent Systems Research Institute,
00016 #     National Institute of
00017 #         Advanced Industrial Science and Technology (AIST), Japan
00018 #     All rights reserved.
00019 #
00020 
00021 import OpenRTM_aist
00022 import RTC
00023 
00024 ##
00025 # @if jp
00026 # @class OutPortConnector
00027 # @brief OutPortConnector 基底クラス
00028 #
00029 # OutPort の Push/Pull 各種 Connector を派生させるための
00030 # 基底クラス。
00031 #
00032 # @since 1.0.0
00033 #
00034 # @else
00035 # @class OutPortConnector
00036 # @brief InPortConnector base class
00037 #
00038 # The base class to derive subclasses for OutPort's Push/Pull Connectors
00039 #
00040 # @since 1.0.0
00041 #
00042 # @endif
00043 #
00044 class OutPortConnector(OpenRTM_aist.ConnectorBase):
00045   """
00046   """
00047 
00048   ##
00049   # @if jp
00050   # @brief コンストラクタ
00051   # @else
00052   # @brief Constructor
00053   # @endif
00054   #
00055   # OutPortConnector(ConnectorInfo& info);
00056   def __init__(self, info):
00057     self._rtcout = OpenRTM_aist.Manager.instance().getLogbuf("OutPortConnector")
00058     self._profile = info
00059     self._endian = None
00060     return
00061 
00062   ##
00063   # @if jp
00064   # @brief デストラクタ
00065   # @else
00066   # @brief Destructor
00067   # @endif
00068   #
00069   def __del__(self):
00070     pass
00071 
00072 
00073   ##
00074   # @if jp
00075   # @brief ConnectorInfo 取得
00076   #
00077   # ConnectorInfo を取得する
00078   #
00079   # @else
00080   # @brief Getting ConnectorInfo
00081   #
00082   # This operation returns ConnectorInfo
00083   #
00084   # @endif
00085   #
00086   # const ConnectorInfo& profile();
00087   def profile(self):
00088     self._rtcout.RTC_TRACE("profile()")
00089     return self._profile
00090 
00091   ##
00092   # @if jp
00093   # @brief Connector ID 取得
00094   #
00095   # Connector ID を取得する
00096   #
00097   # @else
00098   # @brief Getting Connector ID
00099   #
00100   # This operation returns Connector ID
00101   #
00102   # @endif
00103   #
00104   # const char* id();
00105   def id(self):
00106     self._rtcout.RTC_TRACE("id() = %s", self.profile().id)
00107     return self.profile().id
00108 
00109 
00110   ##
00111   # @if jp
00112   # @brief Connector 名取得
00113   #
00114   # Connector 名を取得する
00115   #
00116   # @else
00117   # @brief Getting Connector name
00118   #
00119   # This operation returns Connector name
00120   #
00121   # @endif
00122   #
00123   # const char* name();
00124   def name(self):
00125     self._rtcout.RTC_TRACE("name() = %s", self.profile().name)
00126     return self.profile().name
00127 
00128 
00129   # void setConnectorInfo(ConnectorInfo info);
00130   def setConnectorInfo(self, info):
00131     self._profile = info
00132 
00133     if self._profile.properties.hasKey("serializer"):
00134       endian = self._profile.properties.getProperty("serializer.cdr.endian")
00135       if not endian:
00136         self._rtcout.RTC_ERROR("InPortConnector.setConnectorInfo(): endian is not supported.")
00137         return RTC.RTC_ERROR
00138         
00139       endian = OpenRTM_aist.split(endian, ",") # Maybe endian is ["little","big"]
00140       endian = OpenRTM_aist.normalize(endian) # Maybe self._endian is "little" or "big"
00141 
00142       if endian == "little":
00143         self._endian = True
00144       elif endian == "big":
00145         self._endian = False
00146       else:
00147         self._endian = None
00148             
00149     else:
00150       self._endian = True # little endian
00151 
00152     return RTC.RTC_OK


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Thu Aug 27 2015 14:17:28