diff options
author | alex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-02-23 17:59:44 +0000 |
---|---|---|
committer | alex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-02-23 17:59:44 +0000 |
commit | 07cbe861573d080acca1afe66c7d64e4b8d0d2d1 (patch) | |
tree | 267cb330cdb0fd3b2c8456bf1482e74388baa8e9 | |
parent | 9147b6fc8ef11be6f3ab3db307ae071ddb63461e (diff) | |
download | ATCD-07cbe861573d080acca1afe66c7d64e4b8d0d2d1.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/ChangeLog-98c | 6 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Property/CosPropertyService_i.cpp | 113 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Property/CosPropertyService_i.h | 6 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Property/CosProperty_Hash.cpp | 25 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Property/CosProperty_Hash.h | 26 |
5 files changed, 114 insertions, 62 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c index 35eb84ca4a6..675f465fe58 100644 --- a/TAO/ChangeLog-98c +++ b/TAO/ChangeLog-98c @@ -1,3 +1,9 @@ +Mon Feb 23 11:57:16 1998 Alexander Babu Arulanthu <alex@merengue.cs.wustl.edu> + + * orbsvcs/orbsvcs/Property/ : Changed the names EXT_ID and INT_ID + that I used for Hash_Table operations to less generic + CosProperty_Hash_Key and CosProperty_Hash_Value respectively. + Mon Feb 23 11:40:37 1998 David L. Levine <levine@cs.wustl.edu> * TAO_IDL/Makefile: added clean and realclean targets for diff --git a/TAO/orbsvcs/orbsvcs/Property/CosPropertyService_i.cpp b/TAO/orbsvcs/orbsvcs/Property/CosPropertyService_i.cpp index a5a92e5411c..b2c7c8c0192 100644 --- a/TAO/orbsvcs/orbsvcs/Property/CosPropertyService_i.cpp +++ b/TAO/orbsvcs/orbsvcs/Property/CosPropertyService_i.cpp @@ -94,6 +94,7 @@ TAO_PropertySet::TAO_PropertySet (void) this->hash_table_.total_size ())); } +// Destructor TAO_PropertySet::~TAO_PropertySet (void) { } @@ -106,14 +107,14 @@ TAO_PropertySet::define_property (const char *property_name, const CORBA::Any &property_value, CORBA::Environment &env) { - EXT_ID ext_id ((CosPropertyService::PropertyName) property_name); - INT_ID int_id (property_value); + CosProperty_Hash_Key CosProperty_Hash_Key ((CosPropertyService::PropertyName) property_name); + CosProperty_Hash_Value CosProperty_Hash_Value (property_value); ACE_DEBUG ((LM_DEBUG, "define_property : property_name %s \n", property_name)); - int ret = this->hash_table_.bind (ext_id, int_id); + int ret = this->hash_table_.bind (CosProperty_Hash_Key, CosProperty_Hash_Value); if (ret == 0) ACE_DEBUG ((LM_DEBUG, @@ -121,10 +122,18 @@ TAO_PropertySet::define_property (const char *property_name, ret)); } +// Defining a sequence of properties ( Need to check for overwriting, +// duplicate names, void names etc void TAO_PropertySet::define_properties (const CosPropertyService::Properties &nproperties, CORBA::Environment &env) { + for (int pi = 0; pi < nproperties.length (); pi++) + { + this->define_property (nproperties [pi].property_name, + nproperties [pi].property_value.in (), + env); + } } // Returns the current number of properties associated with this @@ -135,12 +144,16 @@ TAO_PropertySet::get_number_of_properties ( CORBA::Environment &env) return this->hash_table_.current_size (); } -void +// Returns all of the property names currently defined in the +// PropertySet. If the PropertySet contains more than how_many +// property names, then the remaining property names are put into the +// PropertyNamesIterator. ( Interator not done) +void TAO_PropertySet::get_all_property_names (CORBA::ULong how_many, CosPropertyService::PropertyNames_out property_names, CosPropertyService::PropertyNamesIterator_out rest, CORBA::Environment &env) -{ +{ } // Returns the value of a property in the PropertySet. @@ -149,81 +162,113 @@ CORBA::Any * TAO_PropertySet::get_property_value (const char *property_name, CORBA::Environment &env) { - EXT_ID ext_id ((CosPropertyService::PropertyName) property_name); - INT_ID int_id; + CosProperty_Hash_Key CosProperty_Hash_Key ((CosPropertyService::PropertyName) property_name); + CosProperty_Hash_Value CosProperty_Hash_Value; - ACE_DEBUG ((LM_DEBUG, " get_prop_value: Input str : %s, ext_id.pname_.in () : %s \n", + ACE_DEBUG ((LM_DEBUG, " get_prop_value: Input str : %s, CosProperty_Hash_Key.pname_.in () : %s \n", property_name, - ext_id.pname_.in ())); + CosProperty_Hash_Key.pname_.in ())); - if (this->hash_table_.find (ext_id, int_id) != 0) + if (this->hash_table_.find (CosProperty_Hash_Key, CosProperty_Hash_Value) != 0) ACE_ERROR ((LM_ERROR, "Find failed: \n")); - - ACE_DEBUG ( (LM_DEBUG, "find fn over \n") ); - return &int_id.pvalue_; -} + ACE_DEBUG ( (LM_DEBUG, "find fn over \n") ); + return &CosProperty_Hash_Value.pvalue_; +} + +// Returns the values of the properties listed in property_names. When +// the boolean flag is true, the Properties parameter contains valid +// values for all requested property names. If false, then all +// properties with a value of type tk_void may have failed due to +// PropertyNotFound or InvalidPropertyName. +// A separate invocation of get_property for each such property name +// is necessary to determine the specific exception or to verify that +// tk_void is the correct any TypeCode for that property name. This +// approach was taken to avoid a complex, hard to program structure to +// carry mixed results. CORBA::Boolean TAO_PropertySet::get_properties (const CosPropertyService::PropertyNames &property_names, CosPropertyService::Properties_out nproperties, CORBA::Environment &env) { - CORBA::Boolean return_val = CORBA::B_FALSE; - - return return_val; + return CORBA::B_FALSE; + } - + +// Returns all of the property names currently defined in the +// PropertySet. If the PropertySet contains more than how_many +// property names, then the remaining property names are put into the PropertyNamesIterator. void TAO_PropertySet::get_all_properties (CORBA::ULong how_many, CosPropertyService::Properties_out nproperties, CosPropertyService::PropertiesIterator_out rest, CORBA::Environment &env) { + } // Deletes the specified property if it exists from a PropertySet. - void TAO_PropertySet::delete_property (const char *property_name, CORBA::Environment &env) { - EXT_ID ext_id ((CosPropertyService::PropertyName) property_name); + CosProperty_Hash_Key CosProperty_Hash_Key ((CosPropertyService::PropertyName) property_name); - ACE_DEBUG ((LM_DEBUG, "delete_property : property_name %s, ext_id.pname_.in() %s \n", property_name, - ext_id.pname_.in())); + ACE_DEBUG ((LM_DEBUG, "delete_property : property_name %s, CosProperty_Hash_Key.pname_.in() %s \n", property_name, + CosProperty_Hash_Key.pname_.in())); - // alex: Doing unbinding.. Not getting INT_ID back... Problem if dynamic allocation is done - if (this->hash_table_.unbind (ext_id) != 0) + // alex: Doing unbinding.. Not getting CosProperty_Hash_Value back... Problem if dynamic allocation is done + if (this->hash_table_.unbind (CosProperty_Hash_Key) != 0) ACE_ERROR ((LM_ERROR, "Unbind failed \n")); } - + +// Deletes the properties defined in the property_names +// parameter. This is a batch operation that returns the +// MultipleExceptions exception if any delete failed. void TAO_PropertySet::delete_properties (const CosPropertyService::PropertyNames &property_names, CORBA::Environment &env) { + for (size_t pi = 0; pi < property_names.length (); pi++) + delete_property (property_names[pi], env); } +// Delete all the properties in the current ProperySet : Do it one by +// one. close () and then open () CORBA::Boolean TAO_PropertySet::delete_all_properties (CORBA::Environment &env) { - CORBA::Boolean return_val = CORBA::B_FALSE; - - return return_val; + if (hash_table_.close () != 0) + { + ACE_DEBUG ((LM_DEBUG, "delete_all_properties:Error Closing the Hash_Map_Manager")); + return CORBA::B_FALSE; + } + if (hash_table_.open () != 0) + { + ACE_DEBUG ((LM_DEBUG, "Could not open Hash_Map_Manager")); + return CORBA::B_TRUE; + } + return CORBA::B_TRUE; } // Returns TRUE if the property is defined in the PropertySet. - CORBA::Boolean TAO_PropertySet::is_property_defined (const char *property_name, CORBA::Environment &env) { - EXT_ID ext_id ((CosPropertyService::PropertyName) property_name); - - if (this->hash_table_.find (ext_id) == 0) - return CORBA::B_TRUE; + CosProperty_Hash_Key CosProperty_Hash_Key ((CosPropertyService::PropertyName) property_name); + + if (this->hash_table_.find (CosProperty_Hash_Key) == 0) + { + ACE_DEBUG ((LM_DEBUG, "is_property_defined :find successfull \n")); + return CORBA::B_TRUE; + } else - return CORBA::B_FALSE; + { + ACE_DEBUG ((LM_DEBUG, "is_property_defined :find failed \n")); + return CORBA::B_FALSE; + } } TAO_PropertySetDef::TAO_PropertySetDef (void) diff --git a/TAO/orbsvcs/orbsvcs/Property/CosPropertyService_i.h b/TAO/orbsvcs/orbsvcs/Property/CosPropertyService_i.h index dcd5b3b041c..efcba41d55d 100644 --- a/TAO/orbsvcs/orbsvcs/Property/CosPropertyService_i.h +++ b/TAO/orbsvcs/orbsvcs/Property/CosPropertyService_i.h @@ -11,7 +11,7 @@ // CosPropertyService_i.h // // = AUTHOR -// Sumedh Mungee <sumedh@cs.wustl.edu> +// Alexander Babu Arulanthu <alex@cs.wustl.edu> // // ============================================================================ @@ -72,10 +72,10 @@ class TAO_ORBSVCS_Export TAO_PropertySet : public virtual POA_CosPropertyServic // Gives operations for defining, deleting, enumerating and // checking of properties. // - // = DESCRIPTION + // = DESCRIPTIONq // Uses a HashTable to manage the properties. public: - typedef ACE_Hash_Map_Manager<EXT_ID, INT_ID, ACE_Null_Mutex> CosProperty_Hash_Map; + typedef ACE_Hash_Map_Manager<CosProperty_Hash_Key, CosProperty_Hash_Value, ACE_Null_Mutex> CosProperty_Hash_Map; TAO_PropertySet (void); // Default constructor diff --git a/TAO/orbsvcs/orbsvcs/Property/CosProperty_Hash.cpp b/TAO/orbsvcs/orbsvcs/Property/CosProperty_Hash.cpp index b725e05a421..e42d214a215 100644 --- a/TAO/orbsvcs/orbsvcs/Property/CosProperty_Hash.cpp +++ b/TAO/orbsvcs/orbsvcs/Property/CosProperty_Hash.cpp @@ -15,43 +15,43 @@ #include "CosProperty_Hash.h" -EXT_ID::EXT_ID (void) +CosProperty_Hash_Key::CosProperty_Hash_Key (void) { } -EXT_ID::EXT_ID (const CosPropertyService::PropertyName &name) +CosProperty_Hash_Key::CosProperty_Hash_Key (const CosPropertyService::PropertyName &name) : pname_ (name) { } int -EXT_ID::operator == (const EXT_ID &ext_id) const +CosProperty_Hash_Key::operator == (const CosProperty_Hash_Key &CosProperty_Hash_Key) const { - ACE_DEBUG ((LM_DEBUG, "EXT_ID::operator == : %s == %s \n", - this->pname_.in (), ext_id.pname_.in ())); + ACE_DEBUG ((LM_DEBUG, "CosProperty_Hash_Key::operator == : %s == %s \n", + this->pname_.in (), CosProperty_Hash_Key.pname_.in ())); - return ACE_OS::strcmp (this->pname_.in (), ext_id.pname_.in ()) == 0; + return ACE_OS::strcmp (this->pname_.in (), CosProperty_Hash_Key.pname_.in ()) == 0; } u_long -EXT_ID::hash (void) const +CosProperty_Hash_Key::hash (void) const { u_long ret = ACE::hash_pjw (this->pname_.in ()); - ACE_DEBUG ((LM_DEBUG, "EXT_ID::hash : hasing %s : val : %d \n", + ACE_DEBUG ((LM_DEBUG, "CosProperty_Hash_Key::hash : hasing %s : val : %d \n", this->pname_.in (), ret)); return ret; } -EXT_ID::~EXT_ID (void) +CosProperty_Hash_Key::~CosProperty_Hash_Key (void) { } -INT_ID::INT_ID (void) +CosProperty_Hash_Value::CosProperty_Hash_Value (void) { } -INT_ID::INT_ID (const CORBA::Any &anyvalue) +CosProperty_Hash_Value::CosProperty_Hash_Value (const CORBA::Any &anyvalue) { TAO_TRY { @@ -70,6 +70,7 @@ INT_ID::INT_ID (const CORBA::Any &anyvalue) TAO_ENDTRY; } -INT_ID::~INT_ID (void) +CosProperty_Hash_Value::~CosProperty_Hash_Value (void) { } + diff --git a/TAO/orbsvcs/orbsvcs/Property/CosProperty_Hash.h b/TAO/orbsvcs/orbsvcs/Property/CosProperty_Hash.h index ceab4b25d2c..b932e3f5386 100644 --- a/TAO/orbsvcs/orbsvcs/Property/CosProperty_Hash.h +++ b/TAO/orbsvcs/orbsvcs/Property/CosProperty_Hash.h @@ -8,7 +8,7 @@ // CosProperty_Hash.h // // = DESCRITION -// Defines INT_ID and EXT_ID classes for the Hash_Map_Manager to +// Defines CosProperty_Hash_Value and CosProperty_Hash_Key classes for the Hash_Map_Manager to // be used in the CosPropertyService. // // = AUTHOR @@ -21,50 +21,50 @@ #include "ace/Hash_Map_Manager.h" #include "ace/Synch.h" -#include "CosPropertyServiceS.h" +#include "orbsvcs/CosPropertyServiceS.h" -class TAO_ORBSVCS_Export EXT_ID +class Tao_ORBSVCS_Export CosProperty_Hash_Key { // = TITLE // Key for the Hash Table. public: - EXT_ID (void); + CosProperty_Hash_Key (void); // Default constructor - EXT_ID (const CosPropertyService::PropertyName &name); + CosProperty_Hash_Key (const CosPropertyService::PropertyName &name); // Costructor that takes PropertyName - //EXT_ID (const EXT_ID &ext_id); + //CosProperty_Hash_Key (const CosProperty_Hash_Key &CosProperty_Hash_Key); // Copy constructor - virtual int operator == (const EXT_ID &ext_id) const; + virtual int operator == (const CosProperty_Hash_Key &CosProperty_Hash_Key) const; // The vital operator for hash binding and "find"ing. virtual u_long hash (void) const; // The vital function - virtual ~EXT_ID (void); + virtual ~CosProperty_Hash_Key (void); // Destructor CosPropertyService::PropertyName_var pname_; // This is still the public variable... }; -class TAO_ORBSVCS_Export INT_ID +class TAO_ORBSVCS_Export CosProperty_Hash_Value { // = TITLE // This is the Hash Entry. public: - INT_ID (void); + CosProperty_Hash_Value (void); // Default constructor - INT_ID (const CORBA::Any &value); + CosProperty_Hash_Value (const CORBA::Any &value); // Constructor with Any value - //INT_ID (const INT_ID &int_id); + //CosProperty_Hash_Value (const CosProperty_Hash_Value &CosProperty_Hash_Value); // Copy constructor - virtual ~INT_ID (void); + virtual ~CosProperty_Hash_Value (void); // Destructor CORBA::Any pvalue_; |