SdoOrganization.py

説明を見る。
00001 #!/usr/bin/env python
00002 # -*- coding: euc-jp -*-
00003 
00004 ##
00005 # @file SdoOrganization.py
00006 # @brief SDO Organization implementation class
00007 # @date $Date: 2007/09/12 $
00008 # @author Noriaki Ando <n-ando@aist.go.jp> and Shinji Kurihara
00009 # 
00010 # Copyright (C) 2006
00011 #     Task-intelligence Research Group,
00012 #     Intelligent Systems Research Institute,
00013 #     National Institute of
00014 #         Advanced Industrial Science and Technology (AIST), Japan
00015 #     All rights reserved.
00016 
00017 
00018 import omniORB.any
00019 from omniORB import CORBA
00020 import threading
00021 
00022 import OpenRTM
00023 import SDOPackage, SDOPackage__POA
00024 
00025 
00026 
00027 ##
00028 # @if jp
00029 # @class ScopedLock
00030 # @brief ScopedLock クラス
00031 #
00032 # 排他処理用ロッククラス。
00033 #
00034 # @since 0.4.0
00035 #
00036 # @else
00037 #
00038 # @endif
00039 class ScopedLock:
00040   def __init__(self, mutex):
00041     self.mutex = mutex
00042     self.mutex.acquire()
00043 
00044   def __del__(self):
00045     self.mutex.release()
00046 
00047 
00048 # SdoOrganization.o 23788
00049 # 41892
00050 
00051 
00052 
00053 ##
00054 # @if jp
00055 # 
00056 # @class Organization_impl
00057 # @brief SDO Organization 実装クラス
00058 # 
00059 # Organization interface は Resource Data Model で定義されたデータの
00060 # 追加、削除等の操作を行うためのインターフェースである。
00061 # 
00062 # @since 0.4.0
00063 # 
00064 # @else
00065 # 
00066 # @class Organization_impl
00067 # @brief Organization implementation class
00068 # 
00069 # The Organization interface is used to manage the Organization attribute.
00070 # 
00071 # @since 0.4.0
00072 # 
00073 # @endif
00074 class Organization_impl:
00075 
00076 
00077 
00078   ##
00079   # @if jp
00080   # 
00081   # @brief コンストラクタ
00082   # 
00083   # コンストラクタ
00084   # 
00085   # @else
00086   # 
00087   # @endif
00088   def __init__(self):
00089     self._pId = OpenRTM.uuid1()
00090     self._org_mutex = threading.RLock()
00091 
00092     self._orgProperty = SDOPackage.OrganizationProperty([])
00093     self._varOwner    = None
00094     self._memberList  = []
00095 
00096 
00097   #============================================================
00098   #
00099   # <<< CORBA interfaces >>>
00100   #
00101   #============================================================
00102   ##
00103   # @if jp
00104   # 
00105   # @brief [CORBA interface] Organization ID を取得する
00106   # 
00107   # Organization の ID を返すオペレーション。
00108   #
00109   # @param self
00110   # 
00111   # @return Resource Data Model で定義された Organization ID。
00112   # 
00113   # @exception SDONotExists ターゲットのSDOが存在しない。(本例外は、CORBA標準
00114   #                         システム例外のOBJECT_NOT_EXISTにマッピングされる)
00115   # @exception NotAvailable SDOは存在するが応答がない。
00116   # @exception InternalError 内部的エラーが発生した。
00117   # @else
00118   # 
00119   # @brief [CORBA interface] Get Organization Id
00120   # 
00121   # This operation returns the 'id' of the Organization.
00122   #
00123   # @param self
00124   # 
00125   # @return The id of the Organization defined in the resource data model.
00126   # 
00127   # @exception SDONotExists if the target SDO does not exist.(This exception 
00128   #                         is mapped to CORBA standard system exception
00129   #                         OBJECT_NOT_EXIST.)
00130   # @exception NotAvailable The target SDO is reachable but cannot respond.
00131   # @exception InternalError The target SDO cannot execute the operation
00132   #                          completely due to some internal error.
00133   # @endif
00134   def get_organization_id(self):
00135     return self._pId
00136 
00137 
00138   ##
00139   # @if jp
00140   # 
00141   # @brief [CORBA interface] OrganizationProperty の取得
00142   # 
00143   # Organization が所有する OrganizationProperty を返すオペレーション。
00144   # Organization がプロパティを持たなければ空のリストを返す。
00145   # 
00146   # @param self
00147   # 
00148   # @return Organization のプロパティのリスト。
00149   # 
00150   # @exception SDONotExists ターゲットのSDOが存在しない。(本例外は、CORBA標準
00151   #                         システム例外のOBJECT_NOT_EXISTにマッピングされる)
00152   # @exception NotAvailable SDOは存在するが応答がない。
00153   # @exception InternalError 内部的エラーが発生した。
00154   # @else
00155   # 
00156   # @brief [CORBA interface] Get OrganizationProperty
00157   # 
00158   # This operation returns the OrganizationProperty that an Organization
00159   # has. An empty OrganizationProperty is returned if the Organization does
00160   # not have any properties.
00161   # 
00162   # @param self
00163   # 
00164   # @return The list with properties of the organization.
00165   # 
00166   # @exception SDONotExists if the target SDO does not exist.(This exception 
00167   #                         is mapped to CORBA standard system exception
00168   #                         OBJECT_NOT_EXIST.)
00169   # @exception NotAvailable The target SDO is reachable but cannot respond.
00170   # @exception InternalError The target SDO cannot execute the operation
00171   #                          completely due to some internal error.
00172   # @endif
00173   def get_organization_property(self):
00174     guard = ScopedLock(self._org_mutex)
00175     prop = SDOPackage.OrganizationProperty(self._orgProperty.properties)
00176     return prop
00177 
00178 
00179   ##
00180   # @if jp
00181   # 
00182   # @brief [CORBA interface] OrganizationProperty の特定の値の取得
00183   # 
00184   # OrganizationProperty の指定された値を返すオペレーション。
00185   # 引数 "name" で指定されたプロパティの値を返す。
00186   # 
00187   # @param self
00188   # @param name 値を返すプロパティの名前。
00189   # 
00190   # @return 引数 "name" で指定されたプロパティの値。
00191   # 
00192   # @exception SDONotExists ターゲットのSDOが存在しない。(本例外は、CORBA標準
00193   #                         システム例外のOBJECT_NOT_EXISTにマッピングされる)
00194   # @exception InvalidParameter 引数 "namne" で指定されたプロパティが
00195   #            存在しない。
00196   # @exception NotAvailable SDOは存在するが応答がない。
00197   # @exception InternalError 内部的エラーが発生した。
00198   # @else
00199   # 
00200   # @brief [CORBA interface] Get specified value of OrganizationProperty
00201   # 
00202   # This operation returns a value in the OrganizationProperty.
00203   # The value to be returned is specified by argument "name."
00204   # 
00205   # @param self
00206   # @param name The name of the value to be returned.
00207   # 
00208   # @return The value of property which is specified by argument "name".
00209   # 
00210   # @exception SDONotExists if the target SDO does not exist.(This exception 
00211   #                         is mapped to CORBA standard system exception
00212   #                         OBJECT_NOT_EXIST.)
00213   # @exception InvalidParameter If there are no Property stored with argument
00214   #                             "name".
00215   # @exception NotAvailable The target SDO is reachable but cannot respond.
00216   # @exception InternalError The target SDO cannot execute the operation
00217   #                          completely due to some internal error.
00218   # @endif
00219   def get_organization_property_value(self, name):
00220     if name is None:
00221       raise SDOPackage.InvalidParameter("Empty name.")
00222 
00223     index = OpenRTM.CORBA_SeqUtil.find(self._orgProperty.properties, self.nv_name(name))
00224 
00225     if index < 0:
00226       raise SDOPackage.InvalidParameter("Not found.")
00227 
00228     try:
00229       value = omniORB.any.to_any(self._orgProperty.properties[index].value)
00230       return value
00231     except:
00232       raise SDOPackage.InternalError("get_organization_property_value()")
00233 
00234     # never reach here
00235     return None
00236 
00237 
00238   ##
00239   # @if jp
00240   # 
00241   # @brief [CORBA interface] OrganizationProperty のセット
00242   # 
00243   # ※ SDO Specification の PIM 記述とオペレーション名が異なる。
00244   # ※ addOrganizationProperty に対応か?<BR>
00245   # OrganizationProperty を Organization に追加するオペレーション。
00246   # OrganizationProperty は Organization のプロパティ記述である。
00247   # 
00248   # @param self
00249   # @param org_property セットする OrganizationProperty
00250   # 
00251   # @return オペレーションが成功したかどうかを返す。
00252   # 
00253   # @exception SDONotExists ターゲットのSDOが存在しない。(本例外は、CORBA標準
00254   #                         システム例外のOBJECT_NOT_EXISTにマッピングされる)
00255   # @exception InvalidParameter "org_property" が null。
00256   # @exception NotAvailable SDOは存在するが応答がない。
00257   # @exception InternalError 内部的エラーが発生した。
00258   # @else
00259   # 
00260   # @brief [CORBA interface] Set OrganizationProperty
00261   # 
00262   # ※ SDO Specification の PIM 記述とオペレーション名が異なる。
00263   # ※ addOrganizationProperty に対応か?
00264   # This operation adds the OrganizationProperty to an Organization. The
00265   # OrganizationProperty is the property description of an Organization.
00266   # 
00267   # @param self
00268   # @param org_property The type of organization to be added.
00269   # 
00270   # @return If the operation was successfully completed.
00271   # 
00272   # @exception SDONotExists if the target SDO does not exist.(This exception 
00273   #                         is mapped to CORBA standard system exception
00274   #                         OBJECT_NOT_EXIST.)
00275   # @exception InvalidParameter The argument "organizationProperty" is null.
00276   # @exception NotAvailable The target SDO is reachable but cannot respond.
00277   # @exception InternalError The target SDO cannot execute the operation
00278   #                          completely due to some internal error.
00279   # @endif
00280   def set_organization_property(self, org_property):
00281     if org_property is None:
00282       raise SDOPackage.InvalidParameter("org_property is Empty.")
00283 
00284     try:
00285       guard = ScopedLock(self._org_mutex)
00286       self._orgProperty = org_property
00287       return True
00288     except:
00289       raise SDOPackage.InternalError("set_organization_property()")
00290 
00291     return False
00292 
00293 
00294   ##
00295   # @if jp
00296   # 
00297   # @brief [CORBA interface] OrganizationProperty の値のセット
00298   # 
00299   # OrganizationProperty の NVList に name と value のセットを追加もしくは
00300   # 更新するオペレーション。name と value は引数 "name" と "value" により
00301   # 指定する。
00302   # 
00303   # @param self
00304   # @param name 追加・更新されるプロパティの名前。
00305   # @param value 追加・更新されるプロパティの値。
00306   # 
00307   # @return オペレーションが成功したかどうかを返す。
00308   # 
00309   # @exception SDONotExists ターゲットのSDOが存在しない。(本例外は、CORBA標準
00310   #                         システム例外のOBJECT_NOT_EXISTにマッピングされる)
00311   # @exception InvalidParameter 引数 "name" で指定されたプロパティは
00312   #            存在しない。
00313   # @exception NotAvailable SDOは存在するが応答がない。
00314   # @exception InternalError 内部的エラーが発生した。
00315   # @else
00316   # 
00317   # @brief [CORBA interface] Set specified value of OrganizationProperty
00318   # 
00319   # This operation adds or updates a pair of name and value as a property
00320   # of Organization to/in NVList of the OrganizationProperty. The name and
00321   # the value to be added/updated are specified by argument "name" and
00322   # "value."
00323   # 
00324   # @param self
00325   # @param name The name of the property to be added/updated.
00326   # @param value The value of the property to be added/updated.
00327   # 
00328   # @return If the operation was successfully completed.
00329   # 
00330   # @exception SDONotExists if the target SDO does not exist.(This exception 
00331   #                         is mapped to CORBA standard system exception
00332   #                         OBJECT_NOT_EXIST.)
00333   # @exception NotAvailable The target SDO is reachable but cannot respond.
00334   # @exception InvalidParameter The property that is specified by argument
00335   #            "name" does not exist.
00336   # @exception InternalError The target SDO cannot execute the operation
00337   #                          completely due to some internal error.
00338   # @endif
00339   def set_organization_property_value(self, name, value):
00340     if name is None:
00341       raise SDOPackage.InvalidParameter("set_organization_property_value(): Enpty name.")
00342 
00343     index = OpenRTM.CORBA_SeqUtil.find(self._orgProperty.properties, self.nv_name(name))
00344 
00345     if index < 0:
00346       nv = SDOPackage.NameValue(name, value)
00347       OpenRTM.CORBA_SeqUtil.push_back(self._orgProperty.properties, nv)
00348     else:
00349       self._orgProperty.properties[index].value = value
00350 
00351     return True
00352 
00353 
00354   ##
00355   # @if jp
00356   # 
00357   # @brief [CORBA interface] OrganizationProperty の削除
00358   # 
00359   # OrganizationProperty の NVList から特定のプロパティを削除する。
00360   # 削除されるプロパティの名前は引数 "name" により指定される。
00361   # 
00362   # @param self
00363   # @param name 削除するプロパティの名前。
00364   # 
00365   # @return オペレーションが成功したかどうかを返す。
00366   # 
00367   # @exception SDONotExists ターゲットのSDOが存在しない。(本例外は、CORBA標準
00368   #                         システム例外のOBJECT_NOT_EXISTにマッピングされる)
00369   # @exception InvalidParameter 引数 "name" で指定されたプロパティは
00370   #            存在しない。
00371   # @exception NotAvailable SDOは存在するが応答がない。
00372   # @exception InternalError 内部的エラーが発生した。
00373   # @else
00374   # 
00375   # @brief [CORBA interface] Remove specified OrganizationProperty
00376   # 
00377   # This operation removes a property of Organization from NVList of the
00378   # OrganizationProperty. The property to be removed is specified by
00379   # argument "name."
00380   # 
00381   # @param self
00382   # @param name The name of the property to be removed.
00383   # 
00384   # @return If the operation was successfully completed.
00385   # 
00386   # @exception SDONotExists if the target SDO does not exist.(This exception 
00387   #                         is mapped to CORBA standard system exception
00388   #                         OBJECT_NOT_EXIST.)
00389   # @exception NotAvailable The target SDO is reachable but cannot respond.
00390   # @exception InvalidParameter The property that is specified by argument
00391   #            "name" does not exist.
00392   # @exception InternalError The target SDO cannot execute the operation
00393   #                          completely due to some internal error.
00394   # @endif
00395   def remove_organization_property(self, name):
00396     if name is None:
00397       raise SDOPackage.InvalidParameter("remove_organization_property_value(): Enpty name.")
00398 
00399     index = OpenRTM.CORBA_SeqUtil.find(self._orgProperty.properties, self.nv_name(name))
00400 
00401     if index < 0:
00402       raise SDOPackage.InvalidParameter("remove_organization_property_value(): Not found.")
00403 
00404     try:
00405       OpenRTM.CORBA_SeqUtil.erase(self._orgProperty.properties, index)
00406       return True
00407     except:
00408       raise SDOPackage.InternalError("remove_organization_property_value()")
00409 
00410     return False
00411 
00412 
00413   ##
00414   # @if jp
00415   # 
00416   # @brief [CORBA interface] Organization のオーナーを取得する
00417   # 
00418   # この Organization のオーナーへの参照を返す。
00419   # 
00420   # @param self
00421   # 
00422   # @return オーナーオブジェクトへの参照。
00423   # 
00424   # @exception SDONotExists ターゲットのSDOが存在しない。(本例外は、CORBA標準
00425   #                         システム例外のOBJECT_NOT_EXISTにマッピングされる)
00426   # @exception NotAvailable SDOは存在するが応答がない。
00427   # @exception InternalError 内部的エラーが発生した。
00428   # @else
00429   # 
00430   # @brief [CORBA interface] Get the owner of the SDO
00431   # 
00432   # This operation returns the SDOSystemElement that is owner of
00433   # the Organization.
00434   # 
00435   # @param self
00436   # 
00437   # @return Reference of owner object.
00438   # 
00439   # @exception SDONotExists if the target SDO does not exist.(This exception 
00440   #                         is mapped to CORBA standard system exception
00441   #                         OBJECT_NOT_EXIST.)
00442   # @exception NotAvailable The target SDO is reachable but cannot respond.
00443   # @exception InternalError The target SDO cannot execute the operation
00444   #                          completely due to some internal error.
00445   # @endif
00446   def get_owner(self):
00447     return self._varOwner
00448 
00449 
00450   ##
00451   # @if jp
00452   # 
00453   # @brief [CORBA interface] Organization にオーナーをセットする
00454   # 
00455   # Organization に対して SDOSystemElement をオーナーとしてセットする。
00456   # 引数 "sdo" にセットする SDOSystemElement を指定する。
00457   # 
00458   # @param self
00459   # @param sdo オーナーオブジェクトの参照。
00460   # 
00461   # @return オペレーションが成功したかどうかを返す。
00462   # 
00463   # @exception SDONotExists ターゲットのSDOが存在しない。(本例外は、CORBA標準
00464   #                         システム例外のOBJECT_NOT_EXISTにマッピングされる)
00465   # @exception InvalidParameter 引数 "sdo" が nullである、もしくは、
00466   #                             "sdo" が存在しない。
00467   # @exception NotAvailable SDOは存在するが応答がない。
00468   # @exception InternalError 内部的エラーが発生した。
00469   # @else
00470   # 
00471   # @brief [CORBA interface] Set the orner of the Organization
00472   # 
00473   # This operation sets an SDOSystemElement to the owner of the
00474   # Organization. The SDOSystemElement to be set is specified by argument
00475   # "sdo."
00476   # 
00477   # @param self
00478   # @param sdo Reference of owner object.
00479   # 
00480   # @return If the operation was successfully completed.
00481   # 
00482   # @exception SDONotExists if the target SDO does not exist.(This exception 
00483   #                         is mapped to CORBA standard system exception
00484   #                         OBJECT_NOT_EXIST.)
00485   # @exception NotAvailable The target SDO is reachable but cannot respond.
00486   # @exception InvalidParameter The argument "sdo" is null, or the object
00487   #            that is specified by "sdo" in argument "sdo" does not exist.
00488   # @exception InternalError The target SDO cannot execute the operation
00489   #                          completely due to some internal error.
00490   # @endif
00491   def set_owner(self, sdo):
00492     if CORBA.is_nil(sdo):
00493       raise SDOPackage.InvalidParameter("set_owner()")
00494 
00495     try:
00496       self._varOwner = sdo
00497       return True
00498     except:
00499       raise SDOPackage.InternalError("set_owner()")
00500 
00501     return True
00502 
00503 
00504   ##
00505   # @if jp
00506   # 
00507   # @brief [CORBA interface] Organization のメンバーを取得する
00508   # 
00509   # Organization のメンバーの SDO のリストを返す。
00510   # メンバーが存在しなければ空のリストを返す。
00511   # 
00512   # @param self
00513   # 
00514   # @return Organization に含まれるメンバー SDO のリスト。
00515   # 
00516   # @exception SDONotExists ターゲットのSDOが存在しない。(本例外は、CORBA標準
00517   #                         システム例外のOBJECT_NOT_EXISTにマッピングされる)
00518   # @exception NotAvailable SDOは存在するが応答がない。
00519   # @exception InternalError 内部的エラーが発生した。
00520   # @else
00521   # 
00522   # @brief [CORBA interface] Get a menber list of the Organization
00523   # 
00524   # This operation returns a list of SDOs that are members of an
00525   # Organization. An empty list is returned if the Organization does not
00526   # have any members.
00527   # 
00528   # @param self
00529   # 
00530   # @return Member SDOs that are contained in the Organization object.
00531   # 
00532   # @exception SDONotExists if the target SDO does not exist.(This exception 
00533   #                         is mapped to CORBA standard system exception
00534   #                         OBJECT_NOT_EXIST.)
00535   # @exception NotAvailable The target SDO is reachable but cannot respond.
00536   # @exception InternalError The target SDO cannot execute the operation
00537   #                          completely due to some internal error.
00538   # @endif
00539   def get_members(self):
00540     try:
00541       return self._memberList
00542     except:
00543       raise SDOPackage.InternalError("get_members()")
00544 
00545 
00546   ##
00547   # @if jp
00548   # 
00549   # @brief [CORBA interface] SDO の セット
00550   # 
00551   # SDO のリストを Organization のメンバーとしてセットする。
00552   # Organization がすでにメンバーの SDO を管理している場合は、
00553   # 与えられた SDO のリストに置き換える。
00554   # 
00555   # @param self
00556   # @param sdos メンバーの SDO。
00557   # 
00558   # @return オペレーションが成功したかどうかを返す。
00559   # 
00560   # @exception SDONotExists ターゲットのSDOが存在しない。(本例外は、CORBA標準
00561   #                         システム例外のOBJECT_NOT_EXISTにマッピングされる)
00562   # @exception InvalidParameter 引数 "SDOList" が nullである、もしくは
00563   #            引数に指定された "SDOList" が存在しない。
00564   # @exception NotAvailable SDOは存在するが応答がない。
00565   # @exception InternalError 内部的エラーが発生した。
00566   # @else
00567   # 
00568   # @brief [CORBA interface] Set SDO's ServiceProfile
00569   # 
00570   # This operation assigns a list of SDOs to an Organization as its members.
00571   # If the Organization has already maintained a member SDO(s) when it is
00572   # called, the operation replaces the member(s) with specified list of
00573   # SDOs.
00574   # 
00575   # @param self
00576   # @param sdos Member SDOs to be assigned.
00577   # 
00578   # @return If the operation was successfully completed.
00579   # 
00580   # @exception SDONotExists if the target SDO does not exist.(This exception 
00581   #                         is mapped to CORBA standard system exception
00582   #                         OBJECT_NOT_EXIST.)
00583   # @exception NotAvailable The target SDO is reachable but cannot respond.
00584   # @exception InvalidParameter The argument "SDOList" is null, or if the
00585   #            object that is specified by the argument "sdos" does not
00586   #            exist.
00587   # @exception InternalError The target SDO cannot execute the operation
00588   #                          completely due to some internal error.
00589   # @endif
00590   def set_members(self, sdos):
00591     if sdos is None:
00592       raise SDOPackage.InvalidParameter("set_members(): SDOList is empty.")
00593 
00594     try:
00595       self._memberList = sdos
00596       return True
00597     except:
00598       raise SDOPackage.InternalError("set_members()")
00599 
00600     return True
00601 
00602 
00603   ##
00604   # @if jp
00605   # 
00606   # @brief [CORBA interface] SDO メンバーの追加
00607   # 
00608   # Organization にメンバーとして SDO を追加する。
00609   # 引数 "sdo" に追加するメンバー SDO を指定する。
00610   # 
00611   # @param self
00612   # @param sdo_list Organization に追加される SDO のリスト。
00613   # 
00614   # @return オペレーションが成功したかどうかを返す。
00615   # 
00616   # @exception SDONotExists ターゲットのSDOが存在しない。(本例外は、CORBA標準
00617   #                         システム例外のOBJECT_NOT_EXISTにマッピングされる)
00618   # @exception InvalidParameter 引数 "sdo" が nullである。
00619   # @exception NotAvailable SDOは存在するが応答がない。
00620   # @exception InternalError 内部的エラーが発生した。
00621   # @else
00622   # 
00623   # @brief [CORBA interface] Add the menebr SDOs
00624   # 
00625   # This operation adds a member that is an SDO to the organization.
00626   # The member to be added is specified by argument "sdo."
00627   # 
00628   # @param self
00629   # @param sdo The member to be added to the organization.
00630   # 
00631   # @return If the operation was successfully completed.
00632   # 
00633   # @exception SDONotExists if the target SDO does not exist.(This exception 
00634   #                         is mapped to CORBA standard system exception
00635   #                         OBJECT_NOT_EXIST.)
00636   # @exception NotAvailable The target SDO is reachable but cannot respond.
00637   # @exception InvalidParameter The argument "sdo" is null.
00638   # @exception InternalError The target SDO cannot execute the operation
00639   #                          completely due to some internal error.
00640   # @endif
00641   def add_members(self, sdo_list):
00642     if sdo_list is None:
00643       raise SDOPackage.InvalidParameter("add_members(): SDOList is empty.")
00644 
00645     try:
00646       OpenRTM.CORBA_SeqUtil.push_back_list(self._memberList, sdo_list)
00647       return True
00648     except:
00649       raise SDOPackage.InternalError("add_members()")
00650 
00651     return False
00652 
00653 
00654   ##
00655   # @if jp
00656   # 
00657   # @brief [CORBA interface] SDO メンバーの削除
00658   # 
00659   # Organization から引数で指定された "id" の SDO を削除する。
00660   # 
00661   # @param self
00662   # @param id 削除する SDO の id。
00663   # 
00664   # @return オペレーションが成功したかどうかを返す。
00665   # 
00666   # @exception SDONotExists ターゲットのSDOが存在しない。(本例外は、CORBA標準
00667   #                         システム例外のOBJECT_NOT_EXISTにマッピングされる)
00668   # @exception InvalidParameter 引数 "id" が null もしくは存在しない。
00669   # @exception NotAvailable SDOは存在するが応答がない。
00670   # @exception InternalError 内部的エラーが発生した。
00671   # @else
00672   # 
00673   # @brief [CORBA interface] Remove menber SDO from Organization
00674   # 
00675   # This operation removes a member from the organization. The member to be
00676   # removed is specified by argument "id."
00677   # 
00678   # @param self
00679   # @param id Id of the SDO to be removed from the organization.
00680   # 
00681   # @return If the operation was successfully completed.
00682   # 
00683   # @exception SDONotExists if the target SDO does not exist.(This exception 
00684   #                         is mapped to CORBA standard system exception
00685   #                         OBJECT_NOT_EXIST.)
00686   # @exception NotAvailable The target SDO is reachable but cannot respond.
00687   # @exception InvalidParameter The argument "id" is null or does not exist.
00688   # @exception InternalError The target SDO cannot execute the operation
00689   #                          completely due to some internal error.
00690   # @endif
00691   def remove_member(self, id):
00692     if id is None:
00693       raise SDOPackage.InvalidParameter("remove_member(): Empty name.")
00694 
00695     index = OpenRTM.CORBA_SeqUtil.find(self._memberList, self.sdo_id(id))
00696 
00697     if index < 0:
00698       raise SDOPackage.InvalidParameter("remove_member(): Not found.")
00699 
00700     try:
00701       OpenRTM.CORBA_SeqUtil.erase(self._memberList, index)
00702       return True
00703     except:
00704       raise SDOPackage.InternalError("remove_member(): Not found.")
00705 
00706     return False
00707 
00708 
00709   ##
00710   # @if jp
00711   # 
00712   # @brief [CORBA interface] Organization の DependencyType を取得
00713   # 
00714   # Organization の関係を表す "DependencyType" を返す。
00715   # 
00716   # @param self
00717   # 
00718   # @return Organizaton の依存関係 DependencyType を返す。
00719   #         DependencyType は OMG SDO 仕様の Section 2.2.2 2-3 ページの
00720   #         "Data Structures Used by Resource Data Model" を参照。
00721   # 
00722   # @exception SDONotExists ターゲットのSDOが存在しない。(本例外は、CORBA標準
00723   #                         システム例外のOBJECT_NOT_EXISTにマッピングされる)
00724   # @exception NotAvailable SDOは存在するが応答がない。
00725   # @exception InternalError 内部的エラーが発生した。
00726   # @else
00727   # 
00728   # @brief [CORBA interface] Get the DependencyType of the Organization
00729   # 
00730   # This operation gets the relationship "DependencyType" of the
00731   # Organization.
00732   # 
00733   # @param self
00734   # 
00735   # @return The relationship of the Organization as DependencyType.
00736   #         DependencyType is defined in Section 2.2.2, "Data Structures
00737   #         Used by Resource Data Model," on page 2-3
00738   #         of OMG SDO Specification.
00739   # 
00740   # @exception SDONotExists if the target SDO does not exist.(This exception 
00741   #                         is mapped to CORBA standard system exception
00742   #                         OBJECT_NOT_EXIST.)
00743   # @exception NotAvailable The target SDO is reachable but cannot respond.
00744   # @exception InternalError The target SDO cannot execute the operation
00745   #                          completely due to some internal error.
00746   # @endif
00747   def get_dependency(self):
00748     return self._dependency
00749 
00750 
00751   ##
00752   # @if jp
00753   # 
00754   # @brief [CORBA interface] Organization の DependencyType をセットする
00755   # 
00756   # Organization の依存関係 "DependencyType" をセットする。
00757   # 引数 "dependencty" により依存関係を与える。
00758   # 
00759   # @param self
00760   # @param dependency Organization の依存関係を表す DependencyType。
00761   #        DependencyType は OMG SDO 仕様の Section 2.2.2、2-3 ページの
00762   #        "Data Structures Used by Resource Data Model" を参照。
00763   # 
00764   # @return オペレーションが成功したかどうかを返す。
00765   # 
00766   # @exception SDONotExists ターゲットのSDOが存在しない。(本例外は、CORBA標準
00767   #                         システム例外のOBJECT_NOT_EXISTにマッピングされる)
00768   # @exception InvalidParameter 引数 "sProfile" が nullである。
00769   # @exception NotAvailable SDOは存在するが応答がない。
00770   # @exception InternalError 内部的エラーが発生した。
00771   # @else
00772   # 
00773   # @brief [CORBA interface] Set the DependencyType of the Organization
00774   # 
00775   # This operation sets the relationship "DependencyType" of the
00776   # Organization. The value to be set is specified by argument "dependency."
00777   # 
00778   # @param self
00779   # @param dependency The relationship of the Organization as
00780   #                   DependencyType. DependencyType is defined in Section
00781   #                   2.2.2, "Data Structures Used by Resource Data Model,"
00782   #                   on page 2-3.
00783   # 
00784   # @return If the operation was successfully completed.
00785   # 
00786   # @exception SDONotExists if the target SDO does not exist.(This exception 
00787   #                         is mapped to CORBA standard system exception
00788   #                         OBJECT_NOT_EXIST.)
00789   # @exception NotAvailable The target SDO is reachable but cannot respond.
00790   # @exception InvalidParameter The argument "dependency" is null.
00791   # @exception InternalError The target SDO cannot execute the operation
00792   #                          completely due to some internal error.
00793   # @endif
00794   def set_dependency(self, dependency):
00795     if dependency is None:
00796       raise SDOPackage.InvalidParameter("set_dependency(): Empty dependency.")
00797 
00798     try:
00799       self._dependency = dependency
00800       return True
00801     except:
00802       raise SDOPackage.InternalError("set_dependency(): Unknown.")
00803 
00804     return False
00805     
00806 
00807   # end of CORBA interface definition
00808   #============================================================
00809 
00810 
00811   ##
00812   # @if jp
00813   # @class nv_name
00814   # @brief NVList検索用functor
00815   # @else
00816   #
00817   # @endif
00818   class nv_name:
00819     def __init__(self, name):
00820       self._name = name
00821 
00822     def __call__(self, nv):
00823       return str(self._name) == str(nv.name)
00824 
00825   ##
00826   # @if jp
00827   # @class sdo_id
00828   # @brief SDO検索用functor
00829   # @else
00830   #
00831   # @endif
00832   class sdo_id:
00833     def __init__(self, id_):
00834       self._id = id_
00835 
00836     def __call__(self, sdo):
00837       id_ = sdo.get_sdo_id()
00838       return str(self._id) == str(id_)
00839     

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