メインページ | ネームスペース一覧 | クラス階層 | 構成 | Directories | ファイル一覧 | ネームスペースメンバ | 構成メンバ | ファイルメンバ

RtcNaming.h

説明を見る。
00001 // -*- C++ -*-
00019 /*
00020  * $Log: RtcNaming.h,v $
00021  * Revision 1.4  2006/10/17 10:14:52  n-ando
00022  * Kanji-code was fixed.
00023  *
00024  * Revision 1.3  2006/09/11 18:26:20  n-ando
00025  * RtcNaming class was completely rewritten.
00026  * - Now RtcCorbaNaming is a wrapper of CosNaming::NamingContext
00027  *   and CosNaming::NamingContextExt with fixed root context.
00028  * - find() method is separated from this class.
00029  * - This class constructor connects to the NameServer without using
00030  *   resolve_initial_reference().
00031  *
00032  * Revision 1.2  2005/05/16 06:29:05  n-ando
00033  * - RtcNaming class was DLL exported for Windows port.
00034  *
00035  * Revision 1.1.1.1  2005/05/12 09:06:18  n-ando
00036  * Public release.
00037  *
00038  *
00039  */
00040 
00041 
00042 #ifndef RtcNaming_h
00043 #define RtcNaming_h
00044 
00045 // CORBA header include
00046 //#include "rtm/idl/RTMBaseStub.h"
00047 //#include "rtm/idl/RTMBaseSkel.h"
00048 //#include "rtm/RtcBase.h"
00049 #include "rtm/RTC.h"
00050 #ifdef ORB_IS_OMNIORB
00051 #undef PACKAGE_BUGREPORT
00052 #undef PACKAGE_NAME
00053 #undef PACKAGE_STRING
00054 #undef PACKAGE_TARNAME
00055 #undef PACKAGE_VERSION
00056 #include "omniORB4/CORBA.h"
00057 //#include "omniORB4/Naming.h"
00058 #endif
00059 
00060 // STL includes
00061 #include <map>
00062 #include <string>
00063 #include <vector>
00064 
00065 namespace RTM
00066 {
00067 
00068   class RtcCorbaNaming
00069   {
00070   public:
00071     RtcCorbaNaming(CORBA::ORB_ptr orb, const char* name_server);
00072     virtual ~RtcCorbaNaming(){};
00073 
00074     typedef CosNaming::NamingContext::NotFound      NotFound;
00075     typedef CosNaming::NamingContext::CannotProceed CannotProceed;
00076     typedef CosNaming::NamingContext::InvalidName   InvalidName;
00077     typedef CosNaming::NamingContext::AlreadyBound  AlreadyBound;
00078     typedef CosNaming::NamingContext::NotEmpty      NotEmpty;
00079     typedef CosNaming::NamingContextExt::InvalidAddress InvalidAddress;
00080     typedef std::vector<CORBA::Object_ptr> ObjectList;
00081 
00127     void bind(const CosNaming::Name& name, CORBA::Object_ptr obj,
00128               const bool force = 1)
00129       throw(NotFound, CannotProceed, InvalidName, AlreadyBound);
00130 
00131 
00155     void bindByString(const char* string_name, CORBA::Object_ptr obj,
00156                       const bool force = 1)
00157       throw(NotFound, CannotProceed, InvalidName, AlreadyBound);
00158 
00194     void bindRecursive(CosNaming::NamingContext_ptr context,
00195                        const CosNaming::Name& name,
00196                        CORBA::Object_ptr obj)
00197       throw(CannotProceed, InvalidName, AlreadyBound);
00198 
00199 
00200 
00220     void rebind(const CosNaming::Name& name, CORBA::Object_ptr obj,
00221                 const bool force = 1)
00222       throw(NotFound, CannotProceed, InvalidName);
00223 
00224 
00247     void rebindByString(const char* string_name, CORBA::Object_ptr obj,
00248                         const bool force = 1)
00249       throw(NotFound, CannotProceed, InvalidName);
00250 
00251     
00276     void rebindRecursive(CosNaming::NamingContext_ptr context,
00277                          const CosNaming::Name& name,
00278                          CORBA::Object_ptr obj)
00279       throw(CannotProceed, InvalidName);
00280 
00299     void bindContext(const CosNaming::Name& name,
00300                      CosNaming::NamingContext_ptr name_cxt,
00301                      const bool force = 1)
00302       throw(NotFound, CannotProceed, InvalidName, AlreadyBound);
00303 
00322     void bindContext(const char* string_name,
00323                      CosNaming::NamingContext_ptr name_cxt,
00324                      const bool force = 1)
00325       throw(NotFound, CannotProceed, InvalidName, AlreadyBound);
00326 
00346     void bindContextRecursive(CosNaming::NamingContext_ptr context,
00347                               const CosNaming::Name& name,
00348                               CosNaming::NamingContext_ptr name_cxt);
00369     void rebindContext(const CosNaming::Name& name,
00370                        CosNaming::NamingContext_ptr name_cxt,
00371                        const bool force = 1)
00372       throw(NotFound, CannotProceed, InvalidName);
00373 
00394     void rebindContext(const char* string_name,
00395                        CosNaming::NamingContext_ptr name_cxt,
00396                        const bool force = 1)
00397       throw(NotFound, CannotProceed, InvalidName);
00398 
00399 
00400     void rebindContextRecursive(CosNaming::NamingContext_ptr context,
00401                                 const CosNaming::Name& name,
00402                                 CosNaming::NamingContext_ptr name_cxt);
00403 
00423     CORBA::Object_ptr resolve(const CosNaming::Name& name)
00424       throw(NotFound, CannotProceed, InvalidName);
00425 
00445     CORBA::Object_ptr resolve(const char* string_name)
00446       throw(NotFound, CannotProceed, InvalidName);
00447 
00467     void unbind(const CosNaming::Name& name)
00468       throw(NotFound, CannotProceed, InvalidName);
00469 
00489     void unbind(const char* string_name)
00490       throw(NotFound, CannotProceed, InvalidName);
00491 
00506     CosNaming::NamingContext_ptr newContext();
00507 
00523     CosNaming::NamingContext_ptr
00524     bindNewContext(const CosNaming::Name& name, bool force = true)
00525       throw(NotFound, CannotProceed, InvalidName, AlreadyBound);
00526 
00542     CosNaming::NamingContext_ptr
00543     bindNewContext(const char* string_name, bool force = true)
00544       throw(NotFound, CannotProceed, InvalidName, AlreadyBound);
00545 
00569     void destroy(CosNaming::NamingContext_ptr context)
00570       throw(NotEmpty);
00571 
00572 
00580     void destroyRecursive(CosNaming::NamingContext_ptr context)
00581       throw(NotEmpty, NotFound, CannotProceed, InvalidName);
00582 
00583 
00591     void clearAll();
00592 
00593 
00601     void list(CosNaming::NamingContext_ptr name_cxt,
00602               unsigned long how_many,
00603               CosNaming::BindingList_var& bl,
00604               CosNaming::BindingIterator_var& bi);
00605 
00606 
00607     //============================================================
00608     // interface of NamingContextExt
00609     //============================================================
00617     char* toString(const CosNaming::Name& name)
00618       throw(InvalidName);
00619     
00620 
00628     CosNaming::Name toName(const char* string_name)
00629       throw(InvalidName);
00630 
00631 
00639     char* toUrl(char* addr, char* string_name)
00640       throw(InvalidAddress, InvalidName);
00641 
00642 
00650     CORBA::Object_ptr resolveStr(const char* string_name)
00651       throw(NotFound, CannotProceed, InvalidName, AlreadyBound);
00652 
00653 
00654     //============================================================
00655     // Find functions
00656     //============================================================
00657 
00658     //    ObjectList find(const char* name, const char* kind);
00659     //    ObjectList findById(const char* name, const char* kind);
00660     //    ObjectList findByKind(const char* name, const char* kind);
00661 
00662 
00670     const char* getNameServer();
00671     
00679     CosNaming::NamingContext_ptr getRootContext();
00680 
00681     
00689     bool isNamingContext(CORBA::Object_ptr obj);
00690     
00698     bool isNamingContext(const CosNaming::Name& name);
00699     
00707     bool isNamingContext(const char* string_name);
00708     
00716     CosNaming::Name subName(const CosNaming::Name& name,
00717                             long begin,
00718                             long end = -1);
00719 
00720     
00728     CORBA::Object_ptr bindOrResolve(CosNaming::NamingContext_ptr context,
00729                                     const CosNaming::Name& name,
00730                                     CORBA::Object_ptr obj);
00731     
00739     CosNaming::NamingContext_ptr
00740     bindOrResolveContext(CosNaming::NamingContext_ptr context,
00741                          const CosNaming::Name& name,
00742                          CosNaming::NamingContext_ptr new_context);
00743 
00744     
00752     CosNaming::NamingContext_ptr
00753     bindOrResolveContext(CosNaming::NamingContext_ptr context,
00754                          const CosNaming::Name& name);
00755 
00756 
00757   protected:
00765     CORBA::ULong getNameLength(const CosNaming::Name& name);
00766 
00774     void nameToString(const CosNaming::Name& name, char* string_name,
00775                       unsigned long slen);
00783     unsigned int split(const std::string& input,
00784                        const std::string& delimiter,
00785                        std::vector<std::string>& results);
00786     
00787     CORBA::ORB_var m_varORB;
00788     std::string m_nameServer;
00789     CosNaming::NamingContextExt_var m_rootContext;
00790 
00791   private:
00792     CORBA::ULong m_blLength;
00793     
00794   };
00795 
00796 }; // end of namespace RTM
00797 
00798 #endif // end of __RtcNaming_h__

OpenRTMに対してSun Nov 5 06:15:05 2006に生成されました。  doxygen 1.4.1