CorbaNaming.h
Go to the documentation of this file.
1 // -*- C++ -*-
20 #ifndef RTC_CORBANAMING_H
21 #define RTC_CORBANAMING_H
22 
23 #include <rtm/RTC.h>
24 
25 // STL includes
26 #include <map>
27 #include <string>
28 #include <vector>
29 
45 #ifdef WIN32
46 #pragma warning( disable : 4290 )
47 #endif
48 
49 namespace RTC
50 {
90  {
91  public:
107  CorbaNaming(CORBA::ORB_ptr orb);
108 
126  CorbaNaming(CORBA::ORB_ptr orb, const char* name_server);
127 
139  virtual ~CorbaNaming(void){};
140 
160  void init(const char* name_server);
161 
162  bool isAlive();
163 
164  typedef CORBA::SystemException SystemException;
165  typedef CosNaming::NamingContext::NotFound NotFound;
166  typedef CosNaming::NamingContext::CannotProceed CannotProceed;
167  typedef CosNaming::NamingContext::InvalidName InvalidName;
168  typedef CosNaming::NamingContext::AlreadyBound AlreadyBound;
169  typedef CosNaming::NamingContext::NotEmpty NotEmpty;
170  typedef CosNaming::NamingContextExt::InvalidAddress InvalidAddress;
171  typedef std::vector<CORBA::Object_ptr> ObjectList;
172 
255  void bind(const CosNaming::Name& name, CORBA::Object_ptr obj,
256  const bool force = 1)
257  throw (SystemException, NotFound, CannotProceed,
258  InvalidName, AlreadyBound);
259 
298  void bindByString(const char* string_name, CORBA::Object_ptr obj,
299  const bool force = 1)
300  throw (SystemException, NotFound, CannotProceed,
301  InvalidName, AlreadyBound);
302 
363  void bindRecursive(CosNaming::NamingContext_ptr context,
364  const CosNaming::Name& name,
365  CORBA::Object_ptr obj)
366  throw (SystemException, CannotProceed, InvalidName, AlreadyBound);
367 
405  void rebind(const CosNaming::Name& name, CORBA::Object_ptr obj,
406  const bool force = 1)
407  throw (SystemException, NotFound, CannotProceed, InvalidName);
408 
445  void rebindByString(const char* string_name, CORBA::Object_ptr obj,
446  const bool force = 1)
447  throw (SystemException, NotFound, CannotProceed, InvalidName);
448 
486  void rebindRecursive(CosNaming::NamingContext_ptr context,
487  const CosNaming::Name& name,
488  CORBA::Object_ptr obj)
489  throw (SystemException, CannotProceed, InvalidName);
490 
527  void bindContext(const CosNaming::Name& name,
528  CosNaming::NamingContext_ptr name_cxt,
529  const bool force = 1)
530  throw (SystemException, NotFound, CannotProceed,
531  InvalidName, AlreadyBound);
532 
570  void bindContext(const char* string_name,
571  CosNaming::NamingContext_ptr name_cxt,
572  const bool force = 1)
573  throw (SystemException, NotFound, CannotProceed,
574  InvalidName, AlreadyBound);
575 
601  void bindContextRecursive(CosNaming::NamingContext_ptr context,
602  const CosNaming::Name& name,
603  CosNaming::NamingContext_ptr name_cxt);
604 
643  void rebindContext(const CosNaming::Name& name,
644  CosNaming::NamingContext_ptr name_cxt,
645  const bool force = 1)
646  throw (SystemException, NotFound, CannotProceed, InvalidName);
647 
686  void rebindContext(const char* string_name,
687  CosNaming::NamingContext_ptr name_cxt,
688  const bool force = 1)
689  throw (SystemException, NotFound, CannotProceed, InvalidName);
690 
716  void rebindContextRecursive(CosNaming::NamingContext_ptr context,
717  const CosNaming::Name& name,
718  CosNaming::NamingContext_ptr name_cxt);
719 
761  CORBA::Object_ptr resolve(const CosNaming::Name& name)
762  throw (SystemException, NotFound, CannotProceed, InvalidName);
763 
806  CORBA::Object_ptr resolve(const char* string_name)
807  throw (SystemException, NotFound, CannotProceed, InvalidName);
808 
846  void unbind(const CosNaming::Name& name)
847  throw (SystemException, NotFound, CannotProceed, InvalidName);
848 
891  void unbind(const char* string_name)
892  throw (SystemException, NotFound, CannotProceed, InvalidName);
893 
915  CosNaming::NamingContext_ptr newContext();
916 
956  CosNaming::NamingContext_ptr
957  bindNewContext(const CosNaming::Name& name, bool force = true)
958  throw (SystemException, NotFound, CannotProceed,
959  InvalidName, AlreadyBound);
960 
1001  CosNaming::NamingContext_ptr
1002  bindNewContext(const char* string_name, bool force = true)
1003  throw (SystemException, NotFound, CannotProceed,
1004  InvalidName, AlreadyBound);
1005 
1033  void destroy(CosNaming::NamingContext_ptr context)
1034  throw (SystemException, NotEmpty);
1035 
1067  void destroyRecursive(CosNaming::NamingContext_ptr context)
1068  throw (SystemException, NotEmpty, NotFound, CannotProceed, InvalidName);
1069 
1083  void clearAll();
1084 
1108  void list(CosNaming::NamingContext_ptr name_cxt,
1109  CORBA::ULong how_many,
1110  CosNaming::BindingList_var& bl,
1111  CosNaming::BindingIterator_var& bi);
1112 
1113  //============================================================
1114  // interface of NamingContextExt
1115  //============================================================
1141  char* toString(const CosNaming::Name& name)
1142  throw (SystemException, InvalidName);
1143 
1169  CosNaming::Name toName(const char* string_name)
1170  throw (SystemException, InvalidName);
1171 
1201  char* toUrl(char* addr, char* string_name)
1202  throw (SystemException, InvalidAddress, InvalidName);
1203 
1235  CORBA::Object_ptr resolveStr(const char* string_name)
1236  throw (SystemException, NotFound, CannotProceed,
1237  InvalidName, AlreadyBound);
1238 
1239  //============================================================
1240  // Find functions
1241  //============================================================
1242 
1243  // ObjectList find(const char* name, const char* kind);
1244  // ObjectList findById(const char* name, const char* kind);
1245  // ObjectList findByKind(const char* name, const char* kind);
1246 
1279  CORBA::Object_ptr bindOrResolve(CosNaming::NamingContext_ptr context,
1280  const CosNaming::Name& name,
1281  CORBA::Object_ptr obj);
1282 
1316  CosNaming::NamingContext_ptr
1317  bindOrResolveContext(CosNaming::NamingContext_ptr context,
1318  const CosNaming::Name& name,
1319  CosNaming::NamingContext_ptr new_context);
1320 
1351  CosNaming::NamingContext_ptr
1352  bindOrResolveContext(CosNaming::NamingContext_ptr context,
1353  const CosNaming::Name& name);
1354 
1372  const char* getNameServer();
1373 
1391  CosNaming::NamingContext_ptr getRootContext();
1392 
1414  bool isNamingContext(CORBA::Object_ptr obj);
1415 
1437  bool isNamingContext(const CosNaming::Name& name);
1438 
1460  bool isNamingContext(const char* string_name);
1461 
1491  CosNaming::Name subName(const CosNaming::Name& name,
1492  CORBA::Long begin,
1493  CORBA::Long end = -1);
1494 
1495  protected:
1528  void nameToString(const CosNaming::Name& name, char* string_name,
1529  CORBA::ULong slen);
1558  CORBA::ULong getNameLength(const CosNaming::Name& name);
1559 
1585  unsigned int split(const std::string& input,
1586  const std::string& delimiter,
1587  std::vector<std::string>& results);
1588 
1596  CORBA::ORB_var m_varORB;
1597 
1613  CosNaming::NamingContextExt_var m_rootContext;
1614 
1615  private:
1616  CORBA::ULong m_blLength;
1617 
1618  }; // class CorbaNaming
1619 }; // namespace RTC
1620 
1621 #ifdef WIN32
1622 #pragma warning( default : 4290 )
1623 #endif
1624 
1625 #endif // end of RTC_CORBANAMING_H
bool isNamingContext(CORBA::Object_ptr obj)
Determine whether the object is NamingContext.
CosNaming::NamingContext::CannotProceed CannotProceed
Definition: CorbaNaming.h:166
void destroyRecursive(CosNaming::NamingContext_ptr context)
Destroy the naming context recursively.
RT-Component.
CORBA::Object_ptr resolveStr(const char *string_name)
Resolve from name of string representation and get object.
void rebindRecursive(CosNaming::NamingContext_ptr context, const CosNaming::Name &name, CORBA::Object_ptr obj)
Bind intermediate context recursively and rebind object.
void nameToString(const CosNaming::Name &name, char *string_name, CORBA::ULong slen)
Get string representation of name component.
CORBA::SystemException SystemException
Definition: CorbaNaming.h:164
CosNaming::NamingContext_ptr bindNewContext(const CosNaming::Name &name, bool force=true)
Bind new NamingContext.
CORBA::ORB_var m_varORB
ORB.
Definition: CorbaNaming.h:1596
const char * getNameServer()
Get the name of name server.
void rebind(const CosNaming::Name &name, CORBA::Object_ptr obj, const bool force=1)
Rebind object.
unsigned int split(const std::string &input, const std::string &delimiter, std::vector< std::string > &results)
Split of string.
CosNaming::NamingContext_ptr getRootContext()
Get the root context.
CORBA::Object_ptr resolve(const CosNaming::Name &name)
Return object bound on the specified NameComponent.
std::string m_nameServer
Name of the name server.
Definition: CorbaNaming.h:1605
CorbaNaming(CORBA::ORB_ptr orb)
Consructor.
Definition: CorbaNaming.cpp:37
void bindContextRecursive(CosNaming::NamingContext_ptr context, const CosNaming::Name &name, CosNaming::NamingContext_ptr name_cxt)
Bind intermediate context recursively and bind NamingContext.
void bindByString(const char *string_name, CORBA::Object_ptr obj, const bool force=1)
Bind object on specified string name position.
CORBA::ULong m_blLength
Definition: CorbaNaming.h:1616
void list(CosNaming::NamingContext_ptr name_cxt, CORBA::ULong how_many, CosNaming::BindingList_var &bl, CosNaming::BindingIterator_var &bi)
Get Binding of the given NamingContext.
CORBA::ULong getNameLength(const CosNaming::Name &name)
Get string length of the name component&#39;s string representation.
void unbind(const CosNaming::Name &name)
Unbind a binding specified by NameComponent.
CosNaming::Name subName(const CosNaming::Name &name, CORBA::Long begin, CORBA::Long end=-1)
Get subset of given name component.
CosNaming::NamingContext::NotFound NotFound
Definition: CorbaNaming.h:165
void rebindContextRecursive(CosNaming::NamingContext_ptr context, const CosNaming::Name &name, CosNaming::NamingContext_ptr name_cxt)
Rebind intermediate context recursively and rebind NamingContext.
void init(const char *name_server)
Initialize the Naming Service.
Definition: CorbaNaming.cpp:77
void bindContext(const CosNaming::Name &name, CosNaming::NamingContext_ptr name_cxt, const bool force=1)
Bind NamingContext.
CosNaming::NamingContext_ptr newContext()
Create new NamingContext.
void bind(const CosNaming::Name &name, CORBA::Object_ptr obj, const bool force=1)
Bind object on specified name component position.
CosNaming::NamingContextExt_var m_rootContext
The root context of specified name server.
Definition: CorbaNaming.h:1613
CosNaming::NamingContext::NotEmpty NotEmpty
Definition: CorbaNaming.h:169
CosNaming::Name toName(const char *string_name)
Resolve given string representation to NameComponent.
CosNaming::NamingContext::AlreadyBound AlreadyBound
Definition: CorbaNaming.h:168
CosNaming::NamingContext_ptr bindOrResolveContext(CosNaming::NamingContext_ptr context, const CosNaming::Name &name, CosNaming::NamingContext_ptr new_context)
Bind or resolve the given name component.
CosNaming::NamingContextExt::InvalidAddress InvalidAddress
Definition: CorbaNaming.h:170
CosNaming::NamingContext::InvalidName InvalidName
Definition: CorbaNaming.h:167
char * toUrl(char *addr, char *string_name)
Get URL representation from given addr and string_name.
void bindRecursive(CosNaming::NamingContext_ptr context, const CosNaming::Name &name, CORBA::Object_ptr obj)
Bind intermediate context recursively and bind object.
CORBA::Object_ptr bindOrResolve(CosNaming::NamingContext_ptr context, const CosNaming::Name &name, CORBA::Object_ptr obj)
Bind or resolve the given name component.
std::vector< CORBA::Object_ptr > ObjectList
Definition: CorbaNaming.h:171
RTComponent header.
virtual ~CorbaNaming(void)
Virtual destructor.
Definition: CorbaNaming.h:139
char * toString(const CosNaming::Name &name)
Get string representation of given NameComponent.
void destroy(CosNaming::NamingContext_ptr context)
Destroy the naming context.
void rebindContext(const CosNaming::Name &name, CosNaming::NamingContext_ptr name_cxt, const bool force=1)
Rebind NamingContext.
void clearAll()
Destroy all bindings.
void rebindByString(const char *string_name, CORBA::Object_ptr obj, const bool force=1)
Rebind Object.


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Jun 10 2019 14:07:51