00001 #!/usr/bin/env python 00002 # -*- coding: euc-jp -*- 00003 00004 ## 00005 # \file CorbaObjectManager.py 00006 # \brief CORBA Object manager class 00007 # \date $Date: 2007/08/27$ 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 from omniORB import CORBA, PortableServer 00020 00021 import OpenRTM 00022 00023 00024 ## 00025 # @if jp 00026 # @class CorbaObjectManager 00027 # @brief CORBA オブジェクトをアクティブ化、非アクティブ化する 00028 # 00029 # RTObjectのアクティブ化,非アクティブ化を行うクラスである。 00030 # 保持しているORB,POAを用いて CORBA オブジェクトのアクティブ化, 00031 # 非アクティブ化を行う。 00032 # 00033 # @since 0.4.0 00034 # 00035 # @else 00036 # @class CorbaObjectManager 00037 # @brief Activate and deactivate CORBA objects 00038 # @endif 00039 class CorbaObjectManager: 00040 """ 00041 """ 00042 00043 00044 00045 ## 00046 # @if jp 00047 # 00048 # @brief コンストラクタ 00049 # 00050 # @param self 00051 # @param orb ORB 00052 # @param poa POA 00053 # 00054 # @else 00055 # 00056 # @brief Consructor 00057 # 00058 # @param orb ORB 00059 # 00060 # @endif 00061 def __init__(self, orb, poa): 00062 self._orb = orb 00063 self._poa = poa 00064 00065 00066 ## 00067 # @if jp 00068 # @brief CORBA オブジェクトをアクティブ化する 00069 # 00070 # 指定されたRTObjectを CORBA オブジェクトとしてアクティブ化し、 00071 # オブジェクトリファレンスを設定する。 00072 # 00073 # @param self 00074 # @param comp アクティブ化対象RTObject 00075 # 00076 # @else 00077 # @brief Activate CORBA object 00078 # @endif 00079 def activate(self, comp): 00080 id_ = self._poa.activate_object(comp) 00081 obj = self._poa.id_to_reference(id_) 00082 comp.setObjRef(obj._narrow(OpenRTM.RTObject_impl)) 00083 00084 00085 ## 00086 # @if jp 00087 # @brief CORBA オブジェクトを非アクティブ化する 00088 # 00089 # 指定されたRTObjectの非アクティブ化を行う 00090 # 00091 # @param self 00092 # @param comp 非アクティブ化対象RTObject 00093 # 00094 # @else 00095 # @brief Deactivate CORBA object 00096 # @endif 00097 def deactivate(self, comp): 00098 id_ = self._poa.servant_to_id(comp) 00099 self._poa.deactivate_object(id_)