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

CorbaNaming.h

説明を見る。
00001 // -*- C++ -*-
00020 /*
00021  * $Log: CorbaNaming.h,v $
00022  * Revision 1.2  2007/04/13 15:35:21  n-ando
00023  * Error handing processing in case NameServer does not exist was added.
00024  * Some bug fixes.
00025  *
00026  * Revision 1.1  2006/11/04 19:43:01  n-ando
00027  * CORBA Naming service helper class has rewritten and renamed.
00028  *
00029  */
00030 
00031 
00032 #ifndef CorbaNaming_h
00033 #define CorbaNaming_h
00034 
00035 #include <rtm/RTC.h>
00036 #ifdef ORB_IS_OMNIORB
00037 #undef PACKAGE_BUGREPORT
00038 #undef PACKAGE_NAME
00039 #undef PACKAGE_STRING
00040 #undef PACKAGE_TARNAME
00041 #undef PACKAGE_VERSION
00042 #include <omniORB4/CORBA.h>
00043 #endif
00044 
00045 // STL includes
00046 #include <map>
00047 #include <string>
00048 #include <vector>
00049 
00050 namespace RTC
00051 {
00086   class CorbaNaming
00087   {
00088   public:
00089     CorbaNaming(CORBA::ORB_ptr orb);
00090     CorbaNaming(CORBA::ORB_ptr orb, const char* name_server);
00091     virtual ~CorbaNaming(){};
00092     void init(const char* name_server);
00093 
00094     typedef CosNaming::NamingContext::NotFound      NotFound;
00095     typedef CosNaming::NamingContext::CannotProceed CannotProceed;
00096     typedef CosNaming::NamingContext::InvalidName   InvalidName;
00097     typedef CosNaming::NamingContext::AlreadyBound  AlreadyBound;
00098     typedef CosNaming::NamingContext::NotEmpty      NotEmpty;
00099     typedef CosNaming::NamingContextExt::InvalidAddress InvalidAddress;
00100     typedef std::vector<CORBA::Object_ptr> ObjectList;
00101 
00102 
00148     void bind(const CosNaming::Name& name, CORBA::Object_ptr obj,
00149               const bool force = 1)
00150       throw(NotFound, CannotProceed, InvalidName, AlreadyBound);
00151 
00152 
00176     void bindByString(const char* string_name, CORBA::Object_ptr obj,
00177                       const bool force = 1)
00178       throw(NotFound, CannotProceed, InvalidName, AlreadyBound);
00179 
00215     void bindRecursive(CosNaming::NamingContext_ptr context,
00216                        const CosNaming::Name& name,
00217                        CORBA::Object_ptr obj)
00218       throw(CannotProceed, InvalidName, AlreadyBound);
00219 
00220 
00221 
00241     void rebind(const CosNaming::Name& name, CORBA::Object_ptr obj,
00242                 const bool force = 1)
00243       throw(NotFound, CannotProceed, InvalidName);
00244 
00245 
00268     void rebindByString(const char* string_name, CORBA::Object_ptr obj,
00269                         const bool force = 1)
00270       throw(NotFound, CannotProceed, InvalidName);
00271 
00272     
00297     void rebindRecursive(CosNaming::NamingContext_ptr context,
00298                          const CosNaming::Name& name,
00299                          CORBA::Object_ptr obj)
00300       throw(CannotProceed, InvalidName);
00301 
00320     void bindContext(const CosNaming::Name& name,
00321                      CosNaming::NamingContext_ptr name_cxt,
00322                      const bool force = 1)
00323       throw(NotFound, CannotProceed, InvalidName, AlreadyBound);
00324 
00343     void bindContext(const char* string_name,
00344                      CosNaming::NamingContext_ptr name_cxt,
00345                      const bool force = 1)
00346       throw(NotFound, CannotProceed, InvalidName, AlreadyBound);
00347 
00367     void bindContextRecursive(CosNaming::NamingContext_ptr context,
00368                               const CosNaming::Name& name,
00369                               CosNaming::NamingContext_ptr name_cxt);
00390     void rebindContext(const CosNaming::Name& name,
00391                        CosNaming::NamingContext_ptr name_cxt,
00392                        const bool force = 1)
00393       throw(NotFound, CannotProceed, InvalidName);
00394 
00415     void rebindContext(const char* string_name,
00416                        CosNaming::NamingContext_ptr name_cxt,
00417                        const bool force = 1)
00418       throw(NotFound, CannotProceed, InvalidName);
00419 
00420 
00421     void rebindContextRecursive(CosNaming::NamingContext_ptr context,
00422                                 const CosNaming::Name& name,
00423                                 CosNaming::NamingContext_ptr name_cxt);
00424 
00444     CORBA::Object_ptr resolve(const CosNaming::Name& name)
00445       throw(NotFound, CannotProceed, InvalidName);
00446 
00466     CORBA::Object_ptr resolve(const char* string_name)
00467       throw(NotFound, CannotProceed, InvalidName);
00468 
00488     void unbind(const CosNaming::Name& name)
00489       throw(NotFound, CannotProceed, InvalidName);
00490 
00510     void unbind(const char* string_name)
00511       throw(NotFound, CannotProceed, InvalidName);
00512 
00527     CosNaming::NamingContext_ptr newContext();
00528 
00544     CosNaming::NamingContext_ptr
00545     bindNewContext(const CosNaming::Name& name, bool force = true)
00546       throw(NotFound, CannotProceed, InvalidName, AlreadyBound);
00547 
00563     CosNaming::NamingContext_ptr
00564     bindNewContext(const char* string_name, bool force = true)
00565       throw(NotFound, CannotProceed, InvalidName, AlreadyBound);
00566 
00590     void destroy(CosNaming::NamingContext_ptr context)
00591       throw(NotEmpty);
00592 
00593 
00601     void destroyRecursive(CosNaming::NamingContext_ptr context)
00602       throw(NotEmpty, NotFound, CannotProceed, InvalidName);
00603 
00604 
00612     void clearAll();
00613 
00614 
00622     void list(CosNaming::NamingContext_ptr name_cxt,
00623               unsigned long how_many,
00624               CosNaming::BindingList_var& bl,
00625               CosNaming::BindingIterator_var& bi);
00626 
00627 
00628     //============================================================
00629     // interface of NamingContextExt
00630     //============================================================
00638     char* toString(const CosNaming::Name& name)
00639       throw(InvalidName);
00640     
00641 
00649     CosNaming::Name toName(const char* string_name)
00650       throw(InvalidName);
00651 
00652 
00660     char* toUrl(char* addr, char* string_name)
00661       throw(InvalidAddress, InvalidName);
00662 
00663 
00671     CORBA::Object_ptr resolveStr(const char* string_name)
00672       throw(NotFound, CannotProceed, InvalidName, AlreadyBound);
00673 
00674 
00675     //============================================================
00676     // Find functions
00677     //============================================================
00678 
00679     //    ObjectList find(const char* name, const char* kind);
00680     //    ObjectList findById(const char* name, const char* kind);
00681     //    ObjectList findByKind(const char* name, const char* kind);
00682 
00690     CORBA::Object_ptr bindOrResolve(CosNaming::NamingContext_ptr context,
00691                                     const CosNaming::Name& name,
00692                                     CORBA::Object_ptr obj);
00693     
00701     CosNaming::NamingContext_ptr
00702     bindOrResolveContext(CosNaming::NamingContext_ptr context,
00703                          const CosNaming::Name& name,
00704                          CosNaming::NamingContext_ptr new_context);
00705 
00706     
00714     CosNaming::NamingContext_ptr
00715     bindOrResolveContext(CosNaming::NamingContext_ptr context,
00716                          const CosNaming::Name& name);
00717 
00718 
00726     const char* getNameServer();
00727     
00735     CosNaming::NamingContext_ptr getRootContext();
00736 
00737     
00745     bool isNamingContext(CORBA::Object_ptr obj);
00746     
00754     bool isNamingContext(const CosNaming::Name& name);
00755     
00763     bool isNamingContext(const char* string_name);
00764     
00772     CosNaming::Name subName(const CosNaming::Name& name,
00773                             long begin,
00774                             long end = -1);
00775 
00776 
00777   protected:
00785     void nameToString(const CosNaming::Name& name, char* string_name,
00786                       unsigned long slen);
00794     CORBA::ULong getNameLength(const CosNaming::Name& name);
00795 
00803     unsigned int split(const std::string& input,
00804                        const std::string& delimiter,
00805                        std::vector<std::string>& results);
00806 
00807 
00808     
00809     CORBA::ORB_var m_varORB;
00810     std::string m_nameServer;
00811     CosNaming::NamingContextExt_var m_rootContext;
00812 
00813   private:
00814     CORBA::ULong m_blLength;
00815     
00816   }; // class CorbaNaming
00817 
00818 }; // namespace RTC
00819 
00820 #endif // end of __Naming_h__

OpenRTMに対してFri Oct 5 05:14:57 2007に生成されました。  doxygen 1.4.1