#include <Registry.h>
Collaboration diagram for ACE_Registry::Naming_Context:

Public Types | |
| enum | { MAX_OBJECT_NAME_SIZE = BUFSIZ, MAX_CONTEXT_NAME_SIZE = MAXPATHLEN + 1 } |
Public Member Functions | |
| Naming_Context (void) | |
| Empty constructor: keys will be NULL. | |
| Naming_Context (const HKEY &key) | |
| Constructor: key_ will be set to . | |
| ~Naming_Context (void) | |
| Destructor will call <Naming_Context::close>. | |
| int | bind_new (const Name &name, const Object &object) |
| int | bind_new (const ACE_TString &name, const Object &object) |
| int | bind (const Name &name, const Object &object) |
| int | bind (const ACE_TString &name, const Object &object) |
| int | rebind (const Name &name, const Object &object) |
| int | rebind (const ACE_TString &name, const Object &object) |
| Update with in context. | |
| int | resolve (const Name &name, Object &object) |
| int | resolve (const ACE_TString &name, Object &object) |
| Find with in context. | |
| int | unbind (const Name &name) |
| int | unbind (const ACE_TString &name) |
| Delete object with in context. | |
| int | new_context (Naming_Context &naming_context) |
Create new naming_context. | |
| int | bind_new_context (const Name &name, Naming_Context &naming_context, u_long persistence=REG_OPTION_NON_VOLATILE, u_long security_access=KEY_ALL_ACCESS, LPSECURITY_ATTRIBUTES security_attributes=0) |
| int | bind_new_context (const ACE_TString &name, Naming_Context &naming_context, u_long persistence=REG_OPTION_NON_VOLATILE, u_long security_access=KEY_ALL_ACCESS, LPSECURITY_ATTRIBUTES security_attributes=0) |
| int | bind_context (const Name &name, Naming_Context &naming_context, u_long persistence=REG_OPTION_NON_VOLATILE, u_long security_access=KEY_ALL_ACCESS, LPSECURITY_ATTRIBUTES security_attributes=0) |
| int | bind_context (const ACE_TString &name, Naming_Context &naming_context, u_long persistence=REG_OPTION_NON_VOLATILE, u_long security_access=KEY_ALL_ACCESS, LPSECURITY_ATTRIBUTES security_attributes=0) |
| int | rebind_context (const Name &name, Naming_Context &naming_context) |
| int | rebind_context (const ACE_TString &name, Naming_Context &naming_context) |
| Rename to . | |
| int | resolve_context (const Name &name, Naming_Context &naming_context, u_long security_access=KEY_ALL_ACCESS) |
| int | resolve_context (const ACE_TString &name, Naming_Context &naming_context, u_long security_access=KEY_ALL_ACCESS) |
| Find with in context. | |
| int | unbind_context (const Name &name) |
| int | unbind_context (const ACE_TString &name) |
| Remove naming_context with from context. | |
| int | destroy (void) |
| Same as with as naming_context. | |
| int | list (u_long how_many, Binding_List &list, Binding_Iterator &iterator) |
| int | list (Binding_List &list) |
| int | flush (void) |
| Sync content of context to disk. | |
| int | close (void) |
| HKEY | key (void) |
| Get key. | |
| HKEY | parent (void) |
| Get parent. | |
| void | name (Name &name) |
| void | name (ACE_TString &name) |
| Set name (String version). | |
| ACE_TString | name (void) |
| Get name (String version). | |
Protected Member Functions | |
| void | key (HKEY key) |
| Set key. | |
| void | parent (HKEY parent) |
| Set parent. | |
| void | name (const Name &name) |
| void | name (const ACE_TString &name) |
Private Member Functions | |
| Naming_Context (const Naming_Context &rhs) | |
| Disallow copy constructors. | |
| const Naming_Context & | operator= (const Naming_Context &rhs) |
| Disallow assignment. | |
Private Attributes | |
| HKEY | key_ |
| Key for self. | |
| HKEY | parent_key_ |
| Key for parent. | |
| ACE_TString | name_ |
| Name of self. | |
Friends | |
| class | ACE_Predefined_Naming_Contexts |
| Friend factory. | |
Think about a context as being similar to a directory in a file system.
Definition at line 178 of file Registry.h.
|
|
Definition at line 184 of file Registry.h.
00184 {
00185 /// Max sizes of names
00186 /// (Not too sure about this value)
00187 MAX_OBJECT_NAME_SIZE = BUFSIZ,
00188
00189 /// Max size of context name
00190 MAX_CONTEXT_NAME_SIZE = MAXPATHLEN + 1
00191 };
|
|
|
Empty constructor: keys will be NULL.
Definition at line 177 of file Registry.cpp.
00178 : key_ ((HKEY) 0), 00179 parent_key_ ((HKEY) 0), 00180 name_ () 00181 { 00182 } |
|
|
Constructor: key_ will be set to .
Definition at line 186 of file Registry.cpp.
00187 : key_ (key), 00188 parent_key_ ((HKEY) 0), 00189 name_ () 00190 { 00191 } |
|
|
Destructor will call <Naming_Context::close>.
Definition at line 216 of file Registry.cpp. References close().
00217 {
00218 this->close ();
00219 }
|
|
|
Disallow copy constructors.
Definition at line 194 of file Registry.cpp.
00195 : key_ (rhs.key_), 00196 parent_key_ (rhs.parent_key_), 00197 name_ (rhs.name_) 00198 { 00199 // This is incorrect. 00200 // Rather than copying key, we should call ::DuplicateHandle() 00201 // But since this is private (and not used), I don't care much 00202 } |
|
||||||||||||
|
Insert or update with into context This will not fail if already exists (String version) Definition at line 264 of file Registry.cpp. References ACE_REGISTRY_CALL_RETURN, ACE_TString, ACE_String_Base< CHAR >::c_str(), ACE_Registry::Object::data(), ACE_Registry::Object::size(), and ACE_Registry::Object::type().
00266 {
00267 long result = ACE_TEXT_RegSetValueEx (this->key_,
00268 name.c_str (),
00269 0,
00270 object.type (),
00271 (const BYTE *) object.data (),
00272 object.size ());
00273 ACE_REGISTRY_CALL_RETURN (result);
00274 }
|
|
||||||||||||
|
Insert or update object with name into Definition at line 254 of file Registry.cpp. References ACE_Registry::make_string(), and ACE_Registry::Name. Referenced by ACE_Registry_Name_Space::bind(), bind_new(), and rebind().
00256 {
00257 return this->bind (ACE_Registry::make_string (name), object);
00258 }
|
|
||||||||||||||||||||||||
|
Insert or update with relative to context This will not fail if already exists Definition at line 458 of file Registry.cpp. References ACE_REGISTRY_CALL_RETURN, ACE_TString, ACE_String_Base< CHAR >::c_str(), key_, name(), and parent().
00463 {
00464 u_long reason;
00465
00466 long result = ACE_TEXT_RegCreateKeyEx (this->key_,
00467 name.c_str (),
00468 0,
00469 0,
00470 persistence,
00471 security_access,
00472 security_attributes,
00473 &naming_context.key_,
00474 &reason);
00475 if (result == ERROR_SUCCESS)
00476 {
00477 // Set the correct parent
00478 naming_context.parent (this->key_);
00479 // Set the correct name
00480 naming_context.name (name);
00481 }
00482
00483 ACE_REGISTRY_CALL_RETURN (result);
00484 }
|
|
||||||||||||||||||||||||
|
Insert or update with relative to context This will not fail if already exists (Name version) Definition at line 441 of file Registry.cpp. References ACE_Registry::make_string(), and ACE_Registry::Name. Referenced by ACE_Registry_Name_Space::open().
00446 {
00447 return this->bind_context (ACE_Registry::make_string (name),
00448 naming_context,
00449 persistence,
00450 security_access,
00451 security_attributes);
00452 }
|
|
||||||||||||
|
Insert object with name into Definition at line 235 of file Registry.cpp. References ACE_TString, bind(), and resolve().
|
|
||||||||||||
|
Insert object with name into Definition at line 225 of file Registry.cpp. References ACE_Registry::make_string(), and ACE_Registry::Name.
00227 {
00228 return this->bind_new (ACE_Registry::make_string (name), object);
00229 }
|
|
||||||||||||||||||||||||
|
Insert with relative to context This will fail if already exists Definition at line 393 of file Registry.cpp. References ACE_REGISTRY_CALL_RETURN, ACE_TString, ACE_String_Base< CHAR >::c_str(), key_, name(), and parent().
00398 {
00399 u_long reason;
00400
00401 long result = ACE_TEXT_RegCreateKeyEx (this->key_,
00402 name.c_str (),
00403 0,
00404 0,
00405 persistence,
00406 security_access,
00407 security_attributes,
00408 &naming_context.key_,
00409 &reason);
00410 if (result == ERROR_SUCCESS)
00411 // If create succeeds
00412 {
00413 if (reason == REG_CREATED_NEW_KEY)
00414 // If new key: success
00415 {
00416 // Set the correct parent
00417 naming_context.parent (this->key_);
00418 // Set the correct name
00419 naming_context.name (name);
00420 }
00421 else
00422 // reason == REG_OPENED_EXISTING_KEY
00423 // Failed to make new key
00424 {
00425 // reset result to failure
00426 result = -1;
00427 // Close the key first
00428 ::RegCloseKey (naming_context.key_);
00429 // Reset key
00430 naming_context.key_ = (HKEY) 0;
00431 }
00432 }
00433
00434 ACE_REGISTRY_CALL_RETURN (result);
00435 }
|
|
||||||||||||||||||||||||
|
Insert with relative to context This will fail if already exists (Name version) Definition at line 376 of file Registry.cpp. References ACE_Registry::make_string(), and ACE_Registry::Name. Referenced by rebind_context().
00381 {
00382 return this->bind_new_context (ACE_Registry::make_string (name),
00383 naming_context,
00384 persistence,
00385 security_access,
00386 security_attributes);
00387 }
|
|
|
Close the handle of the context
Definition at line 605 of file Registry.cpp. References ACE_REGISTRY_CALL_RETURN. Referenced by new_context(), and ~Naming_Context().
00606 {
00607 long result = this->key_ ? ::RegCloseKey (this->key_) : ERROR_SUCCESS;
00608 ACE_REGISTRY_CALL_RETURN (result);
00609 }
|
|
|
Same as with as naming_context.
Definition at line 584 of file Registry.cpp. References ACE_REGISTRY_CALL_RETURN.
00585 {
00586 // hopefully the parent_key_ is still open
00587 long result = ACE_TEXT_RegDeleteKey (this->parent_key_,
00588 this->name_.c_str ());
00589
00590 ACE_REGISTRY_CALL_RETURN (result);
00591 }
|
|
|
Sync content of context to disk.
Definition at line 596 of file Registry.cpp. References ACE_REGISTRY_CALL_RETURN.
00597 {
00598 long result = ::RegFlushKey (this->key_);
00599 ACE_REGISTRY_CALL_RETURN (result);
00600 }
|
|
|
Set key.
Definition at line 677 of file Registry.cpp.
00678 {
00679 this->key_ = key;
00680 }
|
|
|
Get key.
Definition at line 685 of file Registry.cpp.
00686 {
00687 return this->key_;
00688 }
|
|
|
listing function: iterator creator This gives back a listing of all entries in context. Definition at line 785 of file Registry.cpp. References ACE_Registry::Binding_List, ACE_Registry::Binding_Iterator::current_enumeration(), ACE_Unbounded_Set< T >::insert(), ACE_Registry::Binding_Iterator::naming_context(), ACE_Registry::Binding_Iterator::next_one(), and ACE_Registry::Binding_Iterator::object_iteration_.
00786 {
00787 // Empty list
00788 static const ACE_Registry::Binding_List empty_list;
00789 // Make sure that the list is empty
00790 list = empty_list;
00791
00792 // Create an iterator
00793 ACE_Registry::Binding_Iterator iterator;
00794
00795 // Make sure that the iterator uses <this> naming context
00796 iterator.naming_context (*this);
00797
00798 // Start iterations from the objects
00799 iterator.current_enumeration (iterator.object_iteration_);
00800
00801 long result = 0;
00802 while (1)
00803 {
00804 ACE_Registry::Binding binding;
00805 result = iterator.next_one (binding);
00806 if (result == 0)
00807 list.insert (binding);
00808 else
00809 break;
00810 }
00811 return 0;
00812 }
|
|
||||||||||||||||
|
listing function: iterator creator This is useful when there are many objects and contexts in context and you only want to look at a few entries at a time Definition at line 757 of file Registry.cpp. References ACE_Registry::Binding_List, ACE_Registry::Binding_Iterator::current_enumeration(), ACE_Registry::Binding_Iterator::naming_context(), ACE_Registry::Binding_Iterator::next_n(), ACE_Registry::Binding_Iterator::object_iteration_, and ACE_Registry::Binding_Iterator::reset(). Referenced by ACE_Registry_Name_Space::list_name_entries().
00760 {
00761 // Empty list
00762 static const ACE_Registry::Binding_List empty_list;
00763 // Make sure that the list is empty
00764 list = empty_list;
00765
00766 // Correctly initalize the iterator
00767 iter.reset ();
00768
00769 // Make sure that the iterator uses <this> naming context
00770 iter.naming_context (*this);
00771
00772 // Start iterations from the objects
00773 iter.current_enumeration (iter.object_iteration_);
00774
00775 // Get the next <how_many> values
00776 long result = iter.next_n (how_many,
00777 list);
00778 return result;
00779 }
|
|
|
Set name (String version) Definition at line 728 of file Registry.cpp. References ACE_TString.
00729 {
00730 this->name_ = name;
00731 }
|
|
|
Set name (Name version) Definition at line 710 of file Registry.cpp. References ACE_Registry::make_string(), and ACE_Registry::Name.
00711 {
00712 this->name_ = ACE_Registry::make_string (name);
00713 }
|
|
|
Get name (String version).
Definition at line 737 of file Registry.cpp.
00738 {
00739 return this->name_;
00740 }
|
|
|
Set name (String version).
Definition at line 746 of file Registry.cpp. References ACE_TString.
00747 {
00748 name = this->name_;
00749 }
|
|
|
Get name (Name version) Definition at line 719 of file Registry.cpp. References ACE_Registry::make_name(), and ACE_Registry::Name. Referenced by bind_context(), bind_new_context(), and resolve_context().
00720 {
00721 name = ACE_Registry::make_name (this->name_);
00722 }
|
|
|
Create new
Definition at line 366 of file Registry.cpp. References close().
00367 {
00368 // Make sure that we reset the state and close keys
00369 return naming_context.close ();
00370 }
|
|
|
Disallow assignment.
Definition at line 206 of file Registry.cpp.
00207 {
00208 ACE_UNUSED_ARG(rhs);
00209
00210 // Not implemented
00211 return *this;
00212 }
|
|
|
Set parent.
Definition at line 693 of file Registry.cpp. References parent_key_.
00694 {
00695 this->parent_key_ = parent;
00696 }
|
|
|
Get parent.
Definition at line 701 of file Registry.cpp. References parent_key_. Referenced by bind_context(), bind_new_context(), and resolve_context().
00702 {
00703 return this->parent_key_;
00704 }
|
|
||||||||||||
|
Update with in context.
Definition at line 290 of file Registry.cpp. References ACE_TString, bind(), and resolve().
|
|
||||||||||||
|
Update with in context (Name version) Definition at line 280 of file Registry.cpp. References ACE_Registry::make_string(), and ACE_Registry::Name. Referenced by ACE_Registry_Name_Space::rebind().
00282 {
00283 return this->rebind (ACE_Registry::make_string (name), new_object);
00284 }
|
|
||||||||||||
|
Rename to .
Definition at line 501 of file Registry.cpp. References ACE_TString, bind_new_context(), resolve_context(), and unbind_context().
00503 {
00504 Naming_Context old_naming_context;
00505 // find the old one first
00506 long result = this->resolve_context (name,
00507 old_naming_context);
00508 if (result == 0)
00509 {
00510 // naming_context is found: delete entry
00511 result = this->unbind_context (name);
00512 if (result == 0)
00513 {
00514 // successful deletion; rebind
00515 // beware of race conditions here
00516 // (lets resolve this later)
00517 result = this->bind_new_context (name, new_naming_context);
00518 }
00519 }
00520 return result;
00521 }
|
|
||||||||||||
|
Rename to (Name version) Definition at line 490 of file Registry.cpp. References ACE_Registry::make_string(), and ACE_Registry::Name.
00492 {
00493 return this->rebind_context (ACE_Registry::make_string (name),
00494 new_naming_context);
00495 }
|
|
||||||||||||
|
Find with in context.
Definition at line 316 of file Registry.cpp. References ACE_REGISTRY_CALL_RETURN, ACE_TString, ACE_String_Base< CHAR >::c_str(), ACE_Registry::Object::data(), ACE_Registry::Object::size(), and ACE_Registry::Object::type().
00318 {
00319 // Get object state
00320 u_long type;
00321 void *data = object.data ();
00322 u_long size = object.size ();
00323
00324 long result = ACE_TEXT_RegQueryValueEx (this->key_,
00325 name.c_str (),
00326 0,
00327 &type,
00328 (BYTE *)data,
00329 &size);
00330 if (result == ERROR_SUCCESS)
00331 {
00332 // Reset object state
00333 // No need to set object.data()
00334 object.type (type);
00335 object.size (size);
00336 }
00337
00338 ACE_REGISTRY_CALL_RETURN (result);
00339 }
|
|
||||||||||||
|
Find with in context (Name version) Definition at line 306 of file Registry.cpp. References ACE_Registry::make_string(), and ACE_Registry::Name. Referenced by bind_new(), rebind(), and ACE_Registry_Name_Space::resolve().
00308 {
00309 return this->resolve (ACE_Registry::make_string (name), object);
00310 }
|
|
||||||||||||||||
|
Find with in context.
Definition at line 561 of file Registry.cpp. References ACE_REGISTRY_CALL_RETURN, ACE_TString, ACE_String_Base< CHAR >::c_str(), key_, name(), and parent().
00564 {
00565 long result = ACE_TEXT_RegOpenKeyEx (this->key_,
00566 name.c_str (),
00567 0,
00568 security_access,
00569 &naming_context.key_);
00570 if (result == ERROR_SUCCESS)
00571 {
00572 // set the correct parent
00573 naming_context.parent (this->key_);
00574 // set the correct name
00575 naming_context.name (name);
00576 }
00577
00578 ACE_REGISTRY_CALL_RETURN (result);
00579 }
|
|
||||||||||||||||
|
Find with in context (Name version) Definition at line 548 of file Registry.cpp. References ACE_Registry::make_string(), and ACE_Registry::Name. Referenced by rebind_context().
00551 {
00552 return this->resolve_context (ACE_Registry::make_string (name),
00553 naming_context,
00554 security_access);
00555 }
|
|
|
Delete object with in context.
Definition at line 354 of file Registry.cpp. References ACE_REGISTRY_CALL_RETURN, ACE_TString, and ACE_String_Base< CHAR >::c_str().
00355 {
00356 long result = ACE_TEXT_RegDeleteValue (this->key_,
00357 name.c_str ());
00358
00359 ACE_REGISTRY_CALL_RETURN (result);
00360 }
|
|
|
Delete object with in context (Name version) Definition at line 345 of file Registry.cpp. References ACE_Registry::make_string(), and ACE_Registry::Name. Referenced by ACE_Registry_Name_Space::unbind().
00346 {
00347 return this->unbind (ACE_Registry::make_string (name));
00348 }
|
|
|
Remove naming_context with from context.
Definition at line 536 of file Registry.cpp. References ACE_REGISTRY_CALL_RETURN, ACE_TString, and ACE_String_Base< CHAR >::c_str().
00537 {
00538 long result = ACE_TEXT_RegDeleteKey (this->key_,
00539 name.c_str ());
00540
00541 ACE_REGISTRY_CALL_RETURN (result);
00542 }
|
|
|
Remove naming_context with from context (Name version) Definition at line 527 of file Registry.cpp. References ACE_Registry::make_string(), and ACE_Registry::Name. Referenced by rebind_context().
00528 {
00529 return this->unbind_context (ACE_Registry::make_string (name));
00530 }
|
|
|
Friend factory.
Definition at line 182 of file Registry.h. |
|
|
Key for self.
Definition at line 401 of file Registry.h. Referenced by bind_context(), bind_new_context(), ACE_Predefined_Naming_Contexts::connect(), and resolve_context(). |
|
|
Name of self.
Definition at line 407 of file Registry.h. |
|
|
Key for parent.
Definition at line 404 of file Registry.h. Referenced by parent(). |
1.3.6