CorbaNaming.h
Go to the documentation of this file.
00001 // -*- C++ -*-
00020 #ifndef RTC_CORBANAMING_H
00021 #define RTC_CORBANAMING_H
00022 
00023 #include <rtm/RTC.h>
00024 
00025 // STL includes
00026 #include <map>
00027 #include <string>
00028 #include <vector>
00029 
00045 #ifdef WIN32
00046 #pragma warning( disable : 4290 )
00047 #endif
00048 
00049 namespace RTC
00050 {
00089   class CorbaNaming
00090   {
00091   public:
00107     CorbaNaming(CORBA::ORB_ptr orb);
00108     
00126     CorbaNaming(CORBA::ORB_ptr orb, const char* name_server);
00127     
00139     virtual ~CorbaNaming(void){};
00140     
00160     void init(const char* name_server);
00161 
00162     bool isAlive();
00163     
00164     typedef CORBA::SystemException SystemException;
00165     typedef CosNaming::NamingContext::NotFound      NotFound;
00166     typedef CosNaming::NamingContext::CannotProceed CannotProceed;
00167     typedef CosNaming::NamingContext::InvalidName   InvalidName;
00168     typedef CosNaming::NamingContext::AlreadyBound  AlreadyBound;
00169     typedef CosNaming::NamingContext::NotEmpty      NotEmpty;
00170     typedef CosNaming::NamingContextExt::InvalidAddress InvalidAddress;
00171     typedef std::vector<CORBA::Object_ptr> ObjectList;
00172     
00255     void bind(const CosNaming::Name& name, CORBA::Object_ptr obj,
00256               const bool force = 1)
00257       throw (SystemException, NotFound, CannotProceed,
00258              InvalidName, AlreadyBound);
00259     
00298     void bindByString(const char* string_name, CORBA::Object_ptr obj,
00299                       const bool force = 1)
00300       throw (SystemException, NotFound, CannotProceed,
00301              InvalidName, AlreadyBound);
00302     
00363     void bindRecursive(CosNaming::NamingContext_ptr context,
00364                        const CosNaming::Name& name,
00365                        CORBA::Object_ptr obj)
00366       throw (SystemException, CannotProceed, InvalidName, AlreadyBound);
00367     
00405     void rebind(const CosNaming::Name& name, CORBA::Object_ptr obj,
00406                 const bool force = 1)
00407       throw (SystemException, NotFound, CannotProceed, InvalidName);
00408     
00445     void rebindByString(const char* string_name, CORBA::Object_ptr obj,
00446                         const bool force = 1)
00447       throw (SystemException, NotFound, CannotProceed, InvalidName);
00448     
00486     void rebindRecursive(CosNaming::NamingContext_ptr context,
00487                          const CosNaming::Name& name,
00488                          CORBA::Object_ptr obj)
00489       throw (SystemException, CannotProceed, InvalidName);
00490     
00527     void bindContext(const CosNaming::Name& name,
00528                      CosNaming::NamingContext_ptr name_cxt,
00529                      const bool force = 1)
00530       throw (SystemException, NotFound, CannotProceed,
00531              InvalidName, AlreadyBound);
00532     
00570     void bindContext(const char* string_name,
00571                      CosNaming::NamingContext_ptr name_cxt,
00572                      const bool force = 1)
00573       throw (SystemException, NotFound, CannotProceed,
00574              InvalidName, AlreadyBound);
00575     
00601     void bindContextRecursive(CosNaming::NamingContext_ptr context,
00602                               const CosNaming::Name& name,
00603                               CosNaming::NamingContext_ptr name_cxt);
00604     
00643     void rebindContext(const CosNaming::Name& name,
00644                        CosNaming::NamingContext_ptr name_cxt,
00645                        const bool force = 1)
00646       throw (SystemException, NotFound, CannotProceed, InvalidName);
00647     
00686     void rebindContext(const char* string_name,
00687                        CosNaming::NamingContext_ptr name_cxt,
00688                        const bool force = 1)
00689       throw (SystemException, NotFound, CannotProceed, InvalidName);
00690     
00716     void rebindContextRecursive(CosNaming::NamingContext_ptr context,
00717                                 const CosNaming::Name& name,
00718                                 CosNaming::NamingContext_ptr name_cxt);
00719     
00761     CORBA::Object_ptr resolve(const CosNaming::Name& name)
00762       throw (SystemException, NotFound, CannotProceed, InvalidName);
00763     
00806     CORBA::Object_ptr resolve(const char* string_name)
00807       throw (SystemException, NotFound, CannotProceed, InvalidName);
00808     
00846     void unbind(const CosNaming::Name& name)
00847       throw (SystemException, NotFound, CannotProceed, InvalidName);
00848     
00891     void unbind(const char* string_name)
00892       throw (SystemException, NotFound, CannotProceed, InvalidName);
00893     
00915     CosNaming::NamingContext_ptr newContext();
00916     
00956     CosNaming::NamingContext_ptr
00957     bindNewContext(const CosNaming::Name& name, bool force = true)
00958       throw (SystemException, NotFound, CannotProceed,
00959              InvalidName, AlreadyBound);
00960     
01001     CosNaming::NamingContext_ptr
01002     bindNewContext(const char* string_name, bool force = true)
01003       throw (SystemException, NotFound, CannotProceed,
01004              InvalidName, AlreadyBound);
01005     
01033     void destroy(CosNaming::NamingContext_ptr context)
01034       throw (SystemException, NotEmpty);
01035     
01067     void destroyRecursive(CosNaming::NamingContext_ptr context)
01068       throw (SystemException, NotEmpty, NotFound, CannotProceed, InvalidName);
01069     
01083     void clearAll();
01084     
01108     void list(CosNaming::NamingContext_ptr name_cxt,
01109               CORBA::ULong how_many,
01110               CosNaming::BindingList_var& bl,
01111               CosNaming::BindingIterator_var& bi);
01112     
01113     //============================================================
01114     // interface of NamingContextExt
01115     //============================================================
01141     char* toString(const CosNaming::Name& name)
01142       throw (SystemException, InvalidName);
01143     
01169     CosNaming::Name toName(const char* string_name)
01170       throw (SystemException, InvalidName);
01171     
01201     char* toUrl(char* addr, char* string_name)
01202       throw (SystemException, InvalidAddress, InvalidName);
01203     
01235     CORBA::Object_ptr resolveStr(const char* string_name)
01236       throw (SystemException, NotFound, CannotProceed,
01237              InvalidName, AlreadyBound);
01238     
01239     //============================================================
01240     // Find functions
01241     //============================================================
01242     
01243     //    ObjectList find(const char* name, const char* kind);
01244     //    ObjectList findById(const char* name, const char* kind);
01245     //    ObjectList findByKind(const char* name, const char* kind);
01246     
01279     CORBA::Object_ptr bindOrResolve(CosNaming::NamingContext_ptr context,
01280                                     const CosNaming::Name& name,
01281                                     CORBA::Object_ptr obj);
01282     
01316     CosNaming::NamingContext_ptr
01317     bindOrResolveContext(CosNaming::NamingContext_ptr context,
01318                          const CosNaming::Name& name,
01319                          CosNaming::NamingContext_ptr new_context);
01320     
01351     CosNaming::NamingContext_ptr
01352     bindOrResolveContext(CosNaming::NamingContext_ptr context,
01353                          const CosNaming::Name& name);
01354     
01372     const char* getNameServer();
01373     
01391     CosNaming::NamingContext_ptr getRootContext();
01392     
01414     bool isNamingContext(CORBA::Object_ptr obj);
01415     
01437     bool isNamingContext(const CosNaming::Name& name);
01438     
01460     bool isNamingContext(const char* string_name);
01461     
01491     CosNaming::Name subName(const CosNaming::Name& name,
01492                             CORBA::Long begin,
01493                             CORBA::Long end = -1);
01494     
01495   protected:
01528     void nameToString(const CosNaming::Name& name, char* string_name,
01529                       CORBA::ULong slen);
01558     CORBA::ULong getNameLength(const CosNaming::Name& name);
01559     
01585     unsigned int split(const std::string& input,
01586                        const std::string& delimiter,
01587                        std::vector<std::string>& results);
01588     
01596     CORBA::ORB_var m_varORB;
01597     
01605     std::string m_nameServer;
01613     CosNaming::NamingContextExt_var m_rootContext;
01614     
01615   private:
01616     CORBA::ULong m_blLength;
01617     
01618   }; // class CorbaNaming
01619 }; // namespace RTC
01620 
01621 #ifdef WIN32
01622 #pragma warning( default : 4290 )
01623 #endif
01624 
01625 #endif // end of RTC_CORBANAMING_H


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Sun Mar 26 2017 03:37:15