#include <Local_Name_Space_T.h>
Inheritance diagram for ACE_Local_Name_Space<, ACE_LOCK >:


Public Types | |
| typedef ACE_Allocator_Adapter< ACE_Malloc< ACE_MEM_POOL_2, ACE_LOCK > > | ALLOCATOR |
Public Member Functions | |
| ACE_Local_Name_Space (void) | |
| "Do-nothing" constructor. | |
| ACE_Local_Name_Space (ACE_Naming_Context::Context_Scope_Type scope_in, ACE_Name_Options *name_options) | |
| int | open (ACE_Naming_Context::Context_Scope_Type scope_in) |
| ~ACE_Local_Name_Space (void) | |
| virtual int | bind (const ACE_NS_WString &name, const ACE_NS_WString &value, const char *type="") |
| Bind a new name to a naming context (Wide character strings). | |
| virtual int | rebind (const ACE_NS_WString &name, const ACE_NS_WString &value, const char *type="") |
| virtual int | unbind (const ACE_NS_WString &name) |
| virtual int | unbind_i (const ACE_NS_WString &name) |
| virtual int | resolve (const ACE_NS_WString &name, ACE_NS_WString &value, char *&type) |
| virtual int | resolve_i (const ACE_NS_WString &name, ACE_NS_WString &value, char *&type) |
| virtual int | list_names (ACE_WSTRING_SET &set, const ACE_NS_WString &pattern) |
| virtual int | list_names_i (ACE_WSTRING_SET &set, const ACE_NS_WString &pattern) |
| virtual int | list_values (ACE_WSTRING_SET &set, const ACE_NS_WString &pattern) |
| virtual int | list_values_i (ACE_WSTRING_SET &set, const ACE_NS_WString &pattern) |
| virtual int | list_types (ACE_WSTRING_SET &set, const ACE_NS_WString &pattern) |
| virtual int | list_types_i (ACE_WSTRING_SET &set, const ACE_NS_WString &pattern) |
| virtual int | list_name_entries (ACE_BINDING_SET &set, const ACE_NS_WString &pattern) |
| virtual int | list_name_entries_i (ACE_BINDING_SET &set, const ACE_NS_WString &pattern) |
| virtual int | list_value_entries (ACE_BINDING_SET &set, const ACE_NS_WString &pattern) |
| virtual int | list_value_entries_i (ACE_BINDING_SET &set, const ACE_NS_WString &pattern) |
| virtual int | list_type_entries (ACE_BINDING_SET &set, const ACE_NS_WString &pattern) |
| virtual int | list_type_entries_i (ACE_BINDING_SET &set, const ACE_NS_WString &pattern) |
| virtual void | dump (void) const |
| Dump the state of the object. | |
| virtual void | dump_i (void) const |
Private Member Functions | |
| int | remap (EXCEPTION_POINTERS *ep) |
| Remap the backing store. | |
| int | shared_bind (const ACE_NS_WString &name, const ACE_NS_WString &value, const char *type, int rebind) |
| Factor out code from bind() and rebind(). | |
| int | shared_bind_i (const ACE_NS_WString &name, const ACE_NS_WString &value, const char *type, int rebind) |
| int | create_manager (void) |
| int | create_manager_i (void) |
Private Attributes | |
| ALLOCATOR * | allocator_ |
| Pointer to the allocator. | |
| ACE_Name_Space_Map< ALLOCATOR > * | name_space_map_ |
| Pointer to the allocated map manager. | |
| ACE_Naming_Context::Context_Scope_Type | ns_scope_ |
| ACE_Name_Options * | name_options_ |
| Keep track of the options such as database name etc. | |
| ACE_TCHAR | context_file_ [MAXPATHLEN+MAXNAMELEN] |
| Name of the file used as the backing store. | |
| ACE_LOCK * | lock_ |
| Synchronization variable. | |
Manages a Naming Service for a local name space which includes bindings for node_local and host_local naming contexts. All strings are stored in wide character format. A Name Binding consists of a name (that's the key), a value string and an optional type string (no wide chars).
Definition at line 117 of file Local_Name_Space_T.h.
|
|||||
|
Definition at line 228 of file Local_Name_Space_T.h. Referenced by ACE_Local_Name_Space<, ACE_LOCK >::create_manager_i(). |
|
||||||||||
|
"Do-nothing" constructor.
Definition at line 359 of file Local_Name_Space_T.cpp. References ACE_TRACE.
00360 : allocator_ (0), 00361 name_space_map_ (0), 00362 name_options_ (0) 00363 { 00364 ACE_TRACE ("ACE_Local_Name_Space::ACE_Local_Name_Space"); 00365 } |
|
||||||||||||||||
|
Specifies the scope of this namespace, opens and memory-maps the associated file (if accessible) or contacts the dedicated name server process for NET_LOCAL namespace. Definition at line 368 of file Local_Name_Space_T.cpp. References ACE_ERROR, ACE_LIB_TEXT, ACE_TRACE, LM_ERROR, and ACE_Local_Name_Space<, ACE_LOCK >::open().
00371 : name_options_ (name_options) 00372 { 00373 ACE_TRACE ("ACE_Local_Name_Space::ACE_Local_Name_Space"); 00374 if (this->open (scope_in) == -1) 00375 ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_Local_Name_Space::ACE_Local_Name_Space"))); 00376 } |
|
||||||||||
|
Destructor, do some cleanup :TBD: last dtor should "compress" file Definition at line 379 of file Local_Name_Space_T.cpp. References ACE_TRACE.
00380 {
00381 ACE_TRACE ("ACE_Local_Name_Space::~ACE_Local_Name_Space");
00382
00383 // Remove the map.
00384 delete this->allocator_;
00385 delete this->lock_;
00386 }
|
|
||||||||||||||||||||
|
Bind a new name to a naming context (Wide character strings).
Implements ACE_Name_Space. Definition at line 263 of file Local_Name_Space_T.cpp. References ACE_TRACE, ACE_WRITE_GUARD_RETURN, and ACE_Local_Name_Space<, ACE_LOCK >::shared_bind().
00267 {
00268 ACE_TRACE ("ACE_Local_Name_Space::bind");
00269 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00270
00271 return this->shared_bind (name, value, type, 0);
00272 }
|
|
||||||||||
|
Allocate the appropriate type of map manager that stores the key/value binding. Definition at line 389 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, and ACE_Local_Name_Space<, ACE_LOCK >::create_manager_i(). Referenced by ACE_Local_Name_Space<, ACE_LOCK >::open().
00390 {
00391 // Note that we *must* use structured exception handling here
00392 // because (1) we may need to commit virtual memory pages and (2)
00393 // C++ exception handling doesn't support resumption.
00394 int result = 0;
00395 ACE_SEH_TRY
00396 {
00397 result = this->create_manager_i ();
00398 }
00399 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00400 {
00401 }
00402 return result;
00403 }
|
|
||||||||||
|
Definition at line 407 of file Local_Name_Space_T.cpp. References ACE_OS::access(), ACE_DEBUG, ACE_DIRECTORY_SEPARATOR_STR, ACE_ERROR_RETURN, ACE_GUARD_RETURN, ACE_LIB_TEXT, ACE_LOG_MSG, ACE_MEM_POOL_OPTIONS, ACE_NAME_SERVER_MAP, ACE_NEW_RETURN, ACE_TCHAR, ACE_TRACE, ACE_Local_Name_Space<, ACE_LOCK >::ALLOCATOR, ACE_Allocator_Adapter< MALLOC >::bind(), ACE_Name_Options::database(), ACE::debug(), F_OK, ACE_Allocator_Adapter< MALLOC >::find(), LM_DEBUG, LM_ERROR, ACE_Allocator_Adapter< MALLOC >::malloc(), MAXNAMELEN, MAXPATHLEN, ACE_Local_Name_Space<, ACE_LOCK >::name_options_, ACE_Local_Name_Space<, ACE_LOCK >::name_space_map_, ACE_Name_Options::namespace_dir(), ACE_OS::strcat(), ACE_OS::strcpy(), ACE_OS::strlen(), ACE_OS::strncat(), and ACE_OS::strsncpy(). Referenced by ACE_Local_Name_Space<, ACE_LOCK >::create_manager().
00408 {
00409 ACE_TRACE ("ACE_Local_Name_Space::create_manager_i");
00410 // Get directory name
00411 const ACE_TCHAR *dir = this->name_options_->namespace_dir ();
00412 const ACE_TCHAR *database = this->name_options_->database ();
00413
00414 // Use process name as the file name.
00415 size_t len = ACE_OS::strlen (dir);
00416 len += ACE_OS::strlen (ACE_DIRECTORY_SEPARATOR_STR);
00417 len += ACE_OS::strlen (database) + 1;
00418
00419 if (len >= MAXNAMELEN + MAXPATHLEN)
00420 {
00421 errno = ENAMETOOLONG;
00422 return -1;
00423 }
00424
00425 ACE_OS::strcpy (this->context_file_, dir);
00426 ACE_OS::strcat (this->context_file_, ACE_DIRECTORY_SEPARATOR_STR);
00427 ACE_OS::strcat (this->context_file_, database);
00428
00429 ACE_MEM_POOL_OPTIONS options (this->name_options_->base_address ());
00430
00431 ACE_TCHAR lock_name_for_local_name_space [MAXNAMELEN + MAXPATHLEN];
00432 ACE_TCHAR lock_name_for_backing_store [MAXPATHLEN + MAXNAMELEN];
00433 const ACE_TCHAR *postfix = database;
00434
00435 size_t length = 0;
00436 length = sizeof lock_name_for_local_name_space / sizeof (ACE_TCHAR);
00437 ACE_OS::strsncpy (lock_name_for_local_name_space,
00438 dir,
00439 length);
00440
00441 ACE_OS::strncat (lock_name_for_local_name_space,
00442 ACE_DIRECTORY_SEPARATOR_STR,
00443 length - ACE_OS::strlen (lock_name_for_local_name_space));
00444 ACE_OS::strncat (lock_name_for_local_name_space,
00445 ACE_LIB_TEXT ("name_space_"),
00446 length - ACE_OS::strlen (lock_name_for_local_name_space));
00447 ACE_OS::strncat (lock_name_for_local_name_space,
00448 postfix,
00449 length - ACE_OS::strlen (lock_name_for_local_name_space));
00450
00451 length = sizeof lock_name_for_backing_store / sizeof (ACE_TCHAR);
00452 ACE_OS::strsncpy (lock_name_for_backing_store,
00453 dir,
00454 length);
00455 ACE_OS::strncat (lock_name_for_backing_store,
00456 ACE_DIRECTORY_SEPARATOR_STR,
00457 length - ACE_OS::strlen (lock_name_for_backing_store));
00458 ACE_OS::strncat (lock_name_for_backing_store,
00459 ACE_LIB_TEXT ("backing_store_"),
00460 length - ACE_OS::strlen (lock_name_for_backing_store));
00461 ACE_OS::strncat (lock_name_for_backing_store,
00462 postfix,
00463 length - ACE_OS::strlen (ACE_LIB_TEXT ("backing_store_")));
00464
00465 // Create the allocator with the appropriate options.
00466 ACE_NEW_RETURN (this->allocator_,
00467 ALLOCATOR (this->context_file_,
00468 lock_name_for_backing_store,
00469 &options), -1);
00470
00471 if (ACE_LOG_MSG->op_status ())
00472 ACE_ERROR_RETURN ((LM_ERROR,
00473 ACE_LIB_TEXT ("Allocator::Allocator\n")),
00474 -1);
00475
00476 ACE_NEW_RETURN (this->lock_,
00477 ACE_LOCK (lock_name_for_local_name_space),
00478 -1);
00479
00480 #if !defined (ACE_LACKS_ACCESS)
00481 // Now check if the backing store has been created successfully
00482 if (ACE_OS::access (this->context_file_, F_OK) != 0)
00483 ACE_ERROR_RETURN ((LM_ERROR,
00484 ACE_LIB_TEXT ("create_manager\n")),
00485 -1);
00486 #endif /* ACE_LACKS_ACCESS */
00487
00488 void *ns_map = 0;
00489
00490 // This is the easy case since if we find the Name Server Map
00491 // Manager we know it's already initialized.
00492 if (this->allocator_->find (ACE_NAME_SERVER_MAP, ns_map) == 0)
00493 {
00494 this->name_space_map_ = (ACE_Name_Space_Map <ALLOCATOR> *) ns_map;
00495 if (ACE::debug ())
00496 ACE_DEBUG ((LM_DEBUG,
00497 ACE_LIB_TEXT ("name_space_map_ = %d, ns_map = %d\n"),
00498 this->name_space_map_, ns_map));
00499 }
00500
00501 // This is the hard part since we have to avoid potential race
00502 // conditions... We will use the double check here
00503 else
00504 {
00505 ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00506
00507 // This is the easy case since if we find the Name Server Map
00508 // Manager we know it's already initialized.
00509 if (this->allocator_->find (ACE_NAME_SERVER_MAP, ns_map) == 0)
00510 {
00511 this->name_space_map_ = (ACE_Name_Space_Map <ALLOCATOR> *) ns_map;
00512 if (ACE::debug ())
00513 ACE_DEBUG ((LM_DEBUG,
00514 ACE_LIB_TEXT ("name_space_map_ = %d, ns_map = %d\n"),
00515 this->name_space_map_, ns_map));
00516 }
00517 else
00518 {
00519 size_t map_size = sizeof *this->name_space_map_;
00520 ns_map = this->allocator_->malloc (map_size);
00521
00522 // Initialize the map into its memory location (e.g., shared memory).
00523 this->name_space_map_ =
00524 new (ns_map) ACE_Name_Space_Map <ALLOCATOR> (this->allocator_);
00525
00526 if (this->allocator_->bind (ACE_NAME_SERVER_MAP, ns_map) == -1)
00527 ACE_ERROR_RETURN ((LM_ERROR,
00528 ACE_LIB_TEXT ("create_manager\n")), -1);
00529 }
00530
00531 if (ACE::debug ())
00532 ACE_DEBUG ((LM_DEBUG,
00533 ACE_LIB_TEXT ("name_space_map_ = %d, ns_map = %d\n"),
00534 this->name_space_map_, ns_map));
00535 }
00536
00537 return 0;
00538 }
|
|
||||||||||
|
Dump the state of the object.
Implements ACE_Name_Space. Definition at line 942 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, ACE_Local_Name_Space<, ACE_LOCK >::dump_i(), and ACE_Local_Name_Space<, ACE_LOCK >::remap().
00943 {
00944 #if defined (ACE_HAS_DUMP)
00945 // Note that we *must* use structured exception handling here
00946 // because (1) we may need to commit virtual memory pages and (2)
00947 // C++ exception handling doesn't support resumption.
00948
00949 // This should really be a const cast
00950 ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK> *fake_this =
00951 (ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK> *) this;
00952 ACE_UNUSED_ARG (fake_this);
00953
00954 ACE_SEH_TRY
00955 {
00956 this->dump_i ();
00957 }
00958 ACE_SEH_EXCEPT (fake_this->remap (GetExceptionInformation ()))
00959 {
00960 }
00961 #endif /* ACE_HAS_DUMP */
00962 }
|
|
||||||||||
|
Definition at line 797 of file Local_Name_Space_T.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, ACE_TEXT_CHAR_TO_TCHAR, ACE_TRACE, and LM_DEBUG. Referenced by ACE_Local_Name_Space<, ACE_LOCK >::dump().
00798 {
00799 ACE_TRACE ("ACE_Local_Name_Space::dump_i");
00800
00801 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00802
00803 MAP_MANAGER::ITERATOR map_iterator (*this->name_space_map_);
00804 MAP_MANAGER::ENTRY *map_entry;
00805
00806 for (map_entry = 0;
00807 map_iterator.next (map_entry) != 0;
00808 map_iterator.advance())
00809 {
00810 char *key = map_entry->ext_id_.char_rep ();
00811 char *value = map_entry->int_id_.value ().char_rep ();
00812 #if !defined (ACE_NLOGGING)
00813 const char *type = map_entry->int_id_.type ();
00814 #endif /* ! ACE_NLOGGING */
00815
00816 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("key=%s\nvalue=%s\ntype=%s\n"),
00817 ACE_TEXT_CHAR_TO_TCHAR (key), ACE_TEXT_CHAR_TO_TCHAR (value), ACE_TEXT_CHAR_TO_TCHAR (type)));
00818 // We need to delete key and value since char_rep allocates
00819 // memory for them
00820 delete [] key;
00821 delete [] value;
00822 }
00823
00824 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00825 }
|
|
||||||||||||||||
|
Get a set of names matching a specified pattern (wchars). Matching means the names must begin with the pattern string. Returns the complete binding associated each pattern match. Implements ACE_Name_Space. Definition at line 885 of file Local_Name_Space_T.cpp. References ACE_BINDING_SET, ACE_SEH_EXCEPT, and ACE_SEH_TRY.
00888 {
00889 // Note that we *must* use structured exception handling here
00890 // because (1) we may need to commit virtual memory pages and (2)
00891 // C++ exception handling doesn't support resumption.
00892 int result = 0;
00893 ACE_SEH_TRY
00894 {
00895 result = this->list_name_entries_i (set, pattern);
00896 }
00897 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00898 {
00899 }
00900 return result;
00901 }
|
|
||||||||||||||||
|
Definition at line 680 of file Local_Name_Space_T.cpp. References ACE_BINDING_SET, ACE_READ_GUARD_RETURN, and ACE_TRACE.
00683 {
00684 ACE_TRACE ("ACE_Local_Name_Space::list_name_entries_i");
00685 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00686
00687 MAP_MANAGER::ITERATOR map_iterator (*this->name_space_map_);
00688 MAP_MANAGER::ENTRY *map_entry;
00689
00690 for (map_entry = 0;
00691 map_iterator.next (map_entry) != 0;
00692 map_iterator.advance())
00693 {
00694 if (map_entry->ext_id_.strstr (pattern) != -1)
00695 {
00696 ACE_Name_Binding entry (map_entry->ext_id_,
00697 map_entry->int_id_.value (),
00698 map_entry->int_id_.type ());
00699
00700 if (set.insert (entry) == -1)
00701 return -1;
00702 }
00703 }
00704
00705 return 0;
00706 }
|
|
||||||||||||||||
|
Get a set of names matching a specified pattern (wchars). Matching means the names must begin with the pattern string. Implements ACE_Name_Space. Definition at line 828 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, ACE_WSTRING_SET, and ACE_Local_Name_Space<, ACE_LOCK >::list_names_i().
00831 {
00832 // Note that we *must* use structured exception handling here
00833 // because (1) we may need to commit virtual memory pages and (2)
00834 // C++ exception handling doesn't support resumption.
00835 int result = 0;
00836 ACE_SEH_TRY
00837 {
00838 result = this->list_names_i (set, pattern);
00839 }
00840 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00841 {
00842 }
00843 return result;
00844 }
|
|
||||||||||||||||
|
Definition at line 541 of file Local_Name_Space_T.cpp. References ACE_READ_GUARD_RETURN, ACE_TRACE, ACE_WSTRING_SET, and ACE_Unbounded_Set< T >::insert(). Referenced by ACE_Local_Name_Space<, ACE_LOCK >::list_names().
00544 {
00545 ACE_TRACE ("ACE_Local_Name_Space::list_names_i");
00546 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00547
00548 MAP_MANAGER::ITERATOR map_iterator (*this->name_space_map_);
00549 MAP_MANAGER::ENTRY *map_entry;
00550
00551 int result = 1;
00552
00553 for (map_entry = 0;
00554 map_iterator.next (map_entry) != 0;
00555 map_iterator.advance())
00556 {
00557 if (map_entry->ext_id_.strstr (pattern) != -1)
00558 {
00559 ACE_NS_WString entry (map_entry->ext_id_ );
00560
00561 if (set.insert (entry) == -1)
00562 {
00563 result = -1;
00564 break;
00565 }
00566 else
00567 result = 0;
00568 }
00569 }
00570
00571 return result;
00572 }
|
|
||||||||||||||||
|
Get a set of types matching a specified pattern (wchars). Matching means the types must begin with the pattern string. Returns the complete binding associated each pattern match. Implements ACE_Name_Space. Definition at line 923 of file Local_Name_Space_T.cpp. References ACE_BINDING_SET, ACE_SEH_EXCEPT, ACE_SEH_TRY, and ACE_Local_Name_Space<, ACE_LOCK >::list_type_entries_i().
00926 {
00927 // Note that we *must* use structured exception handling here
00928 // because (1) we may need to commit virtual memory pages and (2)
00929 // C++ exception handling doesn't support resumption.
00930 int result = 0;
00931 ACE_SEH_TRY
00932 {
00933 result = this->list_type_entries_i (set, pattern);
00934 }
00935 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00936 {
00937 }
00938 return result;
00939 }
|
|
||||||||||||||||
|
Definition at line 737 of file Local_Name_Space_T.cpp. References ACE_BINDING_SET, ACE_READ_GUARD_RETURN, ACE_TRACE, ACE_NS_WString::char_rep(), ACE_OS::compile(), ACE_OS::free(), ACE_Unbounded_Set< T >::insert(), ACE_OS::step(), ACE_OS::strcmp(), ACE_OS::strdup(), and ACE_OS::strstr(). Referenced by ACE_Local_Name_Space<, ACE_LOCK >::list_type_entries().
00740 {
00741 ACE_TRACE ("ACE_Local_Name_Space::list_type_entries_i");
00742 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00743
00744 MAP_MANAGER::ITERATOR map_iterator (*this->name_space_map_);
00745 MAP_MANAGER::ENTRY *map_entry;
00746
00747 char *compiled_regexp = 0;
00748 // Note that char_rep() allocates memory so we need to delete it
00749 char *pattern_rep = pattern.char_rep ();
00750
00751 // Check for wildcard case first.
00752 if (ACE_OS::strcmp ("", pattern_rep) == 0)
00753 compiled_regexp = ACE_OS::strdup ("");
00754 else
00755 // Compile the regular expression (the 0's cause ACE_OS::compile
00756 // to allocate space).
00757 #if defined (ACE_HAS_REGEX)
00758 compiled_regexp = ACE_OS::compile (pattern_rep, 0, 0);
00759 #else /* If we don't have regular expressions just the pattern
00760 directly. */
00761 compiled_regexp = pattern_rep;
00762 #endif /* ACE_HAS_REGEX */
00763
00764 for (map_entry = 0;
00765 map_iterator.next (map_entry) != 0;
00766 map_iterator.advance ())
00767 {
00768 // Get the type.
00769 const char *type = map_entry->int_id_.type ();
00770
00771 if (ACE_OS::strcmp ("", pattern_rep) == 0 // Everything matches
00772 // the wildcard.
00773 #if defined (ACE_HAS_REGEX)
00774 || ACE_OS::step (type, compiled_regexp) != 0)
00775 #else /* If we don't have regular expressions just use strstr() for
00776 substring matching. */
00777 || ACE_OS::strstr (type, compiled_regexp) != 0)
00778 #endif /* ACE_HAS_REGEX */
00779 {
00780 ACE_Name_Binding entry (map_entry->ext_id_,
00781 map_entry->int_id_.value (),
00782 map_entry->int_id_.type ());
00783
00784 if (set.insert (entry) == -1)
00785 return -1;
00786 }
00787 }
00788 #if defined (ACE_HAS_REGEX)
00789 if (compiled_regexp)
00790 ACE_OS::free ((void *) compiled_regexp);
00791 #endif /* ACE_HAS_REGEX */
00792 delete [] pattern_rep; // delete pattern_rep;
00793 return 0;
00794 }
|
|
||||||||||||||||
|
Get a set of types matching a specified pattern (wchars). Matching means the types must begin with the pattern string. Implements ACE_Name_Space. Definition at line 866 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, ACE_WSTRING_SET, and ACE_Local_Name_Space<, ACE_LOCK >::list_types_i().
00869 {
00870 // Note that we *must* use structured exception handling here
00871 // because (1) we may need to commit virtual memory pages and (2)
00872 // C++ exception handling doesn't support resumption.
00873 int result = 0;
00874 ACE_SEH_TRY
00875 {
00876 result = this->list_types_i (set, pattern);
00877 }
00878 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00879 {
00880 }
00881 return result;
00882 }
|
|
||||||||||||||||
|
Definition at line 609 of file Local_Name_Space_T.cpp. References ACE_ALLOCATOR_RETURN, ACE_READ_GUARD_RETURN, ACE_TRACE, ACE_WSTRING_SET, ACE_NS_WString::char_rep(), ACE_OS::compile(), ACE_OS::free(), ACE_Unbounded_Set< T >::insert(), ACE_OS::step(), ACE_OS::strcmp(), and ACE_OS::strstr(). Referenced by ACE_Local_Name_Space<, ACE_LOCK >::list_types().
00612 {
00613 ACE_TRACE ("ACE_Local_Name_Space::list_types_i");
00614 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00615
00616 MAP_MANAGER::ITERATOR map_iterator (*this->name_space_map_);
00617 MAP_MANAGER::ENTRY *map_entry;
00618
00619 char *compiled_regexp = 0;
00620
00621 // Note that char_rep() allocates memory so we need to delete it
00622 char *pattern_rep = pattern.char_rep ();
00623
00624 // Check for wildcard case first.
00625 if (ACE_OS::strcmp ("", pattern_rep) == 0)
00626 ACE_ALLOCATOR_RETURN (compiled_regexp,
00627 ACE_OS::strdup (""),
00628 -1);
00629 else
00630 // Compile the regular expression (the 0's cause ACE_OS::compile
00631 // to allocate space).
00632 #if defined (ACE_HAS_REGEX)
00633 compiled_regexp = ACE_OS::compile (pattern_rep, 0, 0);
00634 #else
00635 // If we don't have regular expressions just use the pattern
00636 // directly.
00637 compiled_regexp = pattern_rep;
00638 #endif /* ACE_HAS_REGEX */
00639
00640 int result = 1;
00641
00642 for (map_entry = 0;
00643 map_iterator.next (map_entry) != 0;
00644 map_iterator.advance ())
00645 {
00646 // Get the type
00647 const char *type = map_entry->int_id_.type ();
00648
00649 // Everything matches the wildcard.
00650 if (ACE_OS::strcmp ("", pattern_rep) == 0
00651 #if defined (ACE_HAS_REGEX)
00652 || ACE_OS::step (type, compiled_regexp) != 0)
00653 #else
00654 // If we don't have regular expressions just use strstr() for
00655 // substring matching.
00656 || ACE_OS::strstr (type, compiled_regexp) != 0)
00657 #endif /* ACE_HAS_REGEX */
00658
00659 {
00660 ACE_NS_WString entry (type);
00661
00662 if (set.insert (entry) == -1)
00663 {
00664 result = -1;
00665 break;
00666 }
00667 else
00668 result = 0;
00669 }
00670 }
00671 #if defined (ACE_HAS_REGEX)
00672 if (compiled_regexp)
00673 ACE_OS::free ((void *) compiled_regexp);
00674 #endif /* ACE_HAS_REGEX */
00675 delete [] pattern_rep; // delete pattern_rep;
00676 return result;
00677 }
|
|
||||||||||||||||
|
Get a set of values matching a specified pattern (wchars). Matching means the values must begin with the pattern string. Returns the complete binding associated each pattern match. Implements ACE_Name_Space. Definition at line 904 of file Local_Name_Space_T.cpp. References ACE_BINDING_SET, ACE_SEH_EXCEPT, ACE_SEH_TRY, and ACE_Local_Name_Space<, ACE_LOCK >::list_value_entries_i().
00907 {
00908 // Note that we *must* use structured exception handling here
00909 // because (1) we may need to commit virtual memory pages and (2)
00910 // C++ exception handling doesn't support resumption.
00911 int result = 0;
00912 ACE_SEH_TRY
00913 {
00914 result = this->list_value_entries_i (set, pattern);
00915 }
00916 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00917 {
00918 }
00919 return result;
00920 }
|
|
||||||||||||||||
|
Definition at line 709 of file Local_Name_Space_T.cpp. References ACE_BINDING_SET, ACE_READ_GUARD_RETURN, ACE_TRACE, and ACE_Unbounded_Set< T >::insert(). Referenced by ACE_Local_Name_Space<, ACE_LOCK >::list_value_entries().
00712 {
00713 ACE_TRACE ("ACE_Local_Name_Space::list_value_entries_i");
00714 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00715
00716 MAP_MANAGER::ITERATOR map_iterator (*this->name_space_map_);
00717 MAP_MANAGER::ENTRY *map_entry;
00718
00719 for (map_entry = 0;
00720 map_iterator.next (map_entry) != 0;
00721 map_iterator.advance ())
00722 {
00723 if (map_entry->int_id_.value ().strstr (pattern) != -1)
00724 {
00725 ACE_Name_Binding entry (map_entry->ext_id_,
00726 map_entry->int_id_.value (),
00727 map_entry->int_id_.type ());
00728
00729 if (set.insert (entry) == -1)
00730 return -1;
00731 }
00732 }
00733 return 0;
00734 }
|
|
||||||||||||||||
|
Get a set of values matching a specified pattern (wchars). Matching means the values must begin with the pattern string. Implements ACE_Name_Space. Definition at line 847 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, ACE_WSTRING_SET, and ACE_Local_Name_Space<, ACE_LOCK >::list_values_i().
00850 {
00851 // Note that we *must* use structured exception handling here
00852 // because (1) we may need to commit virtual memory pages and (2)
00853 // C++ exception handling doesn't support resumption.
00854 int result = 0;
00855 ACE_SEH_TRY
00856 {
00857 result = this->list_values_i (set, pattern);
00858 }
00859 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00860 {
00861 }
00862 return result;
00863 }
|
|
||||||||||||||||
|
Definition at line 575 of file Local_Name_Space_T.cpp. References ACE_READ_GUARD_RETURN, ACE_TRACE, ACE_WSTRING_SET, and ACE_Unbounded_Set< T >::insert(). Referenced by ACE_Local_Name_Space<, ACE_LOCK >::list_values().
00578 {
00579 ACE_TRACE ("ACE_Local_Name_Space::list_values_i");
00580 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00581
00582 MAP_MANAGER::ITERATOR map_iterator (*this->name_space_map_);
00583 MAP_MANAGER::ENTRY *map_entry;
00584
00585 int result = 1;
00586
00587 for (map_entry = 0;
00588 map_iterator.next (map_entry) != 0;
00589 map_iterator.advance ())
00590 {
00591 if (map_entry->int_id_.value ().strstr (pattern) != -1)
00592 {
00593 ACE_NS_WString entry (map_entry->int_id_.value ());
00594
00595 if (set.insert (entry) == -1)
00596 {
00597 result = -1;
00598 break;
00599 }
00600 else
00601 result = 0;
00602 }
00603 }
00604
00605 return result;
00606 }
|
|
||||||||||
|
Specifies the scope of this namespace, opens and memory-maps the associated file (if accessible) or contacts the dedicated name server process for NET_LOCAL namespace. Definition at line 349 of file Local_Name_Space_T.cpp. References ACE_TRACE, ACE_Local_Name_Space<, ACE_LOCK >::create_manager(), and ACE_Local_Name_Space<, ACE_LOCK >::ns_scope_. Referenced by ACE_Local_Name_Space<, ACE_LOCK >::ACE_Local_Name_Space().
00351 {
00352 ACE_TRACE ("ACE_Local_Name_Space::open");
00353 this->ns_scope_ = scope_in;
00354
00355 return this->create_manager ();
00356 }
|
|
||||||||||||||||||||
|
Overwrite the value or type of an existing name in a ACE_Local_Name_Space or bind a new name to the context, if it didn't exist yet. (Wide charcter strings interface). Implements ACE_Name_Space. Definition at line 275 of file Local_Name_Space_T.cpp. References ACE_TRACE, ACE_WRITE_GUARD_RETURN, and ACE_Local_Name_Space<, ACE_LOCK >::shared_bind().
00279 {
00280 ACE_TRACE ("ACE_Local_Name_Space::rebind");
00281 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00282
00283 return this->shared_bind (name, value, type, 1);
00284 }
|
|
||||||||||
|
Remap the backing store.
Definition at line 90 of file Local_Name_Space_T.cpp. References ACE_TRACE, and ACE_Allocator_Adapter< MALLOC >::alloc(). Referenced by ACE_Local_Name_Space<, ACE_LOCK >::dump().
00091 {
00092 ACE_TRACE ("ACE_Local_Name_Space::remap");
00093
00094 void *addr = (void *) ep->ExceptionRecord->ExceptionInformation[1];
00095
00096 // The following requires Memory Pool to have ::remap()
00097 // defined. Thus currently this will only work for
00098 // ACE_MMap_Memory_Pool.
00099 if (this->allocator_->alloc ().memory_pool ().remap (addr) == -1)
00100 // Kick it upstairs...
00101 return EXCEPTION_CONTINUE_SEARCH;
00102
00103 #if __X86__
00104 // This is 80x86-specific.
00105 ep->ContextRecord->Edi = (DWORD) addr;
00106 #elif __MIPS__
00107 ep->ContextRecord->IntA0 =
00108 ep->ContextRecord->IntV0 = (DWORD) addr;
00109 ep->ContextRecord->IntT5 = ep->ContextRecord->IntA0 + 3;
00110 #endif /* __X86__ */
00111 // Resume execution at the original point of "failure."
00112 return EXCEPTION_CONTINUE_EXECUTION;
00113 }
|
|
||||||||||||||||||||
|
Get value and type of a given name binding (Wide chars). The caller is responsible for deleting type! Implements ACE_Name_Space. Definition at line 287 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, and ACE_Local_Name_Space<, ACE_LOCK >::resolve_i().
00291 {
00292 // Note that we *must* use structured exception handling here
00293 // because (1) we may need to commit virtual memory pages and (2)
00294 // C++ exception handling doesn't support resumption.
00295 int result = 0;
00296 ACE_SEH_TRY
00297 {
00298 result = this->resolve_i (name, value, type);
00299 }
00300 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00301 {
00302 }
00303 return result;
00304 }
|
|
||||||||||||||||||||
|
Definition at line 308 of file Local_Name_Space_T.cpp. References ACE_NEW_RETURN, ACE_READ_GUARD_RETURN, ACE_TRACE, ACE_Local_Name_Space<, ACE_LOCK >::name_space_map_, ACE_OS::strlen(), ACE_OS::strsncpy(), ACE_NS_Internal::type(), and ACE_NS_Internal::value(). Referenced by ACE_Local_Name_Space<, ACE_LOCK >::resolve().
00312 {
00313 ACE_TRACE ("ACE_Local_Name_Space::resolve_i");
00314 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00315
00316 ACE_NS_String ns_name (name);
00317 ACE_NS_Internal ns_internal;
00318 ACE_NS_String nbc_string; // Note the classy variable name! :)
00319
00320 if (this->name_space_map_->find (ns_name,
00321 ns_internal,
00322 this->allocator_) != 0)
00323 return -1;
00324
00325 // Calls conversion operator and then calls the ACE_NS_WString
00326 // assignment operator to get a fresh copy. (*#*(@#&!*@!!*@&( HP
00327 // compiler causes us to add an extra copy explicitly !! :)
00328 nbc_string = ns_internal.value ();
00329 value = nbc_string;
00330
00331 // Gets type and then the actual reprsentation which is a
00332 // ACE_WCHAR_T
00333 const char *temp = ns_internal.type ();
00334
00335 size_t len = ACE_OS::strlen (ns_internal.type ());
00336 // Makes a copy here. Caller needs to call delete to free up
00337 // memory.
00338 char *new_type = 0;
00339 ACE_NEW_RETURN (new_type,
00340 char [len + 1],
00341 -1);
00342
00343 ACE_OS::strsncpy (new_type, temp, len + 1);
00344 type = new_type;
00345 return 0;
00346 }
|
|
||||||||||||||||||||||||
|
Factor out code from bind() and rebind().
Definition at line 117 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, and ACE_Local_Name_Space<, ACE_LOCK >::shared_bind_i(). Referenced by ACE_Local_Name_Space<, ACE_LOCK >::bind(), and ACE_Local_Name_Space<, ACE_LOCK >::rebind().
00122 {
00123 // Note that we *must* use structured exception handling here
00124 // because (1) we may need to commit virtual memory pages and (2)
00125 // C++ exception handling doesn't support resumption.
00126 int result = 0;
00127 ACE_SEH_TRY
00128 {
00129 result = this->shared_bind_i (name, value, type, rebind);
00130 }
00131 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00132 {
00133 }
00134 return result;
00135 }
|
|
||||||||||||||||||||||||
|
Definition at line 138 of file Local_Name_Space_T.cpp. References ACE_TRACE, ACE_WCHAR_T, ACE_Allocator_Adapter< MALLOC >::free(), ACE_Auto_Basic_Array_Ptr< X >::get(), ACE_String_Base< CHAR >::length(), ACE_Allocator_Adapter< MALLOC >::malloc(), ACE_Local_Name_Space<, ACE_LOCK >::name_space_map_, ACE_String_Base< CHAR >::rep(), ACE_OS::strcpy(), ACE_OS::strlen(), ACE_Allocator_Adapter< MALLOC >::sync(), and ACE_NS_Internal::value(). Referenced by ACE_Local_Name_Space<, ACE_LOCK >::shared_bind().
00143 {
00144
00145 ACE_TRACE ("ACE_Local_Name_Space::shared_bind_i");
00146 const size_t name_len = (name.length () + 1) * sizeof (ACE_WCHAR_T);
00147 const size_t value_len = (value.length () + 1) * sizeof (ACE_WCHAR_T);
00148 const size_t type_len = ACE_OS::strlen (type) + 1;
00149 const size_t total_len = name_len + value_len + type_len;
00150 char *ptr = (char *) this->allocator_->malloc (total_len);
00151
00152 if (ptr == 0)
00153 return -1;
00154 else
00155 {
00156 // Note that the value_rep *must* come first to make sure we can
00157 // retrieve this pointer later on in unbind().
00158 ACE_WCHAR_T *value_rep = (ACE_WCHAR_T *) (ptr);
00159 ACE_WCHAR_T *name_rep = (ACE_WCHAR_T *) (ptr + value_len);
00160 char *new_type = (char *) (ptr + value_len + name_len);
00161
00162 ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> name_urep (name.rep ());
00163 ACE_Auto_Basic_Array_Ptr<ACE_WCHAR_T> value_urep (value.rep ());
00164 ACE_NS_String new_name (name_rep, name_urep.get (), name_len);
00165 ACE_NS_String new_value (value_rep, value_urep.get (), value_len);
00166
00167 ACE_OS::strcpy (new_type, type);
00168 ACE_NS_Internal new_internal (new_value, new_type);
00169 int result = -1;
00170
00171 if (rebind == 0)
00172 {
00173 // Do a normal bind. This will fail if there's already an
00174 // <new_internal> with the same name.
00175 result = this->name_space_map_->bind (new_name,
00176 new_internal,
00177 this->allocator_);
00178
00179 if (result == 1)
00180 {
00181 // Entry already existed so bind failed. Free our
00182 // dynamically allocated memory.
00183 this->allocator_->free ((void *) ptr);
00184 return result;
00185 }
00186 }
00187 else
00188 {
00189 // Do a rebind. If there's already any entry, this will
00190 // return the existing <new_name> and <new_internal> and
00191 // overwrite the existing name binding.
00192 ACE_NS_String old_name;
00193 ACE_NS_Internal old_internal;
00194
00195 result = this->name_space_map_->rebind (new_name, new_internal,
00196 old_name, old_internal,
00197 this->allocator_);
00198 if (result == 1)
00199 {
00200 // Free up the memory we allocated in shared_bind().
00201 // Note that this assumes that the "value" pointer comes
00202 // first and that the value, name, and type are
00203 // contiguously allocated (see above for details)
00204 this->allocator_->free ((void *) (old_internal.value ()).fast_rep ());
00205 }
00206 }
00207
00208 if (result == -1)
00209 // Free our dynamically allocated memory.
00210 this->allocator_->free ((void *) ptr);
00211 else
00212 // If bind() or rebind() succeed, they will automatically sync
00213 // up the map manager entry. However, we must sync up our
00214 // name/value memory.
00215 this->allocator_->sync (ptr, total_len);
00216
00217 return result;
00218 }
00219 }
|
|
||||||||||
|
Delete a name from a ACE_Local_Name_Space (Wide charcter strings Interface). Implements ACE_Name_Space. Definition at line 222 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, and ACE_Local_Name_Space<, ACE_LOCK >::unbind_i().
00224 {
00225 // Note that we *must* use structured exception handling here
00226 // because (1) we may need to commit virtual memory pages and (2)
00227 // C++ exception handling doesn't support resumption.
00228 int result = 0;
00229 ACE_SEH_TRY
00230 {
00231 result = this->unbind_i (name);
00232 }
00233 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00234 {
00235 }
00236 return result;
00237
00238 }
|
|
||||||||||
|
Definition at line 241 of file Local_Name_Space_T.cpp. References ACE_TRACE, ACE_WRITE_GUARD_RETURN, ACE_Allocator_Adapter< MALLOC >::free(), ACE_Local_Name_Space<, ACE_LOCK >::name_space_map_, and ACE_NS_Internal::value(). Referenced by ACE_Local_Name_Space<, ACE_LOCK >::unbind().
00243 {
00244 ACE_TRACE ("ACE_Local_Name_Space::unbind_i");
00245
00246 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00247 ACE_NS_String ns_name (name);
00248 ACE_NS_Internal ns_internal;
00249 if (this->name_space_map_->unbind (ns_name,
00250 ns_internal,
00251 this->allocator_) != 0)
00252 return -1;
00253
00254 // Free up the memory we allocated in shared_bind(). Note that this
00255 // assumes that the "value" pointer comes first and that the value,
00256 // name and type are contiguously allocated (see shared_bind() for
00257 // details)
00258 this->allocator_->free ((void *) (ns_internal.value ()).fast_rep ());
00259 return 0;
00260 }
|
|
|||||
|
Pointer to the allocator.
Definition at line 250 of file Local_Name_Space_T.h. |
|
|||||
|
Name of the file used as the backing store.
Definition at line 263 of file Local_Name_Space_T.h. |
|
|||||
|
Synchronization variable.
Definition at line 266 of file Local_Name_Space_T.h. |
|
|||||
|
Keep track of the options such as database name etc.
Definition at line 260 of file Local_Name_Space_T.h. Referenced by ACE_Local_Name_Space<, ACE_LOCK >::create_manager_i(). |
|
|||||
|
Pointer to the allocated map manager.
Definition at line 253 of file Local_Name_Space_T.h. Referenced by ACE_Local_Name_Space<, ACE_LOCK >::create_manager_i(), ACE_Local_Name_Space<, ACE_LOCK >::resolve_i(), ACE_Local_Name_Space<, ACE_LOCK >::shared_bind_i(), and ACE_Local_Name_Space<, ACE_LOCK >::unbind_i(). |
|
|||||
|
Scope of this naming context (e.g., PROC_LOCAL, NODE_LOCAL, or NET_LOCAL). Definition at line 257 of file Local_Name_Space_T.h. Referenced by ACE_Local_Name_Space<, ACE_LOCK >::open(). |
1.3.6