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


Public Types | |
| typedef ACE_Allocator_Adapter< ACE_Malloc< ACE_MEM_POOL_2, ACE_LOCK > > | ALLOCATOR |
Public Methods | |
| ACE_Local_Name_Space (void) | |
| "Do-nothing" constructor. More... | |
| 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) | |
| Destructor, do some cleanup :TBD: last dtor should "compress" file. More... | |
| 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). More... | |
| virtual int | rebind (const ACE_NS_WString &name, const ACE_NS_WString &value, const char *type="") |
| virtual int | unbind (const ACE_NS_WString &name) |
| Delete a name from a ACE_Local_Name_Space (Wide charcter strings Interface). More... | |
| virtual int | unbind_i (const ACE_NS_WString &name) |
| virtual int | resolve (const ACE_NS_WString &name, ACE_NS_WString &value, char *&type) |
| Get value and type of a given name binding (Wide chars). The caller is responsible for deleting type! More... | |
| 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) |
| Get a set of names matching a specified pattern (wchars). Matching means the names must begin with the pattern string. More... | |
| 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) |
| Get a set of values matching a specified pattern (wchars). Matching means the values must begin with the pattern string. More... | |
| 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) |
| Get a set of types matching a specified pattern (wchars). Matching means the types must begin with the pattern string. More... | |
| 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. More... | |
| virtual void | dump_i (void) const |
Private Methods | |
| int | remap (EXCEPTION_POINTERS *ep) |
| Remap the backing store. More... | |
| 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(). More... | |
| int | shared_bind_i (const ACE_NS_WString &name, const ACE_NS_WString &value, const char *type, int rebind) |
| int | create_manager (void) |
| Allocate the appropriate type of map manager that stores the key/value binding. More... | |
| int | create_manager_i (void) |
Private Attributes | |
| ALLOCATOR * | allocator_ |
| Pointer to the allocator. More... | |
| ACE_Name_Space_Map< ALLOCATOR > * | name_space_map_ |
| Pointer to the allocated map manager. More... | |
| ACE_Naming_Context::Context_Scope_Type | ns_scope_ |
| Scope of this naming context (e.g., PROC_LOCAL, NODE_LOCAL, or NET_LOCAL). More... | |
| ACE_Name_Options * | name_options_ |
| Keep track of the options such as database name etc. More... | |
| ACE_TCHAR | context_file_ [MAXPATHLEN+MAXNAMELEN] |
| Name of the file used as the backing store. More... | |
| ACE_LOCK * | lock_ |
| Synchronization variable. More... | |
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 105 of file Local_Name_Space_T.h.
|
|||||
|
Definition at line 216 of file Local_Name_Space_T.h. |
|
||||||||||
|
"Do-nothing" constructor.
Definition at line 336 of file Local_Name_Space_T.cpp. References ACE_TRACE.
00337 : allocator_ (0), 00338 name_space_map_ (0), 00339 name_options_ (0) 00340 { 00341 ACE_TRACE ("ACE_Local_Name_Space::ACE_Local_Name_Space"); 00342 } |
|
||||||||||||||||
|
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 345 of file Local_Name_Space_T.cpp. References ACE_ERROR, ACE_LIB_TEXT, ACE_TRACE, ACE_Naming_Context::Context_Scope_Type, LM_ERROR, and open.
00347 : name_options_ (name_options) 00348 { 00349 ACE_TRACE ("ACE_Local_Name_Space::ACE_Local_Name_Space"); 00350 if (this->open (scope_in) == -1) 00351 ACE_ERROR ((LM_ERROR, ACE_LIB_TEXT ("%p\n"), ACE_LIB_TEXT ("ACE_Local_Name_Space::ACE_Local_Name_Space"))); 00352 } |
|
||||||||||
|
Destructor, do some cleanup :TBD: last dtor should "compress" file.
Definition at line 355 of file Local_Name_Space_T.cpp. References ACE_TRACE, allocator_, and lock_.
00356 {
00357 ACE_TRACE ("ACE_Local_Name_Space::~ACE_Local_Name_Space");
00358
00359 // Remove the map.
00360 delete this->allocator_;
00361 delete this->lock_;
00362 }
|
|
||||||||||||||||||||
|
Bind a new name to a naming context (Wide character strings).
Implements ACE_Name_Space. Definition at line 245 of file Local_Name_Space_T.cpp. References ACE_TRACE, ACE_WRITE_GUARD_RETURN, and shared_bind.
00248 {
00249 ACE_TRACE ("ACE_Local_Name_Space::bind");
00250 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00251
00252 return this->shared_bind (name, value, type, 0);
00253 }
|
|
||||||||||
|
Allocate the appropriate type of map manager that stores the key/value binding.
Definition at line 365 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, and create_manager_i. Referenced by open.
00366 {
00367 // Note that we *must* use structured exception handling here
00368 // because (1) we may need to commit virtual memory pages and (2)
00369 // C++ exception handling doesn't support resumption.
00370 int result = 0;
00371 ACE_SEH_TRY
00372 {
00373 result = this->create_manager_i ();
00374 }
00375 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00376 {
00377 }
00378 return result;
00379 }
|
|
||||||||||
|
Definition at line 383 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, allocator_, ACE_Allocator_Adapter< ACE_Malloc< ACE_MEM_POOL_2, ACE_LOCK > >::bind, ACE_Name_Options::database, ACE::debug, F_OK, ACE_Allocator_Adapter< ACE_Malloc< ACE_MEM_POOL_2, ACE_LOCK > >::find, LM_DEBUG, LM_ERROR, ACE_Allocator_Adapter< ACE_Malloc< ACE_MEM_POOL_2, ACE_LOCK > >::malloc, MAXNAMELEN, MAXPATHLEN, name_options_, name_space_map_, ACE_Name_Options::namespace_dir, ACE_OS_String::strcat, ACE_OS_String::strcpy, ACE_OS_String::strlen, ACE_OS_String::strncat, and ACE_OS_String::strsncpy. Referenced by create_manager.
00384 {
00385 ACE_TRACE ("ACE_Local_Name_Space::create_manager_i");
00386 // Get directory name
00387 const ACE_TCHAR *dir = this->name_options_->namespace_dir ();
00388 const ACE_TCHAR *database = this->name_options_->database ();
00389
00390 // Use process name as the file name.
00391 size_t len = ACE_OS::strlen (dir);
00392 len += ACE_OS::strlen (ACE_DIRECTORY_SEPARATOR_STR);
00393 len += ACE_OS::strlen (database) + 1;
00394
00395 if (len >= MAXNAMELEN + MAXPATHLEN)
00396 {
00397 errno = ENAMETOOLONG;
00398 return -1;
00399 }
00400
00401 ACE_OS::strcpy (this->context_file_, dir);
00402 ACE_OS::strcat (this->context_file_, ACE_DIRECTORY_SEPARATOR_STR);
00403 ACE_OS::strcat (this->context_file_, database);
00404
00405 #if !defined (CHORUS)
00406 ACE_MEM_POOL_OPTIONS options (this->name_options_->base_address ());
00407 #else
00408 // Use base address == 0, don't use a fixed address.
00409 ACE_MEM_POOL_OPTIONS options (0,
00410 0,
00411 0,
00412 ACE_CHORUS_LOCAL_NAME_SPACE_T_SIZE);
00413 #endif /* CHORUS */
00414
00415 ACE_TCHAR lock_name_for_local_name_space [MAXNAMELEN + MAXPATHLEN];
00416 ACE_TCHAR lock_name_for_backing_store [MAXPATHLEN + MAXNAMELEN];
00417 const ACE_TCHAR *postfix = database;
00418
00419 size_t length = 0;
00420 length = sizeof lock_name_for_local_name_space / sizeof (ACE_TCHAR);
00421 ACE_OS::strsncpy (lock_name_for_local_name_space,
00422 dir,
00423 length);
00424
00425 ACE_OS::strncat (lock_name_for_local_name_space,
00426 ACE_DIRECTORY_SEPARATOR_STR,
00427 length - ACE_OS::strlen (lock_name_for_local_name_space));
00428 ACE_OS::strncat (lock_name_for_local_name_space,
00429 ACE_LIB_TEXT ("name_space_"),
00430 length - ACE_OS::strlen (lock_name_for_local_name_space));
00431 ACE_OS::strncat (lock_name_for_local_name_space,
00432 postfix,
00433 length - ACE_OS::strlen (lock_name_for_local_name_space));
00434
00435 length = sizeof lock_name_for_backing_store / sizeof (ACE_TCHAR);
00436 ACE_OS::strsncpy (lock_name_for_backing_store,
00437 dir,
00438 length);
00439 ACE_OS::strncat (lock_name_for_backing_store,
00440 ACE_DIRECTORY_SEPARATOR_STR,
00441 length - ACE_OS::strlen (lock_name_for_backing_store));
00442 ACE_OS::strncat (lock_name_for_backing_store,
00443 ACE_LIB_TEXT ("backing_store_"),
00444 length - ACE_OS::strlen (lock_name_for_backing_store));
00445 ACE_OS::strncat (lock_name_for_backing_store,
00446 postfix,
00447 length - ACE_OS::strlen (ACE_LIB_TEXT ("backing_store_")));
00448
00449 // Create the allocator with the appropriate options.
00450 ACE_NEW_RETURN (this->allocator_,
00451 ALLOCATOR (this->context_file_,
00452 lock_name_for_backing_store,
00453 &options), -1);
00454
00455 if (ACE_LOG_MSG->op_status ())
00456 ACE_ERROR_RETURN ((LM_ERROR,
00457 ACE_LIB_TEXT ("Allocator::Allocator\n")),
00458 -1);
00459
00460 ACE_NEW_RETURN (this->lock_,
00461 ACE_LOCK (lock_name_for_local_name_space),
00462 -1);
00463
00464 #if !defined (ACE_LACKS_ACCESS)
00465 // Now check if the backing store has been created successfully
00466 if (ACE_OS::access (this->context_file_, F_OK) != 0)
00467 ACE_ERROR_RETURN ((LM_ERROR,
00468 ACE_LIB_TEXT ("create_manager\n")),
00469 -1);
00470 #endif /* ACE_LACKS_ACCESS */
00471
00472 void *ns_map = 0;
00473
00474 // This is the easy case since if we find the Name Server Map
00475 // Manager we know it's already initialized.
00476 if (this->allocator_->find (ACE_NAME_SERVER_MAP, ns_map) == 0)
00477 {
00478 this->name_space_map_ = (ACE_Name_Space_Map <ALLOCATOR> *) ns_map;
00479 if (ACE::debug ())
00480 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("name_space_map_ = %d, ns_map = %d\n"),
00481 this->name_space_map_, ns_map));
00482 }
00483
00484 // This is the hard part since we have to avoid potential race
00485 // conditions... We will use the double check here
00486 else
00487 {
00488 ACE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
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, ACE_LIB_TEXT ("name_space_map_ = %d, ns_map = %d\n"),
00497 this->name_space_map_, ns_map));
00498 }
00499 else
00500 {
00501 size_t map_size = sizeof *this->name_space_map_;
00502 ns_map = this->allocator_->malloc (map_size);
00503
00504 // Initialize the map into its memory location (e.g., shared memory).
00505 this->name_space_map_ =
00506 new (ns_map) ACE_Name_Space_Map <ALLOCATOR> (this->allocator_);
00507
00508 if (this->allocator_->bind (ACE_NAME_SERVER_MAP, ns_map) == -1)
00509 ACE_ERROR_RETURN ((LM_ERROR,
00510 ACE_LIB_TEXT ("create_manager\n")), -1);
00511 }
00512
00513 if (ACE::debug ())
00514 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("name_space_map_ = %d, ns_map = %d\n"),
00515 this->name_space_map_, ns_map));
00516 }
00517
00518 return 0;
00519 }
|
|
||||||||||
|
Dump the state of the object.
Implements ACE_Name_Space. Definition at line 906 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, dump_i, and remap.
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
00912 // This should really be a const cast
00913 ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK> *fake_this =
00914 (ACE_Local_Name_Space<ACE_MEM_POOL_2, ACE_LOCK> *) this;
00915 ACE_UNUSED_ARG (fake_this);
00916
00917 ACE_SEH_TRY
00918 {
00919 this->dump_i ();
00920 }
00921 ACE_SEH_EXCEPT (fake_this->remap (GetExceptionInformation ()))
00922 {
00923 }
00924 }
|
|
||||||||||
|
Definition at line 768 of file Local_Name_Space_T.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, ACE_TRACE, ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::advance, ACE_NS_String::char_rep, ACE_Hash_Map_Entry< ACE_NS_String, ACE_NS_Internal >::ext_id_, ACE_Hash_Map_Entry< ACE_NS_String, ACE_NS_Internal >::int_id_, LM_DEBUG, ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::next, ACE_NS_Internal::type, and ACE_NS_Internal::value. Referenced by dump.
00769 {
00770 ACE_TRACE ("ACE_Local_Name_Space::dump_i");
00771
00772 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00773
00774 MAP_ITERATOR map_iterator (*this->name_space_map_);
00775 MAP_ENTRY *map_entry;
00776
00777 for (map_entry = 0;
00778 map_iterator.next (map_entry) != 0;
00779 map_iterator.advance())
00780 {
00781 char *key = map_entry->ext_id_.char_rep ();
00782 char *value = map_entry->int_id_.value ().char_rep ();
00783 #if !defined (ACE_NLOGGING)
00784 const char *type = map_entry->int_id_.type ();
00785 #endif /* ! ACE_NLOGGING */
00786
00787 ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("key=%s\nvalue=%s\ntype=%s\n"),
00788 key, value, type));
00789 // We need to delete key and value since char_rep allocates memory for them
00790 delete [] key;
00791 delete [] value;
00792 }
00793
00794 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00795 }
|
|
||||||||||||||||
|
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 852 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, and ACE_SEH_TRY.
00854 {
00855 // Note that we *must* use structured exception handling here
00856 // because (1) we may need to commit virtual memory pages and (2)
00857 // C++ exception handling doesn't support resumption.
00858 int result = 0;
00859 ACE_SEH_TRY
00860 {
00861 result = this->list_name_entries_i (set, pattern);
00862 }
00863 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00864 {
00865 }
00866 return result;
00867 }
|
|
||||||||||||||||
|
||||||||||||||||
|
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 798 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, and list_names_i.
00800 {
00801 // Note that we *must* use structured exception handling here
00802 // because (1) we may need to commit virtual memory pages and (2)
00803 // C++ exception handling doesn't support resumption.
00804 int result = 0;
00805 ACE_SEH_TRY
00806 {
00807 result = this->list_names_i (set, pattern);
00808 }
00809 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00810 {
00811 }
00812 return result;
00813 }
|
|
||||||||||||||||
|
Definition at line 522 of file Local_Name_Space_T.cpp. References ACE_READ_GUARD_RETURN, ACE_TRACE, ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::advance, ACE_Hash_Map_Entry< ACE_NS_String, ACE_NS_Internal >::ext_id_, ACE_Unbounded_Set::insert, ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::next, and ACE_NS_String::strstr. Referenced by list_names.
00524 {
00525 ACE_TRACE ("ACE_Local_Name_Space::list_names_i");
00526 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00527
00528 MAP_ITERATOR map_iterator (*this->name_space_map_);
00529 MAP_ENTRY *map_entry;
00530
00531 int result = 1;
00532
00533 for (map_entry = 0;
00534 map_iterator.next (map_entry) != 0;
00535 map_iterator.advance())
00536 {
00537 if (map_entry->ext_id_.strstr (pattern) != -1)
00538 {
00539 ACE_NS_WString entry (map_entry->ext_id_ );
00540
00541 if (set.insert (entry) == -1)
00542 {
00543 result = -1;
00544 break;
00545 }
00546 else
00547 result = 0;
00548 }
00549 }
00550
00551 return result;
00552 }
|
|
||||||||||||||||
|
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 888 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, and list_type_entries_i.
00890 {
00891 // Note that we *must* use structured exception handling here
00892 // because (1) we may need to commit virtual memory pages and (2)
00893 // C++ exception handling doesn't support resumption.
00894 int result = 0;
00895 ACE_SEH_TRY
00896 {
00897 result = this->list_type_entries_i (set, pattern);
00898 }
00899 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00900 {
00901 }
00902 return result;
00903 }
|
|
||||||||||||||||
|
Definition at line 713 of file Local_Name_Space_T.cpp. References ACE_READ_GUARD_RETURN, ACE_TRACE, ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::advance, ACE_NS_WString::char_rep, ACE_OS::compile, ACE_Hash_Map_Entry< ACE_NS_String, ACE_NS_Internal >::ext_id_, ACE_OS_Memory::free, ACE_Unbounded_Set::insert, ACE_Hash_Map_Entry< ACE_NS_String, ACE_NS_Internal >::int_id_, ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::next, ACE_OS::step, ACE_OS_String::strcmp, ACE_OS_String::strdup, ACE_OS_String::strstr, ACE_NS_Internal::type, and ACE_NS_Internal::value. Referenced by list_type_entries.
00715 {
00716 ACE_TRACE ("ACE_Local_Name_Space::list_type_entries_i");
00717 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00718
00719 MAP_ITERATOR map_iterator (*this->name_space_map_);
00720 MAP_ENTRY *map_entry;
00721
00722 char *compiled_regexp = 0;
00723 // Note that char_rep() allocates memory so we need to delete it
00724 char *pattern_rep = pattern.char_rep ();
00725
00726 // Check for wildcard case first.
00727 if (ACE_OS::strcmp ("", pattern_rep) == 0)
00728 compiled_regexp = ACE_OS::strdup ("");
00729 else
00730 // Compile the regular expression (the 0's cause ACE_OS::compile to allocate space).
00731 #if defined (ACE_HAS_REGEX)
00732 compiled_regexp = ACE_OS::compile (pattern_rep, 0, 0);
00733 #else /* If we don't have regular expressions just the pattern directly. */
00734 compiled_regexp = pattern_rep;
00735 #endif /* ACE_HAS_REGEX */
00736
00737 for (map_entry = 0;
00738 map_iterator.next (map_entry) != 0;
00739 map_iterator.advance ())
00740 {
00741 // Get the type.
00742 const char *type = map_entry->int_id_.type ();
00743
00744 if (ACE_OS::strcmp ("", pattern_rep) == 0 // Everything matches the wildcard.
00745 #if defined (ACE_HAS_REGEX)
00746 || ACE_OS::step (type, compiled_regexp) != 0)
00747 #else /* If we don't have regular expressions just use strstr() for substring matching. */
00748 || ACE_OS::strstr (type, compiled_regexp) != 0)
00749 #endif /* ACE_HAS_REGEX */
00750 {
00751 ACE_Name_Binding entry (map_entry->ext_id_,
00752 map_entry->int_id_.value (),
00753 map_entry->int_id_.type ());
00754
00755 if (set.insert (entry) == -1)
00756 return -1;
00757 }
00758 }
00759 #if defined (ACE_HAS_REGEX)
00760 if (compiled_regexp)
00761 ACE_OS::free ((void *) compiled_regexp);
00762 #endif /* ACE_HAS_REGEX */
00763 delete [] pattern_rep; // delete pattern_rep;
00764 return 0;
00765 }
|
|
||||||||||||||||
|
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 834 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, and list_types_i.
00836 {
00837 // Note that we *must* use structured exception handling here
00838 // because (1) we may need to commit virtual memory pages and (2)
00839 // C++ exception handling doesn't support resumption.
00840 int result = 0;
00841 ACE_SEH_TRY
00842 {
00843 result = this->list_types_i (set, pattern);
00844 }
00845 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00846 {
00847 }
00848 return result;
00849 }
|
|
||||||||||||||||
|
Definition at line 588 of file Local_Name_Space_T.cpp. References ACE_ALLOCATOR_RETURN, ACE_READ_GUARD_RETURN, ACE_TRACE, ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::advance, ACE_NS_WString::char_rep, ACE_OS::compile, ACE_OS_Memory::free, ACE_Unbounded_Set::insert, ACE_Hash_Map_Entry< ACE_NS_String, ACE_NS_Internal >::int_id_, ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::next, ACE_OS::step, ACE_OS_String::strcmp, ACE_OS_String::strdup, ACE_OS_String::strstr, and ACE_NS_Internal::type. Referenced by list_types.
00590 {
00591 ACE_TRACE ("ACE_Local_Name_Space::list_types_i");
00592 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00593
00594 MAP_ITERATOR map_iterator (*this->name_space_map_);
00595 MAP_ENTRY *map_entry;
00596
00597 char *compiled_regexp = 0;
00598
00599 // Note that char_rep() allocates memory so we need to delete it
00600 char *pattern_rep = pattern.char_rep ();
00601
00602 // Check for wildcard case first.
00603 if (ACE_OS::strcmp ("", pattern_rep) == 0)
00604 ACE_ALLOCATOR_RETURN (compiled_regexp,
00605 ACE_OS::strdup (""),
00606 -1);
00607 else
00608 // Compile the regular expression (the 0's cause ACE_OS::compile
00609 // to allocate space).
00610 #if defined (ACE_HAS_REGEX)
00611 compiled_regexp = ACE_OS::compile (pattern_rep, 0, 0);
00612 #else
00613 // If we don't have regular expressions just use the pattern
00614 // directly.
00615 compiled_regexp = pattern_rep;
00616 #endif /* ACE_HAS_REGEX */
00617
00618 int result = 1;
00619
00620 for (map_entry = 0;
00621 map_iterator.next (map_entry) != 0;
00622 map_iterator.advance ())
00623 {
00624 // Get the type
00625 const char *type = map_entry->int_id_.type ();
00626
00627 // Everything matches the wildcard.
00628 if (ACE_OS::strcmp ("", pattern_rep) == 0
00629 #if defined (ACE_HAS_REGEX)
00630 || ACE_OS::step (type, compiled_regexp) != 0)
00631 #else
00632 // If we don't have regular expressions just use strstr() for
00633 // substring matching.
00634 || ACE_OS::strstr (type, compiled_regexp) != 0)
00635 #endif /* ACE_HAS_REGEX */
00636
00637 {
00638 ACE_NS_WString entry (type);
00639
00640 if (set.insert (entry) == -1)
00641 {
00642 result = -1;
00643 break;
00644 }
00645 else
00646 result = 0;
00647 }
00648 }
00649 #if defined (ACE_HAS_REGEX)
00650 if (compiled_regexp)
00651 ACE_OS::free ((void *) compiled_regexp);
00652 #endif /* ACE_HAS_REGEX */
00653 delete [] pattern_rep; // delete pattern_rep;
00654 return result;
00655 }
|
|
||||||||||||||||
|
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 870 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, and list_value_entries_i.
00872 {
00873 // Note that we *must* use structured exception handling here
00874 // because (1) we may need to commit virtual memory pages and (2)
00875 // C++ exception handling doesn't support resumption.
00876 int result = 0;
00877 ACE_SEH_TRY
00878 {
00879 result = this->list_value_entries_i (set, pattern);
00880 }
00881 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00882 {
00883 }
00884 return result;
00885 }
|
|
||||||||||||||||
|
||||||||||||||||
|
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 816 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, and list_values_i.
00818 {
00819 // Note that we *must* use structured exception handling here
00820 // because (1) we may need to commit virtual memory pages and (2)
00821 // C++ exception handling doesn't support resumption.
00822 int result = 0;
00823 ACE_SEH_TRY
00824 {
00825 result = this->list_values_i (set, pattern);
00826 }
00827 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00828 {
00829 }
00830 return result;
00831 }
|
|
||||||||||||||||
|
Definition at line 555 of file Local_Name_Space_T.cpp. References ACE_READ_GUARD_RETURN, ACE_TRACE, ACE_Hash_Map_Iterator_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::advance, ACE_Unbounded_Set::insert, ACE_Hash_Map_Entry< ACE_NS_String, ACE_NS_Internal >::int_id_, ACE_Hash_Map_Iterator_Base_Ex< EXT_ID, INT_ID, ACE_Hash< EXT_ID >, ACE_Equal_To< EXT_ID >, ACE_LOCK >::next, ACE_NS_String::strstr, and ACE_NS_Internal::value. Referenced by list_values.
00557 {
00558 ACE_TRACE ("ACE_Local_Name_Space::list_values_i");
00559 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00560
00561 MAP_ITERATOR map_iterator (*this->name_space_map_);
00562 MAP_ENTRY *map_entry;
00563
00564 int result = 1;
00565
00566 for (map_entry = 0;
00567 map_iterator.next (map_entry) != 0;
00568 map_iterator.advance ())
00569 {
00570 if (map_entry->int_id_.value ().strstr (pattern) != -1)
00571 {
00572 ACE_NS_WString entry (map_entry->int_id_.value ());
00573
00574 if (set.insert (entry) == -1)
00575 {
00576 result = -1;
00577 break;
00578 }
00579 else
00580 result = 0;
00581 }
00582 }
00583
00584 return result;
00585 }
|
|
||||||||||
|
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 327 of file Local_Name_Space_T.cpp. References ACE_TRACE, ACE_Naming_Context::Context_Scope_Type, create_manager, and ns_scope_. Referenced by ACE_Local_Name_Space.
00328 {
00329 ACE_TRACE ("ACE_Local_Name_Space::open");
00330 this->ns_scope_ = scope_in;
00331
00332 return this->create_manager ();
00333 }
|
|
||||||||||||||||||||
|
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 256 of file Local_Name_Space_T.cpp. References ACE_TRACE, ACE_WRITE_GUARD_RETURN, and shared_bind. Referenced by shared_bind, and shared_bind_i.
00259 {
00260 ACE_TRACE ("ACE_Local_Name_Space::rebind");
00261 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00262
00263 return this->shared_bind (name, value, type, 1);
00264 }
|
|
||||||||||
|
Remap the backing store.
Definition at line 81 of file Local_Name_Space_T.cpp. References ACE_TRACE, ACE_Allocator_Adapter< ACE_Malloc< ACE_MEM_POOL_2, ACE_LOCK > >::alloc, and allocator_. Referenced by dump.
00082 {
00083 ACE_TRACE ("ACE_Local_Name_Space::remap");
00084
00085 void *addr = (void *) ep->ExceptionRecord->ExceptionInformation[1];
00086
00087 // The following requires Memory Pool to have ::remap()
00088 // defined. Thus currently this will only work for
00089 // ACE_MMap_Memory_Pool.
00090 if (this->allocator_->alloc ().memory_pool ().remap (addr) == -1)
00091 // Kick it upstairs...
00092 return EXCEPTION_CONTINUE_SEARCH;
00093
00094 #if __X86__
00095 // This is 80x86-specific.
00096 ep->ContextRecord->Edi = (DWORD) addr;
00097 #elif __MIPS__
00098 ep->ContextRecord->IntA0 =
00099 ep->ContextRecord->IntV0 = (DWORD) addr;
00100 ep->ContextRecord->IntT5 = ep->ContextRecord->IntA0 + 3;
00101 #endif /* __X86__ */
00102 // Resume execution at the original point of "failure."
00103 return EXCEPTION_CONTINUE_EXECUTION;
00104 }
|
|
||||||||||||||||||||
|
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 267 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, and resolve_i.
00270 {
00271 // Note that we *must* use structured exception handling here
00272 // because (1) we may need to commit virtual memory pages and (2)
00273 // C++ exception handling doesn't support resumption.
00274 int result = 0;
00275 ACE_SEH_TRY
00276 {
00277 result = this->resolve_i (name, value, type);
00278 }
00279 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00280 {
00281 }
00282 return result;
00283 }
|
|
||||||||||||||||||||
|
Definition at line 287 of file Local_Name_Space_T.cpp. References ACE_NEW_RETURN, ACE_READ_GUARD_RETURN, ACE_TRACE, name_space_map_, ACE_OS_String::strlen, ACE_OS_String::strsncpy, ACE_NS_Internal::type, and ACE_NS_Internal::value. Referenced by resolve.
00290 {
00291 ACE_TRACE ("ACE_Local_Name_Space::resolve_i");
00292 ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00293
00294 ACE_NS_String ns_name (name);
00295 ACE_NS_Internal ns_internal;
00296 ACE_NS_String nbc_string; // Note the classy variable name! :)
00297
00298 if (this->name_space_map_->find (ns_name,
00299 ns_internal,
00300 this->allocator_) != 0)
00301 return -1;
00302
00303 // Calls conversion operator and then calls the ACE_NS_WString
00304 // assignment operator to get a fresh copy. (*#*(@#&!*@!!*@&( HP
00305 // compiler causes us to add an extra copy explicitly !! :)
00306 nbc_string = ns_internal.value ();
00307 value = nbc_string;
00308
00309 // Gets type and then the actual reprsentation which is a
00310 // ACE_USHORT16
00311 const char *temp = ns_internal.type ();
00312
00313 size_t len = ACE_OS::strlen (ns_internal.type ());
00314 // Makes a copy here. Caller needs to call delete to free up
00315 // memory.
00316 char *new_type;
00317 ACE_NEW_RETURN (new_type,
00318 char [len + 1],
00319 -1);
00320
00321 ACE_OS::strsncpy (new_type, temp, len + 1);
00322 type = new_type;
00323 return 0;
00324 }
|
|
||||||||||||||||||||||||
|
Factor out code from bind() and rebind().
Definition at line 108 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, rebind, and shared_bind_i. Referenced by bind, and rebind.
00112 {
00113 // Note that we *must* use structured exception handling here
00114 // because (1) we may need to commit virtual memory pages and (2)
00115 // C++ exception handling doesn't support resumption.
00116 int result = 0;
00117 ACE_SEH_TRY
00118 {
00119 result = this->shared_bind_i (name, value, type, rebind);
00120 }
00121 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00122 {
00123 }
00124 return result;
00125 }
|
|
||||||||||||||||||||||||
|
Definition at line 128 of file Local_Name_Space_T.cpp. References ACE_TRACE, ACE_USHORT16, allocator_, ACE_Allocator_Adapter< ACE_Malloc< ACE_MEM_POOL_2, ACE_LOCK > >::free, ACE_Auto_Basic_Array_Ptr::get, ACE_String_Base< ACE_WSTRING_TYPE >::length, ACE_Allocator_Adapter< ACE_Malloc< ACE_MEM_POOL_2, ACE_LOCK > >::malloc, name_space_map_, rebind, ACE_OS_String::strcpy, ACE_OS_String::strlen, ACE_Allocator_Adapter< ACE_Malloc< ACE_MEM_POOL_2, ACE_LOCK > >::sync, ACE_NS_WString::ushort_rep, and ACE_NS_Internal::value. Referenced by shared_bind.
00132 {
00133
00134 ACE_TRACE ("ACE_Local_Name_Space::shared_bind_i");
00135 size_t name_len = (name.length () + 1) * sizeof (ACE_USHORT16);
00136 size_t value_len = (value.length () + 1) * sizeof (ACE_USHORT16);
00137 size_t type_len = ACE_OS::strlen (type) + 1;
00138 size_t total_len = name_len + value_len + type_len;
00139 char *ptr = (char *) this->allocator_->malloc (total_len);
00140
00141 if (ptr == 0)
00142 return -1;
00143 else
00144 {
00145 // Note that the value_rep *must* come first to make sure we can
00146 // retrieve this pointer later on in unbind().
00147 ACE_USHORT16 *value_rep = (ACE_USHORT16 *) (ptr);
00148 ACE_USHORT16 *name_rep = (ACE_USHORT16 *) (ptr + value_len);
00149 char *new_type = (char *) (ptr + value_len + name_len);
00150
00151 ACE_Auto_Basic_Array_Ptr<ACE_USHORT16> name_urep (name.ushort_rep ());
00152 ACE_Auto_Basic_Array_Ptr<ACE_USHORT16> value_urep (value.ushort_rep ());
00153 ACE_NS_String new_name (name_rep, name_urep.get (), name_len);
00154 ACE_NS_String new_value (value_rep, value_urep.get (), value_len);
00155
00156 ACE_OS::strcpy (new_type, type);
00157 ACE_NS_Internal new_internal (new_value, new_type);
00158 int result = -1;
00159
00160 if (rebind == 0)
00161 {
00162 // Do a normal bind. This will fail if there's already an
00163 // <new_internal> with the same name.
00164 result = this->name_space_map_->bind (new_name, new_internal, this->allocator_);
00165
00166 if (result == 1)
00167 {
00168 // Entry already existed so bind failed. Free our dynamically allocated memory.
00169 this->allocator_->free ((void *) ptr);
00170 return result;
00171 }
00172 }
00173 else
00174 {
00175 // Do a rebind. If there's already any entry, this will return the existing
00176 // <new_name> and <new_internal> and overwrite the existing name binding.
00177 ACE_NS_String old_name;
00178 ACE_NS_Internal old_internal;
00179
00180 result = this->name_space_map_->rebind (new_name, new_internal,
00181 old_name, old_internal,
00182 this->allocator_);
00183 if (result == 1)
00184 {
00185 // Free up the memory we allocated in shared_bind(). Note that this
00186 // assumes that the "value" pointer comes first and that the value,
00187 // name, and type are contiguously allocated (see above for details)
00188 this->allocator_->free ((void *) (old_internal.value ()).fast_rep ());
00189 }
00190 }
00191
00192 if (result == -1)
00193 // Free our dynamically allocated memory.
00194 this->allocator_->free ((void *) ptr);
00195 else
00196 // If bind() or rebind() succeed, they will automatically sync
00197 // up the map manager entry. However, we must sync up our
00198 // name/value memory.
00199 this->allocator_->sync (ptr, total_len);
00200
00201 return result;
00202 }
00203 }
|
|
||||||||||
|
Delete a name from a ACE_Local_Name_Space (Wide charcter strings Interface).
Implements ACE_Name_Space. Definition at line 206 of file Local_Name_Space_T.cpp. References ACE_SEH_EXCEPT, ACE_SEH_TRY, and unbind_i.
00207 {
00208 // Note that we *must* use structured exception handling here
00209 // because (1) we may need to commit virtual memory pages and (2)
00210 // C++ exception handling doesn't support resumption.
00211 int result = 0;
00212 ACE_SEH_TRY
00213 {
00214 result = this->unbind_i (name);
00215 }
00216 ACE_SEH_EXCEPT (this->remap (GetExceptionInformation ()))
00217 {
00218 }
00219 return result;
00220
00221 }
|
|
||||||||||
|
Definition at line 224 of file Local_Name_Space_T.cpp. References ACE_TRACE, ACE_WRITE_GUARD_RETURN, allocator_, ACE_Allocator_Adapter< ACE_Malloc< ACE_MEM_POOL_2, ACE_LOCK > >::free, name_space_map_, and ACE_NS_Internal::value. Referenced by unbind.
00225 {
00226 ACE_TRACE ("ACE_Local_Name_Space::unbind_i");
00227
00228 ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, *this->lock_, -1);
00229 ACE_NS_String ns_name (name);
00230 ACE_NS_Internal ns_internal;
00231 if (this->name_space_map_->unbind (ns_name,
00232 ns_internal,
00233 this->allocator_) != 0)
00234 return -1;
00235
00236 // Free up the memory we allocated in shared_bind(). Note that this
00237 // assumes that the "value" pointer comes first and that the value,
00238 // name and type are contiguously allocated (see shared_bind() for
00239 // details)
00240 this->allocator_->free ((void *) (ns_internal.value ()).fast_rep ());
00241 return 0;
00242 }
|
|
|||||
|
Pointer to the allocator.
Definition at line 238 of file Local_Name_Space_T.h. Referenced by create_manager_i, remap, shared_bind_i, unbind_i, and ~ACE_Local_Name_Space. |
|
|||||
|
Name of the file used as the backing store.
Definition at line 251 of file Local_Name_Space_T.h. |
|
|||||
|
Synchronization variable.
Definition at line 254 of file Local_Name_Space_T.h. Referenced by ~ACE_Local_Name_Space. |
|
|||||
|
Keep track of the options such as database name etc.
Definition at line 248 of file Local_Name_Space_T.h. Referenced by create_manager_i. |
|
|||||
|
Pointer to the allocated map manager.
Definition at line 241 of file Local_Name_Space_T.h. Referenced by create_manager_i, resolve_i, shared_bind_i, and unbind_i. |
|
|||||
|
Scope of this naming context (e.g., PROC_LOCAL, NODE_LOCAL, or NET_LOCAL).
Definition at line 245 of file Local_Name_Space_T.h. Referenced by open. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002