diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-06-06 05:31:12 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-06-06 05:31:12 +0000 |
commit | 04083db794bd12b187bfda4dfcaa009256fd823a (patch) | |
tree | 1ffe7ee6c6ad40b2c91c430489d3de24b2a4bbf8 | |
parent | 083a2168714bdbb769436248370f6f9b607cc17b (diff) | |
download | ATCD-04083db794bd12b187bfda4dfcaa009256fd823a.tar.gz |
.
85 files changed, 2205 insertions, 2198 deletions
diff --git a/ChangeLog-99b b/ChangeLog-99b index 277c456ffa6..78d6e436b01 100644 --- a/ChangeLog-99b +++ b/ChangeLog-99b @@ -1,3 +1,9 @@ +Sat Jun 5 23:34:21 1999 Douglas C. Schmidt <schmidt@danzon.cs.wustl.edu> + + * ace/Containers_T: Changed all uses of "index" to "slot" to avoid + conflicts with broken C++ compilers that define macros named + "index." + Sat Jun 5 22:57:31 1999 Carlos O'Ryan <coryan@cs.wustl.edu> * ace/OS.h: diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c index 10607197a67..8b9898150d9 100644 --- a/TAO/ChangeLog-99c +++ b/TAO/ChangeLog-99c @@ -1,3 +1,8 @@ +Sat Jun 5 23:48:23 1999 Douglas C. Schmidt <schmidt@danzon.cs.wustl.edu> + + * tao: Replaced all uses of "index" with "slot" since "index" is + defined as a macro by some broken C++ compilers... + Sun Jun 6 00:23:19 1999 Carlos O'Ryan <coryan@cs.wustl.edu> * orbsvcs/orbsvcs/AV/sfp.cpp: @@ -15,8 +20,9 @@ Sun Jun 6 00:06:26 1999 Carlos O'Ryan <coryan@cs.wustl.edu> Sat Jun 5 23:06:01 1999 Carlos O'Ryan <coryan@cs.wustl.edu> * Sun/CC 5.0 works with TAO now! Partly because we don't use the - same templates than before and partly because we found work - arounds the other compiler bugs. + same templates than before and partly because we found work + arounds the other SunC++ compiler bugs, e.g., incorrect code + generation for certain types of default constructors. * tao/Object_Adapter.h: * tao/Object_Adapter.i: diff --git a/TAO/tao/Acceptor_Impl.cpp b/TAO/tao/Acceptor_Impl.cpp index 39642cf5662..f7d35cfaddd 100644 --- a/TAO/tao/Acceptor_Impl.cpp +++ b/TAO/tao/Acceptor_Impl.cpp @@ -41,12 +41,12 @@ TAO_Acceptor_Impl<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open (TAO_ORB_Core* orb_cor int reuse_addr) { this->orb_core_ = orb_core; - return this->ACE_Acceptor<SVC_HANDLER,ACE_PEER_ACCEPTOR_2>::open ( - local_address, - this->orb_core_->reactor (), - flags, - use_select, - reuse_addr); + return this->ACE_Acceptor<SVC_HANDLER,ACE_PEER_ACCEPTOR_2>::open + (local_address, + this->orb_core_->reactor (), + flags, + use_select, + reuse_addr); } template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int @@ -70,13 +70,15 @@ TAO_Acceptor_Impl<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::activate_svc_handler (SVC_H if (this->ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::activate_svc_handler (sh) == -1) return -1; - TAO_Server_Strategy_Factory *f = this->orb_core_->server_factory (); + TAO_Server_Strategy_Factory *f = + this->orb_core_->server_factory (); if (f->activate_server_connections ()) return sh->activate (f->server_connection_thread_flags (), f->server_connection_thread_count ()); - return this->reactor ()->register_handler (sh, ACE_Event_Handler::READ_MASK); + return this->reactor ()->register_handler + (sh, ACE_Event_Handler::READ_MASK); } #endif /* TAO_ACCEPTOR_IMPL_C */ diff --git a/TAO/tao/Acceptor_Impl.h b/TAO/tao/Acceptor_Impl.h index 76621959393..9d6dc96d6ce 100644 --- a/TAO/tao/Acceptor_Impl.h +++ b/TAO/tao/Acceptor_Impl.h @@ -9,9 +9,6 @@ // = FILENAME // Acceptor_Impl.h // -// = DESCRIPTION -// -// // = AUTHOR // Carlos O'Ryan <coryan@cs.wustl.edu> // Ossama Othman <othman@cs.wustl.edu> @@ -29,9 +26,17 @@ template<class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> class TAO_Acceptor_Impl : public ACE_Acceptor<SVC_HANDLER,ACE_PEER_ACCEPTOR_2> { + // = TITLE + // @@ Carlos, please fill in here. + // + // = DESCRIPTION + // @@ Carlos, please fill in here. public: + // = Initialization and termination methods. TAO_Acceptor_Impl (ACE_Reactor * = 0, int use_select = 1); + // Constructor. + TAO_Acceptor_Impl (const ACE_PEER_ACCEPTOR_ADDR &local_addr, ACE_Reactor * = ACE_Reactor::instance (), int flags = 0, @@ -39,20 +44,21 @@ public: int reuse_addr = 1); // The constructors, just delegate to the base class. - // Initialize the ORB_Core... int open (TAO_ORB_Core* orb_core, const ACE_PEER_ACCEPTOR_ADDR &, int flags = 0, int use_select = 1, int reuse_addr = 1); + // Initialize the ORB_Core. protected: - // = Check the documentation in Acceptor.h + // = See $ACE_ROOT/ace/Acceptor.h for the documentation. virtual int make_svc_handler (SVC_HANDLER *&sh); virtual int activate_svc_handler (SVC_HANDLER *svc_handler); private: - TAO_ORB_Core* orb_core_; + TAO_ORB_Core *orb_core_; + // Pointer to the ORB Core. }; #if defined(__ACE_INLINE__) diff --git a/TAO/tao/Acceptor_Registry.cpp b/TAO/tao/Acceptor_Registry.cpp index 872667aa366..6c57b7e43e4 100644 --- a/TAO/tao/Acceptor_Registry.cpp +++ b/TAO/tao/Acceptor_Registry.cpp @@ -34,11 +34,8 @@ TAO_Acceptor_Registry::endpoint_count (void) int count = 0; TAO_AcceptorSetItor end = this->end (); - for (TAO_AcceptorSetItor i = this->begin (); i != end; ++i) - { - count += (*i)->endpoint_count (); - } + count += (*i)->endpoint_count (); return count; } @@ -50,10 +47,9 @@ TAO_Acceptor_Registry::make_mprofile (const TAO_ObjectKey &object_key, TAO_AcceptorSetItor end = this->end (); for (TAO_AcceptorSetItor i = this->begin (); i != end; ++i) - { - if ((*i)->create_mprofile (object_key, mprofile) == -1) - return -1; - } + if ((*i)->create_mprofile (object_key, + mprofile) == -1) + return -1; return 0; } @@ -62,10 +58,10 @@ int TAO_Acceptor_Registry::is_collocated (const TAO_MProfile &mprofile) { // @@ Fred&Ossama: we should optimize this: we loop over the - // profiles here and in the ORB::is_collocated() method, maybe we - // should return the index of the profile that matched? - // What happens if the address matches but the object key does - // not? Should we keep on searching in the ORB loop? + // profiles here and in the ORB::is_collocated() method, maybe we + // should return the index of the profile that matched? What + // happens if the address matches but the object key does not? + // Should we keep on searching in the ORB loop? TAO_AcceptorSetItor end = this->end (); @@ -75,7 +71,8 @@ TAO_Acceptor_Registry::is_collocated (const TAO_MProfile &mprofile) j != mprofile.profile_count (); ++j) { - const TAO_Profile* profile = mprofile.get_profile (j); + const TAO_Profile *profile = mprofile.get_profile (j); + if ((*i)->tag () == profile->tag () && (*i)->is_collocated (profile)) return 1; @@ -87,7 +84,6 @@ TAO_Acceptor_Registry::is_collocated (const TAO_MProfile &mprofile) int TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core) { - // protocol_factories is in the following form // IOP1://addr1,addr2,...,addrN/;IOP2://addr1,...addrM/;... @@ -116,19 +112,18 @@ TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core) { ACE_CString iop = (*endpoint); - int indx = iop.find ("://", 0); - if (indx == iop.npos) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) Invalid endpoint epecification: " - "<%s>.\n", - iop.c_str ()), - -1); - } - - ACE_CString prefix = iop.substring (0, indx); - - if (indx == ACE_static_cast (int, iop.length () - 3)) + int slot = iop.find ("://", 0); + if (slot == iop.npos) + ACE_ERROR_RETURN ((LM_ERROR, + "(%P|%t) Invalid endpoint epecification: " + "<%s>.\n", + iop.c_str ()), + -1); + ACE_CString prefix = iop.substring (0, slot); + + // @@ Fred, please document where the major number "3" comes + // from. + if (slot == ACE_static_cast (int, iop.length () - 3)) { // Protocol was specified without an endpoint. According to // the "iioploc" spec, this is valid. As such, we extend @@ -140,14 +135,20 @@ TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core) continue; } - ACE_CString addrs = iop.substring (indx + 3); + // @@ Fred, please document where the major number "3" comes + // from. + ACE_CString addrs = iop.substring (slot + 3); if (addrs [addrs.length () - 1] == '/') - addrs [addrs.length () - 1] = '\0'; // get rid of trailing / + // Get rid of trailing '/'. + addrs [addrs.length () - 1] = '\0'; char *last_addr=0; addr_str.reset (addrs.rep ()); - for (char *astr = ACE_OS::strtok_r (addr_str.get (), ",", &last_addr); + + for (char *astr = ACE_OS::strtok_r (addr_str.get (), + ",", + &last_addr); astr != 0 ; astr = ACE_OS::strtok_r (0, ",", @@ -157,8 +158,7 @@ TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core) // Now get the list of avaliable protocol factories. TAO_ProtocolFactorySetItor end = - orb_core->protocol_factories ()->end (); - + orb_core->protocol_factories ()->end (); for (TAO_ProtocolFactorySetItor factory = orb_core->protocol_factories ()->begin (); @@ -171,40 +171,38 @@ TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core) (*factory)->factory ()->make_acceptor (); if (acceptor != 0) { - // Check if an "N.n@" version prefix was specified. + // Check if an "N.n@" version prefix was + // specified. // @@ For now, we just drop the version prefix. - // At some point in the future it may become - // useful. + // At some point in the future it may become + // useful. const char *temp_iop = address.c_str (); - if (isdigit (temp_iop[0]) && - temp_iop[1] == '.' && - isdigit (temp_iop[2]) && - temp_iop[3] == '@') + if (isdigit (temp_iop[0]) + && temp_iop[1] == '.' + && isdigit (temp_iop[2]) + && temp_iop[3] == '@') address = address.substring (4); // add acceptor to list. this->acceptors_.insert (acceptor); - if (acceptor->open (orb_core, address) == -1) + if (acceptor->open (orb_core, + address) == -1) return -1; - break; } else - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) Unable to create an " - "acceptor for <%s>\n", - iop.c_str ()), - -1); - } + ACE_ERROR_RETURN ((LM_ERROR, + "(%P|%t) Unable to create an " + "acceptor for <%s>\n", + iop.c_str ()), + -1); } else continue; } } } - return 0; } @@ -212,12 +210,15 @@ int TAO_Acceptor_Registry::open_default (TAO_ORB_Core *orb_core, ACE_CString *protocol_prefix) { - // No endpoints were specified, we let each protocol pick its - // own default... + // No endpoints were specified, we let each protocol pick its own + // default... TAO_ProtocolFactorySetItor end = orb_core->protocol_factories ()->end (); + // @@ Fred, there should be more comments in this method so that + // people can tell what's going on... Can you please fix it? + for (TAO_ProtocolFactorySetItor i = orb_core->protocol_factories ()->begin (); i != end; @@ -236,12 +237,12 @@ TAO_Acceptor_Registry::open_default (TAO_ORB_Core *orb_core, "TAO (%P|%t) Unable to match protocol prefix " "for <%s>\n", protocol_prefix->c_str ())); - continue; } } - TAO_Acceptor *acceptor = (*i)->factory ()->make_acceptor (); + TAO_Acceptor *acceptor = + (*i)->factory ()->make_acceptor (); if (acceptor == 0) { @@ -283,28 +284,28 @@ TAO_Acceptor_Registry::close_all (void) TAO_AcceptorSetItor end = this->acceptors_.end (); - for (TAO_AcceptorSetItor i = this->acceptors_.begin (); i != end; ++i) + for (TAO_AcceptorSetItor i = this->acceptors_.begin (); + i != end; + ++i) { if (*i == 0) continue; + (*i)->close (); delete *i; } + this->acceptors_.reset (); return 0; } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - template class ACE_Node<TAO_Acceptor*>; template class ACE_Unbounded_Set<TAO_Acceptor*>; template class ACE_Unbounded_Set_Iterator<TAO_Acceptor*>; - #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - #pragma instantiate ACE_Node<TAO_Acceptor*> #pragma instantiate ACE_Unbounded_Set<TAO_Acceptor*> #pragma instantiate ACE_Unbounded_Set_Iterator<TAO_Acceptor*> - #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/tao/Acceptor_Registry.h b/TAO/tao/Acceptor_Registry.h index d0f888c0cf0..7b6db0eabe6 100644 --- a/TAO/tao/Acceptor_Registry.h +++ b/TAO/tao/Acceptor_Registry.h @@ -51,13 +51,17 @@ class TAO_Export TAO_Acceptor_Registry // This class maintains a list os acceptor factories // for all loaded ORB protocols. public: + // = Initialization and termination methods. TAO_Acceptor_Registry (void); // Default constructor. ~TAO_Acceptor_Registry (void); // Default destructor. - // virtual TAO_Acceptor* acceptor (const char* endpoint) = 0; + // @@ Fred, should this method be removed? If so, where should the + // comments be put? + + // virtual TAO_Acceptor *acceptor (const char *endpoint) = 0; // Create a new acceptor from an endpoint specification, if // the specification is not recognized then we return 0. // Each protocol will be characterized by a prefix, so @@ -67,43 +71,42 @@ public: // "iiop://localhost:0" - IIOP, sap_any [any better idea?] // "aal5giop:......" - GIOP over AAL5, how to specify the // end point? - // // this format is extensible, for example: // "rtiiop://macarena:0,15" - real-time IIOP, host, port, prio. int open (TAO_ORB_Core *orb_core); // Initialize all registered acceptors. Return -1 on error. // @@ Fred&Ossama: What is the relationship between the ORB_Core and - // the Acceptor_Registry? Is there just one per orb core? Should - // tbe acceptor registry know which ORB_Core it belongs to? + // the Acceptor_Registry? Is there just one per orb core? Should tbe + // acceptor registry know which ORB_Core it belongs to? int close_all (void); // Close all open acceptors. size_t endpoint_count (void); - // returns the total number of endpoints, i.e. the number of profiles - // that will be created. + // Returns the total number of endpoints, i.e., the number of + // profiles that will be created. int make_mprofile (const TAO_ObjectKey& object_key, TAO_MProfile &mprofile); - // add profiles to the mprofile object for all open endpoints. + // Add profiles to the <mprofile> object for all open endpoints. int is_collocated (const TAO_MProfile& mprofile); // Check if there is at least one profile in <mprofile> that // corresponds to a collocated object. + // = Iterator. TAO_AcceptorSetItor begin (void); TAO_AcceptorSetItor end (void); - // Iteration private: - int open_default (TAO_ORB_Core* orb_core, ACE_CString* protocol_prefix = 0); - // Create an acceptor with a default endpoint + int open_default (TAO_ORB_Core *orb_core, + ACE_CString *protocol_prefix = 0); + // Create an acceptor with a default endpoint. private: - TAO_AcceptorSet acceptors_; - // list of acceptors currently open. + // List of acceptors that are currently open. }; #if defined(__ACE_INLINE__) diff --git a/TAO/tao/Active_Object_Map.cpp b/TAO/tao/Active_Object_Map.cpp index 2bc90fe9095..778dae0bfa0 100644 --- a/TAO/tao/Active_Object_Map.cpp +++ b/TAO/tao/Active_Object_Map.cpp @@ -10,8 +10,6 @@ ACE_RCSID(tao, POA, "$Id$") -//////////////////////////////////////////////////////////////////////////////// - TAO_Active_Object_Map::Map_Entry::Map_Entry (void) : user_id_ (), system_id_ (), @@ -21,13 +19,12 @@ TAO_Active_Object_Map::Map_Entry::Map_Entry (void) { } -//////////////////////////////////////////////////////////////////////////////// - /* static */ size_t TAO_Active_Object_Map::system_id_size_ (0); void -TAO_Active_Object_Map::set_system_id_size (const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters) +TAO_Active_Object_Map::set_system_id_size + (const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters) { if (TAO_Active_Object_Map::system_id_size_ == 0) { @@ -36,26 +33,20 @@ TAO_Active_Object_Map::set_system_id_size (const TAO_Server_Strategy_Factory::Ac switch (creation_parameters.object_lookup_strategy_for_system_id_policy_) { case TAO_LINEAR: - - TAO_Active_Object_Map::system_id_size_ = sizeof (CORBA::ULong); + TAO_Active_Object_Map::system_id_size_ = + sizeof (CORBA::ULong); break; case TAO_DYNAMIC_HASH: default: - TAO_Active_Object_Map::system_id_size_ = sizeof (CORBA::ULong); break; } - size_t hint_size; + size_t hint_size = 0; + if (creation_parameters.use_active_hint_in_ids_) - { - hint_size = ACE_Active_Map_Manager_Key::size (); - } - else - { - hint_size = 0; - } + hint_size = ACE_Active_Map_Manager_Key::size (); TAO_Active_Object_Map::system_id_size_ += hint_size; } @@ -64,19 +55,19 @@ TAO_Active_Object_Map::set_system_id_size (const TAO_Server_Strategy_Factory::Ac switch (creation_parameters.object_lookup_strategy_for_system_id_policy_) { case TAO_LINEAR: - - TAO_Active_Object_Map::system_id_size_ = sizeof (CORBA::ULong); + TAO_Active_Object_Map::system_id_size_ = + sizeof (CORBA::ULong); break; case TAO_DYNAMIC_HASH: - - TAO_Active_Object_Map::system_id_size_ = sizeof (CORBA::ULong); + TAO_Active_Object_Map::system_id_size_ = + sizeof (CORBA::ULong); break; case TAO_ACTIVE_DEMUX: default: - - TAO_Active_Object_Map::system_id_size_ = ACE_Active_Map_Manager_Key::size (); + TAO_Active_Object_Map::system_id_size_ = + ACE_Active_Map_Manager_Key::size (); break; } } @@ -98,6 +89,7 @@ TAO_Active_Object_Map::TAO_Active_Object_Map (int user_id_policy, TAO_Active_Object_Map::set_system_id_size (creation_parameters); TAO_Id_Uniqueness_Strategy *id_uniqueness_strategy = 0; + if (unique_id_policy) { ACE_NEW_THROW_EX (id_uniqueness_strategy, @@ -112,10 +104,12 @@ TAO_Active_Object_Map::TAO_Active_Object_Map (int user_id_policy, CORBA::NO_MEMORY ()); ACE_CHECK; } + // Give ownership to the auto pointer. auto_ptr<TAO_Id_Uniqueness_Strategy> new_id_uniqueness_strategy (id_uniqueness_strategy); TAO_Lifespan_Strategy *lifespan_strategy = 0; + if (persistent_id_policy) { ACE_NEW_THROW_EX (lifespan_strategy, @@ -130,10 +124,12 @@ TAO_Active_Object_Map::TAO_Active_Object_Map (int user_id_policy, CORBA::NO_MEMORY ()); ACE_CHECK; } + // Give ownership to the auto pointer. auto_ptr<TAO_Lifespan_Strategy> new_lifespan_strategy (lifespan_strategy); TAO_Id_Assignment_Strategy *id_assignment_strategy = 0; + if (user_id_policy) { ACE_NEW_THROW_EX (id_assignment_strategy, @@ -141,30 +137,28 @@ TAO_Active_Object_Map::TAO_Active_Object_Map (int user_id_policy, CORBA::NO_MEMORY ()); ACE_CHECK; } + else if (unique_id_policy) + { + ACE_NEW_THROW_EX (id_assignment_strategy, + TAO_System_Id_With_Unique_Id_Strategy, + CORBA::NO_MEMORY ()); + ACE_CHECK; + } else { - if (unique_id_policy) - { - ACE_NEW_THROW_EX (id_assignment_strategy, - TAO_System_Id_With_Unique_Id_Strategy, - CORBA::NO_MEMORY ()); - ACE_CHECK; - } - else - { - ACE_NEW_THROW_EX (id_assignment_strategy, - TAO_System_Id_With_Multiple_Id_Strategy, - CORBA::NO_MEMORY ()); - ACE_CHECK; - } + ACE_NEW_THROW_EX (id_assignment_strategy, + TAO_System_Id_With_Multiple_Id_Strategy, + CORBA::NO_MEMORY ()); + ACE_CHECK; } + // Give ownership to the auto pointer. auto_ptr<TAO_Id_Assignment_Strategy> new_id_assignment_strategy (id_assignment_strategy); TAO_Id_Hint_Strategy *id_hint_strategy = 0; - if ((user_id_policy || - creation_parameters.allow_reactivation_of_system_ids_) && - creation_parameters.use_active_hint_in_ids_) + if ((user_id_policy + || creation_parameters.allow_reactivation_of_system_ids_) + && creation_parameters.use_active_hint_in_ids_) { ACE_NEW_THROW_EX (id_hint_strategy, TAO_Active_Hint_Strategy (creation_parameters.active_object_map_size_), @@ -178,6 +172,7 @@ TAO_Active_Object_Map::TAO_Active_Object_Map (int user_id_policy, CORBA::NO_MEMORY ()); ACE_CHECK; } + // Give ownership to the auto pointer. auto_ptr<TAO_Id_Hint_Strategy> new_id_hint_strategy (id_hint_strategy); @@ -202,17 +197,17 @@ TAO_Active_Object_Map::TAO_Active_Object_Map (int user_id_policy, break; } } + // Give ownership to the auto pointer. auto_ptr<servant_map> new_servant_map (sm); user_id_map *uim = 0; - if (user_id_policy || - creation_parameters.allow_reactivation_of_system_ids_) + if (user_id_policy + || creation_parameters.allow_reactivation_of_system_ids_) { switch (creation_parameters.object_lookup_strategy_for_user_id_policy_) { case TAO_LINEAR: - ACE_NEW_THROW_EX (uim, user_id_linear_map (creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); @@ -221,7 +216,6 @@ TAO_Active_Object_Map::TAO_Active_Object_Map (int user_id_policy, case TAO_DYNAMIC_HASH: default: - ACE_NEW_THROW_EX (uim, user_id_hash_map (creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); @@ -234,7 +228,6 @@ TAO_Active_Object_Map::TAO_Active_Object_Map (int user_id_policy, switch (creation_parameters.object_lookup_strategy_for_system_id_policy_) { case TAO_LINEAR: - ACE_NEW_THROW_EX (uim, user_id_linear_map (creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); @@ -242,7 +235,6 @@ TAO_Active_Object_Map::TAO_Active_Object_Map (int user_id_policy, break; case TAO_DYNAMIC_HASH: - ACE_NEW_THROW_EX (uim, user_id_hash_map (creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); @@ -251,7 +243,6 @@ TAO_Active_Object_Map::TAO_Active_Object_Map (int user_id_policy, case TAO_ACTIVE_DEMUX: default: - ACE_NEW_THROW_EX (uim, user_id_active_map (creation_parameters.active_object_map_size_), CORBA::NO_MEMORY ()); @@ -259,6 +250,7 @@ TAO_Active_Object_Map::TAO_Active_Object_Map (int user_id_policy, break; } } + // Give ownership to the auto pointer. auto_ptr<user_id_map> new_user_id_map (uim); @@ -280,6 +272,7 @@ TAO_Active_Object_Map::~TAO_Active_Object_Map (void) { user_id_map::iterator iterator = this->user_id_map_->begin (); user_id_map::iterator end = this->user_id_map_->end (); + for (; iterator != end; ++iterator) @@ -296,8 +289,6 @@ TAO_Active_Object_Map::~TAO_Active_Object_Map (void) delete this->user_id_map_; } -//////////////////////////////////////////////////////////////////////////////// - TAO_Id_Uniqueness_Strategy::~TAO_Id_Uniqueness_Strategy (void) { } @@ -308,20 +299,13 @@ TAO_Id_Uniqueness_Strategy::set_active_object_map (TAO_Active_Object_Map *active this->active_object_map_ = active_object_map; } -//////////////////////////////////////////////////////////////////////////////// - int TAO_Unique_Id_Strategy::is_servant_in_map (PortableServer::Servant servant) { - int result = this->active_object_map_->servant_map_->find (servant); - if (result == 0) - { - return 1; - } + if (this->active_object_map_->servant_map_->find (servant) == 0) + return 1; else - { - return 0; - } + return 0; } int @@ -331,7 +315,6 @@ TAO_Unique_Id_Strategy::bind_using_user_id (PortableServer::Servant servant, { int result = this->active_object_map_->user_id_map_->find (user_id, entry); - if (result == 0) { if (servant != 0) @@ -347,7 +330,6 @@ TAO_Unique_Id_Strategy::bind_using_user_id (PortableServer::Servant servant, ACE_NEW_RETURN (entry, TAO_Active_Object_Map::Map_Entry, -1); - entry->user_id_ = user_id; entry->servant_ = servant; @@ -357,15 +339,11 @@ TAO_Unique_Id_Strategy::bind_using_user_id (PortableServer::Servant servant, { result = this->active_object_map_->user_id_map_->bind (entry->user_id_, entry); - if (result == 0) { if (servant != 0) - { - result = this->active_object_map_->servant_map_->bind (entry->servant_, - entry); - } - + result = this->active_object_map_->servant_map_->bind (entry->servant_, + entry); if (result != 0) { this->active_object_map_->user_id_map_->unbind (entry->user_id_); @@ -380,9 +358,7 @@ TAO_Unique_Id_Strategy::bind_using_user_id (PortableServer::Servant servant, } } else - { - delete entry; - } + delete entry; } return result; @@ -394,25 +370,18 @@ TAO_Unique_Id_Strategy::unbind_using_user_id (const PortableServer::ObjectId &us TAO_Active_Object_Map::Map_Entry *entry = 0; int result = this->active_object_map_->user_id_map_->unbind (user_id, entry); - if (result == 0) { if (entry->servant_ != 0) - { - result = this->active_object_map_->servant_map_->unbind (entry->servant_); - } + result = this->active_object_map_->servant_map_->unbind (entry->servant_); if (result == 0) - { - result = this->active_object_map_->id_hint_strategy_->unbind (*entry); - } + result = + this->active_object_map_->id_hint_strategy_->unbind (*entry); if (result == 0) - { - delete entry; - } + delete entry; } - return result; } @@ -423,19 +392,14 @@ TAO_Unique_Id_Strategy::find_user_id_using_servant (PortableServer::Servant serv TAO_Active_Object_Map::Map_Entry *entry = 0; int result = this->active_object_map_->servant_map_->find (servant, entry); - if (result == 0) { if (entry->deactivated_) - { - result = -1; - } + result = -1; else - { - ACE_NEW_RETURN (user_id, - PortableServer::ObjectId (entry->user_id_), - -1); - } + ACE_NEW_RETURN (user_id, + PortableServer::ObjectId (entry->user_id_), + -1); } return result; @@ -448,18 +412,13 @@ TAO_Unique_Id_Strategy::find_system_id_using_servant (PortableServer::Servant se TAO_Active_Object_Map::Map_Entry *entry = 0; int result = this->active_object_map_->servant_map_->find (servant, entry); - if (result == 0) { if (entry->deactivated_) - { - result = -1; - } + result = -1; else - { - result = this->active_object_map_->id_hint_strategy_->system_id (system_id, - *entry); - } + result = this->active_object_map_->id_hint_strategy_->system_id (system_id, + *entry); } return result; @@ -487,30 +446,26 @@ TAO_Multiple_Id_Strategy::bind_using_user_id (PortableServer::Servant servant, { int result = this->active_object_map_->user_id_map_->find (user_id, entry); - if (result == 0) { if (servant != 0) - { - entry->servant_ = servant; - } + entry->servant_ = servant; } else { ACE_NEW_RETURN (entry, TAO_Active_Object_Map::Map_Entry, -1); - entry->user_id_ = user_id; entry->servant_ = servant; - result = this->active_object_map_->id_hint_strategy_->bind (*entry); + result = + this->active_object_map_->id_hint_strategy_->bind (*entry); if (result == 0) { result = this->active_object_map_->user_id_map_->bind (entry->user_id_, entry); - if (result != 0) { this->active_object_map_->id_hint_strategy_->unbind (*entry); @@ -518,9 +473,7 @@ TAO_Multiple_Id_Strategy::bind_using_user_id (PortableServer::Servant servant, } } else - { - delete entry; - } + delete entry; } return result; @@ -532,15 +485,12 @@ TAO_Multiple_Id_Strategy::unbind_using_user_id (const PortableServer::ObjectId & TAO_Active_Object_Map::Map_Entry *entry = 0; int result = this->active_object_map_->user_id_map_->unbind (user_id, entry); - if (result == 0) { result = this->active_object_map_->id_hint_strategy_->unbind (*entry); if (result == 0) - { - delete entry; - } + delete entry; } return result; @@ -575,15 +525,12 @@ TAO_Multiple_Id_Strategy::remaining_activations (PortableServer::Servant servant TAO_Active_Object_Map::Map_Entry *entry = map_pair.second (); if (entry->servant_ == servant) - { - return 1; - } + return 1; } + return 0; } -//////////////////////////////////////////////////////////////////////////////// - TAO_Lifespan_Strategy::~TAO_Lifespan_Strategy (void) { } @@ -594,8 +541,6 @@ TAO_Lifespan_Strategy::set_active_object_map (TAO_Active_Object_Map *active_obje this->active_object_map_ = active_object_map; } -//////////////////////////////////////////////////////////////////////////////// - int TAO_Transient_Strategy::find_servant_using_system_id_and_user_id (const PortableServer::ObjectId &system_id, const PortableServer::ObjectId &user_id, @@ -607,17 +552,11 @@ TAO_Transient_Strategy::find_servant_using_system_id_and_user_id (const Portable if (result == 0) { if (entry->deactivated_) - { - result = -1; - } + result = -1; else if (entry->servant_ == 0) - { - result = -1; - } + result = -1; else - { - servant = entry->servant_; - } + servant = entry->servant_; } else { @@ -626,17 +565,11 @@ TAO_Transient_Strategy::find_servant_using_system_id_and_user_id (const Portable if (result == 0) { if (entry->deactivated_) - { - result = -1; - } + result = -1; else if (entry->servant_ == 0) - { - result = -1; - } + result = -1; else - { - servant = entry->servant_; - } + servant = entry->servant_; } } @@ -653,21 +586,15 @@ TAO_Persistent_Strategy::find_servant_using_system_id_and_user_id (const Portabl { int result = this->active_object_map_->id_hint_strategy_->find (system_id, entry); - if (result == 0 && - user_id == entry->user_id_) + if (result == 0 + && user_id == entry->user_id_) { if (entry->deactivated_) - { - result = -1; - } + result = -1; else if (entry->servant_ == 0) - { - result = -1; - } + result = -1; else - { - servant = entry->servant_; - } + servant = entry->servant_; } else { @@ -676,25 +603,17 @@ TAO_Persistent_Strategy::find_servant_using_system_id_and_user_id (const Portabl if (result == 0) { if (entry->deactivated_) - { - result = -1; - } + result = -1; else if (entry->servant_ == 0) - { - result = -1; - } + result = -1; else - { - servant = entry->servant_; - } + servant = entry->servant_; } } return result; } -//////////////////////////////////////////////////////////////////////////////// - TAO_Id_Assignment_Strategy::~TAO_Id_Assignment_Strategy (void) { } @@ -705,8 +624,6 @@ TAO_Id_Assignment_Strategy::set_active_object_map (TAO_Active_Object_Map *active this->active_object_map_ = active_object_map; } -//////////////////////////////////////////////////////////////////////////////// - int TAO_User_Id_Strategy::bind_using_system_id (PortableServer::Servant servant, TAO_Active_Object_Map::Map_Entry *&entry) @@ -714,8 +631,6 @@ TAO_User_Id_Strategy::bind_using_system_id (PortableServer::Servant servant, return -1; } -//////////////////////////////////////////////////////////////////////////////// - int TAO_System_Id_With_Unique_Id_Strategy::bind_using_system_id (PortableServer::Servant servant, TAO_Active_Object_Map::Map_Entry *&entry) @@ -735,10 +650,8 @@ TAO_System_Id_With_Unique_Id_Strategy::bind_using_system_id (PortableServer::Ser if (result == 0) { if (servant != 0) - { - result = this->active_object_map_->servant_map_->bind (entry->servant_, - entry); - } + result = this->active_object_map_->servant_map_->bind (entry->servant_, + entry); if (result != 0) { @@ -754,15 +667,11 @@ TAO_System_Id_With_Unique_Id_Strategy::bind_using_system_id (PortableServer::Ser } } else - { - delete entry; - } + delete entry; return result; } -//////////////////////////////////////////////////////////////////////////////// - int TAO_System_Id_With_Multiple_Id_Strategy::bind_using_system_id (PortableServer::Servant servant, TAO_Active_Object_Map::Map_Entry *&entry) @@ -770,7 +679,6 @@ TAO_System_Id_With_Multiple_Id_Strategy::bind_using_system_id (PortableServer::S ACE_NEW_RETURN (entry, TAO_Active_Object_Map::Map_Entry, -1); - int result = this->active_object_map_->user_id_map_->bind_create_key (entry, entry->user_id_); if (result == 0) @@ -786,9 +694,7 @@ TAO_System_Id_With_Multiple_Id_Strategy::bind_using_system_id (PortableServer::S } } else - { - delete entry; - } + delete entry; return result; } diff --git a/TAO/tao/Active_Object_Map.h b/TAO/tao/Active_Object_Map.h index 825d4477a2b..3b0a834d816 100644 --- a/TAO/tao/Active_Object_Map.h +++ b/TAO/tao/Active_Object_Map.h @@ -25,8 +25,6 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -//////////////////////////////////////////////////////////////////////////////// - // Forward declarations. class TAO_Id_Uniqueness_Strategy; class TAO_Lifespan_Strategy; @@ -48,7 +46,6 @@ public: // Value field of the active object map. // // = DESCRIPTION - // // We need a mapping from and to all of the following fields: // <user_id>, <system_id>, and <servant>. Therefore, we keep // all the fields together in the map. @@ -56,6 +53,7 @@ public: Map_Entry (void); // Default constructor. + // @@ Irfan, can you please add a comment for each of these fields? PortableServer::ObjectId user_id_; PortableServer::ObjectId system_id_; PortableServer::Servant servant_; @@ -229,8 +227,6 @@ public: // Size of the system id produced by the map. }; -//////////////////////////////////////////////////////////////////////////////// - class TAO_Id_Uniqueness_Strategy { // = TITLE @@ -240,7 +236,6 @@ class TAO_Id_Uniqueness_Strategy // Strategy for implementing points of variation between the // UNIQUE_ID and the MULTIPLE_ID policies. public: - virtual ~TAO_Id_Uniqueness_Strategy (void); // Virtual destructor. @@ -280,8 +275,6 @@ protected: // Pointer to the active map. }; -//////////////////////////////////////////////////////////////////////////////// - class TAO_Unique_Id_Strategy : public TAO_Id_Uniqueness_Strategy { // = TITLE @@ -319,8 +312,6 @@ public: // object map? Can be used with any policy. }; -//////////////////////////////////////////////////////////////////////////////// - class TAO_Multiple_Id_Strategy : public TAO_Id_Uniqueness_Strategy { // = TITLE @@ -358,8 +349,6 @@ public: // object map? Can be used with any policy. }; -//////////////////////////////////////////////////////////////////////////////// - class TAO_Lifespan_Strategy { // = TITLE @@ -388,8 +377,6 @@ protected: // Pointer to the active map. }; -//////////////////////////////////////////////////////////////////////////////// - class TAO_Transient_Strategy : public TAO_Lifespan_Strategy { // = TITLE @@ -398,7 +385,6 @@ class TAO_Transient_Strategy : public TAO_Lifespan_Strategy // = DESCRIPTION // Strategy for the TRANSIENT policy. public: - virtual int find_servant_using_system_id_and_user_id (const PortableServer::ObjectId &system_id, const PortableServer::ObjectId &user_id, PortableServer::Servant &servant, @@ -406,8 +392,6 @@ public: // Can be used with any policy. }; -//////////////////////////////////////////////////////////////////////////////// - class TAO_Persistent_Strategy : public TAO_Lifespan_Strategy { // = TITLE @@ -416,7 +400,6 @@ class TAO_Persistent_Strategy : public TAO_Lifespan_Strategy // = DESCRIPTION // Strategy for the PERSISTENT policy. public: - virtual int find_servant_using_system_id_and_user_id (const PortableServer::ObjectId &system_id, const PortableServer::ObjectId &user_id, PortableServer::Servant &servant, @@ -425,8 +408,6 @@ public: }; -//////////////////////////////////////////////////////////////////////////////// - class TAO_Id_Assignment_Strategy { // = TITLE @@ -436,7 +417,6 @@ class TAO_Id_Assignment_Strategy // Strategy for implementing points of variation between the // USER_ID and the SYSTEM_ID policies. public: - virtual ~TAO_Id_Assignment_Strategy (void); // Virtual destructor. @@ -453,8 +433,6 @@ protected: // Pointer to the active map. }; -//////////////////////////////////////////////////////////////////////////////// - class TAO_User_Id_Strategy : public TAO_Id_Assignment_Strategy { // = TITLE @@ -463,14 +441,11 @@ class TAO_User_Id_Strategy : public TAO_Id_Assignment_Strategy // = DESCRIPTION // Strategy for the USER_ID policy. public: - virtual int bind_using_system_id (PortableServer::Servant servant, TAO_Active_Object_Map::Map_Entry *&entry); // Must be used with SYSTEM_ID policy. }; -//////////////////////////////////////////////////////////////////////////////// - class TAO_System_Id_With_Unique_Id_Strategy : public TAO_Id_Assignment_Strategy { // = TITLE @@ -479,14 +454,11 @@ class TAO_System_Id_With_Unique_Id_Strategy : public TAO_Id_Assignment_Strategy // = DESCRIPTION // Strategy for the SYSTEM_ID policy (with UNIQUE_ID policy). public: - virtual int bind_using_system_id (PortableServer::Servant servant, TAO_Active_Object_Map::Map_Entry *&entry); // Must be used with SYSTEM_ID policy. }; -//////////////////////////////////////////////////////////////////////////////// - class TAO_System_Id_With_Multiple_Id_Strategy : public TAO_Id_Assignment_Strategy { // = TITLE @@ -495,14 +467,11 @@ class TAO_System_Id_With_Multiple_Id_Strategy : public TAO_Id_Assignment_Strateg // = DESCRIPTION // Strategy for the SYSTEM_ID policy (with MULTIPLE_ID policy). public: - virtual int bind_using_system_id (PortableServer::Servant servant, TAO_Active_Object_Map::Map_Entry *&entry); // Must be used with SYSTEM_ID policy. }; -//////////////////////////////////////////////////////////////////////////////// - class TAO_Id_Hint_Strategy { // = TITLE @@ -512,10 +481,10 @@ class TAO_Id_Hint_Strategy // Strategy for implementing points of variation between the // active hint and the no hint policies. public: - virtual ~TAO_Id_Hint_Strategy (void); // Virtual destructor. + // @@ Irfan, can you please add comments to these methods. virtual int recover_key (const PortableServer::ObjectId &system_id, PortableServer::ObjectId &user_id) = 0; @@ -532,8 +501,6 @@ public: TAO_Active_Object_Map::Map_Entry &entry) = 0; }; -//////////////////////////////////////////////////////////////////////////////// - class TAO_Active_Hint_Strategy : public TAO_Id_Hint_Strategy { // = TITLE @@ -542,7 +509,7 @@ class TAO_Active_Hint_Strategy : public TAO_Id_Hint_Strategy // = DESCRIPTION // Strategy for adding active hints to ids. public: - + // @@ Irfan, can you please add comments to these methods. TAO_Active_Hint_Strategy (CORBA::ULong map_size); virtual ~TAO_Active_Hint_Strategy (void); @@ -571,8 +538,6 @@ public: system_id_map system_id_map_; }; -//////////////////////////////////////////////////////////////////////////////// - class TAO_No_Hint_Strategy : public TAO_Id_Hint_Strategy { // = TITLE @@ -581,7 +546,7 @@ class TAO_No_Hint_Strategy : public TAO_Id_Hint_Strategy // = DESCRIPTION // Strategy for not adding active hints to ids. public: - + // @@ Irfan, can you please add comments to these methods. virtual ~TAO_No_Hint_Strategy (void); // Virtual destructor. @@ -601,8 +566,6 @@ public: TAO_Active_Object_Map::Map_Entry &entry); }; -//////////////////////////////////////////////////////////////////////////////// - #if defined (__ACE_INLINE__) # include "tao/Active_Object_Map.i" #endif /* __ACE_INLINE__ */ diff --git a/TAO/tao/Active_Object_Map.i b/TAO/tao/Active_Object_Map.i index 82d7191f512..569a95b6b1a 100644 --- a/TAO/tao/Active_Object_Map.i +++ b/TAO/tao/Active_Object_Map.i @@ -6,6 +6,9 @@ TAO_Active_Object_Map::is_servant_in_map (PortableServer::Servant servant) return this->id_uniqueness_strategy_->is_servant_in_map (servant); } +// @@ Irfan, a lot of these methods are rather large -- should we +// really be trying to inline them all?! + ACE_INLINE int TAO_Active_Object_Map::is_user_id_in_map (const PortableServer::ObjectId &user_id) { @@ -15,18 +18,12 @@ TAO_Active_Object_Map::is_user_id_in_map (const PortableServer::ObjectId &user_i if (result == 0) { if (entry->servant_ == 0) - { - result = 0; - } + result = 0; else - { - result = 1; - } + result = 1; } else - { - result = 0; - } + result = 0; return result; } @@ -41,11 +38,8 @@ TAO_Active_Object_Map::bind_using_system_id_returning_system_id (PortableServer: entry); if (result == 0) - { - result = this->id_hint_strategy_->system_id (system_id, - *entry); - } - + result = this->id_hint_strategy_->system_id (system_id, + *entry); return result; } @@ -57,14 +51,10 @@ TAO_Active_Object_Map::bind_using_system_id_returning_user_id (PortableServer::S int result = this->id_assignment_strategy_->bind_using_system_id (servant, entry); - if (result == 0) - { - ACE_NEW_RETURN (user_id, - PortableServer::ObjectId (entry->user_id_), - -1); - } - + ACE_NEW_RETURN (user_id, + PortableServer::ObjectId (entry->user_id_), + -1); return result; } @@ -87,11 +77,8 @@ TAO_Active_Object_Map::find_system_id_using_user_id (const PortableServer::Objec user_id, entry); if (result == 0) - { - result = this->id_hint_strategy_->system_id (system_id, - *entry); - } - + result = this->id_hint_strategy_->system_id (system_id, + *entry); return result; } @@ -140,17 +127,11 @@ TAO_Active_Object_Map::find_servant_using_user_id (const PortableServer::ObjectI if (result == 0) { if (entry->deactivated_) - { - result = -1; - } + result = -1; else if (entry->servant_ == 0) - { - result = -1; - } + result = -1; else - { - servant = entry->servant_; - } + servant = entry->servant_; } return result; @@ -180,13 +161,9 @@ TAO_Active_Object_Map::find_servant_and_system_id_using_user_id (const PortableS if (result == 0) { if (entry->deactivated_) - { - result = -1; - } + result = -1; else if (entry->servant_ == 0) - { - result = -1; - } + result = -1; else { servant = entry->servant_; @@ -213,14 +190,10 @@ TAO_Active_Object_Map::find_user_id_using_system_id (const PortableServer::Objec PortableServer::ObjectId id; int result = this->id_hint_strategy_->recover_key (system_id, id); - if (result == 0) - { - ACE_NEW_RETURN (user_id, - PortableServer::ObjectId (id), - -1); - } - + ACE_NEW_RETURN (user_id, + PortableServer::ObjectId (id), + -1); return 0; } diff --git a/TAO/tao/Any.cpp b/TAO/tao/Any.cpp index fa75cd2eb1d..f38210d6cfe 100644 --- a/TAO/tao/Any.cpp +++ b/TAO/tao/Any.cpp @@ -48,8 +48,9 @@ CORBA_Any::type (void) const return CORBA::TypeCode::_duplicate (this->type_); } -// Will replace if the typecode arg is an -// alias for the existing one - otherwise raises an exception. +// Will replace if the typecode arg is an alias for the existing one - +// otherwise raises an exception. + void CORBA_Any::type (CORBA::TypeCode_ptr tc, CORBA::Environment &env) @@ -60,14 +61,13 @@ CORBA_Any::type (CORBA::TypeCode_ptr tc, this->type_ = CORBA::TypeCode::_duplicate (tc); } else - { - env.exception (new CORBA::BAD_TYPECODE ()); - } + env.exception (new CORBA::BAD_TYPECODE ()); } -// TAO doesn't give any guarantees if the value returned by value can be cast -// to the desired type. This is a deprecated routine and its use must be -// avoided. Use the >>= operators. +// TAO doesn't give any guarantees if the value returned by value can +// be cast to the desired type. This is a deprecated routine and its +// use must be avoided. Use the >>= operators. + const void * CORBA_Any::value (void) const { @@ -105,10 +105,13 @@ CORBA_Any::CORBA_Any (CORBA::TypeCode_ptr tc, CORBA::Environment env; TAO_OutputCDR stream; - // encode the value - stream.encode (this->type_, this->value_, 0, env); + // Encode the value. + stream.encode (this->type_, + this->value_, + 0, + env); - // retrieve the start of the message block chain and save it + // Retrieve the start of the message block chain and save it. this->cdr_ = stream.begin ()->clone (); } } @@ -131,19 +134,23 @@ CORBA_Any::CORBA_Any (const CORBA_Any &src) any_owns_data_ (0) { if (src.type_ != 0) - this->type_ = CORBA::TypeCode::_duplicate (src.type_); + this->type_ = + CORBA::TypeCode::_duplicate (src.type_); else - this->type_ = CORBA::TypeCode::_duplicate (CORBA::_tc_null); + this->type_ = + CORBA::TypeCode::_duplicate (CORBA::_tc_null); CORBA::Environment env; - // CDR stream always contains encoded object, if any holds anything at all. + // CDR stream always contains encoded object, if any holds anything + // at all. this->cdr_ = ACE_Message_Block::duplicate (src.cdr_); // No need to copy src's value_. We can always get that from cdr. } // assignment operator + CORBA_Any & CORBA_Any::operator= (const CORBA_Any &src) { @@ -153,13 +160,13 @@ CORBA_Any::operator= (const CORBA_Any &src) if (this == &src) return *this; - // decrement the refcount on the Message_Block we hold, it does not + // Decrement the refcount on the Message_Block we hold, it does not // matter if we own the data or not, because we always own the // message block (i.e. it is always cloned or duplicated. ACE_Message_Block::release ((ACE_Message_Block *) this->cdr_); this->cdr_ = 0; - // if we own any previous data, deallocate it + // If we own any previous data, deallocate it. this->free_value (env); if (this->type_ != 0) @@ -167,26 +174,29 @@ CORBA_Any::operator= (const CORBA_Any &src) // Now copy the contents of the source to ourselves. if (src.type_ != 0) - this->type_ = CORBA::TypeCode::_duplicate (src.type_); + this->type_ = + CORBA::TypeCode::_duplicate (src.type_); else - this->type_ = CORBA::TypeCode::_duplicate (CORBA::_tc_null); + this->type_ = + CORBA::TypeCode::_duplicate (CORBA::_tc_null); + this->any_owns_data_ = 0; this->cdr_ = ACE_Message_Block::duplicate (src.cdr_); - // Simply duplicate the cdr string here. We can save the decode operation - // if there's no need to extract the object. + // Simply duplicate the cdr string here. We can save the decode + // operation if there's no need to extract the object. return *this; } // Destructor for an "Any" deep-frees memory if needed. -// CORBA_Any::~CORBA_Any (void) { // decrement the refcount on the Message_Block we hold, it does not // matter if we own the data or not, because we always own the // message block (i.e. it is always cloned or duplicated. + ACE_Message_Block::release (this->cdr_); this->cdr_ = 0; @@ -195,7 +205,6 @@ CORBA_Any::~CORBA_Any (void) if (this->type_) CORBA::release (this->type_); - } // All-at-once replacement of the contents of an "Any." @@ -217,23 +226,27 @@ CORBA_Any::replace (CORBA::TypeCode_ptr tc, // Duplicate tc and then release this->type_, just in case tc and // type_ are the same thing. - CORBA::TypeCode_ptr tmp = CORBA::TypeCode::_duplicate (tc); + CORBA::TypeCode_ptr tmp = + CORBA::TypeCode::_duplicate (tc); CORBA::release (this->type_); this->type_ = tmp; - // NW: I think an Any should alway owns the CDR stream, so I removed the + // @@ NW: I think an Any should alway owns the CDR stream, so I removed the // check here. - // if the Any owns the data, we encode the "value" into a CDR stream and - // store it. We also destroy the "value" since we own it. + // if the Any owns the data, we encode the "value" into a CDR stream + // and store it. We also destroy the "value" since we own it. TAO_OutputCDR stream; - stream.encode (tc, value, 0, ACE_TRY_ENV); + stream.encode (tc, + value, + 0, + ACE_TRY_ENV); ACE_CHECK; - this->value_ = ACE_const_cast(void *, value); + this->value_ = ACE_const_cast (void *, value); this->any_owns_data_ = any_owns_data; this->cdr_ = 0; - // retrieve the start of the message block chain and duplicate it + // Retrieve the start of the message block chain and duplicate it. this->cdr_ = ACE_Message_Block::duplicate (stream.begin ()); } @@ -259,8 +272,8 @@ CORBA_Any::_tao_replace (CORBA::TypeCode_ptr tc, this->any_owns_data_ = 0; this->cdr_ = ACE_Message_Block::duplicate (mb); - // We can save the decode operation - // if there's no need to extract the object. + // We can save the decode operation if there's no need to extract + // the object. } void @@ -290,8 +303,8 @@ CORBA_Any::_tao_replace (CORBA::TypeCode_ptr tc, this->any_owns_data_ = any_owns_data; this->cdr_ = ACE_Message_Block::duplicate (mb); - // We can save the decode operation - // if there's no need to extract the object. + // We can save the decode operation if there's no need to extract + // the object. } void @@ -315,6 +328,7 @@ CORBA_Any::_tao_replace (CORBA::TypeCode_ptr tc, } // Free internal data. + void CORBA_Any::free_value (CORBA::Environment &env) { @@ -327,13 +341,17 @@ CORBA_Any::free_value (CORBA::Environment &env) this->value_ = 0; } -// insertion of typecode +// Insertion of typecode. + void CORBA_Any::operator<<= (CORBA::TypeCode_ptr tc) { CORBA::Environment env; CORBA::TypeCode_ptr *_tao_tc; - ACE_NEW (_tao_tc, CORBA::TypeCode_ptr); + + ACE_NEW (_tao_tc, + CORBA::TypeCode_ptr); + *_tao_tc = CORBA::TypeCode::_duplicate (tc); this->replace (CORBA::_tc_TypeCode, _tao_tc, @@ -341,21 +359,28 @@ CORBA_Any::operator<<= (CORBA::TypeCode_ptr tc) env); } -// insertion of CORBA object - copying +// Insertion of CORBA object - copying. + void CORBA::Any::operator<<= (const CORBA::Object_ptr obj) { - CORBA::Object_ptr objptr = CORBA::Object::_duplicate (obj); + CORBA::Object_ptr objptr = + CORBA::Object::_duplicate (obj); + (*this) <<= &objptr; } -// insertion of CORBA object - non-copying +// Insertion of CORBA object - non-copying. + void CORBA::Any::operator<<= (CORBA::Object_ptr *objptr) { CORBA::Environment env; CORBA::Object_ptr *_tao_object_ptr; - ACE_NEW (_tao_object_ptr, CORBA::Object_ptr); + + ACE_NEW (_tao_object_ptr, + CORBA::Object_ptr); + *_tao_object_ptr = *objptr; this->replace (CORBA::_tc_Object, _tao_object_ptr, @@ -363,7 +388,8 @@ CORBA::Any::operator<<= (CORBA::Object_ptr *objptr) env); } -// insertion of from_string +// Insertion of from_string. + void CORBA_Any::operator<<= (from_string s) { @@ -376,15 +402,17 @@ CORBA_Any::operator<<= (from_string s) }; CORBA::TypeCode_ptr tc = 0; + if (s.bound_ > 0) { // Bounded string. _oc_string [1] = s.bound_; - ACE_NEW (tc, CORBA::TypeCode (CORBA::tk_string, - sizeof _oc_string, - (char *) &_oc_string, - 1, - sizeof (CORBA::String_var))); + ACE_NEW (tc, + CORBA::TypeCode (CORBA::tk_string, + sizeof _oc_string, + (char *) &_oc_string, + 1, + sizeof (CORBA::String_var))); } else tc = CORBA::_tc_string; // unbounded. @@ -392,10 +420,13 @@ CORBA_Any::operator<<= (from_string s) CORBA::Environment env; if (s.nocopy_) this->replace (tc, new char* (s.val_), 1, env); - else - // copying - this->replace (tc, new char* (CORBA::string_dup (s.val_)), - 1, env); + else // copying. + this->replace (tc, + // @@ Jeff, shouldn't we be checking to see if + // "new" fails?! + new char *(CORBA::string_dup (s.val_)), + 1, + env); } // Extraction: these are safe and hence we have to check that the @@ -408,20 +439,20 @@ CORBA_Any::operator>>= (CORBA::Short &s) const CORBA::Environment env; if (this->type_->equivalent (CORBA::_tc_short, env)) - { - if (this->any_owns_data_ && this->value_) - { - s = *(CORBA::Short *) this->value_; - return 1; - } - else { - TAO_InputCDR stream (this->cdr_); - return stream.read_short (s); + if (this->any_owns_data_ && this->value_) + { + s = *(CORBA::Short *) this->value_; + return 1; + } + else + { + TAO_InputCDR stream (this->cdr_); + return stream.read_short (s); + } } - } else - return 0; + return 0; } CORBA::Boolean @@ -430,20 +461,20 @@ CORBA_Any::operator>>= (CORBA::UShort &s) const CORBA::Environment env; if (this->type_->equivalent (CORBA::_tc_ushort, env)) - { - if (this->any_owns_data_ && this->value_) - { - s = *(CORBA::UShort *) this->value_; - return 1; - } - else { - TAO_InputCDR stream (this->cdr_); - return stream.read_ushort (s); + if (this->any_owns_data_ && this->value_) + { + s = *(CORBA::UShort *) this->value_; + return 1; + } + else + { + TAO_InputCDR stream (this->cdr_); + return stream.read_ushort (s); + } } - } else - return 0; + return 0; } CORBA::Boolean @@ -452,20 +483,20 @@ CORBA_Any::operator>>= (CORBA::Long &l) const CORBA::Environment env; if (this->type_->equivalent (CORBA::_tc_long, env)) - { - if (this->any_owns_data_ && this->value_) { - l = *(CORBA::Long *) this->value_; - return 1; - } - else - { - TAO_InputCDR stream (this->cdr_); - return stream.read_long (l); + if (this->any_owns_data_ && this->value_) + { + l = *(CORBA::Long *) this->value_; + return 1; + } + else + { + TAO_InputCDR stream (this->cdr_); + return stream.read_long (l); + } } - } else - return 0; + return 0; } CORBA::Boolean @@ -474,20 +505,20 @@ CORBA_Any::operator>>= (CORBA::ULong &l) const CORBA::Environment env; if (this->type_->equivalent (CORBA::_tc_ulong, env)) - { - if (this->any_owns_data_ && this->value_) - { - l = *(CORBA::ULong *) this->value_; - return 1; - } - else { - TAO_InputCDR stream (this->cdr_); - return stream.read_ulong (l); + if (this->any_owns_data_ && this->value_) + { + l = *(CORBA::ULong *) this->value_; + return 1; + } + else + { + TAO_InputCDR stream (this->cdr_); + return stream.read_ulong (l); + } } - } else - return 0; + return 0; } CORBA::Boolean @@ -496,20 +527,20 @@ CORBA_Any::operator>>= (CORBA::LongLong &l) const CORBA::Environment env; if (this->type_->equivalent (CORBA::_tc_longlong, env)) - { - if (this->any_owns_data_ && this->value_) { - l = *(CORBA::LongLong *) this->value_; - return 1; - } - else - { - TAO_InputCDR stream (this->cdr_); - return stream.read_longlong (l); + if (this->any_owns_data_ && this->value_) + { + l = *(CORBA::LongLong *) this->value_; + return 1; + } + else + { + TAO_InputCDR stream (this->cdr_); + return stream.read_longlong (l); + } } - } else - return 0; + return 0; } CORBA::Boolean @@ -518,20 +549,20 @@ CORBA_Any::operator>>= (CORBA::ULongLong &l) const CORBA::Environment env; if (this->type_->equivalent (CORBA::_tc_ulonglong, env)) - { - if (this->any_owns_data_ && this->value_) - { - l = *(CORBA::ULongLong *) this->value_; - return 1; - } - else { - TAO_InputCDR stream (this->cdr_); - return stream.read_ulonglong (l); + if (this->any_owns_data_ && this->value_) + { + l = *(CORBA::ULongLong *) this->value_; + return 1; + } + else + { + TAO_InputCDR stream (this->cdr_); + return stream.read_ulonglong (l); + } } - } else - return 0; + return 0; } CORBA::Boolean @@ -540,20 +571,20 @@ CORBA_Any::operator>>= (CORBA::Float &f) const CORBA::Environment env; if (this->type_->equivalent (CORBA::_tc_float, env)) - { - if (this->any_owns_data_ && this->value_) - { - f = *(CORBA::Float *) this->value_; - return 1; - } - else { - TAO_InputCDR stream (this->cdr_); - return stream.read_float (f); + if (this->any_owns_data_ && this->value_) + { + f = *(CORBA::Float *) this->value_; + return 1; + } + else + { + TAO_InputCDR stream (this->cdr_); + return stream.read_float (f); + } } - } else - return 0; + return 0; } CORBA::Boolean @@ -562,20 +593,20 @@ CORBA_Any::operator>>= (CORBA::Double &d) const CORBA::Environment env; if (this->type_->equivalent (CORBA::_tc_double, env)) - { - if (this->any_owns_data_ && this->value_) { - d = *(CORBA::Double *) this->value_; - return 1; - } - else - { - TAO_InputCDR stream (this->cdr_); - return stream.read_double (d); + if (this->any_owns_data_ && this->value_) + { + d = *(CORBA::Double *) this->value_; + return 1; + } + else + { + TAO_InputCDR stream (this->cdr_); + return stream.read_double (d); + } } - } else - return 0; + return 0; } CORBA::Boolean @@ -584,22 +615,22 @@ CORBA_Any::operator>>= (CORBA::Any &a) const CORBA::Environment env; if (this->type_->equivalent (CORBA::_tc_any, env)) - { - if (this->any_owns_data_ && this->value_) - { - a = *(CORBA::Any *) this->value_; - return 1; - } - else { - TAO_InputCDR stream (this->cdr_); - // decode the CDR - return (stream.decode (CORBA::_tc_any, &a, 0, env) - == CORBA::TypeCode::TRAVERSE_CONTINUE) ? 1 : 0; + if (this->any_owns_data_ && this->value_) + { + a = *(CORBA::Any *) this->value_; + return 1; + } + else + { + TAO_InputCDR stream (this->cdr_); + // decode the CDR + return (stream.decode (CORBA::_tc_any, &a, 0, env) + == CORBA::TypeCode::TRAVERSE_CONTINUE) ? 1 : 0; + } } - } else - return 0; + return 0; } CORBA::Boolean @@ -608,28 +639,32 @@ CORBA_Any::operator>>= (char *&s) const CORBA::Environment env; if (this->type_->equal (CORBA::_tc_string, env)) - { - if (this->any_owns_data_ && this->value_) { - s = *(char **) this->value_; - return 1; - } - else - { - TAO_InputCDR stream (this->cdr_); - if (stream.read_string (s)) - { - ACE_const_cast(CORBA_Any*, this)->any_owns_data_ = 1; - char** tmp = new char*; - *tmp = s; - ACE_const_cast(CORBA_Any*, this)->value_ = tmp; - return 1; - } - return 0; + if (this->any_owns_data_ && this->value_) + { + s = *(char **) this->value_; + return 1; + } + else + { + TAO_InputCDR stream (this->cdr_); + if (stream.read_string (s)) + { + ACE_const_cast (CORBA_Any *, + this)->any_owns_data_ = 1; + // @@ Jeff, shouldn't we check if "new" fails? + char** tmp = new char*; + *tmp = s; + ACE_const_cast (CORBA_Any *, + this)->value_ = tmp; + return 1; + } + + return 0; + } } - } else - return 0; + return 0; } CORBA::Boolean @@ -638,26 +673,26 @@ CORBA_Any::operator>>= (CORBA::TypeCode_ptr &tc) const CORBA::Environment env; if (this->type_->equivalent (CORBA::_tc_TypeCode, env)) - { - if (this->any_owns_data_ && this->value_) { - tc = *(CORBA::TypeCode_ptr *) this->value_; - return 1; - } - else - { - TAO_InputCDR stream ((ACE_Message_Block *) this->cdr_); - CORBA::Boolean flag = - (stream.decode (CORBA::_tc_TypeCode, - &tc, - 0, - env) - == CORBA::TypeCode::TRAVERSE_CONTINUE) ? 1 : 0; - return flag; + if (this->any_owns_data_ && this->value_) + { + tc = *(CORBA::TypeCode_ptr *) this->value_; + return 1; + } + else + { + TAO_InputCDR stream ((ACE_Message_Block *) this->cdr_); + CORBA::Boolean flag = + (stream.decode (CORBA::_tc_TypeCode, + &tc, + 0, + env) + == CORBA::TypeCode::TRAVERSE_CONTINUE) ? 1 : 0; + return flag; + } } - } else - return 0; + return 0; } // = extraction into the special types @@ -668,20 +703,20 @@ CORBA_Any::operator>>= (to_boolean b) const CORBA::Environment env; if (this->type_->equivalent (CORBA::_tc_boolean, env)) - { - if (this->any_owns_data_ && this->value_) - { - b.ref_ = *(CORBA::Boolean *) this->value_; - return 1; - } - else { - TAO_InputCDR stream ((ACE_Message_Block *) this->cdr_); - return stream.read_boolean (b.ref_); + if (this->any_owns_data_ && this->value_) + { + b.ref_ = *(CORBA::Boolean *) this->value_; + return 1; + } + else + { + TAO_InputCDR stream ((ACE_Message_Block *) this->cdr_); + return stream.read_boolean (b.ref_); + } } - } else - return 0; + return 0; } CORBA::Boolean @@ -690,20 +725,20 @@ CORBA_Any::operator>>= (to_octet o) const CORBA::Environment env; if (this->type_->equivalent (CORBA::_tc_octet, env)) - { - if (this->any_owns_data_ && this->value_) { - o.ref_ = *(CORBA::Octet *) this->value_; - return 1; - } - else - { - TAO_InputCDR stream ((ACE_Message_Block *) this->cdr_); - return stream.read_octet (o.ref_); + if (this->any_owns_data_ && this->value_) + { + o.ref_ = *(CORBA::Octet *) this->value_; + return 1; + } + else + { + TAO_InputCDR stream ((ACE_Message_Block *) this->cdr_); + return stream.read_octet (o.ref_); + } } - } else - return 0; + return 0; } CORBA::Boolean @@ -712,20 +747,20 @@ CORBA_Any::operator>>= (to_char c) const CORBA::Environment env; if (this->type_->equivalent (CORBA::_tc_char, env)) - { - if (this->any_owns_data_ && this->value_) - { - c.ref_ = *(CORBA::Char *) this->value_; - return 1; - } - else { - TAO_InputCDR stream ((ACE_Message_Block *) this->cdr_); - return stream.read_char (c.ref_); + if (this->any_owns_data_ && this->value_) + { + c.ref_ = *(CORBA::Char *) this->value_; + return 1; + } + else + { + TAO_InputCDR stream ((ACE_Message_Block *) this->cdr_); + return stream.read_char (c.ref_); + } } - } else - return 0; + return 0; } CORBA::Boolean @@ -734,20 +769,20 @@ CORBA_Any::operator>>= (to_wchar wc) const CORBA::Environment env; if (this->type_->equivalent (CORBA::_tc_wchar, env)) - { - if (this->any_owns_data_ && this->value_) - { - wc.ref_ = *(CORBA::WChar *) this->value_; - return 1; - } - else { - TAO_InputCDR stream ((ACE_Message_Block *) this->cdr_); - return stream.read_wchar (wc.ref_); + if (this->any_owns_data_ && this->value_) + { + wc.ref_ = *(CORBA::WChar *) this->value_; + return 1; + } + else + { + TAO_InputCDR stream ((ACE_Message_Block *) this->cdr_); + return stream.read_wchar (wc.ref_); + } } - } else - return 0; + return 0; } CORBA::Boolean @@ -756,26 +791,27 @@ CORBA_Any::operator>>= (to_string s) const CORBA::Environment env; if (this->type_->equivalent (CORBA::_tc_string, env)) - { - CORBA::ULong bound = this->type_->length (env); - if (s.bound_ == bound) // bounds are same { - if (this->any_owns_data_ && this->value_) - { - s.val_ = *(char **) this->value_; - return 1; - } - else - { - TAO_InputCDR stream ((ACE_Message_Block *) this->cdr_); - if (stream.read_string (s.val_)) + CORBA::ULong bound = this->type_->length (env); + if (s.bound_ == bound) // bounds are same { - ACE_const_cast (CORBA_Any*, this)->any_owns_data_ = 1; - return 1; + if (this->any_owns_data_ && this->value_) + { + s.val_ = *(char **) this->value_; + return 1; + } + else + { + TAO_InputCDR stream ((ACE_Message_Block *) this->cdr_); + if (stream.read_string (s.val_)) + { + ACE_const_cast (CORBA_Any *, + this)->any_owns_data_ = 1; + return 1; + } + } } - } } - } // Otherwise. return 0; @@ -787,48 +823,53 @@ CORBA_Any::operator>>= (to_object obj) const CORBA::Environment env; if (this->type_->equivalent (CORBA::_tc_Object, env)) - { - if (this->any_owns_data_ && this->value_) - { - obj.ref_ = *(CORBA::Object_ptr *) this->value_; - return 1; - } - else { - // @@ This uses ORB_Core instance because we need one to - // demarshal objects (to create the right profiles for that - // object), but the Any does not belong to any ORB. - TAO_InputCDR stream (this->cdr_, - ACE_CDR_BYTE_ORDER, - TAO_ORB_Core_instance ()); - - CORBA::Boolean flag = (stream.decode (CORBA::_tc_Object, - &obj.ref_, 0, env) - == CORBA::TypeCode::TRAVERSE_CONTINUE) ? 1:0; - if (flag) - { - CORBA::Object_ptr *tmp = new CORBA::Object_ptr; - *tmp = obj.ref_; - ACE_const_cast(CORBA_Any*,this)->value_ = tmp; - return 1; - } - // we own this allocated value - // this->value_ = obj.ref_; - return flag; + if (this->any_owns_data_ && this->value_) + { + obj.ref_ = *(CORBA::Object_ptr *) this->value_; + return 1; + } + else + { + // @@ This uses ORB_Core instance because we need one to + // demarshal objects (to create the right profiles for that + // object), but the Any does not belong to any ORB. + TAO_InputCDR stream (this->cdr_, + ACE_CDR_BYTE_ORDER, + TAO_ORB_Core_instance ()); + + CORBA::Boolean flag = (stream.decode (CORBA::_tc_Object, + &obj.ref_, 0, env) + == CORBA::TypeCode::TRAVERSE_CONTINUE) ? 1:0; + if (flag) + { + CORBA::Object_ptr *tmp = new CORBA::Object_ptr; + *tmp = obj.ref_; + ACE_const_cast (CORBA_Any *, + this)->value_ = tmp; + return 1; + } + // we own this allocated value + // this->value_ = obj.ref_; + return flag; + } } - } else - return 0; + return 0; } -// this is a copying version for unbounded strings -// Not inline, to avoid use in Any.i before definition in ORB.i. +// this is a copying version for unbounded strings Not inline, to +// avoid use in Any.i before definition in ORB.i. + void CORBA_Any::operator<<= (const char* s) { CORBA::Environment env; - this->replace (CORBA::_tc_string, new char* (CORBA::string_dup (s)), - 1, env); + this->replace (CORBA::_tc_string, + // @@ Jeff, shouldn't we be checking if "new" failed? + new char* (CORBA::string_dup (s)), + 1, + env); } // ---------------------------------------------------------------------- @@ -839,12 +880,12 @@ CORBA::Any_var & CORBA_Any_var::operator= (CORBA::Any *p) { if (this->ptr_ != p) - { - if (this->ptr_ != 0) - delete (this->ptr_); + { + if (this->ptr_ != 0) + delete (this->ptr_); - this->ptr_ = p; - } + this->ptr_ = p; + } return *this; } @@ -854,6 +895,9 @@ CORBA_Any_var::operator= (const CORBA::Any_var& r) if (this->ptr_ != 0) delete this->ptr_; + // @@ Jeff, shouldn't we be checking to see if "new" failed? BTW, + // if this call can fail then maybe we shouldn't be returning + // Any_var & but instead be making this a "void" function? this->ptr_ = new CORBA::Any (*r.ptr_); return *this; } @@ -872,68 +916,90 @@ CORBA_Any::dump (const CORBA::Any &any_value) CORBA::TypeCode_var type = any_value.type (); if (type->equal (CORBA::_tc_null, env)) - ACE_DEBUG ((LM_DEBUG,"Null\n")); + ACE_DEBUG ((LM_DEBUG, + "Null\n")); else if (type->equal (CORBA::_tc_void, env)) - ACE_DEBUG ((LM_DEBUG,"Void\n")); + ACE_DEBUG ((LM_DEBUG, + "Void\n")); else if (type->equal (CORBA::_tc_short, env)) { CORBA::Short s; any_value >>= s; - ACE_DEBUG ((LM_DEBUG,"Short %d\n",s)); + ACE_DEBUG ((LM_DEBUG, + "Short %d\n", + s)); } else if (type->equal (CORBA::_tc_long, env)) { CORBA::Long l; any_value >>= l; - ACE_DEBUG ((LM_DEBUG,"Long %d\n", l)); + ACE_DEBUG ((LM_DEBUG, + "Long %d\n", + l)); } else if (type->equal (CORBA::_tc_ushort, env)) { CORBA::UShort s; any_value >>= s; - ACE_DEBUG ((LM_DEBUG,"UShort %d\n", s)); + ACE_DEBUG ((LM_DEBUG, + "UShort %d\n", + s)); } else if (type->equal (CORBA::_tc_ulong, env)) { CORBA::ULong l; any_value >>= l; - ACE_DEBUG ((LM_DEBUG,"ULong %d\n", l)); + ACE_DEBUG ((LM_DEBUG, + "ULong %d\n", + l)); } else if (type->equal (CORBA::_tc_float, env)) { CORBA::Float f; any_value >>= f; - ACE_DEBUG ((LM_DEBUG,"Float %f\n", f)); + ACE_DEBUG ((LM_DEBUG, + "Float %f\n", + f)); } else if (type->equal (CORBA::_tc_double, env)) { CORBA::Double d; any_value >>= d; - ACE_DEBUG ((LM_DEBUG,"Double %f\n", d)); + ACE_DEBUG ((LM_DEBUG, + "Double %f\n", + d)); } else if (type->equal (CORBA::_tc_boolean, env)) { CORBA::Boolean b; any_value >>= (to_boolean)b; if (b == 1) - ACE_DEBUG ((LM_DEBUG, "Boolean TRUE\n")); + ACE_DEBUG ((LM_DEBUG, + "Boolean TRUE\n")); else - ACE_DEBUG ((LM_DEBUG, "Boolean FALSE\n")); + ACE_DEBUG ((LM_DEBUG, + "Boolean FALSE\n")); } else if (type->equal (CORBA::_tc_char, env)) { CORBA::Char ch; any_value >>= to_char (ch); - ACE_DEBUG ((LM_DEBUG,"Char %c\n", ch)); + ACE_DEBUG ((LM_DEBUG, + "Char %c\n", + ch)); } else if (type->equal (CORBA::_tc_string, env)) { CORBA::String str; any_value >>= str; - ACE_DEBUG ((LM_DEBUG, "String %s\n", str)); + ACE_DEBUG ((LM_DEBUG, + "String %s\n", + str)); } else - ACE_DEBUG ((LM_DEBUG, "TCKind %d\n", type->kind_)); + ACE_DEBUG ((LM_DEBUG, + "TCKind %d\n", + type->kind_)); } diff --git a/TAO/tao/Any.h b/TAO/tao/Any.h index 61153cd8ddc..337f0c79685 100644 --- a/TAO/tao/Any.h +++ b/TAO/tao/Any.h @@ -77,10 +77,10 @@ public: CORBA_Any (CORBA::TypeCode_ptr type, CORBA::UShort dummy, const ACE_Message_Block* mb); - // Constructor. Used by DynAny and others to optimize Any - // activities by using CDR. The dummy arg is to keep calls - // like CORBA_Any foo (CORBA::TypeCode_ptr bar (NULL), NULL) from - // being confused with the constructor above. + // Constructor. Used by DynAny and others to optimize Any activities + // by using CDR. The dummy arg is to keep calls like CORBA_Any foo + // (CORBA::TypeCode_ptr bar (NULL), NULL) from being confused with + // the constructor above. CORBA_Any (const CORBA_Any &a); // Copy constructor. @@ -284,9 +284,9 @@ public: // = TAO extensions CORBA::Boolean any_owns_data (void) const; - // does the Any own the data or not. This is used by the >>= - // operators generated by the IDL compiler. The >>= operator checks - // if the Any owns the data. If it does, then it will simply + // Reports whether the Any own the data or not. This is used by the + // >>= operators generated by the IDL compiler. The >>= operator + // checks if the Any owns the data. If it does, then it will simply // retrieve the data from internal cache. Otherwise, the operator // will have to decode the cdr string. diff --git a/TAO/tao/Any.i b/TAO/tao/Any.i index e90463f0307..ea859f47316 100644 --- a/TAO/tao/Any.i +++ b/TAO/tao/Any.i @@ -8,9 +8,12 @@ CORBA_Any::replace (CORBA::TypeCode_ptr type, const void *value, CORBA::Environment &TAO_IN_ENV) { - // invoke the first form of the replace method and pass the default value - // (FALSE) for the "any_owns_data" parameter - this->replace (type, value, 0, TAO_IN_ENV); + // Invoke the first form of the replace method and pass the default + // value (FALSE) for the "any_owns_data" parameter + this->replace (type, + value, + 0, + TAO_IN_ENV); } ACE_INLINE CORBA::Boolean @@ -31,56 +34,88 @@ ACE_INLINE void CORBA_Any::operator<<= (CORBA::Short s) { CORBA::Environment env; - this->replace (CORBA::_tc_short, new CORBA::Short (s), 1, env); + this->replace (CORBA::_tc_short, + // @@ Jeff, shouldn't we be checking if "new" fails? + new CORBA::Short (s), + 1, + env); } ACE_INLINE void CORBA_Any::operator<<= (CORBA::UShort s) { CORBA::Environment env; - this->replace (CORBA::_tc_ushort, new CORBA::UShort (s), 1, env); + this->replace (CORBA::_tc_ushort, + // @@ Jeff, shouldn't we be checking if "new" fails? + new CORBA::UShort (s), + 1, + env); } ACE_INLINE void CORBA_Any::operator<<= (CORBA::Long l) { CORBA::Environment env; - this->replace (CORBA::_tc_long, new CORBA::Long (l), 1, env); + this->replace (CORBA::_tc_long, + // @@ Jeff, shouldn't we be checking if "new" fails? + new CORBA::Long (l), + 1, + env); } ACE_INLINE void CORBA_Any::operator<<= (CORBA::ULong l) { CORBA::Environment env; - this->replace (CORBA::_tc_ulong, new CORBA::ULong (l), 1, env); + this->replace (CORBA::_tc_ulong, + // @@ Jeff, shouldn't we be checking if "new" fails? + new CORBA::ULong (l), + 1, + env); } ACE_INLINE void CORBA_Any::operator<<= (CORBA::LongLong l) { CORBA::Environment env; - this->replace (CORBA::_tc_longlong, new CORBA::LongLong (l), 1, env); + this->replace (CORBA::_tc_longlong, + // @@ Jeff, shouldn't we be checking if "new" fails? + new CORBA::LongLong (l), + 1, + env); } ACE_INLINE void CORBA_Any::operator<<= (CORBA::ULongLong l) { CORBA::Environment env; - this->replace (CORBA::_tc_ulonglong, new CORBA::ULongLong (l), 1, env); + this->replace (CORBA::_tc_ulonglong, + // @@ Jeff, shouldn't we be checking if "new" fails? + new CORBA::ULongLong (l), + 1, + env); } ACE_INLINE void CORBA_Any::operator<<= (CORBA::Float f) { CORBA::Environment env; - this->replace (CORBA::_tc_float, new CORBA::Float (f), 1, env); + this->replace (CORBA::_tc_float, + // @@ Jeff, shouldn't we be checking if "new" fails? + new CORBA::Float (f), + 1, + env); } ACE_INLINE void CORBA_Any::operator<<= (CORBA::Double d) { CORBA::Environment env; - this->replace (CORBA::_tc_double, new CORBA::Double (d), 1, env); + this->replace (CORBA::_tc_double, + // @@ Jeff, shouldn't we be checking if "new" fails? + new CORBA::Double (d), + 1, + env); } // insertion of Any - copying @@ -88,7 +123,11 @@ ACE_INLINE void CORBA_Any::operator<<= (const CORBA_Any& a) { CORBA::Environment env; - this->replace (CORBA::_tc_any, new CORBA_Any (a), 1, env); + this->replace (CORBA::_tc_any, + // @@ Jeff, shouldn't we be checking if "new" fails? + new CORBA_Any (a), + 1, + env); } // insertion of Any - non-copying @@ -96,7 +135,11 @@ ACE_INLINE void CORBA::Any::operator<<= (CORBA::Any_ptr anyptr) { CORBA::Environment env; - this->replace (CORBA::_tc_any, anyptr, 1, env); + this->replace (CORBA::_tc_any, + // @@ Jeff, shouldn't we be checking if "new" fails? + anyptr, + 1, + env); } // implementing the special types @@ -110,32 +153,44 @@ ACE_INLINE void CORBA_Any::operator<<= (from_boolean b) { CORBA::Environment env; - this->replace (CORBA::_tc_boolean, new CORBA::Boolean (b.val_), - 1, env); + this->replace (CORBA::_tc_boolean, + // @@ Jeff, shouldn't we be checking if "new" fails? + new CORBA::Boolean (b.val_), + 1, + env); } ACE_INLINE void CORBA_Any::operator<<= (from_octet o) { CORBA::Environment env; - this->replace (CORBA::_tc_octet, new CORBA::Octet (o.val_), - 1, env); + this->replace (CORBA::_tc_octet, + // @@ Jeff, shouldn't we be checking if "new" fails? + new CORBA::Octet (o.val_), + 1, + env); } ACE_INLINE void CORBA_Any::operator<<= (from_char c) { CORBA::Environment env; - this->replace (CORBA::_tc_char, new CORBA::Char (c.val_), - 1, env); + this->replace (CORBA::_tc_char, + // @@ Jeff, shouldn't we be checking if "new" fails? + new CORBA::Char (c.val_), + 1, + env); } ACE_INLINE void CORBA_Any::operator<<= (from_wchar wc) { CORBA::Environment env; - this->replace (CORBA::_tc_wchar, new CORBA::WChar (wc.val_), - 1, env); + this->replace (CORBA::_tc_wchar, + // @@ Jeff, shouldn't we be checking if "new" fails? + new CORBA::WChar (wc.val_), + 1, + env); } // ************************************************************* @@ -156,6 +211,7 @@ CORBA_Any_var::CORBA_Any_var (CORBA_Any *p) ACE_INLINE CORBA_Any_var::CORBA_Any_var (const CORBA_Any_var& r) + // @@ Jeff, shouldn't we be checking if "new" fails? : ptr_ (new CORBA::Any (*r.ptr_)) { } diff --git a/TAO/tao/CDR.cpp b/TAO/tao/CDR.cpp index e0d7dc513e1..b16c3708661 100644 --- a/TAO/tao/CDR.cpp +++ b/TAO/tao/CDR.cpp @@ -46,25 +46,24 @@ ACE_RCSID(tao, CDR, "$Id$") #if defined (ACE_ENABLE_TIMEPROBES) static const char *TAO_CDR_Timeprobe_Description[] = - { - "OutputCDR::ctor[1] - enter", - "OutputCDR::ctor[1] - leave", - "OutputCDR::ctor[2] - enter", - "OutputCDR::ctor[2] - leave", - "OutputCDR::ctor[3] - enter", - "OutputCDR::ctor[3] - leave" - }; +{ + "OutputCDR::ctor[1] - enter", + "OutputCDR::ctor[1] - leave", + "OutputCDR::ctor[2] - enter", + "OutputCDR::ctor[2] - leave", + "OutputCDR::ctor[3] - enter", + "OutputCDR::ctor[3] - leave" +}; enum - { - TAO_OUTPUT_CDR_CTOR1_ENTER = 2000, - TAO_OUTPUT_CDR_CTOR1_LEAVE, - TAO_OUTPUT_CDR_CTOR2_ENTER, - TAO_OUTPUT_CDR_CTOR2_LEAVE, - TAO_OUTPUT_CDR_CTOR3_ENTER, - TAO_OUTPUT_CDR_CTOR3_LEAVE - }; - +{ + TAO_OUTPUT_CDR_CTOR1_ENTER = 2000, + TAO_OUTPUT_CDR_CTOR1_LEAVE, + TAO_OUTPUT_CDR_CTOR2_ENTER, + TAO_OUTPUT_CDR_CTOR2_LEAVE, + TAO_OUTPUT_CDR_CTOR3_ENTER, + TAO_OUTPUT_CDR_CTOR3_LEAVE +}; // Setup Timeprobes ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_CDR_Timeprobe_Description, @@ -72,10 +71,6 @@ ACE_TIMEPROBE_EVENT_DESCRIPTIONS (TAO_CDR_Timeprobe_Description, #endif /* ACE_ENABLE_TIMEPROBES */ -// **************************************************************** -// **************************************************************** -// **************************************************************** - TAO_OutputCDR::TAO_OutputCDR (size_t size, int byte_order, ACE_Allocator *buffer_allocator, @@ -135,18 +130,23 @@ TAO_OutputCDR::encode (CORBA::TypeCode_ptr tc, CORBA::Environment &ACE_TRY_ENV) { TAO_Marshal_Object *mobj = - TAO_MARSHAL_FACTORY::instance ()->make_marshal_object (tc, - ACE_TRY_ENV); + TAO_MARSHAL_FACTORY::instance ()->make_marshal_object + (tc, ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::TypeCode::TRAVERSE_STOP); if (!mobj) return CORBA::TypeCode::TRAVERSE_STOP; - return mobj->encode (tc, data, data2, this, ACE_TRY_ENV); + return mobj->encode (tc, + data, + data2, + this, + ACE_TRY_ENV); } CORBA::Boolean -operator<< (TAO_OutputCDR& cdr, const CORBA::Any &x) +operator<< (TAO_OutputCDR& cdr, + const CORBA::Any &x) { // @@ This function should *not* use the interpreter, there must be // a way to do this with just CDR operations!!!! @@ -251,14 +251,19 @@ TAO_InputCDR::decode (CORBA::TypeCode_ptr tc, CORBA::Environment &ACE_TRY_ENV) { TAO_Marshal_Object *mobj = - TAO_MARSHAL_FACTORY::instance ()->make_marshal_object (tc, - ACE_TRY_ENV); + TAO_MARSHAL_FACTORY::instance ()->make_marshal_object + (tc, ACE_TRY_ENV); + ACE_CHECK_RETURN (CORBA::TypeCode::TRAVERSE_STOP); if (!mobj) return CORBA::TypeCode::TRAVERSE_STOP; - return mobj->decode (tc, data, data2, this, ACE_TRY_ENV); + return mobj->decode (tc, + data, + data2, + this, + ACE_TRY_ENV); } CORBA::TypeCode::traverse_status @@ -266,18 +271,21 @@ TAO_InputCDR::skip (CORBA::TypeCode_ptr tc, CORBA::Environment &ACE_TRY_ENV) { TAO_Marshal_Object *mobj = - TAO_MARSHAL_FACTORY::instance ()->make_marshal_object (tc, - ACE_TRY_ENV); + TAO_MARSHAL_FACTORY::instance ()->make_marshal_object + (tc, ACE_TRY_ENV); ACE_CHECK_RETURN (CORBA::TypeCode::TRAVERSE_STOP); if (mobj == 0) return CORBA::TypeCode::TRAVERSE_STOP; - return mobj->skip (tc, this, ACE_TRY_ENV); + return mobj->skip (tc, + this, + ACE_TRY_ENV); } CORBA::Boolean -operator>> (TAO_InputCDR& cdr, CORBA::Any &x) +operator>> (TAO_InputCDR &cdr, + CORBA::Any &x) { ACE_TRY_NEW_ENV { diff --git a/TAO/tao/CDR.h b/TAO/tao/CDR.h index fdeb718c212..c4dcbd2476f 100644 --- a/TAO/tao/CDR.h +++ b/TAO/tao/CDR.h @@ -109,12 +109,12 @@ public: // remove <data>, since it did not allocate it. ~TAO_OutputCDR (void); - // destructor + // Destructor. CORBA::TypeCode::traverse_status append (CORBA::TypeCode_ptr tc, - TAO_InputCDR *src, - CORBA_Environment &ACE_TRY_ENV = - TAO_default_environment ()); + TAO_InputCDR *src, + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()); // Append the contents of the CDR stream based on information // described by <tc>; returning any errors in <TAO_IN_ENV>. @@ -124,10 +124,10 @@ public: // = TAO specific methods. CORBA::TypeCode::traverse_status encode (CORBA::TypeCode_ptr tc, - const void *data, - const void *, - CORBA_Environment &ACE_TRY_ENV = - TAO_default_environment ()); + const void *data, + const void *, + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()); // Marshalls the contents of <data> as described by the TypeCode in // <tc>. Any errors are reported though the <TAO_IN_ENV> parameter. @@ -198,12 +198,11 @@ public: TAO_InputCDR (const TAO_InputCDR& rhs, size_t size); // This creates an encapsulated stream, the first byte must be (per - // the spec) the byte order of the encapsulation. - - // The default values for the allocators - // in this constructor are not 0, but are generated by the - // ORB. Refer to the constructor body in CDR.cpp for the - // code that supplies these values to the base class constructor. + // the spec) the byte order of the encapsulation. The default + // values for the allocators in this constructor are not 0, but are + // generated by the ORB. Refer to the constructor body in CDR.cpp + // for the code that supplies these values to the base class + // constructor. TAO_InputCDR (const TAO_OutputCDR& rhs, ACE_Allocator* buffer_allocator = 0, @@ -216,23 +215,21 @@ public: // = TAO specific methods. - CORBA::TypeCode::traverse_status decode ( - CORBA::TypeCode_ptr tc, - const void *data, - const void *, - CORBA_Environment &ACE_TRY_ENV = - TAO_default_environment ()); + CORBA::TypeCode::traverse_status decode (CORBA::TypeCode_ptr tc, + const void *data, + const void *, + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()); // Demarshall the contents of the CDR stream into <data> as // described by <tc>; returning any errors in <TAO_IN_ENV>. - CORBA::TypeCode::traverse_status skip ( - CORBA::TypeCode_ptr tc, - CORBA_Environment &ACE_TRY_ENV = - TAO_default_environment ()); + CORBA::TypeCode::traverse_status skip (CORBA::TypeCode_ptr tc, + CORBA_Environment &ACE_TRY_ENV = + TAO_default_environment ()); // Skip the contents of the CDR stream based on information // described by <tc>; returning any errors in <TAO_IN_ENV>. - TAO_ORB_Core* orb_core (void) const; + TAO_ORB_Core *orb_core (void) const; // Accessor private: diff --git a/TAO/tao/CDR.i b/TAO/tao/CDR.i index b1e8445fbe9..f4d61111e5a 100644 --- a/TAO/tao/CDR.i +++ b/TAO/tao/CDR.i @@ -6,8 +6,6 @@ TAO_OutputCDR::~TAO_OutputCDR (void) { } -// **************************************************************** - ACE_INLINE TAO_InputCDR::TAO_InputCDR (const char *buf, size_t bufsiz, @@ -100,61 +98,61 @@ TAO_InputCDR::orb_core (void) const ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os, CORBA::Short x) { - return ACE_static_cast(ACE_OutputCDR&,os) << x; + return ACE_static_cast (ACE_OutputCDR &, os) << x; } ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os, CORBA::UShort x) { - return ACE_static_cast(ACE_OutputCDR&,os) << x; + return ACE_static_cast (ACE_OutputCDR &, os) << x; } ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os, CORBA::Long x) { - return ACE_static_cast(ACE_OutputCDR&,os) << x; + return ACE_static_cast (ACE_OutputCDR &, os) << x; } ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os, CORBA::ULong x) { - return ACE_static_cast(ACE_OutputCDR&,os) << x; + return ACE_static_cast (ACE_OutputCDR &, os) << x; } ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os, CORBA::LongLong x) { - return ACE_static_cast(ACE_OutputCDR&,os) << x; + return ACE_static_cast (ACE_OutputCDR &, os) << x; } ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os, CORBA::ULongLong x) { - return ACE_static_cast(ACE_OutputCDR&,os) << x; + return ACE_static_cast (ACE_OutputCDR &, os) << x; } ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR& os, CORBA::LongDouble x) { - return ACE_static_cast(ACE_OutputCDR&,os) << x; + return ACE_static_cast (ACE_OutputCDR &, os) << x; } ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os, CORBA::Float x) { - return ACE_static_cast(ACE_OutputCDR&,os) << x; + return ACE_static_cast (ACE_OutputCDR &, os) << x; } ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os, CORBA::Double x) { - return ACE_static_cast(ACE_OutputCDR&,os) << x; + return ACE_static_cast (ACE_OutputCDR &, os) << x; } ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os, const CORBA::Char* x) { - return ACE_static_cast(ACE_OutputCDR&,os) << x; + return ACE_static_cast (ACE_OutputCDR &, os) << x; } // **************************************************************** @@ -162,13 +160,13 @@ ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &os, ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, CORBA::Short &x) { - return ACE_static_cast(ACE_InputCDR&,is) >> x; + return ACE_static_cast (ACE_InputCDR &, is) >> x; } ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, CORBA::UShort &x) { - return ACE_static_cast(ACE_InputCDR&,is) >> x; + return ACE_static_cast (ACE_InputCDR &, is) >> x; } ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, @@ -180,41 +178,41 @@ ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, CORBA::ULong &x) { - return ACE_static_cast(ACE_InputCDR&,is) >> x; + return ACE_static_cast (ACE_InputCDR &, is) >> x; } ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, CORBA::LongLong &x) { - return ACE_static_cast(ACE_InputCDR&,is) >> x; + return ACE_static_cast (ACE_InputCDR &, is) >> x; } ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, CORBA::ULongLong &x) { - return ACE_static_cast(ACE_InputCDR&,is) >> x; + return ACE_static_cast (ACE_InputCDR &, is) >> x; } ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, CORBA::LongDouble &x) { - return ACE_static_cast(ACE_InputCDR&,is) >> x; + return ACE_static_cast (ACE_InputCDR &, is) >> x; } ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, CORBA::Float &x) { - return ACE_static_cast(ACE_InputCDR&,is) >> x; + return ACE_static_cast (ACE_InputCDR &, is) >> x; } ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, CORBA::Double &x) { - return ACE_static_cast(ACE_InputCDR&,is) >> x; + return ACE_static_cast (ACE_InputCDR &, is) >> x; } ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &is, CORBA::Char* &x) { - return ACE_static_cast(ACE_InputCDR&,is) >> x; + return ACE_static_cast (ACE_InputCDR &, is) >> x; } diff --git a/TAO/tao/CDR_Interpreter.cpp b/TAO/tao/CDR_Interpreter.cpp index 8d12e0075b6..b35f8fa6a5c 100644 --- a/TAO/tao/CDR_Interpreter.cpp +++ b/TAO/tao/CDR_Interpreter.cpp @@ -270,10 +270,10 @@ TAO_CDR_Interpreter::skip_long (TAO_InputCDR *stream) size_t TAO_CDR_Interpreter::calc_nested_size_and_alignment_i (CORBA::TypeCode_ptr tc, - TAO_InputCDR *stream, - CORBA::TCKind kind, - size_t &alignment, - CORBA::Environment &env) + TAO_InputCDR *stream, + CORBA::TCKind kind, + size_t &alignment, + CORBA::Environment &env) { CORBA::ULong temp; // Just a temporary to retrieve CORBA::TCKind variables as ULong's @@ -333,9 +333,7 @@ TAO_CDR_Interpreter::calc_nested_size_and_alignment_i (CORBA::TypeCode_ptr tc, alignment, env); if (env.exception () != 0) - { - return 0; - } + return 0; // Check for garbage at end of parameter lists, or other cases // where parameters and the size allocated to them don't jive. @@ -411,9 +409,9 @@ TAO_CDR_Interpreter::calc_nested_size_and_alignment_i (CORBA::TypeCode_ptr tc, size_t TAO_CDR_Interpreter::calc_nested_size_and_alignment (CORBA::TypeCode_ptr tc, - TAO_InputCDR *stream, - size_t &alignment, - CORBA::Environment &env) + TAO_InputCDR *stream, + size_t &alignment, + CORBA::Environment &env) { // Get the "kind" ... if this is an indirection, this is a guess // which will soon be updated. @@ -502,9 +500,9 @@ TAO_CDR_Interpreter::calc_nested_size_and_alignment (CORBA::TypeCode_ptr tc, size_t TAO_CDR_Interpreter::calc_struct_and_except_attributes (TAO_InputCDR *stream, - size_t &alignment, - CORBA::Boolean is_exception, - CORBA::Environment &env) + size_t &alignment, + CORBA::Boolean is_exception, + CORBA::Environment &env) { CORBA::ULong members; size_t size; @@ -541,43 +539,44 @@ TAO_CDR_Interpreter::calc_struct_and_except_attributes (TAO_InputCDR *stream, return 0; } - // iterate over all the members, skipping their names and looking + // Iterate over all the members, skipping their names and looking // only at type data. - for ( ; members != 0; members--) { - size_t member_size; - size_t member_alignment; + for ( ; members != 0; members--) + { + size_t member_size; + size_t member_alignment; - // Skip name of the member. - if (!stream->skip_string ()) - { - env.exception (new CORBA::BAD_TYPECODE ()); - return 0; - } + // Skip name of the member. + if (!stream->skip_string ()) + { + env.exception (new CORBA::BAD_TYPECODE ()); + return 0; + } - // Get size and alignment of the member, accounting for - // indirection and the various kinds of parameter encoding. + // Get size and alignment of the member, accounting for + // indirection and the various kinds of parameter encoding. - member_size = calc_nested_size_and_alignment (0, - stream, - member_alignment, - env); - if (env.exception () != 0) - return 0; + member_size = calc_nested_size_and_alignment (0, + stream, + member_alignment, + env); + if (env.exception () != 0) + return 0; - // Round up the struct size to handle member alignment (by adding - // internal padding), then update the current size to handle the - // member's size. + // Round up the struct size to handle member alignment (by + // adding internal padding), then update the current size to + // handle the member's size. - size = (size_t) align_binary (size, member_alignment); - size += member_size; + size = (size_t) align_binary (size, member_alignment); + size += member_size; - // Finally update the overall structure alignment requirement, if - // this element must be more strongly aligned. + // Finally update the overall structure alignment requirement, + // if this element must be more strongly aligned. - if (member_alignment > alignment) - alignment = member_alignment; - }; + if (member_alignment > alignment) + alignment = member_alignment; + }; // Round up the structure size to match its overall alignment. This // adds tail padding, if needed. @@ -588,8 +587,8 @@ TAO_CDR_Interpreter::calc_struct_and_except_attributes (TAO_InputCDR *stream, size_t TAO_CDR_Interpreter::calc_struct_attributes (TAO_InputCDR *stream, - size_t &alignment, - CORBA::Environment &env) + size_t &alignment, + CORBA::Environment &env) { return calc_struct_and_except_attributes (stream, alignment, @@ -601,8 +600,8 @@ TAO_CDR_Interpreter::calc_struct_attributes (TAO_InputCDR *stream, size_t TAO_CDR_Interpreter::calc_exception_attributes (TAO_InputCDR *stream, - size_t &alignment, - CORBA::Environment &env) + size_t &alignment, + CORBA::Environment &env) { return calc_struct_and_except_attributes (stream, alignment, @@ -619,9 +618,9 @@ TAO_CDR_Interpreter::calc_exception_attributes (TAO_InputCDR *stream, size_t TAO_CDR_Interpreter::calc_key_union_attributes (TAO_InputCDR *stream, - size_t &overall_alignment, - size_t &discrim_size_with_pad, - CORBA::Environment &env) + size_t &overall_alignment, + size_t &discrim_size_with_pad, + CORBA::Environment &env) { CORBA::ULong members; CORBA::ULong temp; @@ -629,7 +628,8 @@ TAO_CDR_Interpreter::calc_key_union_attributes (TAO_InputCDR *stream, size_t discrim_and_base_size_with_pad; size_t value_alignment; size_t value_size; - // define a dummy structure to compute alignment of pointer type + + // Define a dummy structure to compute alignment of pointer type struct align_ptr { void *one; @@ -638,9 +638,11 @@ TAO_CDR_Interpreter::calc_key_union_attributes (TAO_InputCDR *stream, }; align_ptr ap; - // the first member of the union internal representation is the VPTR + // The first member of the union internal representation is the VPTR // since every union inherits from TAO_Base_Union - overall_alignment = (char *) &ap.two - (char *) &ap.one + overall_alignment = + (char *) &ap.two + - (char *) &ap.one - TAO_MAXIMUM_NATIVE_TYPE_SIZE; value_alignment = 1; @@ -687,8 +689,10 @@ TAO_CDR_Interpreter::calc_key_union_attributes (TAO_InputCDR *stream, // requirement for the union part of the construct. value_alignment = 1; + for ( ; members != 0; members--) { - size_t member_size, member_alignment; + size_t member_size; + size_t member_alignment; // Skip member label; its size varies with discriminant type, but // here we don't care about its content. This is where illegal @@ -774,14 +778,11 @@ TAO_CDR_Interpreter::calc_key_union_attributes (TAO_InputCDR *stream, (void) CORBA::TypeCode::skip_typecode (*stream); } else - { - // proceed with the normal way of computing the size and alignment - member_size = calc_nested_size_and_alignment (0, - stream, - member_alignment, - env); - } - + // Proceed with the normal way of computing the size and alignment + member_size = calc_nested_size_and_alignment (0, + stream, + member_alignment, + env); if (env.exception () != 0) return 0; @@ -790,6 +791,7 @@ TAO_CDR_Interpreter::calc_key_union_attributes (TAO_InputCDR *stream, // alignment restriction on SPARC, x86, and some m68k platforms. if (member_size > value_size) value_size = member_size; + if (member_alignment > value_alignment) value_alignment = member_alignment; } @@ -798,8 +800,10 @@ TAO_CDR_Interpreter::calc_key_union_attributes (TAO_InputCDR *stream, // order to be followed by the value. discrim_and_base_size_with_pad = (size_t) align_binary (discrim_and_base_size, value_alignment); + discrim_size_with_pad = discrim_and_base_size_with_pad - sizeof (TAO_Base_Union); + // Now calculate the overall size of the structure, which is the // discriminator, inter-element padding, value, and tail padding. // We know all of those except tail padding, which is a function of @@ -823,20 +827,23 @@ TAO_CDR_Interpreter::calc_key_union_attributes (TAO_InputCDR *stream, size_t TAO_CDR_Interpreter::calc_union_attributes (TAO_InputCDR *stream, - size_t &alignment, - CORBA::Environment &env) + size_t &alignment, + CORBA::Environment &env) { size_t scratch; - return calc_key_union_attributes (stream, alignment, scratch, env); + return calc_key_union_attributes (stream, + alignment, + scratch, + env); } // Calculate size and alignment for a typedeffed type. size_t TAO_CDR_Interpreter::calc_alias_attributes (TAO_InputCDR *stream, - size_t &alignment, - CORBA::Environment &env) + size_t &alignment, + CORBA::Environment &env) { // Skip type ID and name in the parameter stream @@ -858,15 +865,18 @@ TAO_CDR_Interpreter::calc_alias_attributes (TAO_InputCDR *stream, size_t TAO_CDR_Interpreter::calc_array_attributes (TAO_InputCDR *stream, - size_t &alignment, - CORBA::Environment &env) + size_t &alignment, + CORBA::Environment &env) { size_t member_size; CORBA::ULong member_count; // get size and alignment of the array member - member_size = calc_nested_size_and_alignment (0, stream, alignment, env); + member_size = calc_nested_size_and_alignment (0, + stream, + alignment, + env); if (env.exception () != 0) return 0; @@ -890,14 +900,15 @@ TAO_CDR_Interpreter::calc_array_attributes (TAO_InputCDR *stream, size_t TAO_CDR_Interpreter::calc_seq_attributes (TAO_InputCDR *stream, - size_t &alignment, - CORBA::Environment &env) + size_t &alignment, + CORBA::Environment &env) { CORBA::TCKind kind; // Get the "kind" ... if this is an indirection, this is a guess // which will soon be updated. CORBA::ULong temp; + if (stream->read_ulong (temp) == 0) { env.exception (new CORBA::BAD_TYPECODE ()); @@ -916,12 +927,13 @@ TAO_CDR_Interpreter::calc_seq_attributes (TAO_InputCDR *stream, } // Notice how we change the sign of the offset to estimate the - // maximum size. - // Also note that the offset is computed starting from the offset - // field. However, by this time, we have already read the offset field i.e., - // we have already moved ahead by 4 bytes (size of CORBA::Long). So we should - // increase our offset by this amount. - ACE_Message_Block *mb = (ACE_Message_Block *) stream->start (); + // maximum size. Also note that the offset is computed starting + // from the offset field. However, by this time, we have already + // read the offset field i.e., we have already moved ahead by 4 + // bytes (size of CORBA::Long). So we should increase our offset + // by this amount. + ACE_Message_Block *mb = + (ACE_Message_Block *) stream->start (); TAO_InputCDR indirected_stream (mb->rd_ptr () + offset - 4, -1 * (offset - 4)); @@ -934,7 +946,7 @@ TAO_CDR_Interpreter::calc_seq_attributes (TAO_InputCDR *stream, } } - kind = ACE_static_cast(CORBA::TCKind, temp); + kind = ACE_static_cast (CORBA::TCKind, temp); // Skip the rest of the stream because we don't use it. if (stream->skip_bytes (stream->length ()) == 0) @@ -953,21 +965,26 @@ TAO_CDR_Interpreter::calc_seq_attributes (TAO_InputCDR *stream, alignment = 1; #else alignment = - (char*)&align.two - (char*)&align.one - TAO_MAXIMUM_NATIVE_TYPE_SIZE; + (char *) &align.two + - (char *) &align.one + - TAO_MAXIMUM_NATIVE_TYPE_SIZE; #endif /* TAO_HAS_FIXED_BYTE_ALIGNMENT */ } else { - // Note: GHS can't handle TAO_Unbounded_Sequence<CORBA::Long> below. - // Instead, use TAO_Unbounded_String_Sequence. - declare_entry (TAO_Unbounded_String_Sequence, tk_sequence); + // Note: GHS can't handle TAO_Unbounded_Sequence<CORBA::Long> + // below. Instead, use TAO_Unbounded_String_Sequence. + declare_entry (TAO_Unbounded_String_Sequence, + tk_sequence); size = sizeof (TAO_Unbounded_String_Sequence); align_struct_tk_sequence align; #if defined (TAO_HAS_FIXED_BYTE_ALIGNMENT) alignment = 1; #else alignment = - (char*)&align.two - (char*)&align.one - TAO_MAXIMUM_NATIVE_TYPE_SIZE; + (char *) &align.two + - (char *) &align.one + - TAO_MAXIMUM_NATIVE_TYPE_SIZE; #endif /* TAO_HAS_FIXED_BYTE_ALIGNMENT */ } return size; @@ -978,9 +995,9 @@ TAO_CDR_Interpreter::calc_seq_attributes (TAO_InputCDR *stream, CORBA::Boolean TAO_CDR_Interpreter::match_value (CORBA::TCKind kind, - TAO_InputCDR *tc_stream, - const void *value, - CORBA::Environment &env) + TAO_InputCDR *tc_stream, + const void *value, + CORBA::Environment &env) { CORBA::Boolean retval = 0; @@ -1062,9 +1079,9 @@ TAO_CDR_Interpreter::match_value (CORBA::TCKind kind, } int -TAO_CDR_Interpreter -::calc_union_attr_is_var_sized_member (TAO_InputCDR *stream, - CORBA::Boolean &flag) +TAO_CDR_Interpreter::calc_union_attr_is_var_sized_member + (TAO_InputCDR *stream, + CORBA::Boolean &flag) { CORBA::Environment env; CORBA::ULong temp; @@ -1072,10 +1089,8 @@ TAO_CDR_Interpreter // Get the tk_ "kind" field if (stream->read_ulong (temp) == 0) - { - // error - return -1; - } + // Error. + return -1; env.clear (); @@ -1123,28 +1138,23 @@ TAO_CDR_Interpreter // Pull encapsulation length out of the stream. if (stream->read_ulong (encap) == 0) - { - return -1; - } + return -1; assert (encap <= UINT_MAX); TAO_InputCDR nested (*stream, temp); if (nested.good_bit () == 0) - { - return -1; - } + return -1; // Skip type ID and name in the parameter stream if (!nested.skip_string () // type ID || !nested.skip_string ()) // typedef name - { - return -1; - } + return -1; // stream->skip_bytes (encap); - return calc_union_attr_is_var_sized_member (&nested, flag); + return calc_union_attr_is_var_sized_member (&nested, + flag); } ACE_NOTREACHED (break); case CORBA::tk_struct: @@ -1154,52 +1164,45 @@ TAO_CDR_Interpreter // Pull encapsulation length out of the stream. if (stream->read_ulong (encap) == 0) - { - return -1; - } + return -1; assert (encap <= UINT_MAX); TAO_InputCDR nested (*stream, temp); if (nested.good_bit () == 0) - { - return -1; - } + return -1; // stream.skip_bytes (encap); // Skip type ID and name in the parameter stream if (!nested.skip_string () // type ID || !nested.skip_string ()) // typedef name - { - return -1; - } + return -1; CORBA::ULong member_count; if (nested.read_ulong (member_count) == 0) - { - return -1; - } + return -1; + for (CORBA::ULong i = 0; i < member_count && !flag; i++) { - // stop this loop the moment we discover that a member is variable - // in size + // Stop this loop the moment we discover that a member is + // variable in size. // skip the name if (nested.skip_string () == 0) - { - return -1; - } + return -1; + TAO_InputCDR member_tc (nested); - if (calc_union_attr_is_var_sized_member (&member_tc, flag) == -1) - { - return -1; - } + if (calc_union_attr_is_var_sized_member (&member_tc, + flag) == -1) + return -1; + CORBA::TypeCode::skip_typecode (nested); } + + return flag; } - return flag; - ACE_NOTREACHED (break); + ACE_NOTREACHED (break); case ~0: // TO-DO return 0; diff --git a/TAO/tao/CORBA.pidl b/TAO/tao/CORBA.pidl index c9264902975..108889a16b9 100644 --- a/TAO/tao/CORBA.pidl +++ b/TAO/tao/CORBA.pidl @@ -1,7 +1,7 @@ // $Id$ -// This will have all nwe definitions that will go in to -// CORBA from now onwards. +// This will have all new definitions that will go in to CORBA from +// now on. #pragma prefix "omg.org" diff --git a/TAO/tao/Client_Strategy_Factory.h b/TAO/tao/Client_Strategy_Factory.h index 745a605b861..609a20fa79e 100644 --- a/TAO/tao/Client_Strategy_Factory.h +++ b/TAO/tao/Client_Strategy_Factory.h @@ -10,7 +10,7 @@ // Client_Strategy_Factory.h // // = AUTHOR -// Chris Cleeland +// Chris Cleeland <cleeland@cs.wustl.edu> // // ============================================================================ @@ -27,10 +27,10 @@ class TAO_Wait_Strategy; class TAO_Transport; class TAO_Export TAO_Client_Strategy_Factory : public ACE_Service_Object +{ // = TITLE // Abstract factory used by the client to manufacture various // strategies used on the client-side. -{ public: // = Intialization and termination methods. TAO_Client_Strategy_Factory (void); @@ -40,15 +40,15 @@ public: // Destructor virtual ACE_Lock* create_iiop_profile_lock (void); - // create the lock for the forwarding IIOP Profile used by - // the TAO_GIOP_Invocation::location_forward and the - // TAO_GIOP_Invocation::start + // Create the lock for the forwarding IIOP Profile used by the + // <TAO_GIOP_Invocation::location_forward> and the + // <TAO_GIOP_Invocation::start>. virtual TAO_Transport_Mux_Strategy *create_transport_mux_strategy (void); // Create the correct client request muxing strategy. virtual TAO_Wait_Strategy *create_wait_strategy (TAO_Transport *transport); - // Create the correct client wait_for_reply strategy. + // Create the correct client <wait_for_reply> strategy. }; #endif /* TAO_CLIENT_STRATEGY_FACTORY_H */ diff --git a/TAO/tao/Connector_Registry.cpp b/TAO/tao/Connector_Registry.cpp index fdf346a9589..fdb041e5d2e 100644 --- a/TAO/tao/Connector_Registry.cpp +++ b/TAO/tao/Connector_Registry.cpp @@ -20,18 +20,17 @@ TAO_Connector_Registry::~TAO_Connector_Registry (void) TAO_Connector * TAO_Connector_Registry::get_connector (CORBA::ULong tag) { - TAO_ConnectorSetItor end = - this->connectors_.end (); + this->connectors_.end (); TAO_ConnectorSetItor connector = - this->connectors_.begin (); + this->connectors_.begin (); for (; connector != end ; connector++) { if ((*connector)->tag () == tag) - return (*connector); + return *connector; } return 0; } @@ -41,11 +40,12 @@ TAO_Connector_Registry::open (TAO_ORB_Core *orb_core) { // Open one connector for each loaded protocol! TAO_ProtocolFactorySetItor end = - orb_core->protocol_factories ()->end (); + orb_core->protocol_factories ()->end (); TAO_ProtocolFactorySetItor factory = - orb_core->protocol_factories ()->begin (); + orb_core->protocol_factories ()->begin (); TAO_Connector *connector = 0; + for ( ; factory != end; ++factory) @@ -68,15 +68,20 @@ int TAO_Connector_Registry::close_all (void) { TAO_ConnectorSetItor end = - this->connectors_.end (); - for (TAO_ConnectorSetItor i = this->connectors_.begin (); i != end; ++i) + this->connectors_.end (); + + for (TAO_ConnectorSetItor i = this->connectors_.begin (); + i != end; + ++i) { if (*i == 0) continue; + (*i)->close (); delete *i; } + this->connectors_.reset (); return 0; } @@ -84,23 +89,25 @@ TAO_Connector_Registry::close_all (void) int TAO_Connector_Registry::preconnect (TAO_EndpointSet &preconnections) { - TAO_EndpointSetIterator first_endpoint_set = preconnections.begin (); - TAO_EndpointSetIterator last_endpoint_set = preconnections.end (); + TAO_EndpointSetIterator first_endpoint_set = + preconnections.begin (); + TAO_EndpointSetIterator last_endpoint_set = + preconnections.end (); for (TAO_EndpointSetIterator i = first_endpoint_set; i != last_endpoint_set; ++i) { - TAO_ConnectorSetItor first_connector = this->connectors_.begin (); - TAO_ConnectorSetItor last_connector = this->connectors_.end (); + TAO_ConnectorSetItor first_connector = + this->connectors_.begin (); + TAO_ConnectorSetItor last_connector = + this->connectors_.end (); for (TAO_ConnectorSetItor connector = first_connector; - connector != last_connector ; + connector != last_connector; ++connector) - { - if (*connector) - (*connector)->preconnect ((*i).c_str ()); - } + if (*connector) + (*connector)->preconnect ((*i).c_str ()); } return 0; // Success @@ -112,9 +119,10 @@ TAO_Connector_Registry::connect (TAO_Stub *&obj, { TAO_Profile *profile = obj->profile_in_use (); - // here is where we get the appropriate connector object but we are + // Here is where we get the appropriate connector object but we are // the Connector Registry so call get_connector(tag) - TAO_Connector *connector = this->get_connector (profile->tag ()); + TAO_Connector *connector = + this->get_connector (profile->tag ()); return connector->connect (profile, transport); } @@ -125,13 +133,14 @@ TAO_Connector_Registry::make_mprofile (const char *ior, CORBA::Environment &ACE_TRY_ENV) { if (!ior) - { - ACE_THROW_RETURN (CORBA::MARSHAL (), -1); - // Failure: Null IOR string pointer - } + // Failure: Null IOR string pointer + ACE_THROW_RETURN (CORBA::MARSHAL (), + -1); - TAO_ConnectorSetItor first_connector = this->connectors_.begin (); - TAO_ConnectorSetItor last_connector = this->connectors_.end (); + TAO_ConnectorSetItor first_connector = + this->connectors_.begin (); + TAO_ConnectorSetItor last_connector = + this->connectors_.end (); for (TAO_ConnectorSetItor connector = first_connector; connector != last_connector; @@ -139,27 +148,30 @@ TAO_Connector_Registry::make_mprofile (const char *ior, { if (*connector) { - if ((*connector)->make_mprofile (ior, mprofile, ACE_TRY_ENV) == 0) - return 0; // Success + if ((*connector)->make_mprofile (ior, + mprofile, + ACE_TRY_ENV) == 0) + // Success. + return 0; } else - { - ACE_THROW_RETURN (CORBA::MARSHAL (), -1); - // Failure: Null pointer to connector in connector registry - } + // Failure: Null pointer to connector in connector registry. + ACE_THROW_RETURN (CORBA::MARSHAL (), + -1); } - ACE_THROW_RETURN (CORBA::MARSHAL (), -1); - // Failure: None of the connectors were able to parse the - // URL style IOR into an MProfile. + // Failure: None of the connectors were able to parse the URL style + // IOR into an MProfile. + ACE_THROW_RETURN (CORBA::MARSHAL (), + -1); } -TAO_Profile* -TAO_Connector_Registry::create_profile (TAO_InputCDR& cdr) +TAO_Profile * +TAO_Connector_Registry::create_profile (TAO_InputCDR &cdr) { CORBA::ULong tag; - // If there is an error we abort + // If there is an error we abort. if ((cdr >> tag) == 0) return 0; @@ -176,9 +188,10 @@ TAO_Connector_Registry::create_profile (TAO_InputCDR& cdr) tag)); } - TAO_Profile* pfile; - ACE_NEW_RETURN (pfile, TAO_Unknown_Profile (tag), 0); - + TAO_Profile *pfile; + ACE_NEW_RETURN (pfile, + TAO_Unknown_Profile (tag), + 0); if (pfile->decode (cdr) == -1) { pfile->_decr_refcnt (); @@ -187,19 +200,18 @@ TAO_Connector_Registry::create_profile (TAO_InputCDR& cdr) return pfile; } - // OK, we've got known profile. - // It's going to be encapsulated ProfileData. - // Create a new decoding stream and context for it, and skip the - // data in the parent stream + // OK, we've got known profile. It's going to be encapsulated + // ProfileData. Create a new decoding stream and context for it, + // and skip the data in the parent stream - // ProfileData is encoded as a sequence of octet. So first get - // the length of the sequence. + // ProfileData is encoded as a sequence of octet. So first get the + // length of the sequence. CORBA::ULong encap_len; if ((cdr >> encap_len) == 0) return 0; - // Create the decoding stream from the encapsulation in the - // buffer, and skip the encapsulation. + // Create the decoding stream from the encapsulation in the buffer, + // and skip the encapsulation. TAO_InputCDR str (cdr, encap_len); if (str.good_bit () == 0 @@ -221,4 +233,4 @@ template class ACE_Unbounded_Set_Iterator<TAO_Connector*>; #pragma instantiate ACE_Unbounded_Set<TAO_Connector*> #pragma instantiate ACE_Unbounded_Set_Iterator<TAO_Connector*> -#endif +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/tao/Context.cpp b/TAO/tao/Context.cpp index 5fdbdc2a891..ed9b7ff2ee4 100644 --- a/TAO/tao/Context.cpp +++ b/TAO/tao/Context.cpp @@ -1,6 +1,5 @@ // $Id$ - #include "tao/Context.h" #if !defined (TAO_HAS_MINIMUM_CORBA) @@ -129,9 +128,11 @@ CORBA_ContextList::~CORBA_ContextList (void) { for (CORBA::ULong i = 0; i < this->count (); ++i) { - char* *ctx; + char **ctx; + if (this->ctx_list_.get (ctx, i) == -1) return; + CORBA::string_free (*ctx); } } @@ -149,17 +150,17 @@ CORBA_ContextList::add_consume (char *ctx) } char * -CORBA_ContextList::item (CORBA::ULong index, +CORBA_ContextList::item (CORBA::ULong slot, CORBA::Environment &ACE_TRY_ENV) { - char* *ctx; + char **ctx; ACE_TRY_ENV.clear (); - if (this->ctx_list_.get (ctx, index) == -1) + + if (this->ctx_list_.get (ctx, + slot) == -1) ACE_THROW_RETURN (CORBA::TypeCode::Bounds (), 0); else - { - return CORBA::string_dup (*ctx); - } + return CORBA::string_dup (*ctx); } void @@ -181,6 +182,7 @@ void CORBA_ContextList::_destroy (void) { CORBA::ULong current = --this->ref_count_; + if (current == 0) delete this; } diff --git a/TAO/tao/Context.h b/TAO/tao/Context.h index 2e3a0b9538f..1ef307d626e 100644 --- a/TAO/tao/Context.h +++ b/TAO/tao/Context.h @@ -30,38 +30,37 @@ class TAO_Export CORBA_Context // CORBA_Context // // = DESCRIPTION - // TAO's minimal implementation of the Context interface. - // Since Contexts are inherently un-typesafe, there use - // is deprecated and the feature may eventaully disappear - // from CORBA. It is implemented only to make the arg list - // of CORBA_Object::_create_request() compliant. The only - // (pointer) value that should be passed is 0. + // TAO's minimal implementation of the Context interface. Since + // Contexts are inherently un-typesafe, there use is deprecated + // and the feature may eventaully disappear from CORBA. It is + // implemented only to make the arg list of + // CORBA_Object::_create_request() compliant. The only (pointer) + // value that should be passed is 0. // public: - // Default ctor and dtor. + // = Initialization and termination methods. CORBA_Context (void); + // Constructor. + ~CORBA_Context (void); + // Destructor. - // Pseudo object methods - static CORBA_Context* _duplicate (CORBA_Context*); - static CORBA_Context* _nil (void); + // = Pseudo-object methods + static CORBA_Context *_duplicate (CORBA_Context*); + static CORBA_Context *_nil (void); // = Reference counting. CORBA::ULong _incr_refcnt (void); CORBA::ULong _decr_refcnt (void); -// All the spec-required functions below will just throw -// a CORBA::NO_IMPLEMENT exception and do nothing else. + // = All the spec-required functions below will just throw a + // CORBA::NO_IMPLEMENT exception and do nothing else. - const char *context_name ( - CORBA::Environment &ACE_TRY_ENV = - TAO_default_environment () - ) const; + const char *context_name (CORBA::Environment &ACE_TRY_ENV = + TAO_default_environment ()) const; - CORBA_Context_ptr parent ( - CORBA::Environment &ACE_TRY_ENV = - TAO_default_environment () - ) const; + CORBA_Context_ptr parent (CORBA::Environment &ACE_TRY_ENV = + TAO_default_environment ()) const; void create_child (const char *child_ctx_name, CORBA_Context_out child_ctx, @@ -96,10 +95,10 @@ public: private: CORBA::ULong refcount_; - // reference counting + // Reference counting. ACE_SYNCH_MUTEX refcount_lock_; - // protect the reference count + // Protect the reference count. }; typedef CORBA_Context* CORBA_Context_ptr; @@ -113,11 +112,9 @@ class TAO_Export CORBA_Context_var // As any other pseudo object Context must have a T_var class, // the interface an semantics are specified in the CORBA spec. // - // = NOTE - // We use CORBA_Context_ptr as the _ptr type instead of - // CORBA::Context_ptr, this is an attempt to reduced the cyclic + // We use <CORBA_Context_ptr> as the _ptr type instead of + // <CORBA::Context_ptr> in an attempt to reduced the cyclic // dependencies in TAO. - // public: CORBA_Context_var (void); CORBA_Context_var (CORBA_Context_ptr); @@ -150,11 +147,9 @@ class TAO_Export CORBA_Context_out // As any other pseudo object Context must have a T_out class, // the interface an semantics are specified in the CORBA spec. // - // = NOTE - // We use CORBA_Context_ptr as the _ptr type instead of - // CORBA::Context_ptr, this is an attempt to reduced the cyclic + // We use <CORBA_Context_ptr> as the _ptr type instead of + // <CORBA::Context_ptr> in an attempt to reduced the cyclic // dependencies in TAO. - // public: CORBA_Context_out (CORBA_Context_ptr &); CORBA_Context_out (CORBA_Context_var &); @@ -179,10 +174,10 @@ class CORBA_ContextList // Maintains a list of strings for Contexts. public: CORBA_ContextList (void); - // constructor + // Constructor. CORBA_ContextList (CORBA::ULong len, - char* *ctx_list); + char **ctx_list); // Constructor - initialize given a length and an array of // strings. @@ -192,6 +187,7 @@ public: CORBA::ULong count (); // return the number of elements + // @@ Jeff, can you please comment these methods? CORBA_ContextList_ptr _duplicate (void); void _destroy (void); @@ -199,20 +195,20 @@ public: static CORBA_ContextList_ptr _nil (); void add (char *ctx); - // add a string to the list + // Add a string to the list. void add_consume (char *ctx); - // add and consume a string to the list + // Add and consume a string to the list. - char *item (CORBA::ULong index, + char *item (CORBA::ULong slot, CORBA_Environment &ACE_TRY_ENV = TAO_default_environment ()); - // return the typecode at index i. Raises the "Bounds" exception + // Return the typecode at slot i. Raises the "Bounds" exception. - void remove (CORBA::ULong index, + void remove (CORBA::ULong slot, CORBA_Environment &ACE_TRY_ENV = TAO_default_environment ()); - // remove the typecode at index i. Raises the "Bounds" exception + // remove the typecode at slot i. Raises the "Bounds" exception #if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8 typedef CORBA::ContextList_ptr _ptr_type; @@ -221,7 +217,7 @@ public: // Useful for template programming. private: - // not allowed + // Not allowed. CORBA_ContextList (const CORBA_ContextList &); CORBA_ContextList &operator= (const CORBA_ContextList &); @@ -229,7 +225,7 @@ private: // Reference counter. ACE_Unbounded_Queue<char *> ctx_list_; - // internal list of typecodes + // Internal list of typecodes. }; class TAO_Export CORBA_ContextList_var @@ -291,5 +287,4 @@ private: #endif /* __ACE_INLINE__ */ #endif /* TAO_HAS_MINIMUM_CORBA */ - #endif /* TAO_CONTEXT_H */ diff --git a/TAO/tao/Context.i b/TAO/tao/Context.i index 3182747ac1d..dd2febd271a 100644 --- a/TAO/tao/Context.i +++ b/TAO/tao/Context.i @@ -4,6 +4,7 @@ // These should never be non-NULL, but the method // is required of pseudo objects. + ACE_INLINE CORBA_Context* CORBA_Context::_duplicate (CORBA_Context* x) { @@ -204,8 +205,10 @@ CORBA_ContextList::_nil (void) // Inline operations for class CORBA_ContextList_var // ************************************************************* +// default constructor + ACE_INLINE -CORBA_ContextList_var::CORBA_ContextList_var (void) // default constructor +CORBA_ContextList_var::CORBA_ContextList_var (void) : ptr_ (CORBA_ContextList::_nil ()) {} @@ -220,8 +223,9 @@ CORBA_ContextList_var::ptr (void) const return this->ptr_; } +// copy constructor ACE_INLINE -CORBA_ContextList_var::CORBA_ContextList_var (const CORBA_ContextList_var &p) // copy constructor +CORBA_ContextList_var::CORBA_ContextList_var (const CORBA_ContextList_var &p) : ptr_ (p.ptr_->_duplicate ()) {} diff --git a/TAO/tao/Domain.pidl b/TAO/tao/Domain.pidl index 6e20883b2cf..1e413c6bed1 100644 --- a/TAO/tao/Domain.pidl +++ b/TAO/tao/Domain.pidl @@ -1,4 +1,3 @@ -// // $Id$ // // ================================================================ @@ -20,8 +19,6 @@ #if !defined POLICY_DOMAIN_IDL #define POLICY_DOMAIN_IDL - - #pragma prefix "omg.org" #include "Policy.pidl" diff --git a/TAO/tao/DomainC.h b/TAO/tao/DomainC.h index 39e90a389cf..d618b37ef80 100644 --- a/TAO/tao/DomainC.h +++ b/TAO/tao/DomainC.h @@ -158,7 +158,7 @@ public: operator CORBA_DomainManagerList &(); operator CORBA_DomainManagerList &() const; - TAO_Object_Manager<CORBA_DomainManager> operator[] (CORBA::ULong index); + TAO_Object_Manager<CORBA_DomainManager> operator[] (CORBA::ULong slot); // in, inout, out, _retn const CORBA_DomainManagerList &in (void) const; CORBA_DomainManagerList &inout (void); @@ -182,7 +182,7 @@ public: CORBA_DomainManagerList *&ptr (void); CORBA_DomainManagerList *operator-> (void); - TAO_Object_Manager<CORBA_DomainManager> operator[] (CORBA::ULong index); + TAO_Object_Manager<CORBA_DomainManager> operator[] (CORBA::ULong slot); private: CORBA_DomainManagerList *&ptr_; diff --git a/TAO/tao/DomainC.i b/TAO/tao/DomainC.i index 853a222192e..354178ddc80 100644 --- a/TAO/tao/DomainC.i +++ b/TAO/tao/DomainC.i @@ -447,9 +447,9 @@ CORBA_DomainManagerList_var::operator CORBA_DomainManagerList &() const// cast } ACE_INLINE TAO_Object_Manager<CORBA_DomainManager> -CORBA_DomainManagerList_var::operator[] (CORBA::ULong index) +CORBA_DomainManagerList_var::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } ACE_INLINE const CORBA_DomainManagerList & @@ -544,9 +544,9 @@ CORBA_DomainManagerList_out::operator-> (void) } ACE_INLINE TAO_Object_Manager<CORBA_DomainManager> -CORBA_DomainManagerList_out::operator[] (CORBA::ULong index) +CORBA_DomainManagerList_out::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } ACE_INLINE CORBA::Boolean diff --git a/TAO/tao/DynAny.pidl b/TAO/tao/DynAny.pidl index 942e4c52ac9..6fe4d54641b 100644 --- a/TAO/tao/DynAny.pidl +++ b/TAO/tao/DynAny.pidl @@ -28,200 +28,194 @@ typedef unsigned long TCKind; // IDL interface CORBA_DynAny - { - typedef CORBA_DynAny DynAny; - - exception Invalid {}; - // Typecodes don't match, or argument has no meaningful value. - - exception InvalidValue {}; - // Argument's typecode doesn't match. +{ + typedef CORBA_DynAny DynAny; - exception TypeMismatch {}; - // Requested type doesn't match what's there. + exception Invalid {}; + // Typecodes don't match, or argument has no meaningful value. - exception InvalidSeq {}; - // Wrong length or typecode. + exception InvalidValue {}; + // Argument's typecode doesn't match. + exception TypeMismatch {}; + // Requested type doesn't match what's there. - // Used only with DynFixed - //typedef sequence<octet> OctetSeq; + exception InvalidSeq {}; + // Wrong length or typecode. - TypeCode type (); - // Returns the typecode expected or contained which, - // once the DynAny object is created, cannot be changed. + // Used only with DynFixed + //typedef sequence<octet> OctetSeq; - void assign (in DynAny dyn_any) - raises (Invalid); - // Previous value is overwriiten, but typecodes must match. - void from_any (in any value) - raises (Invalid); - // Previous value is overwritten, but typecodes must match. + TypeCode type (); + // Returns the typecode expected or contained which, + // once the DynAny object is created, cannot be changed. - any to_any () - raises (Invalid); - // Constructs a new CORBA::Any. + void assign (in DynAny dyn_any) + raises (Invalid); + // Previous value is overwriiten, but typecodes must match. - void destroy (); - // Destroys this object and any DynAny objects derived from it. + void from_any (in any value) + raises (Invalid); + // Previous value is overwritten, but typecodes must match. - DynAny copy (); - // Clones this object. + any to_any () + raises (Invalid); + // Constructs a new CORBA::Any. + void destroy (); + // Destroys this object and any DynAny objects derived from it. - // Insertion operations + DynAny copy (); + // Clones this object. - void insert_boolean (in boolean value) - raises (InvalidValue); - void insert_octet (in octet value) - raises (InvalidValue); + // Insertion operations - void insert_char (in char value) - raises (InvalidValue); + void insert_boolean (in boolean value) + raises (InvalidValue); - void insert_short (in short value) - raises (InvalidValue); + void insert_octet (in octet value) + raises (InvalidValue); - void insert_ushort (in unsigned short value) - raises (InvalidValue); + void insert_char (in char value) + raises (InvalidValue); - void insert_long (in long value) - raises (InvalidValue); + void insert_short (in short value) + raises (InvalidValue); - void insert_ulong (in unsigned long value) - raises (InvalidValue); + void insert_ushort (in unsigned short value) + raises (InvalidValue); - void insert_float (in float value) - raises (InvalidValue); + void insert_long (in long value) + raises (InvalidValue); - void insert_double (in double value) - raises (InvalidValue); + void insert_ulong (in unsigned long value) + raises (InvalidValue); - void insert_string (in string value) - raises (InvalidValue); + void insert_float (in float value) + raises (InvalidValue); - void insert_reference (in Object value) - raises (InvalidValue); + void insert_double (in double value) + raises (InvalidValue); - void insert_typecode (in TypeCode value) - raises (InvalidValue); + void insert_string (in string value) + raises (InvalidValue); - void insert_longlong (in long long value) - raises (InvalidValue); + void insert_reference (in Object value) + raises (InvalidValue); - void insert_ulonglong (in unsigned long long value) - raises (InvalidValue); + void insert_typecode (in TypeCode value) + raises (InvalidValue); - // If sizeof(long double) != 16, it's represented as - // as struct and ACE has no support for conversion or - // arithmetic operations. -/* - void insert_longdouble (in long double value) - raises (InvalidValue); -*/ + void insert_longlong (in long long value) + raises (InvalidValue); - void insert_wchar (in wchar value) - raises (InvalidValue); + void insert_ulonglong (in unsigned long long value) + raises (InvalidValue); +#if 0 + // If sizeof(long double) != 16, it's represented as + // as struct and ACE has no support for conversion or + // arithmetic operations. + void insert_longdouble (in long double value) + raises (InvalidValue); +#endif /* 0 */ - // TAO IDL compiler doesn't recognize this type yet. -/* - void insert_wstring (in wstring value) - raises (InvalidValue); -*/ + void insert_wchar (in wchar value) + raises (InvalidValue); - void insert_any (in any value) - raises (InvalidValue); +#if 0 + // TAO IDL compiler doesn't recognize this type (yet). + void insert_wstring (in wstring value) + raises (InvalidValue); +#endif /* 0 */ + void insert_any (in any value) + raises (InvalidValue); - // Extraction operations + // Extraction operations - boolean get_boolean () - raises (TypeMismatch); - - octet get_octet () - raises (TypeMismatch); - - char get_char () - raises (TypeMismatch); - - short get_short () - raises (TypeMismatch); - - unsigned short get_ushort () - raises (TypeMismatch); + boolean get_boolean () + raises (TypeMismatch); - long get_long () - raises (TypeMismatch); + octet get_octet () + raises (TypeMismatch); - unsigned long get_ulong () - raises (TypeMismatch); + char get_char () + raises (TypeMismatch); - float get_float () - raises (TypeMismatch); + short get_short () + raises (TypeMismatch); - double get_double () - raises (TypeMismatch); + unsigned short get_ushort () + raises (TypeMismatch); - string get_string () - raises (TypeMismatch); + long get_long () + raises (TypeMismatch); - Object get_reference () - raises (TypeMismatch); + unsigned long get_ulong () + raises (TypeMismatch); - TypeCode get_typecode () - raises (TypeMismatch); + float get_float () + raises (TypeMismatch); - long long get_longlong () - raises (TypeMismatch); + double get_double () + raises (TypeMismatch); - unsigned long long get_ulonglong () - raises (TypeMismatch); + string get_string () + raises (TypeMismatch); - // If sizeof(long double) != 16, see above. -/* - long double get_longdouble () - raises (TypeMismatch); -*/ + Object get_reference () + raises (TypeMismatch); - wchar get_wchar () - raises (TypeMismatch); + TypeCode get_typecode () + raises (TypeMismatch); + long long get_longlong () + raises (TypeMismatch); - // TAO IDL compiler doesn't recognize this type yet. -/* - wstring get_wstring () - raises (TypeMismatch); -*/ + unsigned long long get_ulonglong () + raises (TypeMismatch); - any get_any () - raises (TypeMismatch); +#if 0 + // If sizeof(long double) != 16, see above. + long double get_longdouble () + raises (TypeMismatch); +#endif /* 0 */ + wchar get_wchar () + raises (TypeMismatch); +#if 0 + // TAO IDL compiler doesn't recognize this type (yet). + wstring get_wstring () + raises (TypeMismatch); +#endif /* 0 */ - DynAny current_component (); - // Returns component at the current position which, for simple - // and enumerated types, is *this. + any get_any () + raises (TypeMismatch); - boolean next (); - // Moves to the next component. Returns FALSE if already at the - // last component. + DynAny current_component (); + // Returns component at the current position which, for simple + // and enumerated types, is *this. - boolean seek (in long index); - // Makes the component at index the current component. - // Returns FALSE if index is out of range. + boolean next (); + // Moves to the next component. Returns FALSE if already at the + // last component. - void rewind (); - // Same as seek (0), which never returns a FALSE value. - }; + boolean seek (in long index); + // Makes the component at index the current component. + // Returns FALSE if index is out of range. + void rewind (); + // Same as seek (0), which never returns a FALSE value. +}; +#if 0 +// Fixed types aren't supported by TAO (yet). - // Fixed types aren't supported by TAO at this time. -/* interface DynFixed : DynAny { OctetSeq get_value (); @@ -229,94 +223,86 @@ interface DynFixed : DynAny void set_value (in OctetSeq val) raises (InvalidValue); }; -*/ - +#endif /* 0 */ interface CORBA_DynEnum : CORBA_DynAny - { - // Since the internal representation is a ulong, - // insert_ulong () and get_ulong () can also be used. - - attribute string value_as_string; - - attribute unsigned long value_as_ulong; - }; +{ + // Since the internal representation is a ulong, + // insert_ulong () and get_ulong () can also be used. + attribute string value_as_string; + attribute unsigned long value_as_ulong; +}; typedef string FieldName; // The name of a struct or union member. struct NameValuePair - { - FieldName id; +{ + FieldName id; + + any value; +}; - any value; - }; // Representation of a struct or union member. typedef sequence<NameValuePair> NameValuePairSeq; // External representation of the members of a DynStruct object. interface CORBA_DynStruct : CORBA_DynAny - { - FieldName current_member_name (); - - TCKind current_member_kind (); - - NameValuePairSeq get_members (); +{ + FieldName current_member_name (); - void set_members (in NameValuePairSeq value) - raises (InvalidSeq); - // If the argument has the wrong length or order, - // mismatched typecodes or invalid members, the - // exception is raised. - }; + TCKind current_member_kind (); + NameValuePairSeq get_members (); + void set_members (in NameValuePairSeq value) + raises (InvalidSeq); + // If the argument has the wrong length or order, + // mismatched typecodes or invalid members, the + // exception is raised. +}; interface CORBA_DynUnion : CORBA_DynAny - { - attribute boolean set_as_default; - // Should be treated as if it were readonly, which it - // probably will be in a future spec. - - DynAny discriminator (); +{ + attribute boolean set_as_default; + // Should be treated as if it were readonly, which it + // probably will be in a future spec. - TCKind discriminator_kind (); + DynAny discriminator (); - DynAny member (); + TCKind discriminator_kind (); - attribute FieldName member_name; - - TCKind member_kind (); - }; + DynAny member (); + attribute FieldName member_name; + TCKind member_kind (); +}; typedef sequence<any> AnySeq; // Representation of the values in a DynArray or DynSequence object. interface CORBA_DynSequence : CORBA_DynAny - { - attribute unsigned long length; - - AnySeq get_elements (); - - void set_elements (in AnySeq value) - raises (InvalidSeq); - // Length and each typecode must match. - }; +{ + attribute unsigned long length; + AnySeq get_elements (); + void set_elements (in AnySeq value) + raises (InvalidSeq); + // Length and each typecode must match. +}; interface CORBA_DynArray : CORBA_DynAny - { - AnySeq get_elements (); +{ + AnySeq get_elements (); - void set_elements (in AnySeq value) - raises (InvalidSeq); + void set_elements (in AnySeq value) + raises (InvalidSeq); // Length and each typecode must match. - }; +}; #endif /* !defined DYN_ANY_IDL */ diff --git a/TAO/tao/DynAnyC.h b/TAO/tao/DynAnyC.h index fd4053a08a5..3e39743055e 100644 --- a/TAO/tao/DynAnyC.h +++ b/TAO/tao/DynAnyC.h @@ -402,7 +402,7 @@ public: CORBA::Environment::default_environment () ); virtual CORBA::Boolean seek ( - CORBA::Long index, + CORBA::Long slot, CORBA::Environment &_tao_environment = CORBA::Environment::default_environment () ); @@ -797,7 +797,7 @@ public: operator const CORBA_NameValuePairSeq &() const; operator CORBA_NameValuePairSeq &(); operator CORBA_NameValuePairSeq &() const; - CORBA_NameValuePair &operator[] (CORBA::ULong index); + CORBA_NameValuePair &operator[] (CORBA::ULong slot); // in, inout, out, _retn const CORBA_NameValuePairSeq &in (void) const; CORBA_NameValuePairSeq &inout (void); @@ -820,7 +820,7 @@ public: operator CORBA_NameValuePairSeq *&(); CORBA_NameValuePairSeq *&ptr (void); CORBA_NameValuePairSeq *operator-> (void); - CORBA_NameValuePair &operator[] (CORBA::ULong index); + CORBA_NameValuePair &operator[] (CORBA::ULong slot); private: CORBA_NameValuePairSeq *&ptr_; @@ -1280,7 +1280,7 @@ public: operator const CORBA_AnySeq &() const; operator CORBA_AnySeq &(); operator CORBA_AnySeq &() const; - CORBA::Any &operator[] (CORBA::ULong index); + CORBA::Any &operator[] (CORBA::ULong slot); // in, inout, out, _retn const CORBA_AnySeq &in (void) const; CORBA_AnySeq &inout (void); @@ -1303,7 +1303,7 @@ public: operator CORBA_AnySeq *&(); CORBA_AnySeq *&ptr (void); CORBA_AnySeq *operator-> (void); - CORBA::Any &operator[] (CORBA::ULong index); + CORBA::Any &operator[] (CORBA::ULong slot); private: CORBA_AnySeq *&ptr_; diff --git a/TAO/tao/DynAnyC.i b/TAO/tao/DynAnyC.i index d9edfe734ec..a495904948f 100644 --- a/TAO/tao/DynAnyC.i +++ b/TAO/tao/DynAnyC.i @@ -660,9 +660,9 @@ CORBA_NameValuePairSeq_var::operator CORBA_NameValuePairSeq &() const// cast } ACE_INLINE CORBA_NameValuePair & -CORBA_NameValuePairSeq_var::operator[] (CORBA::ULong index) +CORBA_NameValuePairSeq_var::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } ACE_INLINE const CORBA_NameValuePairSeq & @@ -757,9 +757,9 @@ CORBA_NameValuePairSeq_out::operator-> (void) } ACE_INLINE CORBA_NameValuePair & -CORBA_NameValuePairSeq_out::operator[] (CORBA::ULong index) +CORBA_NameValuePairSeq_out::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } ACE_INLINE @@ -1215,9 +1215,9 @@ CORBA_AnySeq_var::operator CORBA_AnySeq &() const// cast } ACE_INLINE CORBA::Any & -CORBA_AnySeq_var::operator[] (CORBA::ULong index) +CORBA_AnySeq_var::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } ACE_INLINE const CORBA_AnySeq & @@ -1312,9 +1312,9 @@ CORBA_AnySeq_out::operator-> (void) } ACE_INLINE CORBA::Any & -CORBA_AnySeq_out::operator[] (CORBA::ULong index) +CORBA_AnySeq_out::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } ACE_INLINE diff --git a/TAO/tao/DynAnyS.cpp b/TAO/tao/DynAnyS.cpp index 3f9eb8a6a32..845bcebe334 100644 --- a/TAO/tao/DynAnyS.cpp +++ b/TAO/tao/DynAnyS.cpp @@ -553,12 +553,12 @@ POA_CORBA::_tao_collocated_DynAny::next ( CORBA::Boolean POA_CORBA::_tao_collocated_DynAny::seek ( - CORBA::Long index, + CORBA::Long slot, CORBA::Environment &_tao_environment ) { return this->servant_->seek ( - index, + slot, _tao_environment ); } diff --git a/TAO/tao/DynAny_i.cpp b/TAO/tao/DynAny_i.cpp index b6418e1b9d1..ba08af1e6a8 100644 --- a/TAO/tao/DynAny_i.cpp +++ b/TAO/tao/DynAny_i.cpp @@ -95,7 +95,6 @@ TAO_DynAny_i::~TAO_DynAny_i (void) { } -///////////////////////////////////////////////////////////////// // Common functions CORBA::TypeCode_ptr @@ -167,10 +166,10 @@ TAO_DynAny_i::next (CORBA::Environment &) } CORBA::Boolean -TAO_DynAny_i::seek (CORBA::Long index, +TAO_DynAny_i::seek (CORBA::Long slot, CORBA::Environment &) { - if (index == 0) + if (slot == 0) return 1; else return 0; @@ -182,7 +181,6 @@ TAO_DynAny_i::rewind (CORBA::Environment &) { } -///////////////////////////////////////////////////////////////// // Insert functions void @@ -347,7 +345,6 @@ TAO_DynAny_i::insert_any (const CORBA::Any& value, env.exception (new CORBA_DynAny::InvalidValue); } -/////////////////////////////////////////////////////////////// // Get functions CORBA::Boolean @@ -530,18 +527,18 @@ TAO_DynAny_i::get_any (CORBA::Environment& ACE_TRY_ENV) if (!(this->value_ >>= *val.out ())) { val = 0; - ACE_THROW_RETURN (CORBA_DynAny::TypeMismatch (), 0); + ACE_THROW_RETURN (CORBA_DynAny::TypeMismatch (), + 0); } return val._retn (); } -////////////////////////////////////////////////////////////////////////// // The factory functions CORBA_DynAny_ptr -TAO_DynAny_i::create_dyn_any (const CORBA_Any& any, - CORBA::Environment& ACE_TRY_ENV) +TAO_DynAny_i::create_dyn_any (const CORBA_Any &any, + CORBA::Environment &ACE_TRY_ENV) { switch (TAO_DynAny_i::unalias (any.type (), ACE_TRY_ENV)) { @@ -564,7 +561,7 @@ TAO_DynAny_i::create_dyn_any (const CORBA_Any& any, case CORBA::tk_objref: case CORBA::tk_string: { - TAO_DynAny_i* dp; + TAO_DynAny_i *dp; ACE_NEW_THROW_EX (dp, TAO_DynAny_i (any), CORBA::NO_MEMORY ()); @@ -574,7 +571,7 @@ TAO_DynAny_i::create_dyn_any (const CORBA_Any& any, case CORBA::tk_struct: case CORBA::tk_except: { - TAO_DynStruct_i* dp; + TAO_DynStruct_i *dp; ACE_NEW_THROW_EX (dp, TAO_DynStruct_i (any), CORBA::NO_MEMORY ()); @@ -583,7 +580,7 @@ TAO_DynAny_i::create_dyn_any (const CORBA_Any& any, } case CORBA::tk_sequence: { - TAO_DynSequence_i* dp; + TAO_DynSequence_i *dp; ACE_NEW_THROW_EX (dp, TAO_DynSequence_i (any), CORBA::NO_MEMORY ()); @@ -592,7 +589,7 @@ TAO_DynAny_i::create_dyn_any (const CORBA_Any& any, } case CORBA::tk_union: { - TAO_DynUnion_i* dp; + TAO_DynUnion_i *dp; ACE_NEW_THROW_EX (dp, TAO_DynUnion_i (any), CORBA::NO_MEMORY ()); @@ -601,7 +598,7 @@ TAO_DynAny_i::create_dyn_any (const CORBA_Any& any, } case CORBA::tk_enum: { - TAO_DynEnum_i* dp; + TAO_DynEnum_i *dp; ACE_NEW_THROW_EX (dp, TAO_DynEnum_i (any), CORBA::NO_MEMORY ()); @@ -610,7 +607,7 @@ TAO_DynAny_i::create_dyn_any (const CORBA_Any& any, } case CORBA::tk_array: { - TAO_DynArray_i* dp; + TAO_DynArray_i *dp; ACE_NEW_THROW_EX (dp, TAO_DynArray_i (any), CORBA::NO_MEMORY ()); @@ -628,7 +625,7 @@ CORBA_DynAny_ptr TAO_DynAny_i::create_basic_dyn_any (CORBA_TypeCode_ptr tc, CORBA::Environment& ACE_TRY_ENV) { - TAO_DynAny_i* dp; + TAO_DynAny_i *dp; ACE_NEW_THROW_EX (dp, TAO_DynAny_i (tc), CORBA::NO_MEMORY ()); @@ -640,7 +637,7 @@ CORBA_DynStruct_ptr TAO_DynAny_i::create_dyn_struct (CORBA_TypeCode_ptr tc, CORBA::Environment& ACE_TRY_ENV) { - TAO_DynStruct_i* dp; + TAO_DynStruct_i *dp; ACE_NEW_THROW_EX (dp, TAO_DynStruct_i (tc), CORBA::NO_MEMORY ()); @@ -652,7 +649,7 @@ CORBA_DynSequence_ptr TAO_DynAny_i::create_dyn_sequence (CORBA_TypeCode_ptr tc, CORBA::Environment& ACE_TRY_ENV) { - TAO_DynSequence_i* dp; + TAO_DynSequence_i *dp; ACE_NEW_THROW_EX (dp, TAO_DynSequence_i (tc), CORBA::NO_MEMORY ()); @@ -664,7 +661,7 @@ CORBA_DynArray_ptr TAO_DynAny_i::create_dyn_array (CORBA_TypeCode_ptr tc, CORBA::Environment& ACE_TRY_ENV) { - TAO_DynArray_i* dp; + TAO_DynArray_i *dp; ACE_NEW_THROW_EX (dp, TAO_DynArray_i (tc), CORBA::NO_MEMORY ()); @@ -676,7 +673,7 @@ CORBA_DynUnion_ptr TAO_DynAny_i::create_dyn_union (CORBA_TypeCode_ptr tc, CORBA::Environment& ACE_TRY_ENV) { - TAO_DynUnion_i* dp; + TAO_DynUnion_i *dp; ACE_NEW_THROW_EX (dp, TAO_DynUnion_i (tc), CORBA::NO_MEMORY ()); @@ -688,7 +685,7 @@ CORBA_DynEnum_ptr TAO_DynAny_i::create_dyn_enum (CORBA_TypeCode_ptr tc, CORBA::Environment& ACE_TRY_ENV) { - TAO_DynEnum_i* dp; + TAO_DynEnum_i *dp; ACE_NEW_THROW_EX (dp, TAO_DynEnum_i (tc), CORBA::NO_MEMORY ()); diff --git a/TAO/tao/DynAny_i.h b/TAO/tao/DynAny_i.h index 394b21fff78..d43d9cd01ce 100644 --- a/TAO/tao/DynAny_i.h +++ b/TAO/tao/DynAny_i.h @@ -1,5 +1,6 @@ /* -*- C++ -*- */ // $Id$ + // ========================================================================= // // = LIBRARY @@ -30,7 +31,6 @@ class TAO_Export TAO_DynAny_i : public POA_CORBA::DynAny // // = DESCRIPTION // Implementation of the basic Dynamic Any datatype. - // public: TAO_DynAny_i (CORBA_TypeCode_ptr tc); // constructor with TypeCode argument @@ -41,11 +41,11 @@ public: ~TAO_DynAny_i (void); // destructor - // Functions common to all Dynamic Any types + // = Functions common to all Dynamic Any types void assign (CORBA_DynAny_ptr dyn_any, CORBA::Environment &ACE_TRY_ENV); - // Sets the value of the receiver to the value of the argument + // Sets the value of the receiver to the value of the argument. CORBA_DynAny_ptr copy (CORBA::Environment &ACE_TRY_ENV); // Creates a copy @@ -69,9 +69,9 @@ public: CORBA::Boolean next (CORBA::Environment &); // Returns next component, again here there is only one - CORBA::Boolean seek (CORBA::Long index, + CORBA::Boolean seek (CORBA::Long slot, CORBA::Environment &); - // In this class, returns true only for index of 0 + // In this class, returns true only for slot of 0 void rewind (CORBA::Environment &); // Makes first component the current one @@ -111,67 +111,45 @@ public: void insert_any (const CORBA::Any& value, CORBA::Environment &ACE_TRY_ENV); CORBA::Boolean get_boolean (CORBA::Environment &ACE_TRY_ENV); - CORBA::Octet get_octet (CORBA::Environment &ACE_TRY_ENV); - CORBA::Char get_char (CORBA::Environment &ACE_TRY_ENV); - CORBA::Short get_short (CORBA::Environment &ACE_TRY_ENV); - CORBA::UShort get_ushort (CORBA::Environment &ACE_TRY_ENV); - CORBA::Long get_long (CORBA::Environment &ACE_TRY_ENV); - CORBA::ULong get_ulong (CORBA::Environment &ACE_TRY_ENV); - CORBA::Float get_float (CORBA::Environment &ACE_TRY_ENV); - CORBA::Double get_double (CORBA::Environment &ACE_TRY_ENV); - - char * get_string (CORBA::Environment &ACE_TRY_ENV); - + char *get_string (CORBA::Environment &ACE_TRY_ENV); CORBA::Object_ptr get_reference (CORBA::Environment &ACE_TRY_ENV); - CORBA::TypeCode_ptr get_typecode (CORBA::Environment &ACE_TRY_ENV); - CORBA::LongLong get_longlong (CORBA::Environment &ACE_TRY_ENV); - CORBA::ULongLong get_ulonglong (CORBA::Environment &ACE_TRY_ENV); - CORBA::WChar get_wchar (CORBA::Environment &ACE_TRY_ENV); - CORBA::Any_ptr get_any (CORBA::Environment &ACE_TRY_ENV); -// The ORB DynAny-factory functions will call these so we don't need to -// keep an orb pointer in each DynAny object. + // The ORB DynAny-factory functions will call these so we don't need + // to keep an orb pointer in each DynAny object. static CORBA_DynAny_ptr create_dyn_any (const CORBA_Any& any, CORBA::Environment &ACE_TRY_ENV); - static CORBA_DynAny_ptr create_basic_dyn_any (CORBA_TypeCode_ptr tc, CORBA::Environment &ACE_TRY_ENV); - static CORBA_DynStruct_ptr create_dyn_struct (CORBA_TypeCode_ptr tc, CORBA::Environment &ACE_TRY_ENV); - static CORBA_DynSequence_ptr create_dyn_sequence (CORBA_TypeCode_ptr tc, CORBA::Environment &ACE_TRY_ENV); - static CORBA_DynArray_ptr create_dyn_array (CORBA_TypeCode_ptr tc, CORBA::Environment &ACE_TRY_ENV); - static CORBA_DynUnion_ptr create_dyn_union (CORBA_TypeCode_ptr tc, CORBA::Environment &ACE_TRY_ENV); - static CORBA_DynEnum_ptr create_dyn_enum (CORBA_TypeCode_ptr tc, CORBA::Environment &ACE_TRY_ENV); - // And an extra generic one (not required in the spec) - // that calls one of the above passing a typecode. - // Comes in handy in implementing some versions of current_component(). static CORBA_DynAny_ptr create_dyn_any (CORBA_TypeCode_ptr tc, CORBA::Environment &ACE_TRY_ENV); - + // And an extra generic one (not required in the spec) that calls + // one of the above passing a typecode. Comes in handy in + // implementing some versions of current_component(). static CORBA::TCKind unalias (CORBA_TypeCode_ptr tc, CORBA::Environment &ACE_TRY_ENV); diff --git a/TAO/tao/DynArray_i.cpp b/TAO/tao/DynArray_i.cpp index 40ad77f82d9..07ca4e544f3 100644 --- a/TAO/tao/DynArray_i.cpp +++ b/TAO/tao/DynArray_i.cpp @@ -1,5 +1,6 @@ /* -*- C++ -*- */ // $Id$ + // ==================================================================== // // = LIBRARY @@ -20,7 +21,6 @@ #include "tao/DynArray_i.h" #include "tao/InconsistentTypeCodeC.h" -////////////////////////////////////////////////////////////////////// // Constructors and destructor TAO_DynArray_i::TAO_DynArray_i (const CORBA_Any& any) @@ -32,13 +32,12 @@ TAO_DynArray_i::TAO_DynArray_i (const CORBA_Any& any) CORBA::TypeCode_ptr tc = this->type_.in (); // The type will be correct if this constructor called from a - // factory function, but it could also be called by the - // user, so..... + // factory function, but it could also be called by the user, + // so..... if (TAO_DynAny_i::unalias (tc, env) == CORBA::tk_array) { CORBA::ULong numfields = this->get_arg_length (any.type (), env); - // Resize the array. this->da_members_.size (numfields); @@ -47,7 +46,8 @@ TAO_DynArray_i::TAO_DynArray_i (const CORBA_Any& any) TAO_InputCDR cdr (mb); - CORBA::TypeCode_ptr field_tc = this->get_element_type (env); + CORBA::TypeCode_ptr field_tc = + this->get_element_type (env); for (CORBA::ULong i = 0; i < numfields; i++) { @@ -79,17 +79,14 @@ TAO_DynArray_i::TAO_DynArray_i (CORBA_TypeCode_ptr tc) // Need to check if called by user. if (TAO_DynAny_i::unalias (tc, - env) - == CORBA::tk_array) + env) == CORBA::tk_array) { CORBA::ULong numfields = this->get_arg_length (tc, env); - // Resize the array. this->da_members_.size (numfields); for (CORBA::ULong i = 0; i < numfields; i++) - // With a typecode arg, we just create the top level. this->da_members_[i] = 0; } @@ -101,7 +98,6 @@ TAO_DynArray_i::~TAO_DynArray_i (void) { } -/////////////////////////////////////////////////////////////////////// // Functions specific to DynArray CORBA_AnySeq_ptr @@ -146,7 +142,8 @@ TAO_DynArray_i::set_elements (const CORBA_AnySeq& value, return; } - CORBA::TypeCode_ptr element_type = this->get_element_type (env); + CORBA::TypeCode_ptr element_type = + this->get_element_type (env); for (CORBA::ULong i = 0; i < length; i++) { @@ -169,7 +166,6 @@ TAO_DynArray_i::set_elements (const CORBA_AnySeq& value, } } -////////////////////////////////////////////////////////////////////// // Common functions void @@ -197,7 +193,9 @@ void TAO_DynArray_i::destroy (CORBA::Environment &env) { // Do a deep destroy - for (CORBA::ULong i = 0; i < this->da_members_.size (); i++) + for (CORBA::ULong i = 0; + i < this->da_members_.size (); + i++) if (!CORBA::is_nil (this->da_members_[i].in ())) this->da_members_[i]->destroy (env); @@ -209,7 +207,8 @@ void TAO_DynArray_i::from_any (const CORBA_Any& any, CORBA::Environment &env) { - if (this->type_.in ()->equal (any.type (), env)) + if (this->type_.in ()->equal (any.type (), + env)) { // Get the CDR stream of the argument. ACE_Message_Block* mb = any._tao_get_cdr (); @@ -218,7 +217,6 @@ TAO_DynArray_i::from_any (const CORBA_Any& any, CORBA::ULong length = this->da_members_.size (); CORBA::ULong arg_length = this->get_arg_length (any.type (), env); - if (length != arg_length) { env.exception (new CORBA_DynAny::Invalid); @@ -256,7 +254,9 @@ TAO_DynArray_i::to_any (CORBA::Environment& ACE_TRY_ENV) CORBA_TypeCode_ptr field_tc = this->get_element_type (ACE_TRY_ENV); - for (CORBA::ULong i = 0; i < this->da_members_.size (); i++) + for (CORBA::ULong i = 0; + i < this->da_members_.size (); + i++) { // Each component must have been initialized. if (!this->da_members_[i].in ()) @@ -266,7 +266,8 @@ TAO_DynArray_i::to_any (CORBA::Environment& ACE_TRY_ENV) } // Recursive step - CORBA_Any_var field_any = this->da_members_[i]->to_any (ACE_TRY_ENV); + CORBA_Any_var field_any = + this->da_members_[i]->to_any (ACE_TRY_ENV); ACE_Message_Block* field_mb = field_any->_tao_get_cdr (); @@ -279,7 +280,7 @@ TAO_DynArray_i::to_any (CORBA::Environment& ACE_TRY_ENV) TAO_InputCDR in_cdr (out_cdr); - CORBA_Any* retval; + CORBA_Any *retval; ACE_NEW_THROW_EX (retval, CORBA_Any (this->type (ACE_TRY_ENV), 0, @@ -296,7 +297,9 @@ TAO_DynArray_i::type (CORBA::Environment &) } // If the DynAny has been initialized but this component has not, the -// first call to current_component will create the pointer and return it. +// first call to current_component will create the pointer and return +// it. + CORBA_DynAny_ptr TAO_DynArray_i::current_component (CORBA::Environment &env) { @@ -307,7 +310,6 @@ TAO_DynArray_i::current_component (CORBA::Environment &env) this->da_members_[this->index_] = TAO_DynAny_i::create_dyn_any (this->get_element_type (env), env); - return this->da_members_[this->index_].in (); } @@ -324,13 +326,13 @@ TAO_DynArray_i::next (CORBA::Environment &) } CORBA::Boolean -TAO_DynArray_i::seek (CORBA::Long index, +TAO_DynArray_i::seek (CORBA::Long slot, CORBA::Environment &) { - if (index < 0 || index >= (CORBA::Long) this->da_members_.size ()) + if (slot < 0 || slot >= (CORBA::Long) this->da_members_.size ()) return 0; - this->index_ = index; + this->index_ = slot; return 1; } @@ -340,15 +342,13 @@ TAO_DynArray_i::rewind (CORBA::Environment &) this->index_ = 0; } -//////////////////////////////////////////////////////////////////////// -// The insert-primitive and get-primitive functions are required -// by the spec of all types of DynAny, although if the top level -// members aren't primitive types, these functions aren't too helpful. -// Also, while not mentioned in the spec, the example code seems to -// indicate that next() is called in the body of each of these, and -// it has been so implemented here. +// The insert-primitive and get-primitive functions are required by +// the spec of all types of DynAny, although if the top level members +// aren't primitive types, these functions aren't too helpful. Also, +// while not mentioned in the spec, the example code seems to indicate +// that next() is called in the body of each of these, and it has been +// so implemented here. -//////////////////////////////////////////////////////////////////////// // Insert functions void @@ -575,7 +575,6 @@ TAO_DynArray_i::insert_any (const CORBA::Any& value, env.exception (new CORBA_DynAny::InvalidValue); } -/////////////////////////////////////////////////////////////// // Get functions // If the current component has not been intialized, these @@ -938,7 +937,6 @@ TAO_DynArray_i::get_any (CORBA::Environment &env) return val; } -///////////////////////////////////////////////////////////////////////////////// // Private utility function. CORBA::TypeCode_ptr diff --git a/TAO/tao/DynArray_i.h b/TAO/tao/DynArray_i.h index e7ea518d0cc..f09ab38ab29 100644 --- a/TAO/tao/DynArray_i.h +++ b/TAO/tao/DynArray_i.h @@ -45,20 +45,19 @@ public: ~TAO_DynArray_i (void); // destructor - // Functions specific to DynArray - - // Assign/dump elements using IDL defined type AnySeq + // = Functions specific to DynArray CORBA_AnySeq_ptr get_elements (CORBA::Environment &ACE_TRY_ENV); + // Assign/dump elements using IDL defined type AnySeq void set_elements (const CORBA_AnySeq& value, CORBA::Environment &ACE_TRY_ENV); - // Functions common to all Dynamic Any types + // = Functions common to all Dynamic Any types void assign (CORBA_DynAny_ptr dyn_any, CORBA::Environment &ACE_TRY_ENV); - // Sets the value of the receiver to the value of the argument + // Sets the value of the receiver to the value of the argument. CORBA_DynAny_ptr copy (CORBA::Environment &ACE_TRY_ENV); // Creates a copy @@ -77,14 +76,14 @@ public: // Returns the (constant) type CORBA_DynAny_ptr current_component (CORBA::Environment &ACE_TRY_ENV); - // Used in iterating through the contents + // Used in iterating through the contents. CORBA::Boolean next (CORBA::Environment &ACE_TRY_ENV); // Returns next component - CORBA::Boolean seek (CORBA::Long index, + CORBA::Boolean seek (CORBA::Long slot, CORBA::Environment &ACE_TRY_ENV); - // Jump to component at <index> + // Jump to component at <slot> void rewind (CORBA::Environment &ACE_TRY_ENV); // Makes first component the current one @@ -124,35 +123,20 @@ public: void insert_any (const CORBA::Any& value, CORBA::Environment &ACE_TRY_ENV); CORBA::Boolean get_boolean (CORBA::Environment &ACE_TRY_ENV); - CORBA::Octet get_octet (CORBA::Environment &ACE_TRY_ENV); - CORBA::Char get_char (CORBA::Environment &ACE_TRY_ENV); - CORBA::Short get_short (CORBA::Environment &ACE_TRY_ENV); - CORBA::UShort get_ushort (CORBA::Environment &ACE_TRY_ENV); - CORBA::Long get_long (CORBA::Environment &ACE_TRY_ENV); - CORBA::ULong get_ulong (CORBA::Environment &ACE_TRY_ENV); - CORBA::Float get_float (CORBA::Environment &ACE_TRY_ENV); - CORBA::Double get_double (CORBA::Environment &ACE_TRY_ENV); - - char * get_string (CORBA::Environment &ACE_TRY_ENV); - + char *get_string (CORBA::Environment &ACE_TRY_ENV); CORBA::Object_ptr get_reference (CORBA::Environment &ACE_TRY_ENV); - CORBA::TypeCode_ptr get_typecode (CORBA::Environment &ACE_TRY_ENV); - CORBA::LongLong get_longlong (CORBA::Environment &ACE_TRY_ENV); - CORBA::ULongLong get_ulonglong (CORBA::Environment &ACE_TRY_ENV); - CORBA::WChar get_wchar (CORBA::Environment &ACE_TRY_ENV); - CORBA::Any_ptr get_any (CORBA::Environment &ACE_TRY_ENV); private: @@ -167,7 +151,7 @@ private: // Holds the typecode of the array CORBA::Long index_; - // Index of the current component + // Slot of the current component ACE_Array_Base<CORBA_DynAny_var> da_members_; // Each component is also a DynAny diff --git a/TAO/tao/DynEnum_i.cpp b/TAO/tao/DynEnum_i.cpp index fc9f81daa26..2f607d6dcf8 100644 --- a/TAO/tao/DynEnum_i.cpp +++ b/TAO/tao/DynEnum_i.cpp @@ -20,19 +20,19 @@ #include "tao/DynEnum_i.h" #include "tao/InconsistentTypeCodeC.h" -////////////////////////////////////////////////////////////////////// // Constructors and destructor -TAO_DynEnum_i::TAO_DynEnum_i (const CORBA_Any& any) +TAO_DynEnum_i::TAO_DynEnum_i (const CORBA_Any &any) : type_ (any.type ()), value_ (0) { CORBA::Environment env; // The type will be correct if this constructor called from a - // factory function, but it could also be called by the - // user, so..... - if (TAO_DynAny_i::unalias (this->type_.in (), env) == CORBA::tk_enum) + // factory function, but it could also be called by the user, + // so..... + if (TAO_DynAny_i::unalias (this->type_.in (), + env) == CORBA::tk_enum) { // Get the CDR stream of the argument. ACE_Message_Block* mb = any._tao_get_cdr (); @@ -54,7 +54,7 @@ TAO_DynEnum_i::TAO_DynEnum_i (CORBA_TypeCode_ptr tc) // Need to check if called by user. if (TAO_DynAny_i::unalias (tc, env) - != CORBA::tk_enum) + != CORBA::tk_enum) env.exception (new CORBA_ORB_InconsistentTypeCode); } @@ -62,10 +62,9 @@ TAO_DynEnum_i::~TAO_DynEnum_i (void) { } -////////////////////////////////////////////////////////////////////// // Functions specific to DynEnum -char* +char * TAO_DynEnum_i::value_as_string (CORBA::Environment& env) { return CORBA::string_dup (this->type_.in ()->member_name (this->value_, @@ -73,8 +72,8 @@ TAO_DynEnum_i::value_as_string (CORBA::Environment& env) } void -TAO_DynEnum_i::value_as_string (const char* value_as_string, - CORBA::Environment& env) +TAO_DynEnum_i::value_as_string (const char *value_as_string, + CORBA::Environment &env) { CORBA::ULong count = this->type_.in ()->member_count (env); CORBA::ULong i; @@ -109,7 +108,6 @@ TAO_DynEnum_i::value_as_ulong (CORBA::ULong value_as_ulong, env.exception (new CORBA_DynAny::InvalidValue); } -////////////////////////////////////////////////////////////////////// // Common functions void @@ -144,7 +142,8 @@ void TAO_DynEnum_i::from_any (const CORBA_Any& any, CORBA::Environment &env) { - if (TAO_DynAny_i::unalias (any.type (), env) == CORBA::tk_enum) + if (TAO_DynAny_i::unalias (any.type (), + env) == CORBA::tk_enum) { // Get the CDR stream of the argument. ACE_Message_Block* mb = any._tao_get_cdr (); @@ -164,7 +163,7 @@ TAO_DynEnum_i::to_any (CORBA::Environment& ACE_TRY_ENV) out_cdr.write_ulong (this->value_); - CORBA_Any* retval; + CORBA_Any *retval; ACE_NEW_THROW_EX (retval, CORBA_Any (this->type_.in (), 0, @@ -193,10 +192,10 @@ TAO_DynEnum_i::next (CORBA::Environment &) } CORBA::Boolean -TAO_DynEnum_i::seek (CORBA::Long index, +TAO_DynEnum_i::seek (CORBA::Long slot, CORBA::Environment &) { - if (index == 0) + if (slot == 0) return 1; else return 0; @@ -208,7 +207,6 @@ TAO_DynEnum_i::rewind (CORBA::Environment &) { } -///////////////////////////////////////////////////////////////// // Insert and get functions // // These have no meaning for the enum type, but someone could diff --git a/TAO/tao/DynEnum_i.h b/TAO/tao/DynEnum_i.h index 5253f22187e..e0660dad4d0 100644 --- a/TAO/tao/DynEnum_i.h +++ b/TAO/tao/DynEnum_i.h @@ -45,55 +45,55 @@ public: ~TAO_DynEnum_i (void); // destructor - // Functions specific to DynEnum - // Get and set methods for enum's string and numeric value + // = Functions specific to DynEnum - char* value_as_string (CORBA::Environment &ACE_TRY_ENV); + char *value_as_string (CORBA::Environment &ACE_TRY_ENV); + // Get method for enum's string and numeric value. - void value_as_string (const char* value_as_string, + void value_as_string (const char *value_as_string, CORBA::Environment &ACE_TRY_ENV); + // Set method for enum's string and numeric value. CORBA::ULong value_as_ulong (CORBA::Environment&); void value_as_ulong (CORBA::ULong value_as_ulong, CORBA::Environment &ACE_TRY_ENV); - // Functions common to all Dynamic Any types void assign (CORBA_DynAny_ptr dyn_any, CORBA::Environment &ACE_TRY_ENV); - // Sets the value of the receiver to the value of the argument + // Sets the value of the receiver to the value of the argument. CORBA_DynAny_ptr copy (CORBA::Environment &ACE_TRY_ENV); - // Creates a copy + // Creates a copy. void destroy (CORBA::Environment &ACE_TRY_ENV); - // Makes sure the contents are disposed of correctly + // Makes sure the contents are disposed of correctly. void from_any (const CORBA::Any& any, CORBA::Environment &ACE_TRY_ENV); - // Assigns value from an Any argument + // Assigns value from an Any argument. CORBA::Any_ptr to_any (CORBA::Environment &ACE_TRY_ENV); - // Outputs contents as an Any + // Outputs contents as an Any. CORBA::TypeCode_ptr type (CORBA::Environment &ACE_TRY_ENV); - // Returns the (constant) type + // Returns the (constant) type. CORBA_DynAny_ptr current_component (CORBA::Environment &ACE_TRY_ENV); - // Used in iterating through the contents + // Used in iterating through the contents. CORBA::Boolean next (CORBA::Environment &ACE_TRY_ENV); - // Returns next component + // Returns next component. - CORBA::Boolean seek (CORBA::Long index, + CORBA::Boolean seek (CORBA::Long slot, CORBA::Environment &ACE_TRY_ENV); - // Jump to component at <index> + // Jump to component at <slot>. void rewind (CORBA::Environment &ACE_TRY_ENV); - // Makes first component the current one + // Makes first component the current one. - // Insert and get functions + // = Insert and get functions // In DynEnum, these have no pertinence, so since spec requires // their presence, they will just throw an exception @@ -131,48 +131,33 @@ public: void insert_any (const CORBA::Any& value, CORBA::Environment &ACE_TRY_ENV); CORBA::Boolean get_boolean (CORBA::Environment &ACE_TRY_ENV); - CORBA::Octet get_octet (CORBA::Environment &ACE_TRY_ENV); - CORBA::Char get_char (CORBA::Environment &ACE_TRY_ENV); - CORBA::Short get_short (CORBA::Environment &ACE_TRY_ENV); - CORBA::UShort get_ushort (CORBA::Environment &ACE_TRY_ENV); - CORBA::Long get_long (CORBA::Environment &ACE_TRY_ENV); - CORBA::ULong get_ulong (CORBA::Environment &ACE_TRY_ENV); - CORBA::Float get_float (CORBA::Environment &ACE_TRY_ENV); - CORBA::Double get_double (CORBA::Environment &ACE_TRY_ENV); - - char * get_string (CORBA::Environment &ACE_TRY_ENV); - + char *get_string (CORBA::Environment &ACE_TRY_ENV); CORBA::Object_ptr get_reference (CORBA::Environment &ACE_TRY_ENV); - CORBA::TypeCode_ptr get_typecode (CORBA::Environment &ACE_TRY_ENV); - CORBA::LongLong get_longlong (CORBA::Environment &ACE_TRY_ENV); - CORBA::ULongLong get_ulonglong (CORBA::Environment &ACE_TRY_ENV); - CORBA::WChar get_wchar (CORBA::Environment &ACE_TRY_ENV); - CORBA::Any_ptr get_any (CORBA::Environment &ACE_TRY_ENV); private: CORBA::TypeCode_var type_; - // Holds the typecode of the enum + // Holds the typecode of the enum. CORBA::ULong value_; - // Current numeric value of the enum + // Current numeric value of the enum. TAO_DynEnum_i (void); - // Must be instantiated with at least a typecode + // Must be instantiated with at least a typecode. - // Use copy() or assign() instead of these + // = Use copy() or assign() instead of these TAO_DynEnum_i (const TAO_DynEnum_i &src); TAO_DynEnum_i &operator= (const TAO_DynEnum_i &src); }; diff --git a/TAO/tao/DynSequence_i.cpp b/TAO/tao/DynSequence_i.cpp index 27b8f39ac25..5954e807854 100644 --- a/TAO/tao/DynSequence_i.cpp +++ b/TAO/tao/DynSequence_i.cpp @@ -1,5 +1,6 @@ /* -*- C++ -*- */ // $Id$ + // =================================================================== // // = LIBRARY @@ -20,8 +21,7 @@ #include "tao/DynSequence_i.h" #include "tao/InconsistentTypeCodeC.h" -////////////////////////////////////////////////////////////////////// -// Constructors and destructor +// Constructors and destructor. TAO_DynSequence_i::TAO_DynSequence_i (const CORBA_Any& any) : type_ (any.type ()), @@ -31,27 +31,28 @@ TAO_DynSequence_i::TAO_DynSequence_i (const CORBA_Any& any) CORBA::Environment env; // The type will be correct if this constructor called from a - // factory function, but it could also be called by the - // user, so..... + // factory function, but it could also be called by the user, + // so..... if (TAO_DynAny_i::unalias (this->type_.in (), - env) - == CORBA::tk_sequence) + env) == CORBA::tk_sequence) { // Get the CDR stream of the argument. - ACE_Message_Block* mb = any._tao_get_cdr (); + ACE_Message_Block *mb = any._tao_get_cdr (); TAO_InputCDR cdr (mb); CORBA::ULong length; - // If the any is a sequence, first 4 bytes of cdr hold the length. + // If the any is a sequence, first 4 bytes of cdr hold the + // length. cdr.read_ulong (length); // Resize the array. this->da_members_.size (length); // Get the type of the sequence elments. - CORBA::TypeCode_ptr field_tc = this->get_element_type (env); + CORBA::TypeCode_ptr field_tc = + this->get_element_type (env); for (CORBA::ULong i = 0; i < length; i++) { @@ -65,7 +66,6 @@ TAO_DynSequence_i::TAO_DynSequence_i (const CORBA_Any& any) this->da_members_[i] = TAO_DynAny_i::create_dyn_any (field_any, env); - // Move to the next field in the CDR stream. cdr.skip (field_tc); } @@ -76,6 +76,7 @@ TAO_DynSequence_i::TAO_DynSequence_i (const CORBA_Any& any) // Can't set the length from just the typecode, so we'll // do it upon initialization. + TAO_DynSequence_i::TAO_DynSequence_i (CORBA_TypeCode_ptr tc) : type_ (CORBA::TypeCode::_duplicate (tc)), index_ (0), @@ -94,7 +95,6 @@ TAO_DynSequence_i::~TAO_DynSequence_i (void) { } -/////////////////////////////////////////////////////////////////////// // Functions specific to DynSequence CORBA::ULong @@ -133,7 +133,8 @@ TAO_DynSequence_i::get_elements (CORBA::Environment& ACE_TRY_ENV) // Initialize each Any. for (CORBA::ULong i = 0; i < length; i++) { - CORBA::Any_var temp = this->da_members_[i]->to_any (ACE_TRY_ENV); + CORBA::Any_var temp = + this->da_members_[i]->to_any (ACE_TRY_ENV); (*elements)[i] = temp.in (); } @@ -156,7 +157,8 @@ TAO_DynSequence_i::set_elements (const CORBA_AnySeq& value, return; } - CORBA::TypeCode_ptr element_type = this->get_element_type (env); + CORBA::TypeCode_ptr element_type = + this->get_element_type (env); for (CORBA::ULong i = 0; i < length; i++) { @@ -179,7 +181,6 @@ TAO_DynSequence_i::set_elements (const CORBA_AnySeq& value, } } -////////////////////////////////////////////////////////////////////// // Common functions void @@ -207,7 +208,9 @@ void TAO_DynSequence_i::destroy (CORBA::Environment &env) { // Do a deep destroy - for (CORBA::ULong i = 0; i < this->da_members_.size (); i++) + for (CORBA::ULong i = 0; + i < this->da_members_.size (); + i++) if (!CORBA::is_nil (this->da_members_[i].in ())) this->da_members_[i]->destroy (env); @@ -223,12 +226,14 @@ TAO_DynSequence_i::from_any (const CORBA_Any& any, env)) { // Get the CDR stream of the argument. - ACE_Message_Block* mb = any._tao_get_cdr (); + ACE_Message_Block *mb = + any._tao_get_cdr (); TAO_InputCDR cdr (mb); CORBA::ULong arg_length; - // If the any is a sequence, first 4 bytes of cdr hold the length. + // If the any is a sequence, first 4 bytes of cdr hold the + // length. cdr.read_ulong (arg_length); CORBA::ULong length = this->da_members_.size (); @@ -242,9 +247,12 @@ TAO_DynSequence_i::from_any (const CORBA_Any& any, return; } - CORBA::TypeCode_ptr field_tc = this->get_element_type (env); + CORBA::TypeCode_ptr field_tc = + this->get_element_type (env); - for (CORBA::ULong i = 0; i < arg_length; i++) + for (CORBA::ULong i = 0; + i < arg_length; + i++) { // This Any constructor is a TAO extension. CORBA_Any field_any (field_tc, @@ -285,9 +293,11 @@ TAO_DynSequence_i::to_any (CORBA::Environment& ACE_TRY_ENV) } // Recursive step - CORBA_Any_var field_any = this->da_members_[i]->to_any (ACE_TRY_ENV); + CORBA_Any_var field_any = + this->da_members_[i]->to_any (ACE_TRY_ENV); - ACE_Message_Block* field_mb = field_any->_tao_get_cdr (); + ACE_Message_Block *field_mb = + field_any->_tao_get_cdr (); TAO_InputCDR field_cdr (field_mb); @@ -315,7 +325,9 @@ TAO_DynSequence_i::type (CORBA::Environment &) } // If the DynAny has been initialized but this component has not, the -// first call to current_component will create the pointer and return it. +// first call to current_component will create the pointer and return +// it. + CORBA_DynAny_ptr TAO_DynSequence_i::current_component (CORBA::Environment &env) { @@ -343,13 +355,13 @@ TAO_DynSequence_i::next (CORBA::Environment &) } CORBA::Boolean -TAO_DynSequence_i::seek (CORBA::Long index, +TAO_DynSequence_i::seek (CORBA::Long slot, CORBA::Environment &) { - if (index < 0 || index >= (CORBA::Long) this->da_members_.size ()) + if (slot < 0 || slot >= (CORBA::Long) this->da_members_.size ()) return 0; - this->index_ = index; + this->index_ = slot; return 1; } @@ -359,7 +371,6 @@ TAO_DynSequence_i::rewind (CORBA::Environment &) this->index_ = 0; } -/////////////////////////////////////////////////////////////////////// // The insert-primitive and get-primitive functions are required // by the spec of all types of DynAny, although if the top level // members aren't primitive types, these functions aren't too helpful. @@ -367,7 +378,6 @@ TAO_DynSequence_i::rewind (CORBA::Environment &) // indicate that next() is called in the body of each of these, and // it has been so implemented here. -/////////////////////////////////////////////////////////////////////// // Insert functions void @@ -594,7 +604,6 @@ TAO_DynSequence_i::insert_any (const CORBA::Any& value, env.exception (new CORBA_DynAny::InvalidValue); } -/////////////////////////////////////////////////////////////////////// // Get functions // If the current component has not been intialized, these @@ -627,7 +636,8 @@ CORBA::Octet TAO_DynSequence_i::get_octet (CORBA::Environment &env) { CORBA::Octet val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { @@ -649,7 +659,8 @@ CORBA::Char TAO_DynSequence_i::get_char (CORBA::Environment &env) { CORBA::Char val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { @@ -671,7 +682,8 @@ CORBA::Short TAO_DynSequence_i::get_short (CORBA::Environment &env) { CORBA::Short val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { @@ -693,7 +705,8 @@ CORBA::UShort TAO_DynSequence_i::get_ushort (CORBA::Environment &env) { CORBA::UShort val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { @@ -715,7 +728,8 @@ CORBA::Long TAO_DynSequence_i::get_long (CORBA::Environment &env) { CORBA::Long val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { @@ -737,7 +751,8 @@ CORBA::ULong TAO_DynSequence_i::get_ulong (CORBA::Environment &env) { CORBA::ULong val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { @@ -759,7 +774,8 @@ CORBA::Float TAO_DynSequence_i::get_float (CORBA::Environment &env) { CORBA::Float val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { @@ -781,7 +797,8 @@ CORBA::Double TAO_DynSequence_i::get_double (CORBA::Environment &env) { CORBA::Double val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { @@ -803,7 +820,8 @@ char * TAO_DynSequence_i::get_string (CORBA::Environment &env) { CORBA::Char *val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { @@ -825,7 +843,8 @@ CORBA::Object_ptr TAO_DynSequence_i::get_reference (CORBA::Environment &env) { CORBA_Object_ptr val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { @@ -847,7 +866,8 @@ CORBA::TypeCode_ptr TAO_DynSequence_i::get_typecode (CORBA::Environment &env) { CORBA_TypeCode_ptr val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { @@ -873,7 +893,8 @@ TAO_DynSequence_i::get_longlong (CORBA::Environment &env) #else /* ! ACE_LACKS_LONGLONG_T */ CORBA::LongLong val = 0; #endif /* ! ACE_LACKS_LONGLONG_T */ - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { @@ -895,7 +916,8 @@ CORBA::ULongLong TAO_DynSequence_i::get_ulonglong (CORBA::Environment &env) { CORBA::ULongLong val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { @@ -917,7 +939,8 @@ CORBA::WChar TAO_DynSequence_i::get_wchar (CORBA::Environment &env) { CORBA::WChar val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { @@ -939,7 +962,8 @@ CORBA::Any_ptr TAO_DynSequence_i::get_any (CORBA::Environment &env) { CORBA_Any_ptr val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { @@ -957,12 +981,13 @@ TAO_DynSequence_i::get_any (CORBA::Environment &env) return val; } -////////////////////////////////////////////////////////////////////// // Private utility function. + CORBA::TypeCode_ptr TAO_DynSequence_i::get_element_type (CORBA::Environment& env) { - CORBA::TypeCode_ptr element_type = this->type_.in (); + CORBA::TypeCode_ptr element_type = + this->type_.in (); // Strip away aliases (if any) on top of the outer type while (element_type->kind (env) != CORBA::tk_sequence) diff --git a/TAO/tao/DynSequence_i.h b/TAO/tao/DynSequence_i.h index 3305fa14839..bac5bc18593 100644 --- a/TAO/tao/DynSequence_i.h +++ b/TAO/tao/DynSequence_i.h @@ -45,58 +45,58 @@ public: ~TAO_DynSequence_i (void); // destructor - // Functions specific to DynSequence - - // Get and set length of sequence + // = Functions specific to DynSequence CORBA::ULong length (CORBA::Environment &ACE_TRY_ENV); + // Get length of sequence. void length (CORBA::ULong length, CORBA::Environment &ACE_TRY_ENV); - - // Assign and dump elements using IDL defined type AnySeq + // Set length of sequence. CORBA_AnySeq_ptr get_elements (CORBA::Environment &ACE_TRY_ENV); + // Get elements using IDL defined type AnySeq. void set_elements (const CORBA_AnySeq& value, CORBA::Environment &ACE_TRY_ENV); + // Set elements using IDL defined type AnySeq. - // Functions common to all Dynamic Any types + // = Functions common to all Dynamic Any types void assign (CORBA_DynAny_ptr dyn_any, CORBA::Environment &ACE_TRY_ENV); - // Sets the value of the receiver to the value of the argument + // Sets the value of the receiver to the value of the argument. CORBA_DynAny_ptr copy (CORBA::Environment &ACE_TRY_ENV); - // Creates a copy + // Creates a copy. void destroy (CORBA::Environment &ACE_TRY_ENV); - // Makes sure the contents are disposed of correctly + // Makes sure the contents are disposed of correctly. void from_any (const CORBA::Any& any, CORBA::Environment &ACE_TRY_ENV); - // Assigns value from an Any argument + // Assigns value from an Any argument. CORBA::Any_ptr to_any (CORBA::Environment &ACE_TRY_ENV); - // Outputs contents as an Any + // Outputs contents as an Any. CORBA::TypeCode_ptr type (CORBA::Environment &ACE_TRY_ENV); - // Returns the (constant) type + // Returns the (constant) type. CORBA_DynAny_ptr current_component (CORBA::Environment &ACE_TRY_ENV); - // Used in iterating through the contents + // Used in iterating through the contents. CORBA::Boolean next (CORBA::Environment &ACE_TRY_ENV); - // Returns next component + // Returns next component. - CORBA::Boolean seek (CORBA::Long index, + CORBA::Boolean seek (CORBA::Long slot, CORBA::Environment &ACE_TRY_ENV); - // Jump to component at <index> + // Jump to component at <slot>. void rewind (CORBA::Environment &ACE_TRY_ENV); - // Makes first component the current one + // Makes first component the current one. - // Insert and get functions + // = Insert and get functions void insert_boolean (CORBA::Boolean value, CORBA::Environment &ACE_TRY_ENV); @@ -131,35 +131,20 @@ public: void insert_any (const CORBA::Any& value, CORBA::Environment &ACE_TRY_ENV); CORBA::Boolean get_boolean (CORBA::Environment &ACE_TRY_ENV); - CORBA::Octet get_octet (CORBA::Environment &ACE_TRY_ENV); - CORBA::Char get_char (CORBA::Environment &ACE_TRY_ENV); - CORBA::Short get_short (CORBA::Environment &ACE_TRY_ENV); - CORBA::UShort get_ushort (CORBA::Environment &ACE_TRY_ENV); - CORBA::Long get_long (CORBA::Environment &ACE_TRY_ENV); - CORBA::ULong get_ulong (CORBA::Environment &ACE_TRY_ENV); - CORBA::Float get_float (CORBA::Environment &ACE_TRY_ENV); - CORBA::Double get_double (CORBA::Environment &ACE_TRY_ENV); - - char * get_string (CORBA::Environment &ACE_TRY_ENV); - + char *get_string (CORBA::Environment &ACE_TRY_ENV); CORBA::Object_ptr get_reference (CORBA::Environment &ACE_TRY_ENV); - CORBA::TypeCode_ptr get_typecode (CORBA::Environment &ACE_TRY_ENV); - CORBA::LongLong get_longlong (CORBA::Environment &ACE_TRY_ENV); - CORBA::ULongLong get_ulonglong (CORBA::Environment &ACE_TRY_ENV); - CORBA::WChar get_wchar (CORBA::Environment &ACE_TRY_ENV); - CORBA::Any_ptr get_any (CORBA::Environment &ACE_TRY_ENV); private: @@ -178,7 +163,7 @@ private: TAO_DynSequence_i (void); // Must be instantiated with at least a typecode - // Use copy() or assign() instead of these + // = Use copy() or assign() instead of these TAO_DynSequence_i (const TAO_DynSequence_i &src); TAO_DynSequence_i &operator= (const TAO_DynSequence_i &src); }; diff --git a/TAO/tao/DynStruct_i.cpp b/TAO/tao/DynStruct_i.cpp index 668c4e9597d..131e385f668 100644 --- a/TAO/tao/DynStruct_i.cpp +++ b/TAO/tao/DynStruct_i.cpp @@ -1,5 +1,6 @@ /* -*- C++ -*- */ // $Id$ + // ==================================================================== // // = LIBRARY @@ -20,7 +21,6 @@ #include "tao/DynStruct_i.h" #include "tao/InconsistentTypeCodeC.h" -////////////////////////////////////////////////////////////////////// // Constructors and destructor TAO_DynStruct_i::TAO_DynStruct_i (const CORBA_Any& any) @@ -31,17 +31,19 @@ TAO_DynStruct_i::TAO_DynStruct_i (const CORBA_Any& any) CORBA::Environment env; // The type will be correct if this constructor called from a - // factory function, but it could also be called by the - // user, so..... - if (TAO_DynAny_i::unalias (this->type_.in (), env) == CORBA::tk_struct) + // factory function, but it could also be called by the user, + // so..... + if (TAO_DynAny_i::unalias (this->type_.in (), + env) == CORBA::tk_struct) { - CORBA::ULong numfields = this->type_.in ()->member_count (env); + CORBA::ULong numfields = + this->type_.in ()->member_count (env); // Resize the array. this->da_members_.size (numfields); // Get the CDR stream of the argument. - ACE_Message_Block* mb = any._tao_get_cdr (); + ACE_Message_Block *mb = any._tao_get_cdr (); TAO_InputCDR cdr (mb); @@ -98,7 +100,6 @@ TAO_DynStruct_i::~TAO_DynStruct_i (void) { } -////////////////////////////////////////////////////////////////////////// // Functions specific to DynStruct CORBA::FieldName @@ -225,7 +226,9 @@ TAO_DynStruct_i::from_any (const CORBA_Any& any, ACE_Message_Block* mb = any._tao_get_cdr (); TAO_InputCDR cdr (mb); - for (CORBA::ULong i = 0; i < this->da_members_.size (); i++) + for (CORBA::ULong i = 0; + i < this->da_members_.size (); + i++) { CORBA::TypeCode_ptr field_tc = this->type_.in ()->member_type (i, @@ -256,7 +259,9 @@ TAO_DynStruct_i::to_any (CORBA::Environment& ACE_TRY_ENV) { TAO_OutputCDR out_cdr; - for (CORBA::ULong i = 0; i < this->da_members_.size (); i++) + for (CORBA::ULong i = 0; + i < this->da_members_.size (); + i++) { // Each component must have been initialied. if (!this->da_members_[i].in ()) @@ -265,12 +270,14 @@ TAO_DynStruct_i::to_any (CORBA::Environment& ACE_TRY_ENV) return 0; } - CORBA_TypeCode_ptr field_tc = this->da_members_[i]->type (ACE_TRY_ENV); + CORBA_TypeCode_ptr field_tc = + this->da_members_[i]->type (ACE_TRY_ENV); // Recursive step - CORBA_Any_var field_any = this->da_members_[i]->to_any (ACE_TRY_ENV); + CORBA_Any_var field_any = + this->da_members_[i]->to_any (ACE_TRY_ENV); - ACE_Message_Block* field_mb = field_any->_tao_get_cdr (); + ACE_Message_Block *field_mb = field_any->_tao_get_cdr (); TAO_InputCDR field_cdr (field_mb); @@ -281,7 +288,7 @@ TAO_DynStruct_i::to_any (CORBA::Environment& ACE_TRY_ENV) TAO_InputCDR in_cdr (out_cdr); - CORBA_Any* retval; + CORBA_Any *retval; ACE_NEW_THROW_EX (retval, CORBA_Any (this->type (ACE_TRY_ENV), 0, @@ -297,18 +304,18 @@ TAO_DynStruct_i::type (CORBA::Environment &) return this->type_.in (); } -// If this component hasn't been initialized yet, the first call -// to current_component will create the pointer and return it. +// If this component hasn't been initialized yet, the first call to +// current_component will create the pointer and return it. + CORBA_DynAny_ptr TAO_DynStruct_i::current_component (CORBA::Environment &env) { if (!this->da_members_[this->index_].in ()) this->da_members_[this->index_] = - TAO_DynAny_i::create_dyn_any ( - this->type_.in ()->member_type (this->index_, - env), - env - ); + TAO_DynAny_i::create_dyn_any + (this->type_.in ()->member_type (this->index_, + env), + env); return this->da_members_[this->index_].in (); } @@ -324,13 +331,14 @@ TAO_DynStruct_i::next (CORBA::Environment &) } CORBA::Boolean -TAO_DynStruct_i::seek (CORBA::Long index, +TAO_DynStruct_i::seek (CORBA::Long slot, CORBA::Environment &) { - if (index < 0 || index >= (CORBA::Long) this->da_members_.size ()) + if (slot < 0 + || slot >= (CORBA::Long) this->da_members_.size ()) return 0; - this->index_ = index; + this->index_ = slot; return 1; } @@ -340,7 +348,6 @@ TAO_DynStruct_i::rewind (CORBA::Environment &) this->index_ = 0; } -////////////////////////////////////////////////////////////////////////// // The insert-primitive and get-primitive functions are required // by the spec of all types of DynAny, although if the top level // members aren't primitive types, these functions aren't too helpful. @@ -348,7 +355,6 @@ TAO_DynStruct_i::rewind (CORBA::Environment &) // indicate that next() is called in the body of each of these, and // it has been so implemented here. -///////////////////////////////////////////////////////////////////////////// // Insert functions void @@ -357,7 +363,7 @@ TAO_DynStruct_i::insert_boolean (CORBA::Boolean value, { if (TAO_DynAny_i::unalias (this->type_.in ()->member_type (this->index_), env) - == CORBA::tk_boolean) + == CORBA::tk_boolean) { this->current_component (env)->insert_boolean (value, env); @@ -373,7 +379,7 @@ TAO_DynStruct_i::insert_octet (CORBA::Octet value, { if (TAO_DynAny_i::unalias (this->type_.in ()->member_type (this->index_), env) - == CORBA::tk_octet) + == CORBA::tk_octet) { this->current_component (env)->insert_octet (value, env); @@ -389,7 +395,7 @@ TAO_DynStruct_i::insert_char (CORBA::Char value, { if (TAO_DynAny_i::unalias (this->type_.in ()->member_type (this->index_), env) - == CORBA::tk_char) + == CORBA::tk_char) { this->current_component (env)->insert_char (value, env); @@ -405,7 +411,7 @@ TAO_DynStruct_i::insert_short (CORBA::Short value, { if (TAO_DynAny_i::unalias (this->type_.in ()->member_type (this->index_), env) - == CORBA::tk_short) + == CORBA::tk_short) { this->current_component (env)->insert_short (value, env); @@ -421,7 +427,7 @@ TAO_DynStruct_i::insert_ushort (CORBA::UShort value, { if (TAO_DynAny_i::unalias (this->type_.in ()->member_type (this->index_), env) - == CORBA::tk_ushort) + == CORBA::tk_ushort) { this->current_component (env)->insert_ushort (value, env); @@ -437,7 +443,7 @@ TAO_DynStruct_i::insert_long (CORBA::Long value, { if (TAO_DynAny_i::unalias (this->type_.in ()->member_type (this->index_), env) - == CORBA::tk_long) + == CORBA::tk_long) { this->current_component (env)->insert_long (value, env); @@ -453,7 +459,7 @@ TAO_DynStruct_i::insert_ulong (CORBA::ULong value, { if (TAO_DynAny_i::unalias (this->type_.in ()->member_type (this->index_), env) - == CORBA::tk_long) + == CORBA::tk_long) { this->current_component (env)->insert_ulong (value, env); @@ -469,7 +475,7 @@ TAO_DynStruct_i::insert_float (CORBA::Float value, { if (TAO_DynAny_i::unalias (this->type_.in ()->member_type (this->index_), env) - == CORBA::tk_float) + == CORBA::tk_float) { this->current_component (env)->insert_float (value, env); @@ -485,7 +491,7 @@ TAO_DynStruct_i::insert_double (CORBA::Double value, { if (TAO_DynAny_i::unalias (this->type_.in ()->member_type (this->index_), env) - == CORBA::tk_double) + == CORBA::tk_double) { this->current_component (env)->insert_double (value, env); @@ -501,7 +507,7 @@ TAO_DynStruct_i::insert_string (const char * value, { if (TAO_DynAny_i::unalias (this->type_.in ()->member_type (this->index_), env) - == CORBA::tk_string) + == CORBA::tk_string) { this->current_component (env)->insert_string (value, env); @@ -517,7 +523,7 @@ TAO_DynStruct_i::insert_reference (CORBA::Object_ptr value, { if (TAO_DynAny_i::unalias (this->type_.in ()->member_type (this->index_), env) - == CORBA::tk_objref) + == CORBA::tk_objref) { this->current_component (env)->insert_reference (value, env); @@ -533,7 +539,7 @@ TAO_DynStruct_i::insert_typecode (CORBA::TypeCode_ptr value, { if (TAO_DynAny_i::unalias (this->type_.in ()->member_type (this->index_), env) - == CORBA::tk_TypeCode) + == CORBA::tk_TypeCode) { this->current_component (env)->insert_typecode (value, env); @@ -549,7 +555,7 @@ TAO_DynStruct_i::insert_longlong (CORBA::LongLong value, { if (TAO_DynAny_i::unalias (this->type_.in ()->member_type (this->index_), env) - == CORBA::tk_longlong) + == CORBA::tk_longlong) { this->current_component (env)->insert_longlong (value, env); @@ -565,7 +571,7 @@ TAO_DynStruct_i::insert_ulonglong (CORBA::ULongLong value, { if (TAO_DynAny_i::unalias (this->type_.in ()->member_type (this->index_), env) - == CORBA::tk_ulonglong) + == CORBA::tk_ulonglong) { this->current_component (env)->insert_ulonglong (value, env); @@ -581,7 +587,7 @@ TAO_DynStruct_i::insert_wchar (CORBA::WChar value, { if (TAO_DynAny_i::unalias (this->type_.in ()->member_type (this->index_), env) - == CORBA::tk_wchar) + == CORBA::tk_wchar) { this->current_component (env)->insert_wchar (value, env); @@ -597,7 +603,7 @@ TAO_DynStruct_i::insert_any (const CORBA::Any& value, { if (TAO_DynAny_i::unalias (this->type_.in ()->member_type (this->index_), env) - == CORBA::tk_any) + == CORBA::tk_any) { this->current_component (env)->insert_any (value, env); @@ -607,24 +613,24 @@ TAO_DynStruct_i::insert_any (const CORBA::Any& value, env.exception (new CORBA_DynAny::InvalidValue); } -/////////////////////////////////////////////////////////////////// // Get functions -// If the current component has not been intialized, these -// raise Invalid, which is not required by the spec, but which -// seems like a courteous thing to do. +// If the current component has not been intialized, these raise +// Invalid, which is not required by the spec, but which seems like a +// courteous thing to do. CORBA::Boolean TAO_DynStruct_i::get_boolean (CORBA::Environment &env) { CORBA::Boolean val = 0;; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { if (TAO_DynAny_i::unalias (dp->type (env), env) - == CORBA::tk_boolean) + == CORBA::tk_boolean) { val = dp->get_boolean (env); this->next (env); @@ -642,13 +648,14 @@ CORBA::Octet TAO_DynStruct_i::get_octet (CORBA::Environment &env) { CORBA::Octet val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { if (TAO_DynAny_i::unalias (dp->type (env), env) - == CORBA::tk_octet) + == CORBA::tk_octet) { val = dp->get_octet (env); this->next (env); @@ -666,13 +673,14 @@ CORBA::Char TAO_DynStruct_i::get_char (CORBA::Environment &env) { CORBA::Char val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { if (TAO_DynAny_i::unalias (dp->type (env), env) - == CORBA::tk_char) + == CORBA::tk_char) { val = dp->get_char (env); this->next (env); @@ -690,13 +698,14 @@ CORBA::Short TAO_DynStruct_i::get_short (CORBA::Environment &env) { CORBA::Short val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { if (TAO_DynAny_i::unalias (dp->type (env), env) - == CORBA::tk_short) + == CORBA::tk_short) { val = dp->get_short (env); this->next (env); @@ -714,13 +723,14 @@ CORBA::UShort TAO_DynStruct_i::get_ushort (CORBA::Environment &env) { CORBA::UShort val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { if (TAO_DynAny_i::unalias (dp->type (env), env) - == CORBA::tk_ushort) + == CORBA::tk_ushort) { val = dp->get_ushort (env); this->next (env); @@ -738,13 +748,14 @@ CORBA::Long TAO_DynStruct_i::get_long (CORBA::Environment &env) { CORBA::Long val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { if (TAO_DynAny_i::unalias (dp->type (env), env) - == CORBA::tk_long) + == CORBA::tk_long) { val = dp->get_long (env); this->next (env); @@ -762,13 +773,14 @@ CORBA::ULong TAO_DynStruct_i::get_ulong (CORBA::Environment &env) { CORBA::ULong val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { if (TAO_DynAny_i::unalias (dp->type (env), env) - == CORBA::tk_ulong) + == CORBA::tk_ulong) { val = dp->get_ulong (env); this->next (env); @@ -786,13 +798,14 @@ CORBA::Float TAO_DynStruct_i::get_float (CORBA::Environment &env) { CORBA::Float val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { if (TAO_DynAny_i::unalias (dp->type (env), env) - == CORBA::tk_float) + == CORBA::tk_float) { val = dp->get_float (env); this->next (env); @@ -810,13 +823,14 @@ CORBA::Double TAO_DynStruct_i::get_double (CORBA::Environment &env) { CORBA::Double val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { if (TAO_DynAny_i::unalias (dp->type (env), env) - == CORBA::tk_double) + == CORBA::tk_double) { val = dp->get_double (env); this->next (env); @@ -834,13 +848,14 @@ char * TAO_DynStruct_i::get_string (CORBA::Environment &env) { CORBA::Char *val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { if (TAO_DynAny_i::unalias (dp->type (env), env) - == CORBA::tk_string) + == CORBA::tk_string) { val = dp->get_string (env); this->next (env); @@ -858,13 +873,14 @@ CORBA::Object_ptr TAO_DynStruct_i::get_reference (CORBA::Environment &env) { CORBA_Object_ptr val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { if (TAO_DynAny_i::unalias (dp->type (env), env) - == CORBA::tk_objref) + == CORBA::tk_objref) { val = dp->get_reference (env); this->next (env); @@ -882,13 +898,14 @@ CORBA::TypeCode_ptr TAO_DynStruct_i::get_typecode (CORBA::Environment &env) { CORBA_TypeCode_ptr val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { if (TAO_DynAny_i::unalias (dp->type (env), env) - == CORBA::tk_TypeCode) + == CORBA::tk_TypeCode) { val = dp->get_typecode (env); this->next (env); @@ -934,13 +951,14 @@ CORBA::ULongLong TAO_DynStruct_i::get_ulonglong (CORBA::Environment &env) { CORBA::ULongLong val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { if (TAO_DynAny_i::unalias (dp->type (env), env) - == CORBA::tk_ulonglong) + == CORBA::tk_ulonglong) { val = dp->get_ulonglong (env); this->next (env); @@ -958,13 +976,14 @@ CORBA::WChar TAO_DynStruct_i::get_wchar (CORBA::Environment &env) { CORBA::WChar val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { if (TAO_DynAny_i::unalias (dp->type (env), env) - == CORBA::tk_wchar) + == CORBA::tk_wchar) { val = dp->get_wchar (env); this->next (env); @@ -982,13 +1001,14 @@ CORBA::Any_ptr TAO_DynStruct_i::get_any (CORBA::Environment &env) { CORBA_Any_ptr val = 0; - CORBA_DynAny_ptr dp = this->da_members_[this->index_].in (); + CORBA_DynAny_ptr dp = + this->da_members_[this->index_].in (); if (dp) { if (TAO_DynAny_i::unalias (dp->type (env), env) - == CORBA::tk_any) + == CORBA::tk_any) { val = dp->get_any (env); this->next (env); diff --git a/TAO/tao/DynStruct_i.h b/TAO/tao/DynStruct_i.h index e0d4d8758db..152abe31ba2 100644 --- a/TAO/tao/DynStruct_i.h +++ b/TAO/tao/DynStruct_i.h @@ -45,21 +45,21 @@ public: ~TAO_DynStruct_i (void); // destructor - // Functions specific to DynStruct + // = Functions specific to DynStruct CORBA::FieldName current_member_name (CORBA::Environment &ACE_TRY_ENV); // FieldName is IDL typedef for string CORBA::TCKind current_member_kind (CORBA::Environment &ACE_TRY_ENV); - // Assign and dump elements using IDL defined type NameValuePairSeq - - CORBA::NameValuePairSeq* get_members (CORBA::Environment &ACE_TRY_ENV); + CORBA::NameValuePairSeq *get_members (CORBA::Environment &ACE_TRY_ENV); + // Get elements using IDL defined type NameValuePairSeq. void set_members (const CORBA::NameValuePairSeq& value, CORBA::Environment &ACE_TRY_ENV); + // Set elements using IDL defined type NameValuePairSeq. - // Functions common to all Dynamic Any types + // = Functions common to all Dynamic Any types void assign (CORBA_DynAny_ptr dyn_any, CORBA::Environment &ACE_TRY_ENV); @@ -87,14 +87,14 @@ public: CORBA::Boolean next (CORBA::Environment &ACE_TRY_ENV); // Returns next component - CORBA::Boolean seek (CORBA::Long index, + CORBA::Boolean seek (CORBA::Long slot, CORBA::Environment &ACE_TRY_ENV); - // Jump to component at <index> + // Jump to component at <slot> void rewind (CORBA::Environment &ACE_TRY_ENV); // Makes first component the current one - // Insert and get functions + // = Insert and get functions void insert_boolean (CORBA::Boolean value, CORBA::Environment &ACE_TRY_ENV); @@ -129,35 +129,20 @@ public: void insert_any (const CORBA::Any& value, CORBA::Environment &ACE_TRY_ENV); CORBA::Boolean get_boolean (CORBA::Environment &ACE_TRY_ENV); - CORBA::Octet get_octet (CORBA::Environment &ACE_TRY_ENV); - CORBA::Char get_char (CORBA::Environment &ACE_TRY_ENV); - CORBA::Short get_short (CORBA::Environment &ACE_TRY_ENV); - CORBA::UShort get_ushort (CORBA::Environment &ACE_TRY_ENV); - CORBA::Long get_long (CORBA::Environment &ACE_TRY_ENV); - CORBA::ULong get_ulong (CORBA::Environment &ACE_TRY_ENV); - CORBA::Float get_float (CORBA::Environment &ACE_TRY_ENV); - CORBA::Double get_double (CORBA::Environment &ACE_TRY_ENV); - - char * get_string (CORBA::Environment &ACE_TRY_ENV); - + char *get_string (CORBA::Environment &ACE_TRY_ENV); CORBA::Object_ptr get_reference (CORBA::Environment &ACE_TRY_ENV); - CORBA::TypeCode_ptr get_typecode (CORBA::Environment &ACE_TRY_ENV); - CORBA::LongLong get_longlong (CORBA::Environment &ACE_TRY_ENV); - CORBA::ULongLong get_ulonglong (CORBA::Environment &ACE_TRY_ENV); - CORBA::WChar get_wchar (CORBA::Environment &ACE_TRY_ENV); - CORBA::Any_ptr get_any (CORBA::Environment &ACE_TRY_ENV); private: @@ -173,7 +158,7 @@ private: TAO_DynStruct_i (void); // Must be instantiated with at least a typecode - // Use copy() or assign() instead of these + // = Use copy() or assign() instead of these TAO_DynStruct_i (const TAO_DynStruct_i &src); TAO_DynStruct_i &operator= (const TAO_DynStruct_i &src); }; diff --git a/TAO/tao/DynUnion_i.cpp b/TAO/tao/DynUnion_i.cpp index 6cba81f3497..571aae717e0 100644 --- a/TAO/tao/DynUnion_i.cpp +++ b/TAO/tao/DynUnion_i.cpp @@ -20,7 +20,6 @@ #include "tao/DynUnion_i.h" #include "tao/InconsistentTypeCodeC.h" -////////////////////////////////////////////////////////////////////// // Constructors and destructor TAO_DynUnion_i::TAO_DynUnion_i (const CORBA_Any& any) @@ -46,7 +45,7 @@ TAO_DynUnion_i::TAO_DynUnion_i (CORBA_TypeCode_ptr tc) if (TAO_DynAny_i::unalias (tc, env) - == CORBA::tk_union) + == CORBA::tk_union) { // Initialize the typecode holder this->type_ = CORBA::TypeCode::_duplicate (tc); @@ -68,12 +67,12 @@ TAO_DynUnion_i::~TAO_DynUnion_i (void) { } -///////////////////////////////////////////////////////////////////// // Functions specific to DynUnion -// If an invalid value has been passed in to the discriminator, -// we don't save it but instead set the member index to the -// default value, if one exists. +// If an invalid value has been passed in to the discriminator, we +// don't save it but instead set the member index to the default +// value, if one exists. + CORBA::Boolean TAO_DynUnion_i::set_as_default (CORBA::Environment& env) { @@ -121,13 +120,17 @@ TAO_DynUnion_i::member_name (CORBA::Environment& env) // If a valid member name is supplied, this function creates a new // member which is NOT initialized. + void TAO_DynUnion_i::member_name (const char* member_name, CORBA::Environment& env) { - CORBA::ULong count = this->type_->member_count (env); + CORBA::ULong count = + this->type_->member_count (env); - for (CORBA::ULong i = 0; i < count; i++) + for (CORBA::ULong i = 0; + i < count; + i++) { if (!ACE_OS::strcmp (member_name, this->type_->member_name (i, @@ -154,7 +157,6 @@ TAO_DynUnion_i::member_name (const char* member_name, } } - CORBA::TCKind TAO_DynUnion_i::member_kind (CORBA::Environment& env) { @@ -163,7 +165,6 @@ TAO_DynUnion_i::member_kind (CORBA::Environment& env) env); } -////////////////////////////////////////////////////////////////////// // Common functions void @@ -214,7 +215,8 @@ CORBA::Any_ptr TAO_DynUnion_i::to_any (CORBA::Environment& ACE_TRY_ENV) { // Both Dynanys must have been initialied. - if (this->member_.in () == 0 || this->discriminator_.in () == 0) + if (this->member_.in () == 0 + || this->discriminator_.in () == 0) { ACE_TRY_ENV.exception (new CORBA_DynAny::Invalid); return 0; @@ -224,11 +226,14 @@ TAO_DynUnion_i::to_any (CORBA::Environment& ACE_TRY_ENV) // Add the discriminator to the CDR stream. - CORBA_TypeCode_ptr disc_tc = this->discriminator_->type (ACE_TRY_ENV); + CORBA_TypeCode_ptr disc_tc = + this->discriminator_->type (ACE_TRY_ENV); - CORBA_Any_var disc_any = this->discriminator_->to_any (ACE_TRY_ENV); + CORBA_Any_var disc_any = + this->discriminator_->to_any (ACE_TRY_ENV); - ACE_Message_Block* disc_mb = disc_any->_tao_get_cdr (); + ACE_Message_Block *disc_mb = + disc_any->_tao_get_cdr (); TAO_InputCDR disc_cdr (disc_mb); @@ -238,11 +243,14 @@ TAO_DynUnion_i::to_any (CORBA::Environment& ACE_TRY_ENV) // Add the member to the CDR stream. - CORBA_TypeCode_ptr member_tc = this->member_->type (ACE_TRY_ENV); + CORBA_TypeCode_ptr member_tc = + this->member_->type (ACE_TRY_ENV); - CORBA_Any_var member_any = this->member_->to_any (ACE_TRY_ENV); + CORBA_Any_var member_any = + this->member_->to_any (ACE_TRY_ENV); - ACE_Message_Block* member_mb = member_any->_tao_get_cdr (); + ACE_Message_Block *member_mb = + member_any->_tao_get_cdr (); TAO_InputCDR member_cdr (member_mb); @@ -253,7 +261,7 @@ TAO_DynUnion_i::to_any (CORBA::Environment& ACE_TRY_ENV) // Make the Any. TAO_InputCDR in_cdr (out_cdr); - CORBA_Any* retval; + CORBA_Any *retval; ACE_NEW_THROW_EX (retval, CORBA_Any (this->type (ACE_TRY_ENV), 0, @@ -294,13 +302,14 @@ TAO_DynUnion_i::next (CORBA::Environment &env) } CORBA::Boolean -TAO_DynUnion_i::seek (CORBA::Long index, +TAO_DynUnion_i::seek (CORBA::Long slot, CORBA::Environment &env) { - if (index < 0 || index >= (CORBA::Long) this->type_->member_count (env)) + if (slot < 0 + || slot >= (CORBA::Long) this->type_->member_count (env)) return 0; - this->index_ = index; + this->index_ = slot; if (!CORBA::is_nil (this->member_.in ())) this->member_->destroy (env); @@ -329,14 +338,12 @@ TAO_DynUnion_i::rewind (CORBA::Environment &env) env); } -///////////////////////////////////////////////////////////////////////////// // Insert and get functions // // Note that next() is not called in the body of these functions as it is // with DynStruct, DynSequence and DynArray. It doesn't seem to make sense // for unions. -/////////////////////////////////////////////////////////////////////////////// // Insert functions void @@ -350,19 +357,24 @@ TAO_DynUnion_i::insert_boolean (CORBA::Boolean value, env); else { - CORBA::ULong count = this->type_->member_count (env); + CORBA::ULong count = + this->type_->member_count (env); - for (CORBA::ULong i = 0; i < count; i++) + for (CORBA::ULong i = 0; + i < count; + i++) { - CORBA::TypeCode_ptr tc = this->type_->member_type (i, - env); + CORBA::TypeCode_ptr tc = + this->type_->member_type (i, + env); if (TAO_DynAny_i::unalias (tc, env) == CORBA::tk_boolean) { - this->member_ = TAO_DynAny_i::create_dyn_any (tc, - env); + this->member_ = + TAO_DynAny_i::create_dyn_any (tc, + env); this->member_->insert_boolean (value, env); this->discriminator_ = @@ -389,19 +401,24 @@ TAO_DynUnion_i::insert_octet (CORBA::Octet value, env); else { - CORBA::ULong count = this->type_->member_count (env); + CORBA::ULong count = + this->type_->member_count (env); - for (CORBA::ULong i = 0; i < count; i++) + for (CORBA::ULong i = 0; + i < count; + i++) { - CORBA::TypeCode_ptr tc = this->type_->member_type (i, - env); + CORBA::TypeCode_ptr tc = + this->type_->member_type (i, + env); if (TAO_DynAny_i::unalias (tc, env) == CORBA::tk_octet) { - this->member_ = TAO_DynAny_i::create_dyn_any (tc, - env); + this->member_ = + TAO_DynAny_i::create_dyn_any (tc, + env); this->member_->insert_octet (value, env); this->discriminator_ = @@ -428,19 +445,24 @@ TAO_DynUnion_i::insert_char (CORBA::Char value, env); else { - CORBA::ULong count = this->type_->member_count (env); + CORBA::ULong count = + this->type_->member_count (env); - for (CORBA::ULong i = 0; i < count; i++) + for (CORBA::ULong i = 0; + i < count; + i++) { - CORBA::TypeCode_ptr tc = this->type_->member_type (i, - env); + CORBA::TypeCode_ptr tc = + this->type_->member_type (i, + env); if (TAO_DynAny_i::unalias (tc, env) == CORBA::tk_char) { - this->member_ = TAO_DynAny_i::create_dyn_any (tc, - env); + this->member_ = + TAO_DynAny_i::create_dyn_any (tc, + env); this->member_->insert_char (value, env); this->discriminator_ = @@ -466,19 +488,23 @@ TAO_DynUnion_i::insert_short (CORBA::Short value, this->member_->insert_short (value, env); else { - CORBA::ULong count = this->type_->member_count (env); + CORBA::ULong count = + this->type_->member_count (env); - for (CORBA::ULong i = 0; i < count; i++) + for (CORBA::ULong i = 0; + i < count; + i++) { - CORBA::TypeCode_ptr tc = this->type_->member_type (i, - env); - + CORBA::TypeCode_ptr tc = + this->type_->member_type (i, + env); if (TAO_DynAny_i::unalias (tc, env) == CORBA::tk_short) { - this->member_ = TAO_DynAny_i::create_dyn_any (tc, - env); + this->member_ = + TAO_DynAny_i::create_dyn_any (tc, + env); this->member_->insert_short (value, env); this->discriminator_ = @@ -505,19 +531,24 @@ TAO_DynUnion_i::insert_long (CORBA::Long value, env); else { - CORBA::ULong count = this->type_->member_count (env); + CORBA::ULong count = + this->type_->member_count (env); - for (CORBA::ULong i = 0; i < count; i++) + for (CORBA::ULong i = 0; + i < count; + i++) { - CORBA::TypeCode_ptr tc = this->type_->member_type (i, - env); + CORBA::TypeCode_ptr tc = + this->type_->member_type (i, + env); if (TAO_DynAny_i::unalias (tc, env) == CORBA::tk_long) { - this->member_ = TAO_DynAny_i::create_dyn_any (tc, - env); + this->member_ = + TAO_DynAny_i::create_dyn_any (tc, + env); this->member_->insert_long (value, env); this->discriminator_ = @@ -544,9 +575,12 @@ TAO_DynUnion_i::insert_ushort (CORBA::UShort value, env); else { - CORBA::ULong count = this->type_->member_count (env); + CORBA::ULong count = + this->type_->member_count (env); - for (CORBA::ULong i = 0; i < count; i++) + for (CORBA::ULong i = 0; + i < count; + i++) { CORBA::TypeCode_ptr tc = this->type_->member_type (i, env); @@ -555,8 +589,9 @@ TAO_DynUnion_i::insert_ushort (CORBA::UShort value, env) == CORBA::tk_ushort) { - this->member_ = TAO_DynAny_i::create_dyn_any (tc, - env); + this->member_ = + TAO_DynAny_i::create_dyn_any (tc, + env); this->member_->insert_ushort (value, env); this->discriminator_ = @@ -583,19 +618,24 @@ TAO_DynUnion_i::insert_ulong (CORBA::ULong value, env); else { - CORBA::ULong count = this->type_->member_count (env); + CORBA::ULong count = + this->type_->member_count (env); - for (CORBA::ULong i = 0; i < count; i++) + for (CORBA::ULong i = 0; + i < count; + i++) { - CORBA::TypeCode_ptr tc = this->type_->member_type (i, - env); + CORBA::TypeCode_ptr tc = + this->type_->member_type (i, + env); if (TAO_DynAny_i::unalias (tc, env) == CORBA::tk_ulong) { - this->member_ = TAO_DynAny_i::create_dyn_any (tc, - env); + this->member_ = + TAO_DynAny_i::create_dyn_any (tc, + env); this->member_->insert_ulong (value, env); this->discriminator_ = @@ -622,19 +662,24 @@ TAO_DynUnion_i::insert_float (CORBA::Float value, env); else { - CORBA::ULong count = this->type_->member_count (env); + CORBA::ULong count = + this->type_->member_count (env); - for (CORBA::ULong i = 0; i < count; i++) + for (CORBA::ULong i = 0; + i < count; + i++) { - CORBA::TypeCode_ptr tc = this->type_->member_type (i, - env); + CORBA::TypeCode_ptr tc = + this->type_->member_type (i, + env); if (TAO_DynAny_i::unalias (tc, env) == CORBA::tk_float) { - this->member_ = TAO_DynAny_i::create_dyn_any (tc, - env); + this->member_ = + TAO_DynAny_i::create_dyn_any (tc, + env); this->member_->insert_float (value, env); this->discriminator_ = @@ -661,19 +706,24 @@ TAO_DynUnion_i::insert_double (CORBA::Double value, env); else { - CORBA::ULong count = this->type_->member_count (env); + CORBA::ULong count = + this->type_->member_count (env); - for (CORBA::ULong i = 0; i < count; i++) + for (CORBA::ULong i = 0; + i < count; + i++) { - CORBA::TypeCode_ptr tc = this->type_->member_type (i, - env); + CORBA::TypeCode_ptr tc = + this->type_->member_type (i, + env); if (TAO_DynAny_i::unalias (tc, env) == CORBA::tk_double) { - this->member_ = TAO_DynAny_i::create_dyn_any (tc, - env); + this->member_ = + TAO_DynAny_i::create_dyn_any (tc, + env); this->member_->insert_double (value, env); this->discriminator_ = @@ -700,19 +750,23 @@ TAO_DynUnion_i::insert_string (const char* value, env); else { - CORBA::ULong count = this->type_->member_count (env); + CORBA::ULong count = + this->type_->member_count (env); - for (CORBA::ULong i = 0; i < count; i++) + for (CORBA::ULong i = 0; + i < count; + i++) { - CORBA::TypeCode_ptr tc = this->type_->member_type (i, - env); - + CORBA::TypeCode_ptr tc = + this->type_->member_type (i, + env); if (TAO_DynAny_i::unalias (tc, env) == CORBA::tk_string) { - this->member_ = TAO_DynAny_i::create_dyn_any (tc, - env); + this->member_ = + TAO_DynAny_i::create_dyn_any (tc, + env); this->member_->insert_string (value, env); this->discriminator_ = @@ -739,19 +793,24 @@ TAO_DynUnion_i::insert_reference (CORBA::Object_ptr value, env); else { - CORBA::ULong count = this->type_->member_count (env); + CORBA::ULong count = + this->type_->member_count (env); - for (CORBA::ULong i = 0; i < count; i++) + for (CORBA::ULong i = 0; + i < count; + i++) { - CORBA::TypeCode_ptr tc = this->type_->member_type (i, - env); + CORBA::TypeCode_ptr tc = + this->type_->member_type (i, + env); if (TAO_DynAny_i::unalias (tc, env) == CORBA::tk_objref) { - this->member_ = TAO_DynAny_i::create_dyn_any (tc, - env); + this->member_ = + TAO_DynAny_i::create_dyn_any (tc, + env); this->member_->insert_reference (value, env); this->discriminator_ = @@ -778,19 +837,24 @@ TAO_DynUnion_i::insert_typecode (CORBA::TypeCode_ptr value, env); else { - CORBA::ULong count = this->type_->member_count (env); + CORBA::ULong count = + this->type_->member_count (env); - for (CORBA::ULong i = 0; i < count; i++) + for (CORBA::ULong i = 0; + i < count; + i++) { - CORBA::TypeCode_ptr tc = this->type_->member_type (i, - env); + CORBA::TypeCode_ptr tc = + this->type_->member_type (i, + env); if (TAO_DynAny_i::unalias (tc, env) == CORBA::tk_TypeCode) { - this->member_ = TAO_DynAny_i::create_dyn_any (tc, - env); + this->member_ = + TAO_DynAny_i::create_dyn_any (tc, + env); this->member_->insert_typecode (value, env); this->discriminator_ = @@ -817,19 +881,23 @@ TAO_DynUnion_i::insert_longlong (CORBA::LongLong value, env); else { - CORBA::ULong count = this->type_->member_count (env); + CORBA::ULong count = + this->type_->member_count (env); - for (CORBA::ULong i = 0; i < count; i++) + for (CORBA::ULong i = 0; + i < count; + i++) { - CORBA::TypeCode_ptr tc = this->type_->member_type (i, - env); - + CORBA::TypeCode_ptr tc = + this->type_->member_type (i, + env); if (TAO_DynAny_i::unalias (tc, env) == CORBA::tk_longlong) { - this->member_ = TAO_DynAny_i::create_dyn_any (tc, - env); + this->member_ = + TAO_DynAny_i::create_dyn_any (tc, + env); this->member_->insert_longlong (value, env); this->discriminator_ = @@ -856,19 +924,23 @@ TAO_DynUnion_i::insert_ulonglong (CORBA::ULongLong value, env); else { - CORBA::ULong count = this->type_->member_count (env); + CORBA::ULong count = + this->type_->member_count (env); - for (CORBA::ULong i = 0; i < count; i++) + for (CORBA::ULong i = 0; + i < count; + i++) { - CORBA::TypeCode_ptr tc = this->type_->member_type (i, - env); - + CORBA::TypeCode_ptr tc = + this->type_->member_type (i, + env); if (TAO_DynAny_i::unalias (tc, env) == CORBA::tk_ulonglong) { - this->member_ = TAO_DynAny_i::create_dyn_any (tc, - env); + this->member_ = + TAO_DynAny_i::create_dyn_any (tc, + env); this->member_->insert_ulonglong (value, env); this->discriminator_ = @@ -895,19 +967,24 @@ TAO_DynUnion_i::insert_wchar (CORBA::WChar value, env); else { - CORBA::ULong count = this->type_->member_count (env); + CORBA::ULong count = + this->type_->member_count (env); - for (CORBA::ULong i = 0; i < count; i++) + for (CORBA::ULong i = 0; + i < count; + i++) { - CORBA::TypeCode_ptr tc = this->type_->member_type (i, - env); + CORBA::TypeCode_ptr tc = + this->type_->member_type (i, + env); if (TAO_DynAny_i::unalias (tc, env) == CORBA::tk_wchar) { - this->member_ = TAO_DynAny_i::create_dyn_any (tc, - env); + this->member_ = + TAO_DynAny_i::create_dyn_any (tc, + env); this->member_->insert_wchar (value, env); this->discriminator_ = @@ -933,19 +1010,23 @@ TAO_DynUnion_i::insert_any (const CORBA::Any& value, this->member_->insert_any (value, env); else { - CORBA::ULong count = this->type_->member_count (env); + CORBA::ULong count = + this->type_->member_count (env); - for (CORBA::ULong i = 0; i < count; i++) + for (CORBA::ULong i = 0; + i < count; + i++) { - CORBA::TypeCode_ptr tc = this->type_->member_type (i, - env); - + CORBA::TypeCode_ptr tc = + this->type_->member_type (i, + env); if (TAO_DynAny_i::unalias (tc, env) == CORBA::tk_any) { - this->member_ = TAO_DynAny_i::create_dyn_any (tc, - env); + this->member_ = + TAO_DynAny_i::create_dyn_any (tc, + env); this->member_->insert_any (value, env); this->discriminator_ = @@ -961,14 +1042,14 @@ TAO_DynUnion_i::insert_any (const CORBA::Any& value, } } -///////////////////////////////////////////////////////////////////////////////// // Get functions CORBA::Boolean TAO_DynUnion_i::get_boolean (CORBA::Environment &env) { - if (this->member_.in () && TAO_DynAny_i::unalias (this->member_->type (env), - env) + if (this->member_.in () + && TAO_DynAny_i::unalias (this->member_->type (env), + env) == CORBA::tk_boolean) return this->member_->get_boolean (env); else @@ -981,8 +1062,9 @@ TAO_DynUnion_i::get_boolean (CORBA::Environment &env) CORBA::Octet TAO_DynUnion_i::get_octet (CORBA::Environment &env) { - if (this->member_.in () && TAO_DynAny_i::unalias (this->member_->type (env), - env) + if (this->member_.in () + && TAO_DynAny_i::unalias (this->member_->type (env), + env) == CORBA::tk_octet) return this->member_->get_octet (env); else @@ -995,8 +1077,9 @@ TAO_DynUnion_i::get_octet (CORBA::Environment &env) CORBA::Char TAO_DynUnion_i::get_char (CORBA::Environment &env) { - if (this->member_.in () && TAO_DynAny_i::unalias (this->member_->type (env), - env) + if (this->member_.in () + && TAO_DynAny_i::unalias (this->member_->type (env), + env) == CORBA::tk_char) return this->member_->get_char (env); else @@ -1009,8 +1092,9 @@ TAO_DynUnion_i::get_char (CORBA::Environment &env) CORBA::Short TAO_DynUnion_i::get_short (CORBA::Environment &env) { - if (this->member_.in () && TAO_DynAny_i::unalias (this->member_->type (env), - env) + if (this->member_.in () + && TAO_DynAny_i::unalias (this->member_->type (env), + env) == CORBA::tk_short) return this->member_->get_short (env); else @@ -1023,8 +1107,9 @@ TAO_DynUnion_i::get_short (CORBA::Environment &env) CORBA::Long TAO_DynUnion_i::get_long (CORBA::Environment &env) { - if (this->member_.in () && TAO_DynAny_i::unalias (this->member_->type (env), - env) + if (this->member_.in () + && TAO_DynAny_i::unalias (this->member_->type (env), + env) == CORBA::tk_long) return this->member_->get_long (env); else @@ -1037,8 +1122,9 @@ TAO_DynUnion_i::get_long (CORBA::Environment &env) CORBA::UShort TAO_DynUnion_i::get_ushort(CORBA::Environment &env) { - if (this->member_.in () && TAO_DynAny_i::unalias (this->member_->type (env), - env) + if (this->member_.in () + && TAO_DynAny_i::unalias (this->member_->type (env), + env) == CORBA::tk_ushort) return this->member_->get_ushort (env); else @@ -1051,8 +1137,9 @@ TAO_DynUnion_i::get_ushort(CORBA::Environment &env) CORBA::ULong TAO_DynUnion_i::get_ulong (CORBA::Environment &env) { - if (this->member_.in () && TAO_DynAny_i::unalias (this->member_->type (env), - env) + if (this->member_.in () + && TAO_DynAny_i::unalias (this->member_->type (env), + env) == CORBA::tk_ulong) return this->member_->get_ulong (env); else @@ -1065,8 +1152,9 @@ TAO_DynUnion_i::get_ulong (CORBA::Environment &env) CORBA::Float TAO_DynUnion_i::get_float (CORBA::Environment &env) { - if (this->member_.in () && TAO_DynAny_i::unalias (this->member_->type (env), - env) + if (this->member_.in () + && TAO_DynAny_i::unalias (this->member_->type (env), + env) == CORBA::tk_float) return this->member_->get_float (env); else @@ -1079,8 +1167,9 @@ TAO_DynUnion_i::get_float (CORBA::Environment &env) CORBA::Double TAO_DynUnion_i::get_double (CORBA::Environment &env) { - if (this->member_.in () && TAO_DynAny_i::unalias (this->member_->type (env), - env) + if (this->member_.in () + && TAO_DynAny_i::unalias (this->member_->type (env), + env) == CORBA::tk_double) return this->member_->get_double (env); else @@ -1093,8 +1182,9 @@ TAO_DynUnion_i::get_double (CORBA::Environment &env) CORBA::String TAO_DynUnion_i::get_string (CORBA::Environment &env) { - if (this->member_.in () && TAO_DynAny_i::unalias (this->member_->type (env), - env) + if (this->member_.in () + && TAO_DynAny_i::unalias (this->member_->type (env), + env) == CORBA::tk_string) return this->member_->get_string (env); else @@ -1107,8 +1197,9 @@ TAO_DynUnion_i::get_string (CORBA::Environment &env) CORBA::TypeCode_ptr TAO_DynUnion_i::get_typecode (CORBA::Environment &env) { - if (this->member_.in () && TAO_DynAny_i::unalias (this->member_->type (env), - env) + if (this->member_.in () + && TAO_DynAny_i::unalias (this->member_->type (env), + env) == CORBA::tk_TypeCode) return this->member_->get_typecode (env); else @@ -1121,8 +1212,9 @@ TAO_DynUnion_i::get_typecode (CORBA::Environment &env) CORBA::Object_ptr TAO_DynUnion_i::get_reference (CORBA::Environment &env) { - if (this->member_.in () && TAO_DynAny_i::unalias (this->member_->type (env), - env) + if (this->member_.in () + && TAO_DynAny_i::unalias (this->member_->type (env), + env) == CORBA::tk_objref) return this->member_->get_reference (env); else @@ -1135,8 +1227,9 @@ TAO_DynUnion_i::get_reference (CORBA::Environment &env) CORBA::LongLong TAO_DynUnion_i::get_longlong (CORBA::Environment &env) { - if (this->member_.in () && TAO_DynAny_i::unalias (this->member_->type (env), - env) + if (this->member_.in () + && TAO_DynAny_i::unalias (this->member_->type (env), + env) == CORBA::tk_longlong) return this->member_->get_longlong (env); else @@ -1155,8 +1248,9 @@ TAO_DynUnion_i::get_longlong (CORBA::Environment &env) CORBA::ULongLong TAO_DynUnion_i::get_ulonglong (CORBA::Environment &env) { - if (this->member_.in () && TAO_DynAny_i::unalias (this->member_->type (env), - env) + if (this->member_.in () + && TAO_DynAny_i::unalias (this->member_->type (env), + env) == CORBA::tk_ulonglong) return this->member_->get_ulonglong (env); else @@ -1169,8 +1263,9 @@ TAO_DynUnion_i::get_ulonglong (CORBA::Environment &env) CORBA::WChar TAO_DynUnion_i::get_wchar (CORBA::Environment &env) { - if (this->member_.in () && TAO_DynAny_i::unalias (this->member_->type (env), - env) + if (this->member_.in () + && TAO_DynAny_i::unalias (this->member_->type (env), + env) == CORBA::tk_wchar) return this->member_->get_wchar (env); else @@ -1183,8 +1278,9 @@ TAO_DynUnion_i::get_wchar (CORBA::Environment &env) CORBA::Any_ptr TAO_DynUnion_i::get_any (CORBA::Environment &env) { - if (this->member_.in () && TAO_DynAny_i::unalias (this->member_->type (env), - env) + if (this->member_.in () + && TAO_DynAny_i::unalias (this->member_->type (env), + env) == CORBA::tk_any) return this->member_->get_any (env); else @@ -1194,7 +1290,6 @@ TAO_DynUnion_i::get_any (CORBA::Environment &env) } } -///////////////////////////////////////////////////////////////////////////// // Private functions // Some specialized instantiations of the template functor defined in @@ -1202,24 +1297,22 @@ TAO_DynUnion_i::get_any (CORBA::Environment &env) ACE_TEMPLATE_SPECIALIZATION CORBA::Boolean -DU_Extractor<CORBA::Boolean>::check_match ( - const CORBA_Any& inside_any, - const CORBA_Any& outside_any - ) +DU_Extractor<CORBA::Boolean>::check_match (const CORBA_Any& inside_any, + const CORBA_Any& outside_any) { CORBA::Any::to_boolean member_struct (this->member_index_); CORBA::Any::to_boolean arg_struct (this->arg_index_); + inside_any >>= member_struct; outside_any >>= arg_struct; + return member_struct.ref_ == arg_struct.ref_; } ACE_TEMPLATE_SPECIALIZATION CORBA::Boolean -DU_Extractor<CORBA::Char>::check_match ( - const CORBA_Any& inside_any, - const CORBA_Any& outside_any - ) +DU_Extractor<CORBA::Char>::check_match (const CORBA_Any& inside_any, + const CORBA_Any& outside_any) { CORBA::Any::to_char member_struct (this->member_index_); CORBA::Any::to_char arg_struct (this->arg_index_); @@ -1234,8 +1327,10 @@ TAO_DynUnion_i::WChar_extractor::check_match (const CORBA_Any& inside_any, { CORBA::Any::to_wchar member_struct (this->member_index_); CORBA::Any::to_wchar arg_struct (this->arg_index_); + inside_any >>= member_struct; outside_any >>= arg_struct; + return member_struct.ref_ == arg_struct.ref_; } @@ -1244,7 +1339,7 @@ TAO_DynUnion_i::Enum_extractor::check_match (const CORBA_Any& inside_any, const CORBA_Any& outside_any) { // Get the CDR stream of one argument... - ACE_Message_Block* mb = inside_any._tao_get_cdr (); + ACE_Message_Block *mb = inside_any._tao_get_cdr (); TAO_InputCDR inside_cdr (mb); @@ -1269,74 +1364,74 @@ TAO_DynUnion_i::get_extractor (CORBA::TCKind kind, switch (kind) { - case CORBA::tk_short: - ACE_NEW_THROW_EX (retval, - DU_Extractor<CORBA::Short>, - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (0); - return retval; - case CORBA::tk_long: - ACE_NEW_THROW_EX (retval, - DU_Extractor<CORBA::Long>, - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (0); - return retval; - case CORBA::tk_ushort: - ACE_NEW_THROW_EX (retval, - DU_Extractor<CORBA::UShort>, - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (0); - return retval; - case CORBA::tk_ulong: - ACE_NEW_THROW_EX (retval, - DU_Extractor<CORBA::ULong>, - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (0); - return retval; - case CORBA::tk_boolean: - ACE_NEW_THROW_EX (retval, - DU_Extractor<CORBA::Boolean>, - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (0); - return retval; - case CORBA::tk_char: - ACE_NEW_THROW_EX (retval, - DU_Extractor<CORBA::Char>, - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (0); - return retval; - -// For platforms without native 64-bit ints . . . + case CORBA::tk_short: + ACE_NEW_THROW_EX (retval, + DU_Extractor<CORBA::Short>, + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (0); + return retval; + case CORBA::tk_long: + ACE_NEW_THROW_EX (retval, + DU_Extractor<CORBA::Long>, + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (0); + return retval; + case CORBA::tk_ushort: + ACE_NEW_THROW_EX (retval, + DU_Extractor<CORBA::UShort>, + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (0); + return retval; + case CORBA::tk_ulong: + ACE_NEW_THROW_EX (retval, + DU_Extractor<CORBA::ULong>, + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (0); + return retval; + case CORBA::tk_boolean: + ACE_NEW_THROW_EX (retval, + DU_Extractor<CORBA::Boolean>, + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (0); + return retval; + case CORBA::tk_char: + ACE_NEW_THROW_EX (retval, + DU_Extractor<CORBA::Char>, + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (0); + return retval; + + // For platforms without native 64-bit ints . . . #if !defined (ACE_LACKS_LONGLONG_T) - case CORBA::tk_longlong: - ACE_NEW_THROW_EX (retval, - DU_Extractor<CORBA::LongLong>, - CORBA::NO_MEMORY ()); + case CORBA::tk_longlong: + ACE_NEW_THROW_EX (retval, + DU_Extractor<CORBA::LongLong>, + CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (0); - return retval; + ACE_CHECK_RETURN (0); + return retval; #endif /* ACE_LACKS_LONGLONG_T */ - case CORBA::tk_ulonglong: - ACE_NEW_THROW_EX (retval, - DU_Extractor<CORBA::ULongLong>, - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (0); - return retval; - case CORBA::tk_wchar: - ACE_NEW_THROW_EX (retval, - WChar_extractor, - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (0); - return retval; - case CORBA::tk_enum: - ACE_NEW_THROW_EX (retval, - Enum_extractor, - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (0); - return retval; - default: - return 0; + case CORBA::tk_ulonglong: + ACE_NEW_THROW_EX (retval, + DU_Extractor<CORBA::ULongLong>, + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (0); + return retval; + case CORBA::tk_wchar: + ACE_NEW_THROW_EX (retval, + WChar_extractor, + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (0); + return retval; + case CORBA::tk_enum: + ACE_NEW_THROW_EX (retval, + Enum_extractor, + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (0); + return retval; + default: + return 0; } } @@ -1417,12 +1512,12 @@ TAO_DynUnion_i::set_from_any (const CORBA_Any& any, if (!CORBA::is_nil (this->member_.in ())) this->member_->destroy (env); - this->member_ = TAO_DynAny_i::create_dyn_any (member_any, - env); + this->member_ = + TAO_DynAny_i::create_dyn_any (member_any, + env); } } - #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class DU_Extractor<CORBA::Short>; template class DU_Extractor<CORBA::Long>; diff --git a/TAO/tao/DynUnion_i.h b/TAO/tao/DynUnion_i.h index 744021ad40e..1937cd03613 100644 --- a/TAO/tao/DynUnion_i.h +++ b/TAO/tao/DynUnion_i.h @@ -29,8 +29,7 @@ class TAO_Export TAO_DynUnion_i : public POA_CORBA::DynUnion // TAO_DynUnion_i // // = DESCRIPTION - // Implementation of Dynamic Any type for Unions - // + // Implementation of Dynamic Any type for Unions. public: TAO_DynUnion_i (const CORBA_Any& any); // constructor taking an Any argument @@ -41,7 +40,7 @@ public: ~TAO_DynUnion_i (void); // destructor - // Functions specific to DynUnion + // = Functions specific to DynUnion CORBA::Boolean set_as_default (CORBA::Environment &ACE_TRY_ENV); // Does union have a default member? @@ -59,10 +58,9 @@ public: CORBA_DynAny_ptr member (CORBA::Environment &ACE_TRY_ENV); // Returns active member - // Get and set for member name - - char* member_name (CORBA::Environment &ACE_TRY_ENV); + // = Get and set for member name + char *member_name (CORBA::Environment &ACE_TRY_ENV); void member_name (const char* member_name, CORBA::Environment &ACE_TRY_ENV); @@ -97,9 +95,9 @@ public: CORBA::Boolean next (CORBA::Environment &ACE_TRY_ENV); // Returns next component - CORBA::Boolean seek (CORBA::Long index, + CORBA::Boolean seek (CORBA::Long slot, CORBA::Environment &ACE_TRY_ENV); - // Jump to component at <index> + // Jump to component at <slot> void rewind (CORBA::Environment &ACE_TRY_ENV); // Makes first component the current one @@ -139,35 +137,20 @@ public: void insert_any (const CORBA::Any& value, CORBA::Environment &ACE_TRY_ENV); CORBA::Boolean get_boolean (CORBA::Environment &ACE_TRY_ENV); - CORBA::Octet get_octet (CORBA::Environment &ACE_TRY_ENV); - CORBA::Char get_char (CORBA::Environment &ACE_TRY_ENV); - CORBA::Short get_short (CORBA::Environment &ACE_TRY_ENV); - CORBA::UShort get_ushort (CORBA::Environment &ACE_TRY_ENV); - CORBA::Long get_long (CORBA::Environment &ACE_TRY_ENV); - CORBA::ULong get_ulong (CORBA::Environment &ACE_TRY_ENV); - CORBA::Float get_float (CORBA::Environment &ACE_TRY_ENV); - CORBA::Double get_double (CORBA::Environment &ACE_TRY_ENV); - - char * get_string (CORBA::Environment &ACE_TRY_ENV); - + char *get_string (CORBA::Environment &ACE_TRY_ENV); CORBA::Object_ptr get_reference (CORBA::Environment &ACE_TRY_ENV); - CORBA::TypeCode_ptr get_typecode (CORBA::Environment &ACE_TRY_ENV); - CORBA::LongLong get_longlong (CORBA::Environment &ACE_TRY_ENV); - CORBA::ULongLong get_ulonglong (CORBA::Environment &ACE_TRY_ENV); - CORBA::WChar get_wchar (CORBA::Environment &ACE_TRY_ENV); - CORBA::Any_ptr get_any (CORBA::Environment &ACE_TRY_ENV); private: @@ -215,8 +198,8 @@ private: CORBA::Environment &ACE_TRY_ENV); // Returns a pointer to the correct extractor class. - void set_from_any(const CORBA_Any& any, - CORBA::Environment &ACE_TRY_ENV); + void set_from_any (const CORBA_Any& any, + CORBA::Environment &ACE_TRY_ENV); // Code common to the constructor from an Any arg and the member // function from_any(). }; diff --git a/TAO/tao/DynUnion_i_T.cpp b/TAO/tao/DynUnion_i_T.cpp index 68250e3d093..7b7e5dcfe64 100644 --- a/TAO/tao/DynUnion_i_T.cpp +++ b/TAO/tao/DynUnion_i_T.cpp @@ -19,11 +19,11 @@ #include "tao/DynUnion_i_T.h" // Method of template class that serves as a functor for all that -// compares Anys constructed from all legal discriminator -// types - some are specifically defined in DynUnion_i.cpp. +// compares Anys constructed from all legal discriminator types - some +// are specifically defined in DynUnion_i.cpp. template <class Type> -DU_Extractor<Type>::~DU_Extractor () +DU_Extractor<Type>::~DU_Extractor (void) { } diff --git a/TAO/tao/DynUnion_i_T.h b/TAO/tao/DynUnion_i_T.h index 1a89483f1d0..284067af644 100644 --- a/TAO/tao/DynUnion_i_T.h +++ b/TAO/tao/DynUnion_i_T.h @@ -44,7 +44,7 @@ class DU_Extractor : public DU_Extractor_base // TAO_DynUnion_i or even at global scope in the same file. // public: - virtual ~DU_Extractor (); + virtual ~DU_Extractor (void); virtual CORBA::Boolean check_match (const CORBA_Any& inside_any, const CORBA_Any& outside_any); diff --git a/TAO/tao/Environment.cpp b/TAO/tao/Environment.cpp index 8388202ff1b..3f6be977140 100644 --- a/TAO/tao/Environment.cpp +++ b/TAO/tao/Environment.cpp @@ -70,7 +70,7 @@ CORBA_Environment::CORBA_Environment (TAO_ORB_Core* orb_core) { orb_core->default_environment (this); } -#endif +#endif /* 0 */ CORBA::ULong CORBA_Environment::_incr_refcnt (void) @@ -84,6 +84,7 @@ CORBA_Environment::_decr_refcnt (void) { { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, this->refcount_lock_, 0); + this->refcount_--; if (this->refcount_ != 0) return this->refcount_; @@ -170,6 +171,8 @@ CORBA_Environment::default_environment () int CORBA::Environment::exception_type (void) const { + // @@ Carlos, is this stuff that's properly "transformed" for EBCDIC + // platforms?! static char sysex_prefix [] = "IDL:omg.org/CORBA/"; static char typecode_extra [] = "TypeCode/"; static char poa_prefix [] = "IDL:PortableServer/"; @@ -177,19 +180,24 @@ CORBA::Environment::exception_type (void) const if (!this->exception_) return CORBA::NO_EXCEPTION; - // All exceptions currently (CORBA 2.0) defined in the CORBA - // scope are system exceptions ... except for a couple that - // are related to TypeCodes. + // All exceptions currently (CORBA 2.0) defined in the CORBA scope + // are system exceptions ... except for a couple that are related to + // TypeCodes. const char *id = this->exception_->_id (); - if ((ACE_OS::strncmp (id, sysex_prefix, sizeof sysex_prefix - 1) == 0 + if ((ACE_OS::strncmp (id, + sysex_prefix, + sizeof sysex_prefix - 1) == 0 && ACE_OS::strncmp (id + sizeof sysex_prefix - 1, - typecode_extra, sizeof typecode_extra - 1) != 0) - || ACE_OS::strncmp (id, poa_prefix, sizeof poa_prefix - 1) == 0) + typecode_extra, + sizeof typecode_extra - 1) != 0) + || ACE_OS::strncmp (id, + poa_prefix, + sizeof poa_prefix - 1) == 0) return CORBA::SYSTEM_EXCEPTION; - - return CORBA::USER_EXCEPTION; + else + return CORBA::USER_EXCEPTION; } const char* @@ -212,15 +220,15 @@ CORBA::Environment::print_exception (const char *info, { const char *id = this->exception_->_id (); - ACE_DEBUG ((LM_ERROR, "TAO: (%P|%t) EXCEPTION, %s\n", info)); + ACE_DEBUG ((LM_ERROR, + "TAO: (%P|%t) EXCEPTION, %s\n", + info)); CORBA::SystemException *x2 = CORBA_SystemException::_narrow (this->exception_); if (x2 != 0) - { - x2->print_exception_tao_ (); - } + x2->print_exception_tao_ (); else // @@ we can use the exception's typecode to dump all the data // held within it ... @@ -234,8 +242,6 @@ CORBA::Environment::print_exception (const char *info, "TAO: (%P|%t) no exception\n")); } -// ********************************************************* - CORBA_Environment_var & CORBA_Environment_var::operator= (CORBA_Environment_ptr p) { @@ -255,6 +261,9 @@ CORBA_Environment_var::operator= (const CORBA_Environment_var &r) if (this->ptr_ != 0) delete this->ptr_; + // @@ Carlos, shouldn't we be checking for "new" failure? If so, + // shouldn't we not be passing back *this but instead make this a + // "void" function? this->ptr_ = new CORBA::Environment (*r.ptr_); return *this; } diff --git a/TAO/tao/Environment.h b/TAO/tao/Environment.h index baeef4f8ec9..86eb048700e 100644 --- a/TAO/tao/Environment.h +++ b/TAO/tao/Environment.h @@ -10,15 +10,14 @@ // Environment.h // // = DESCRIPTION -// Declare the CORBA_Environment class. -// Note that this header file only requires a few forward -// declarations of CORBA classes, this is *very* important because -// even the ORB needs to know about it; make your changes with care. -// It is also a good idea trying to minimize cross dependencies -// between header files. +// Declare the CORBA_Environment class. Note that this header file +// only requires a few forward declarations of CORBA classes, this +// is *very* important because even the ORB needs to know about it; +// make your changes with care. It is also a good idea trying to +// minimize cross dependencies between header files. // // = AUTHOR -// Carlos O'Ryan +// Carlos O'Ryan <coryan@cs.wustl.edu> // // ============================================================================ @@ -39,7 +38,6 @@ class TAO_Export CORBA_Environment // CORBA_Environment // // = DESCRIPTION - // // A CORBA_Environment is a way to automagically ensure that // exception data is freed -- the "var" class for Exceptions. It // adds just a bit of convenience function support, helping @@ -51,34 +49,31 @@ class TAO_Export CORBA_Environment // if the user creates a new environment the old one is "pushed" // (actually the new one remembers it), eventually the new // environment destructor pops itself from the stack and we - // recover the old environment. - // This means that if the user create a new environment and - // somebody calls a function using the default one the exception - // will still be received in the environment created by the user. - // The only drawback is that environments life time must nest - // properly, this shouldn't be a problem because environments are - // usually created on the stack, but, the spec allows their - // creation on the heap and/or as class members; we need to - // investigate the tradeoffs and take a decision. - // + // recover the old environment. This means that if the user + // create a new environment and somebody calls a function using + // the default one the exception will still be received in the + // environment created by the user. The only drawback is that + // environments life time must nest properly, this shouldn't be a + // problem because environments are usually created on the stack, + // but, the spec allows their creation on the heap and/or as class + // members; we need to investigate the tradeoffs and take a + // decision. public: // = Initialization and termination methods. - CORBA_Environment (void); - // The default constructor, the environment will hold no - // exceptions. + // The default constructor, the environment will hold no exceptions. CORBA_Environment (const CORBA_Environment &env); - // Copy constructor + // Copy constructor. CORBA_Environment &operator=(const CORBA_Environment &env); - // Assingment + // Assingment. ~CORBA_Environment (void); // Destructor, release the exception. CORBA_Exception* exception (void) const; - // Return the exception. Caller must call _incr_refcnf() in order + // Return the exception. Caller must call <_incr_refcnf> in order // to keep the ptr. void exception (CORBA_Exception *ex); @@ -88,7 +83,7 @@ public: // Return if the exception is a user exception or a system // exception. - const char* exception_id (void) const; + const char *exception_id (void) const; // return the repository ID for the exception. void clear (void); @@ -96,8 +91,8 @@ public: void print_exception (const char *info, FILE *f=stdout) const; - // Print the exception to output determined by f. - // This function is not CORBA compliant. + // Print the exception to output determined by f. This function is + // not CORBA compliant. // = Obtain a default environment to use with TAO. static CORBA_Environment &default_environment (void); @@ -119,17 +114,17 @@ private: // Initialize using a well known ORB Core; this is intended for the // bootstraping of the ORB_Core, not for general consumption. - CORBA_Exception* exception_; + CORBA_Exception *exception_; // Pointer to the exception object contained in the environment. - CORBA_Environment* previous_; + CORBA_Environment *previous_; // The previous environment on the "default environment stack". CORBA::ULong refcount_; - // reference counting + // Reference counting. ACE_SYNCH_MUTEX refcount_lock_; - // protect the reference count + // Protect the reference count. }; class TAO_Export CORBA_Environment_var @@ -141,10 +136,13 @@ class TAO_Export CORBA_Environment_var // Provide for automatic storage deallocation on going out of // scope. public: - CORBA_Environment_var (void); // default constructor + CORBA_Environment_var (void); + // default constructor CORBA_Environment_var (CORBA_Environment_ptr); - CORBA_Environment_var (const CORBA_Environment_var &); // copy constructor - ~CORBA_Environment_var (void); // destructor + CORBA_Environment_var (const CORBA_Environment_var &); + // copy constructor + ~CORBA_Environment_var (void); + // destructor CORBA_Environment_var &operator= (CORBA_Environment_ptr); CORBA_Environment_var &operator= (const CORBA_Environment_var &); diff --git a/TAO/tao/Environment.i b/TAO/tao/Environment.i index 6d318b17359..3dd045f35f8 100644 --- a/TAO/tao/Environment.i +++ b/TAO/tao/Environment.i @@ -7,9 +7,7 @@ CORBA_Environment::exception (void) const return this->exception_; } -// ************************************************************* // Inline operations for class CORBA_Environment_var -// ************************************************************* ACE_INLINE CORBA_Environment_var::CORBA_Environment_var (void) @@ -85,9 +83,7 @@ CORBA_Environment_var::_retn (void) return val; } -// ************************************************************* // Inline operations for class CORBA_Environment_out -// ************************************************************* ACE_INLINE CORBA_Environment_out::CORBA_Environment_out (CORBA_Environment_ptr &p) diff --git a/TAO/tao/Exception.cpp b/TAO/tao/Exception.cpp index e86b406fd85..591f52a908f 100644 --- a/TAO/tao/Exception.cpp +++ b/TAO/tao/Exception.cpp @@ -1,10 +1,5 @@ // $Id$ -// Copyright 1994-1995 by Sun Microsystems Inc. -// All Rights Reserved -// -// ORB: Exception handling support -// // THREADING NOTE: calling thread handles mutual exclusion policy // on all of these data structures. @@ -726,12 +721,12 @@ CORBA_ExceptionList::add_consume (CORBA::TypeCode_ptr tc) } CORBA::TypeCode_ptr -CORBA_ExceptionList::item (CORBA::ULong index, +CORBA_ExceptionList::item (CORBA::ULong slot, CORBA::Environment &TAO_IN_ENV) { CORBA::TypeCode_ptr *tc; TAO_IN_ENV.clear (); - if (this->tc_list_.get (tc, index) == -1) + if (this->tc_list_.get (tc, slot) == -1) TAO_THROW_RETURN (CORBA::TypeCode::Bounds (), 0); else { diff --git a/TAO/tao/Exception.h b/TAO/tao/Exception.h index e18713743af..539a4693725 100644 --- a/TAO/tao/Exception.h +++ b/TAO/tao/Exception.h @@ -357,11 +357,11 @@ public: void add_consume (CORBA::TypeCode_ptr tc); // add and consume a TypeCode to the list - CORBA::TypeCode_ptr item (CORBA::ULong index, CORBA_Environment &TAO_IN_ENV = TAO_default_environment ()); - // return the typecode at index i. Raises the "Bounds" exception + CORBA::TypeCode_ptr item (CORBA::ULong slot, CORBA_Environment &TAO_IN_ENV = TAO_default_environment ()); + // return the typecode at slot i. Raises the "Bounds" exception - void remove (CORBA::ULong index, CORBA_Environment &TAO_IN_ENV = TAO_default_environment ()); - // remove the typecode at index i. Raises the "Bounds" exception + void remove (CORBA::ULong slot, CORBA_Environment &TAO_IN_ENV = TAO_default_environment ()); + // remove the typecode at slot i. Raises the "Bounds" exception #if !defined(__GNUC__) || __GNUC__ > 2 || __GNUC_MINOR__ >= 8 typedef CORBA::ExceptionList_ptr _ptr_type; diff --git a/TAO/tao/GIOP.cpp b/TAO/tao/GIOP.cpp index 2ca104289fd..0c770c36de8 100644 --- a/TAO/tao/GIOP.cpp +++ b/TAO/tao/GIOP.cpp @@ -133,12 +133,11 @@ TAO_GIOP::dump_msg (const char *label, { if (TAO_debug_level >= 5) { - const char* message_name = "UNKNOWN MESSAGE"; - unsigned long index = ptr[7]; - if (index < sizeof (names)/sizeof(names[0])) - { - message_name = names [index]; - } + const char *message_name = "UNKNOWN MESSAGE"; + // @@ Carlos, where does the magic number '7' come from?! + u_long slot = ptr[7]; + if (slot < sizeof (names)/sizeof(names[0])) + message_name = names [slot]; ACE_DEBUG ((LM_DEBUG, "%s GIOP v%c.%c msg, %d data bytes, %s endian, %s", label, diff --git a/TAO/tao/IIOP_Connector.cpp b/TAO/tao/IIOP_Connector.cpp index ef738d2a6e5..bde6aa8e298 100644 --- a/TAO/tao/IIOP_Connector.cpp +++ b/TAO/tao/IIOP_Connector.cpp @@ -214,11 +214,11 @@ TAO_IIOP_Connector::preconnect (const char *preconnects) char[num_connections], -1); - size_t index = 0; + size_t slot = 0; // Fill in the remote address array - while (dests.pop (remote_addrs[index]) == 0) - handlers[index++] = 0; + while (dests.pop (remote_addrs[slot]) == 0) + handlers[slot++] = 0; // Finally, try to connect. this->base_connector_.connect_n (num_connections, @@ -227,13 +227,13 @@ TAO_IIOP_Connector::preconnect (const char *preconnects) failures); // Loop over all the failures and set the handlers that // succeeded to idle state. - for (index = 0; - index < num_connections; - index++) + for (slot = 0; + slot < num_connections; + slot++) { - if (!failures[index]) + if (!failures[slot]) { - handlers[index]->idle (); + handlers[slot]->idle (); successes++; if (TAO_debug_level > 0) @@ -241,8 +241,8 @@ TAO_IIOP_Connector::preconnect (const char *preconnects) ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) Preconnection <%s:%d> " "succeeded.\n", - remote_addrs[index].get_host_name (), - remote_addrs[index].get_port_number ())); + remote_addrs[slot].get_host_name (), + remote_addrs[slot].get_port_number ())); } } else @@ -251,8 +251,8 @@ TAO_IIOP_Connector::preconnect (const char *preconnects) { ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) Preconnection <%s:%d> failed.\n", - remote_addrs[index].get_host_name (), - remote_addrs[index].get_port_number ())); + remote_addrs[slot].get_host_name (), + remote_addrs[slot].get_port_number ())); } } } diff --git a/TAO/tao/MProfile.h b/TAO/tao/MProfile.h index 13de8fa3330..9e702b8c84d 100644 --- a/TAO/tao/MProfile.h +++ b/TAO/tao/MProfile.h @@ -106,12 +106,12 @@ public: // return the maximum number of profiles that can be stored in this // container, (size_+1) - const TAO_Profile* get_profile (CORBA::ULong index) const; - // Return the profile at position <index>. - // If <index> is out of range it returns 0. + const TAO_Profile* get_profile (CORBA::ULong slot) const; + // Return the profile at position <slot>. If <slot> is out of range + // it returns 0. void rewind (void); - // Sets the current index back to 0. + // Sets the current slot back to 0. int add_profile (TAO_Profile_ptr pfile); // Return the index of this entry or -1 if it can not be added. diff --git a/TAO/tao/MProfile.i b/TAO/tao/MProfile.i index f9d25df3593..30290e35597 100644 --- a/TAO/tao/MProfile.i +++ b/TAO/tao/MProfile.i @@ -170,11 +170,11 @@ TAO_MProfile::size (void) const } ACE_INLINE const TAO_Profile* -TAO_MProfile::get_profile (CORBA::ULong index) const +TAO_MProfile::get_profile (CORBA::ULong slot) const { - if (index >= this->last_) + if (slot >= this->last_) return 0; - return this->pfiles_[index]; + return this->pfiles_[slot]; } ACE_INLINE TAO_Profile_ptr * diff --git a/TAO/tao/MessagingC.h b/TAO/tao/MessagingC.h index c44e12642a4..c4c14644d9a 100644 --- a/TAO/tao/MessagingC.h +++ b/TAO/tao/MessagingC.h @@ -1512,7 +1512,7 @@ TAO_NAMESPACE Messaging operator const PolicyValueSeq &() const; operator PolicyValueSeq &(); operator PolicyValueSeq &() const; - PolicyValue &operator[] (CORBA::ULong index); + PolicyValue &operator[] (CORBA::ULong slot); // in, inout, out, _retn const PolicyValueSeq &in (void) const; PolicyValueSeq &inout (void); @@ -1535,7 +1535,7 @@ TAO_NAMESPACE Messaging operator PolicyValueSeq *&(); PolicyValueSeq *&ptr (void); PolicyValueSeq *operator-> (void); - PolicyValue &operator[] (CORBA::ULong index); + PolicyValue &operator[] (CORBA::ULong slot); private: PolicyValueSeq *&ptr_; diff --git a/TAO/tao/MessagingC.i b/TAO/tao/MessagingC.i index 7d55bfffe5f..089a9683786 100644 --- a/TAO/tao/MessagingC.i +++ b/TAO/tao/MessagingC.i @@ -2905,9 +2905,9 @@ Messaging::PolicyValueSeq_var::operator Messaging::PolicyValueSeq &() const// ca } ACE_INLINE Messaging::PolicyValue & -Messaging::PolicyValueSeq_var::operator[] (CORBA::ULong index) +Messaging::PolicyValueSeq_var::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } ACE_INLINE const Messaging::PolicyValueSeq & @@ -3002,9 +3002,9 @@ Messaging::PolicyValueSeq_out::operator-> (void) } ACE_INLINE Messaging::PolicyValue & -Messaging::PolicyValueSeq_out::operator[] (CORBA::ULong index) +Messaging::PolicyValueSeq_out::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } #if defined(TAO_POLLER) diff --git a/TAO/tao/MessagingS.cpp b/TAO/tao/MessagingS.cpp index b77e56ae911..9e0d01518e7 100644 --- a/TAO/tao/MessagingS.cpp +++ b/TAO/tao/MessagingS.cpp @@ -1443,22 +1443,22 @@ TAO_Messaging_Poller_Perfect_Hash_OpTable::lookup (const char *str, unsigned int if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE) { - int index = lookup[key]; + int slot = lookup[key]; - if (index >= 0 && index < MAX_HASH_VALUE) + if (slot >= 0 && slot < MAX_HASH_VALUE) { - const char *s = wordlist[index].opname_; + const char *s = wordlist[slot].opname_; if (*str == *s && !strncmp (str + 1, s + 1, len - 1)) - return &wordlist[index]; + return &wordlist[slot]; } - else if (index < 0 && index >= -MAX_HASH_VALUE) + else if (slot < 0 && slot >= -MAX_HASH_VALUE) return 0; else { - unsigned int offset = key + index + (index > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE); - const class TAO_operation_db_entry *base = &wordlist[-lookup[offset]]; - const class TAO_operation_db_entry *ptr = base + -lookup[offset + 1]; + u_int offset = key + slot + (slot > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE); + const TAO_operation_db_entry *base = &wordlist[-lookup[offset]]; + const TAO_operation_db_entry *ptr = base + -lookup[offset + 1]; while (--ptr >= base) if (*str == *ptr->opname_ && !strncmp (str + 1, ptr->opname_ + 1, len - 1)) diff --git a/TAO/tao/ORB.h b/TAO/tao/ORB.h index 4d9f4152d6a..06ace06bd1f 100644 --- a/TAO/tao/ORB.h +++ b/TAO/tao/ORB.h @@ -143,11 +143,11 @@ public: operator const char *() const; // only read privileges. - char &operator[] (CORBA::ULong index); - // allows access and modification using an index. + char &operator[] (CORBA::ULong slot); + // allows access and modification using an slot. - char operator[] (CORBA::ULong index) const; - // allows only accessing thru an index. + char operator[] (CORBA::ULong slot) const; + // allows only accessing thru an slot. // = in, out, out, and _retn operations. // ORBOS/97-05-15, Appendix C.2 @@ -248,11 +248,11 @@ public: operator const CORBA::WChar *() const; // only read privileges. - CORBA::WChar &operator[] (CORBA::ULong index); - // allows access and modification using an index. + CORBA::WChar &operator[] (CORBA::ULong slot); + // allows access and modification using an slot. - CORBA::WChar operator[] (CORBA::ULong index) const; - // allows only accessing thru an index. + CORBA::WChar operator[] (CORBA::ULong slot) const; + // allows only accessing thru an slot. // = in, out, out, and _retn operations. // ORBOS/97-05-15, Appendix C.2 diff --git a/TAO/tao/ORB.i b/TAO/tao/ORB.i index 679df3f3c6b..aa4193884ce 100644 --- a/TAO/tao/ORB.i +++ b/TAO/tao/ORB.i @@ -18,17 +18,17 @@ CORBA_String_var::CORBA_String_var (const char *p) } ACE_INLINE CORBA::Char & -CORBA_String_var::operator[] (CORBA::ULong index) +CORBA_String_var::operator[] (CORBA::ULong slot) { // We need to verify bounds else raise some exception. - return this->ptr_[index]; + return this->ptr_[slot]; } ACE_INLINE CORBA::Char -CORBA_String_var::operator[] (CORBA::ULong index) const +CORBA_String_var::operator[] (CORBA::ULong slot) const { // We need to verify bounds else raise some exception. - return this->ptr_[index]; + return this->ptr_[slot]; } ACE_INLINE @@ -139,17 +139,17 @@ CORBA_WString_var::CORBA_WString_var (const CORBA::WChar *p) } ACE_INLINE CORBA::WChar & -CORBA_WString_var::operator[] (CORBA::ULong index) +CORBA_WString_var::operator[] (CORBA::ULong slot) { // We need to verify bounds else raise some exception. - return this->ptr_[index]; + return this->ptr_[slot]; } ACE_INLINE CORBA::WChar -CORBA_WString_var::operator[] (CORBA::ULong index) const +CORBA_WString_var::operator[] (CORBA::ULong slot) const { // We need to verify bounds else raise some exception. - return this->ptr_[index]; + return this->ptr_[slot]; } ACE_INLINE diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index 5663d0fa403..7a637c44276 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -104,14 +104,14 @@ int TAO_ORB_Core::add_to_ior_table (ACE_CString init_ref, TAO_IOR_LookupTable &table) { - int index = 0; - if ((index = init_ref.find ("=")) == ACE_CString::npos) + int slot = init_ref.find ("="); + if (slot == ACE_CString::npos) ACE_ERROR_RETURN ((LM_ERROR, "Unable to parse -ORBInitRef parameter\n"), -1); - ACE_CString object_id = init_ref.substr (0,index); - ACE_CString ior = init_ref.substr (index+1); + ACE_CString object_id = init_ref.substr (0, slot); + ACE_CString ior = init_ref.substr (slot + 1); // Add the objectID-IOR to the table and return the status. return table.add_ior (object_id, ior); diff --git a/TAO/tao/ObjectIDList.h b/TAO/tao/ObjectIDList.h index 8bfc52b66b0..b5c51249cc6 100644 --- a/TAO/tao/ObjectIDList.h +++ b/TAO/tao/ObjectIDList.h @@ -84,7 +84,7 @@ public: operator const CORBA_ORB_ObjectIdList &() const; operator CORBA_ORB_ObjectIdList &(); operator CORBA_ORB_ObjectIdList &() const; - TAO_SeqElem_String_Manager operator[] (CORBA::ULong index); + TAO_SeqElem_String_Manager operator[] (CORBA::ULong slot); // in, inout, out, _retn const CORBA_ORB_ObjectIdList &in (void) const; CORBA_ORB_ObjectIdList &inout (void); @@ -113,7 +113,7 @@ public: operator CORBA_ORB_ObjectIdList *&(); CORBA_ORB_ObjectIdList *&ptr (void); CORBA_ORB_ObjectIdList *operator-> (void); - TAO_SeqElem_String_Manager operator[] (CORBA::ULong index); + TAO_SeqElem_String_Manager operator[] (CORBA::ULong slot); private: CORBA_ORB_ObjectIdList *&ptr_; diff --git a/TAO/tao/ObjectIDList.i b/TAO/tao/ObjectIDList.i index 81f58ef39c9..a03864bede7 100644 --- a/TAO/tao/ObjectIDList.i +++ b/TAO/tao/ObjectIDList.i @@ -93,9 +93,9 @@ CORBA_ORB_ObjectIdList_var::operator CORBA_ORB_ObjectIdList &() const// cast } ACE_INLINE TAO_SeqElem_String_Manager -CORBA_ORB_ObjectIdList_var::operator[] (CORBA::ULong index) +CORBA_ORB_ObjectIdList_var::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } ACE_INLINE const CORBA_ORB_ObjectIdList & @@ -190,9 +190,9 @@ CORBA_ORB_ObjectIdList_out::operator-> (void) } ACE_INLINE TAO_SeqElem_String_Manager -CORBA_ORB_ObjectIdList_out::operator[] (CORBA::ULong index) +CORBA_ORB_ObjectIdList_out::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } diff --git a/TAO/tao/Object_KeyC.i b/TAO/tao/Object_KeyC.i index fae8ef6d74c..82bfaa7cb26 100644 --- a/TAO/tao/Object_KeyC.i +++ b/TAO/tao/Object_KeyC.i @@ -126,9 +126,9 @@ TAO_ObjectKey_var::operator TAO_ObjectKey &() const// cast } ACE_INLINE CORBA::Octet & -TAO_ObjectKey_var::operator[] (CORBA::ULong index) +TAO_ObjectKey_var::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } ACE_INLINE const TAO_ObjectKey & @@ -223,8 +223,8 @@ TAO_ObjectKey_out::operator-> (void) } ACE_INLINE CORBA::Octet & -TAO_ObjectKey_out::operator[] (CORBA::ULong index) +TAO_ObjectKey_out::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } diff --git a/TAO/tao/POAC.cpp b/TAO/tao/POAC.cpp index 2a77c6540b7..9e9f91fec88 100644 --- a/TAO/tao/POAC.cpp +++ b/TAO/tao/POAC.cpp @@ -2047,7 +2047,7 @@ PortableServer::POA::InvalidPolicy::~InvalidPolicy (void) PortableServer::POA::InvalidPolicy::InvalidPolicy (const PortableServer::POA::InvalidPolicy &_tao_excp) : CORBA_UserException (_tao_excp._type ()) { - this->index = _tao_excp.index; + this->slot = _tao_excp.slot; } // assignment operator @@ -2055,7 +2055,7 @@ PortableServer::POA::InvalidPolicy& PortableServer::POA::InvalidPolicy::operator= (const PortableServer::POA::InvalidPolicy &_tao_excp) { this->CORBA_UserException::operator= (_tao_excp); - this->index = _tao_excp.index; + this->slot = _tao_excp.slot; return *this; } @@ -2063,7 +2063,7 @@ PortableServer::POA::InvalidPolicy::InvalidPolicy( CORBA::UShort _tao_index) : CORBA_UserException (PortableServer::POA::_tc_InvalidPolicy) { - this->index = _tao_index; + this->slot = _tao_index; } void PortableServer::POA::InvalidPolicy::_raise (void) diff --git a/TAO/tao/POAC.h b/TAO/tao/POAC.h index 52e84359553..97ef856d8c5 100644 --- a/TAO/tao/POAC.h +++ b/TAO/tao/POAC.h @@ -148,7 +148,7 @@ TAO_NAMESPACE PortableServer{ operator const _tao_seq_Octet &() const; operator _tao_seq_Octet &(); operator _tao_seq_Octet &() const; - CORBA::Octet &operator[] (CORBA::ULong index); + CORBA::Octet &operator[] (CORBA::ULong slot); // in, inout, out, _retn const _tao_seq_Octet &in (void) const; _tao_seq_Octet &inout (void); @@ -176,7 +176,7 @@ TAO_NAMESPACE PortableServer{ operator _tao_seq_Octet *&(); _tao_seq_Octet *&ptr (void); _tao_seq_Octet *operator-> (void); - CORBA::Octet &operator[] (CORBA::ULong index); + CORBA::Octet &operator[] (CORBA::ULong slot); private: _tao_seq_Octet *&ptr_; @@ -1790,7 +1790,7 @@ TAO_NAMESPACE PortableServer{ CORBA::UShort _tao_index ); - CORBA::UShort index; + CORBA::UShort slot; // = TAO extension static CORBA::Exception *_alloc (void); diff --git a/TAO/tao/POAC.i b/TAO/tao/POAC.i index e5797af0bd8..009f59e41dd 100644 --- a/TAO/tao/POAC.i +++ b/TAO/tao/POAC.i @@ -270,9 +270,9 @@ PortableServer::_tao_seq_Octet_var::operator PortableServer::_tao_seq_Octet &() } ACE_INLINE CORBA::Octet & -PortableServer::_tao_seq_Octet_var::operator[] (CORBA::ULong index) +PortableServer::_tao_seq_Octet_var::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } ACE_INLINE const PortableServer::_tao_seq_Octet & @@ -374,9 +374,9 @@ PortableServer::_tao_seq_Octet_out::operator-> (void) } ACE_INLINE CORBA::Octet & -PortableServer::_tao_seq_Octet_out::operator[] (CORBA::ULong index) +PortableServer::_tao_seq_Octet_out::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } @@ -3637,9 +3637,7 @@ ACE_INLINE CORBA::Boolean operator<< (TAO_OutputCDR &strm, const PortableServer: if (strm << _tao_aggregate._id ()) { // now marshal the members (if any) - if ( - (strm << _tao_aggregate.index) - ) + if ((strm << _tao_aggregate.slot)) return 1; else return 0; @@ -3656,9 +3654,7 @@ ACE_INLINE CORBA::Boolean operator>> (TAO_InputCDR &strm, PortableServer::POA::I (_tao_aggregate._is_a (_tao_repoID))) { // now marshal the members - if ( - (strm >> _tao_aggregate.index) - ) + if ((strm >> _tao_aggregate.slot)) return 1; else return 0; diff --git a/TAO/tao/POA_CORBA.h b/TAO/tao/POA_CORBA.h index df2a799b910..27adf2f9535 100644 --- a/TAO/tao/POA_CORBA.h +++ b/TAO/tao/POA_CORBA.h @@ -1005,7 +1005,7 @@ public: ) = 0; virtual CORBA::Boolean seek ( - CORBA::Long index, + CORBA::Long slot, CORBA::Environment &TAO_IN_ENV = CORBA::Environment::default_environment () ) = 0; @@ -1227,7 +1227,7 @@ public: CORBA::Environment::default_environment () ); virtual CORBA::Boolean seek ( - CORBA::Long index, + CORBA::Long slot, CORBA::Environment &TAO_IN_ENV = CORBA::Environment::default_environment () ); diff --git a/TAO/tao/PolicyC.h b/TAO/tao/PolicyC.h index 798f2618bdb..ad0187265ce 100644 --- a/TAO/tao/PolicyC.h +++ b/TAO/tao/PolicyC.h @@ -294,7 +294,7 @@ public: operator const CORBA_PolicyTypeSeq &() const; operator CORBA_PolicyTypeSeq &(); operator CORBA_PolicyTypeSeq &() const; - CORBA::PolicyType &operator[] (CORBA::ULong index); + CORBA::PolicyType &operator[] (CORBA::ULong slot); // in, inout, out, _retn const CORBA_PolicyTypeSeq &in (void) const; CORBA_PolicyTypeSeq &inout (void); @@ -317,7 +317,7 @@ public: operator CORBA_PolicyTypeSeq *&(); CORBA_PolicyTypeSeq *&ptr (void); CORBA_PolicyTypeSeq *operator-> (void); - CORBA::PolicyType &operator[] (CORBA::ULong index); + CORBA::PolicyType &operator[] (CORBA::ULong slot); private: CORBA_PolicyTypeSeq *&ptr_; diff --git a/TAO/tao/PolicyC.i b/TAO/tao/PolicyC.i index 72d236faf5a..e7eac539a4d 100644 --- a/TAO/tao/PolicyC.i +++ b/TAO/tao/PolicyC.i @@ -302,9 +302,9 @@ CORBA_PolicyList_var::operator CORBA_PolicyList &() const// cast } ACE_INLINE TAO_Object_Manager <CORBA_Policy > -CORBA_PolicyList_var::operator[] (CORBA::ULong index) +CORBA_PolicyList_var::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } ACE_INLINE const CORBA_PolicyList & @@ -399,9 +399,9 @@ CORBA_PolicyList_out::operator-> (void) } ACE_INLINE TAO_Object_Manager <CORBA_Policy > -CORBA_PolicyList_out::operator[] (CORBA::ULong index) +CORBA_PolicyList_out::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } // ************************************************************* @@ -483,9 +483,9 @@ CORBA_PolicyTypeSeq_var::operator CORBA_PolicyTypeSeq &() const// cast } ACE_INLINE CORBA::PolicyType & -CORBA_PolicyTypeSeq_var::operator[] (CORBA::ULong index) +CORBA_PolicyTypeSeq_var::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } ACE_INLINE const CORBA_PolicyTypeSeq & @@ -580,9 +580,9 @@ CORBA_PolicyTypeSeq_out::operator-> (void) } ACE_INLINE CORBA::PolicyType & -CORBA_PolicyTypeSeq_out::operator[] (CORBA::ULong index) +CORBA_PolicyTypeSeq_out::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } // **************************************************************** diff --git a/TAO/tao/Policy_Manager.cpp b/TAO/tao/Policy_Manager.cpp index 4fc046dc161..6203c5b3ae8 100644 --- a/TAO/tao/Policy_Manager.cpp +++ b/TAO/tao/Policy_Manager.cpp @@ -52,10 +52,10 @@ TAO_Policy_Manager_Impl::set_policy_overrides ( if (CORBA::is_nil (policy)) continue; - CORBA::ULong index = policy->policy_type (ACE_TRY_ENV); + CORBA::ULong slot = policy->policy_type (ACE_TRY_ENV); ACE_CHECK; - switch (index) + switch (slot) { case TAO_MESSAGING_RELATIVE_RT_TIMEOUT_POLICY_TYPE: { @@ -111,7 +111,7 @@ TAO_Policy_Manager_Impl::set_policy_overrides ( this->other_policies_[j]->policy_type (ACE_TRY_ENV); ACE_CHECK; - if (current == index) + if (current == slot) { this->other_policies_[j]->destroy (ACE_TRY_ENV); ACE_CHECK; @@ -168,9 +168,9 @@ TAO_Policy_Manager_Impl::get_policy_overrides ( { for (CORBA::ULong j = 0; j < types.length (); ++j) { - CORBA::ULong index = types[j]; + CORBA::ULong slot = types[j]; - switch (index) + switch (slot) { case TAO_MESSAGING_RELATIVE_RT_TIMEOUT_POLICY_TYPE: if (this->relative_roundtrip_timeout_ != 0) @@ -204,7 +204,7 @@ TAO_Policy_Manager_Impl::get_policy_overrides ( this->other_policies_[i]->policy_type (ACE_TRY_ENV); ACE_CHECK_RETURN (0); - if (current != index) + if (current != slot) continue; policy_list[n++] = diff --git a/TAO/tao/Request.h b/TAO/tao/Request.h index 01bb77c3532..74d9322ce5d 100644 --- a/TAO/tao/Request.h +++ b/TAO/tao/Request.h @@ -354,7 +354,7 @@ public: operator const CORBA_ORB_RequestSeq &() const; operator CORBA_ORB_RequestSeq &(); operator CORBA_ORB_RequestSeq &() const; - CORBA::Octet &operator[] (CORBA::ULong index); + CORBA::Octet &operator[] (CORBA::ULong slot); // in, inout, out, _retn const CORBA_ORB_RequestSeq &in (void) const; CORBA_ORB_RequestSeq &inout (void); @@ -377,7 +377,7 @@ public: operator CORBA_ORB_RequestSeq *&(); CORBA_ORB_RequestSeq *&ptr (void); CORBA_ORB_RequestSeq *operator-> (void); - CORBA::Octet &operator[] (CORBA::ULong index); + CORBA::Octet &operator[] (CORBA::ULong slot); private: CORBA_ORB_RequestSeq *&ptr_; diff --git a/TAO/tao/Sequence.cpp b/TAO/tao/Sequence.cpp index 779beb4e3ce..359b0228d31 100644 --- a/TAO/tao/Sequence.cpp +++ b/TAO/tao/Sequence.cpp @@ -122,12 +122,14 @@ operator= (const TAO_Unbounded_String_Sequence &rhs) } TAO_SeqElem_String_Manager -TAO_Unbounded_String_Sequence::operator[] (CORBA::ULong index) const +TAO_Unbounded_String_Sequence::operator[] (CORBA::ULong slot) const { - ACE_ASSERT (index < this->maximum_); + ACE_ASSERT (slot < this->maximum_); char **const tmp = - ACE_reinterpret_cast (char **ACE_CAST_CONST, this->buffer_); - return TAO_SeqElem_String_Manager (tmp + index, this->release_); + ACE_reinterpret_cast (char **ACE_CAST_CONST, + this->buffer_); + return TAO_SeqElem_String_Manager (tmp + slot, + this->release_); } char* * diff --git a/TAO/tao/Sequence.h b/TAO/tao/Sequence.h index dc37b17bd64..433bc6949c7 100644 --- a/TAO/tao/Sequence.h +++ b/TAO/tao/Sequence.h @@ -294,7 +294,7 @@ public: // reallocation is performed. After reallocation, the release flag // is always set to TRUE. - TAO_SeqElem_String_Manager operator[] (CORBA::ULong index) const; + TAO_SeqElem_String_Manager operator[] (CORBA::ULong slot) const; // read-write accessor static char* *allocbuf (CORBA::ULong); diff --git a/TAO/tao/Sequence_T.cpp b/TAO/tao/Sequence_T.cpp index fe30d6dc81d..c753666365f 100644 --- a/TAO/tao/Sequence_T.cpp +++ b/TAO/tao/Sequence_T.cpp @@ -883,12 +883,13 @@ TAO_Bounded_String_Sequence<MAX>::operator= } template<CORBA::ULong MAX> TAO_SeqElem_String_Manager -TAO_Bounded_String_Sequence<MAX>::operator[] (CORBA::ULong index) const +TAO_Bounded_String_Sequence<MAX>::operator[] (CORBA::ULong slot) const { - ACE_ASSERT (index < this->maximum_); - char **const tmp = ACE_reinterpret_cast (char ** ACE_CAST_CONST, + ACE_ASSERT (slot < this->maximum_); + char **const tmp = ACE_reinterpret_cast (char **ACE_CAST_CONST, this->buffer_); - return TAO_SeqElem_String_Manager (tmp + index, this->release_); + return TAO_SeqElem_String_Manager (tmp + slot, + this->release_); } template<CORBA::ULong MAX> char ** diff --git a/TAO/tao/Sequence_T.h b/TAO/tao/Sequence_T.h index 918160ab25f..427bf186584 100644 --- a/TAO/tao/Sequence_T.h +++ b/TAO/tao/Sequence_T.h @@ -401,7 +401,7 @@ public: // the reallocation is performed. After reallocation, the release // flag is always set to TRUE. - TAO_Object_Manager<T> operator[] (CORBA::ULong index) const; + TAO_Object_Manager<T> operator[] (CORBA::ULong slot) const; // read-write accessor static T **allocbuf (CORBA::ULong); @@ -471,7 +471,7 @@ public: TAO_Bounded_Object_Sequence &operator= (const TAO_Bounded_Object_Sequence<T,MAX> &); // Assignment from another Bounded sequence. - TAO_Object_Manager<T> operator[] (CORBA::ULong index) const; + TAO_Object_Manager<T> operator[] (CORBA::ULong slot) const; // Read-write accessor. static T **allocbuf (CORBA::ULong length); @@ -537,7 +537,7 @@ public: // members and frees all string members, and then performs a // deepcopy to create a new structure. - TAO_Object_Manager<T> operator[] (CORBA::ULong index) const; + TAO_Object_Manager<T> operator[] (CORBA::ULong slot) const; // read-write accessor static T **allocbuf (CORBA::ULong); @@ -585,7 +585,7 @@ public: TAO_Bounded_Pseudo_Sequence &operator= (const TAO_Bounded_Pseudo_Sequence<T,MAX> &); // Assignment from another Bounded sequence. - TAO_Object_Manager<T> operator[] (CORBA::ULong index) const; + TAO_Object_Manager<T> operator[] (CORBA::ULong slot) const; // Read-write accessor. static T **allocbuf (CORBA::ULong length); @@ -659,7 +659,7 @@ public: // If release=TRUE, the destructor destroys each of the current // elements (items zero through length-1). - TAO_SeqElem_String_Manager operator[] (CORBA::ULong index) const; + TAO_SeqElem_String_Manager operator[] (CORBA::ULong slot) const; // read-write accessor static char **allocbuf (CORBA::ULong length); diff --git a/TAO/tao/Sequence_T.i b/TAO/tao/Sequence_T.i index 35c7c972afe..c32f03bb038 100644 --- a/TAO/tao/Sequence_T.i +++ b/TAO/tao/Sequence_T.i @@ -295,11 +295,11 @@ TAO_Unbounded_Object_Sequence (CORBA::ULong maximum, } template <class T> ACE_INLINE TAO_Object_Manager<T> -TAO_Unbounded_Object_Sequence<T>::operator[] (CORBA::ULong index) const +TAO_Unbounded_Object_Sequence<T>::operator[] (CORBA::ULong slot) const { - ACE_ASSERT (index < this->maximum_); + ACE_ASSERT (slot < this->maximum_); T ** const tmp = ACE_reinterpret_cast (T ** ACE_CAST_CONST, this->buffer_); - return TAO_Object_Manager<T> (tmp + index, this->release_); + return TAO_Object_Manager<T> (tmp + slot, this->release_); } // ************************************************************* @@ -322,11 +322,11 @@ TAO_Bounded_Object_Sequence (CORBA::ULong length, } template <class T, CORBA::ULong MAX> ACE_INLINE TAO_Object_Manager<T> -TAO_Bounded_Object_Sequence<T, MAX>::operator[] (CORBA::ULong index) const +TAO_Bounded_Object_Sequence<T, MAX>::operator[] (CORBA::ULong slot) const { - ACE_ASSERT (index < this->maximum_); + ACE_ASSERT (slot < this->maximum_); T **const tmp = ACE_reinterpret_cast (T ** ACE_CAST_CONST, this->buffer_); - return TAO_Object_Manager<T> (tmp + index, this->release_); + return TAO_Object_Manager<T> (tmp + slot, this->release_); } // ************************************************************* @@ -350,11 +350,11 @@ TAO_Unbounded_Pseudo_Sequence (CORBA::ULong maximum, } template <class T> ACE_INLINE TAO_Object_Manager<T> -TAO_Unbounded_Pseudo_Sequence<T>::operator[] (CORBA::ULong index) const +TAO_Unbounded_Pseudo_Sequence<T>::operator[] (CORBA::ULong slot) const { - ACE_ASSERT (index < this->maximum_); + ACE_ASSERT (slot < this->maximum_); T ** const tmp = ACE_reinterpret_cast (T ** ACE_CAST_CONST, this->buffer_); - return TAO_Object_Manager<T> (tmp + index, this->release_); + return TAO_Object_Manager<T> (tmp + slot, this->release_); } // ************************************************************* @@ -377,11 +377,11 @@ TAO_Bounded_Pseudo_Sequence (CORBA::ULong length, } template <class T, CORBA::ULong MAX> ACE_INLINE TAO_Object_Manager<T> -TAO_Bounded_Pseudo_Sequence<T, MAX>::operator[] (CORBA::ULong index) const +TAO_Bounded_Pseudo_Sequence<T, MAX>::operator[] (CORBA::ULong slot) const { - ACE_ASSERT (index < this->maximum_); + ACE_ASSERT (slot < this->maximum_); T **const tmp = ACE_reinterpret_cast (T ** ACE_CAST_CONST, this->buffer_); - return TAO_Object_Manager<T> (tmp + index, this->release_); + return TAO_Object_Manager<T> (tmp + slot, this->release_); } // ************************************************************* diff --git a/TAO/tao/Services.h b/TAO/tao/Services.h index 2d8029e8aed..990b8caa775 100644 --- a/TAO/tao/Services.h +++ b/TAO/tao/Services.h @@ -85,7 +85,7 @@ struct TAO_Export CORBA_ServiceDetail operator const _tao_seq_Octet &() const; operator _tao_seq_Octet &(); operator _tao_seq_Octet &() const; - CORBA::Octet &operator[] (CORBA::ULong index); + CORBA::Octet &operator[] (CORBA::ULong slot); // in, inout, out, _retn const _tao_seq_Octet &in (void) const; _tao_seq_Octet &inout (void); @@ -114,7 +114,7 @@ struct TAO_Export CORBA_ServiceDetail operator _tao_seq_Octet *&(); _tao_seq_Octet *&ptr (void); _tao_seq_Octet *operator-> (void); - CORBA::Octet &operator[] (CORBA::ULong index); + CORBA::Octet &operator[] (CORBA::ULong slot); private: _tao_seq_Octet *&ptr_; @@ -274,7 +274,7 @@ struct CORBA_ServiceInformation operator const _tao_seq_ServiceOption &() const; operator _tao_seq_ServiceOption &(); operator _tao_seq_ServiceOption &() const; - CORBA::ServiceOption &operator[] (CORBA::ULong index); + CORBA::ServiceOption &operator[] (CORBA::ULong slot); // in, inout, out, _retn const _tao_seq_ServiceOption &in (void) const; _tao_seq_ServiceOption &inout (void); @@ -304,8 +304,7 @@ struct CORBA_ServiceInformation operator _tao_seq_ServiceOption *&(); _tao_seq_ServiceOption *&ptr (void); _tao_seq_ServiceOption *operator-> (void); - CORBA::ServiceOption &operator[] (CORBA::ULong index); - + CORBA::ServiceOption &operator[] (CORBA::ULong slot); private: _tao_seq_ServiceOption *&ptr_; // assignment from T_var not allowed @@ -413,7 +412,7 @@ struct CORBA_ServiceInformation operator const _tao_seq_ServiceDetail &() const; operator _tao_seq_ServiceDetail &(); operator _tao_seq_ServiceDetail &() const; - CORBA_ServiceDetail &operator[] (CORBA::ULong index); + CORBA_ServiceDetail &operator[] (CORBA::ULong slot); // in, inout, out, _retn const _tao_seq_ServiceDetail &in (void) const; _tao_seq_ServiceDetail &inout (void); @@ -443,7 +442,7 @@ struct CORBA_ServiceInformation operator _tao_seq_ServiceDetail *&(); _tao_seq_ServiceDetail *&ptr (void); _tao_seq_ServiceDetail *operator-> (void); - CORBA_ServiceDetail &operator[] (CORBA::ULong index); + CORBA_ServiceDetail &operator[] (CORBA::ULong slot); private: _tao_seq_ServiceDetail *&ptr_; diff --git a/TAO/tao/Services.i b/TAO/tao/Services.i index 5c52bc2ac61..0dbaff7e6b4 100644 --- a/TAO/tao/Services.i +++ b/TAO/tao/Services.i @@ -260,9 +260,9 @@ CORBA_ServiceDetail::_tao_seq_Octet_var::operator CORBA_ServiceDetail::_tao_seq_ } ACE_INLINE CORBA::Octet & -CORBA_ServiceDetail::_tao_seq_Octet_var::operator[] (CORBA::ULong index) +CORBA_ServiceDetail::_tao_seq_Octet_var::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } ACE_INLINE const CORBA_ServiceDetail::_tao_seq_Octet & @@ -357,9 +357,9 @@ CORBA_ServiceDetail::_tao_seq_Octet_out::operator-> (void) } ACE_INLINE CORBA::Octet & -CORBA_ServiceDetail::_tao_seq_Octet_out::operator[] (CORBA::ULong index) +CORBA_ServiceDetail::_tao_seq_Octet_out::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } @@ -783,9 +783,9 @@ CORBA_ServiceInformation::_tao_seq_ServiceOption_var::operator CORBA_ServiceInfo } ACE_INLINE CORBA::ServiceOption & -CORBA_ServiceInformation::_tao_seq_ServiceOption_var::operator[] (CORBA::ULong index) +CORBA_ServiceInformation::_tao_seq_ServiceOption_var::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } ACE_INLINE const CORBA_ServiceInformation::_tao_seq_ServiceOption & @@ -880,9 +880,9 @@ CORBA_ServiceInformation::_tao_seq_ServiceOption_out::operator-> (void) } ACE_INLINE CORBA::ServiceOption & -CORBA_ServiceInformation::_tao_seq_ServiceOption_out::operator[] (CORBA::ULong index) +CORBA_ServiceInformation::_tao_seq_ServiceOption_out::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } @@ -1137,9 +1137,9 @@ CORBA_ServiceInformation::_tao_seq_ServiceDetail_var::operator CORBA_ServiceInfo } ACE_INLINE CORBA_ServiceDetail & -CORBA_ServiceInformation::_tao_seq_ServiceDetail_var::operator[] (CORBA::ULong index) +CORBA_ServiceInformation::_tao_seq_ServiceDetail_var::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } ACE_INLINE const CORBA_ServiceInformation::_tao_seq_ServiceDetail & @@ -1234,9 +1234,9 @@ CORBA_ServiceInformation::_tao_seq_ServiceDetail_out::operator-> (void) } ACE_INLINE CORBA_ServiceDetail & -CORBA_ServiceInformation::_tao_seq_ServiceDetail_out::operator[] (CORBA::ULong index) +CORBA_ServiceInformation::_tao_seq_ServiceDetail_out::operator[] (CORBA::ULong slot) { - return this->ptr_->operator[] (index); + return this->ptr_->operator[] (slot); } diff --git a/TAO/tao/Typecode.cpp b/TAO/tao/Typecode.cpp index 36712f19b89..57a76a39d76 100644 --- a/TAO/tao/Typecode.cpp +++ b/TAO/tao/Typecode.cpp @@ -354,54 +354,54 @@ CORBA_TypeCode::equivalent (CORBA::TypeCode_ptr tc, // Applicable only to struct, union, and except CORBA::TypeCode_ptr -CORBA_TypeCode::member_type (CORBA::ULong index, +CORBA_TypeCode::member_type (CORBA::ULong slot, CORBA::Environment &env) const { if (this->private_state_->tc_member_count_known_ && this->private_state_->tc_member_type_list_known_) { - if (index < this->private_state_->tc_member_count_) - return this->private_state_->tc_member_type_list_[index]; + if (slot < this->private_state_->tc_member_count_) + return this->private_state_->tc_member_type_list_[slot]; else TAO_THROW_ENV_RETURN (CORBA::TypeCode::Bounds (), env, 0); } else - return this->private_member_type (index, env); + return this->private_member_type (slot, env); } // Applicable only to struct, union, and except const char * -CORBA_TypeCode::member_name (CORBA::ULong index, +CORBA_TypeCode::member_name (CORBA::ULong slot, CORBA::Environment &env) const { if (this->private_state_->tc_member_count_known_ && this->private_state_->tc_member_name_list_known_) { - if (index < this->private_state_->tc_member_count_) - return this->private_state_->tc_member_name_list_[index]; + if (slot < this->private_state_->tc_member_count_) + return this->private_state_->tc_member_name_list_[slot]; else TAO_THROW_ENV_RETURN (CORBA::TypeCode::Bounds (), env, 0); } else - return this->private_member_name (index, env); + return this->private_member_name (slot, env); } // Return the label of the i-th member. Applicable only to CORBA::tk_union CORBA::Any_ptr -CORBA_TypeCode::member_label (CORBA::ULong index, +CORBA_TypeCode::member_label (CORBA::ULong slot, CORBA::Environment &env) const { if (this->private_state_->tc_member_count_known_ && this->private_state_->tc_member_label_list_known_) { - if (index < this->private_state_->tc_member_count_) - return this->private_state_->tc_member_label_list_[index]; + if (slot < this->private_state_->tc_member_count_) + return this->private_state_->tc_member_label_list_[slot]; else TAO_THROW_ENV_RETURN (CORBA::TypeCode::Bounds (), env, 0); } else - return this->private_member_label (index, env); + return this->private_member_label (slot, env); } // only applicable to CORBA::tk_unions @@ -1373,7 +1373,7 @@ CORBA_TypeCode::private_member_count (CORBA::Environment &env) const // CORBA::TypeCode_ptr -CORBA_TypeCode::private_member_type (CORBA::ULong index, +CORBA_TypeCode::private_member_type (CORBA::ULong slot, CORBA::Environment &env) const { CORBA::ULong temp, mcount; @@ -1399,8 +1399,8 @@ CORBA_TypeCode::private_member_type (CORBA::ULong index, ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->private_state_->mutex_, 0); if (this->private_state_->tc_member_type_list_known_) - if (index < mcount) - return this->private_state_->tc_member_type_list_[index]; + if (slot < mcount) + return this->private_state_->tc_member_type_list_[slot]; else TAO_THROW_ENV_RETURN (CORBA::TypeCode::Bounds (), env, CORBA::TypeCode::_nil ()); @@ -1451,8 +1451,8 @@ CORBA_TypeCode::private_member_type (CORBA::ULong index, this->private_state_->tc_member_type_list_known_ = 1; - if (index < mcount) - return this->private_state_->tc_member_type_list_[index]; + if (slot < mcount) + return this->private_state_->tc_member_type_list_[slot]; else TAO_THROW_ENV_RETURN (CORBA::TypeCode::Bounds (), env, (CORBA::TypeCode_ptr)0); } @@ -1469,8 +1469,8 @@ CORBA_TypeCode::private_member_type (CORBA::ULong index, ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->private_state_->mutex_, 0); if (this->private_state_->tc_member_type_list_known_) - if (index < mcount) - return this->private_state_->tc_member_type_list_[index]; + if (slot < mcount) + return this->private_state_->tc_member_type_list_[slot]; else TAO_THROW_ENV_RETURN (CORBA::TypeCode::Bounds (), env, CORBA::TypeCode::_nil ()); @@ -1522,8 +1522,8 @@ CORBA_TypeCode::private_member_type (CORBA::ULong index, } this->private_state_->tc_member_type_list_known_ = 1; - if (index < mcount) - return this->private_state_->tc_member_type_list_[index]; + if (slot < mcount) + return this->private_state_->tc_member_type_list_[slot]; else TAO_THROW_ENV_RETURN (CORBA::TypeCode::Bounds (), env, (CORBA::TypeCode_ptr)0); } @@ -1539,7 +1539,7 @@ CORBA_TypeCode::private_member_type (CORBA::ULong index, // Applicable only to CORBA::tk_struct, CORBA::tk_union, CORBA::tk_enum, and // CORBA::tk_except const char * -CORBA_TypeCode::private_member_name (CORBA::ULong index, +CORBA_TypeCode::private_member_name (CORBA::ULong slot, CORBA::Environment &env) const { CORBA::ULong temp, mcount; @@ -1564,8 +1564,8 @@ CORBA_TypeCode::private_member_name (CORBA::ULong index, ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->private_state_->mutex_, 0); if (this->private_state_->tc_member_name_list_known_) - if (index < mcount) - return this->private_state_->tc_member_name_list_[index]; + if (slot < mcount) + return this->private_state_->tc_member_name_list_[slot]; else TAO_THROW_ENV_RETURN (CORBA::TypeCode::Bounds (), env, 0); @@ -1592,8 +1592,8 @@ CORBA_TypeCode::private_member_name (CORBA::ULong index, this->private_state_->tc_member_name_list_known_ = 1; - if (index < mcount) - return this->private_state_->tc_member_name_list_[index]; + if (slot < mcount) + return this->private_state_->tc_member_name_list_[slot]; else TAO_THROW_ENV_RETURN (CORBA::TypeCode::Bounds (), env, (char *)0); } @@ -1611,8 +1611,8 @@ CORBA_TypeCode::private_member_name (CORBA::ULong index, ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->private_state_->mutex_, 0); if (this->private_state_->tc_member_name_list_known_) - if (index < mcount) - return this->private_state_->tc_member_name_list_[index]; + if (slot < mcount) + return this->private_state_->tc_member_name_list_[slot]; else TAO_THROW_ENV_RETURN (CORBA::TypeCode::Bounds (), env, 0); @@ -1639,8 +1639,8 @@ CORBA_TypeCode::private_member_name (CORBA::ULong index, this->private_state_->tc_member_name_list_known_ = 1; - if (index < mcount) - return this->private_state_->tc_member_name_list_[index]; + if (slot < mcount) + return this->private_state_->tc_member_name_list_[slot]; else TAO_THROW_ENV_RETURN (CORBA::TypeCode::Bounds (), env, (char *)0); } @@ -1657,8 +1657,8 @@ CORBA_TypeCode::private_member_name (CORBA::ULong index, ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, guard, this->private_state_->mutex_, 0); if (this->private_state_->tc_member_name_list_known_) - if (index < mcount) - return this->private_state_->tc_member_name_list_[index]; + if (slot < mcount) + return this->private_state_->tc_member_name_list_[slot]; else TAO_THROW_ENV_RETURN (CORBA::TypeCode::Bounds (), env, 0); @@ -1708,8 +1708,8 @@ CORBA_TypeCode::private_member_name (CORBA::ULong index, this->private_state_->tc_member_name_list_known_ = 1; - if (index < mcount) - return this->private_state_->tc_member_name_list_[index]; + if (slot < mcount) + return this->private_state_->tc_member_name_list_[slot]; else TAO_THROW_ENV_RETURN (CORBA::TypeCode::Bounds (), env, (char *)0); } @@ -2124,7 +2124,7 @@ CORBA_TypeCode::param_count (CORBA::Environment &env) const } CORBA::Any_ptr -CORBA_TypeCode::parameter (const CORBA::Long index, +CORBA_TypeCode::parameter (const CORBA::Long slot, CORBA::Environment &ACE_TRY_ENV) { ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE, diff --git a/TAO/tao/Typecode.h b/TAO/tao/Typecode.h index d31c2f5f657..5e56496f222 100644 --- a/TAO/tao/Typecode.h +++ b/TAO/tao/Typecode.h @@ -118,13 +118,13 @@ public: // Returns member_count (), raises (BadKind). Useful for tk_struct, // tk_union, tk_enum, tk_alias, and tk_except. - const char *member_name (CORBA::ULong index, + const char *member_name (CORBA::ULong slot, CORBA_Environment &TAO_IN_ENV = TAO_default_environment ()) const; // Returns member_name (...), raises (BadKind, Bounds); Useful for // tk_struct, tk_union, tk_enum, tk_alias, and tk_except. - CORBA::TypeCode_ptr member_type (CORBA::ULong index, + CORBA::TypeCode_ptr member_type (CORBA::ULong slot, CORBA_Environment &TAO_IN_ENV = TAO_default_environment ()) const; // Returns member_type (...), raises (BadKind, Bounds); Useful for @@ -141,7 +141,7 @@ public: CORBA::Long default_index (CORBA_Environment &TAO_IN_ENV = TAO_default_environment ()) const; - // Returns the default index for the tk_union. Raises (BadKind). + // Returns the default slot for the tk_union. Raises (BadKind). CORBA::ULong length (CORBA_Environment &TAO_IN_ENV = TAO_default_environment ()) const; @@ -217,7 +217,7 @@ public: // here as no-ops so legacy apps won't completely break. They // throw CORBA::NO_IMPLEMENT. - CORBA::Any_ptr parameter (const CORBA::Long index, + CORBA::Any_ptr parameter (const CORBA::Long slot, CORBA_Environment &TAO_IN_ENV = TAO_default_environment ()); // Deprecated in the CORBA 2.2 spec and @@ -294,13 +294,13 @@ private: // returns member_count (), raises (BadKind). Useful for tk_struct, // tk_union, tk_enum, tk_alias, and tk_except. - CORBA::TypeCode_ptr private_member_type (CORBA::ULong index, + CORBA::TypeCode_ptr private_member_type (CORBA::ULong slot, CORBA_Environment &TAO_IN_ENV = TAO_default_environment ()) const; // returns member_type (...), raises (BadKind, Bounds); Useful for // tk_struct, tk_union, and tk_except - const char *private_member_name (CORBA::ULong index, + const char *private_member_name (CORBA::ULong slot, CORBA_Environment &TAO_IN_ENV = TAO_default_environment ()) const; // returns member_name (...), raises (BadKind, Bounds); Useful for tk_union, @@ -317,7 +317,7 @@ private: CORBA::Long private_default_index (CORBA_Environment &TAO_IN_ENV = TAO_default_environment ()) const; - // returns the default index for the tk_union. Raises (BadKind); + // returns the default slot for the tk_union. Raises (BadKind); CORBA::Long private_length (CORBA_Environment &TAO_IN_ENV = TAO_default_environment ()) const; diff --git a/TAO/tao/UIOP_Connector.cpp b/TAO/tao/UIOP_Connector.cpp index 9e043fb6eb6..000d501e8c9 100644 --- a/TAO/tao/UIOP_Connector.cpp +++ b/TAO/tao/UIOP_Connector.cpp @@ -208,11 +208,11 @@ TAO_UIOP_Connector::preconnect (const char *preconnects) char[num_connections], -1); - size_t index = 0; + size_t slot = 0; // Fill in the remote address array - while (dests.pop (remote_addrs[index]) == 0) - handlers[index++] = 0; + while (dests.pop (remote_addrs[slot]) == 0) + handlers[slot++] = 0; // Finally, try to connect. this->base_connector_.connect_n (num_connections, @@ -221,20 +221,20 @@ TAO_UIOP_Connector::preconnect (const char *preconnects) failures); // Loop over all the failures and set the handlers that // succeeded to idle state. - for (index = 0; - index < num_connections; - ++index) + for (slot = 0; + slot < num_connections; + ++slot) { - if (!failures[index]) + if (!failures[slot]) { - handlers[index]->idle (); + handlers[slot]->idle (); ++successes; if (TAO_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) Preconnection <%s> succeeded.\n", - remote_addrs[index].get_path_name ())); + remote_addrs[slot].get_path_name ())); } } else @@ -243,7 +243,7 @@ TAO_UIOP_Connector::preconnect (const char *preconnects) { ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) Preconnection <%s> failed.\n", - remote_addrs[index].get_path_name ())); + remote_addrs[slot].get_path_name ())); } } } diff --git a/apps/gperf/ChangeLog b/apps/gperf/ChangeLog index 7f0a5220a68..044553257ab 100644 --- a/apps/gperf/ChangeLog +++ b/apps/gperf/ChangeLog @@ -1,30 +1,31 @@ +Sat Jun 5 23:17:39 1999 Douglas C. Schmidt <schmidt@danzon.cs.wustl.edu> + + * Replaced all uses of "index" with "slot" to avoid problems with + broken C++ compilers that define a macro called "index". + Tue May 4 14:24:27 1999 Alexander Babu Arulanthu <alex@cs.wustl.edu> * src/Options.cpp (parse_args): Removed %a flag from -v option and - used ACE_OS::exit (0) instead. + used ACE_OS::exit (0) instead. Mon Apr 26 15:42:54 1999 Ossama Othman <othman@cs.wustl.edu> - * tests/test-{1,2,3,4,5}.exp: - - Forgot to update the expected test output to reflect the - version string update listed below. + * tests/test-{1,2,3,4,5}.exp: Forgot to update the expected test + output to reflect the version string update listed below. Mon Apr 26 10:42:08 1999 Ossama Othman <othman@cs.wustl.edu> - * src/Version.cpp (version_string): - - Updated version string to "2.8 (ACE version)" since 2.7 is used - by the old Cygnus maintained gperf. + * src/Version.cpp (version_string): Updated version string to "2.8 + (ACE version)" since 2.7 is used by the old Cygnus maintained + gperf. - * src/*.{h,cpp}: - - Updated copyright/distribution information to GPL v2 style notice. + * src/*.{h,cpp}: Updated copyright/distribution information to GPL + v2 style notice. Sun Apr 25 16:16:12 1999 Ossama Othman <othman@cs.wustl.edu> * mdate-sh: Added this file to the CVS repository. It will be - used once the auto{conf,make} integrations are in place. + used once the auto{conf,make} integrations are in place. Sun Apr 25 16:13:40 1999 Ossama Othman <othman@cs.wustl.edu> @@ -34,49 +35,42 @@ Sat Apr 24 18:18:35 1999 Ossama Othman <othman@cs.wustl.edu> * gperf.1: * gperf.info: - * gperf.texi: - - Added missing quote, cosmetic fix, regenerated gperf.info. + * gperf.texi: Added missing quote, cosmetic fix, regenerated + gperf.info. * src/Key_List.cpp * src/Options.h: - * src/Options.cpp: - - Merged Cygnus patch that allows the user to specify a default - fill expression/value in the keyword table. Updated help - message with new `-F' option. Made some cosmetic fixes to the - help message, too. + * src/Options.cpp: Merged Cygnus patch that allows the user to + specify a default fill expression/value in the keyword table. + Updated help message with new `-F' option. Made some cosmetic + fixes to the help message, too. - * tests/test.cpp: + * tests/test.cpp: Minor spelling correction in comment - Minor spelling correction in comment - - * tests/test-6.exp: - - Updated with new expected gperf output. + * tests/test-6.exp: Updated with new expected gperf output. Mon Nov 9 23:37:09 1998 Vishal Kachroo <vishal@cs.wustl.edu> * src/Key_List.cpp: Fixed the problem with Binary and Linear - Search code. + Search code. Sat Oct 10 18:40:56 1998 Vishal Kachroo <vishal@merengue.cs.wustl.edu> * tests/test-6.exp (Usage): copied the output of gperf -h option - into test-6.exp. This test was failing because it didn't have - the -b option previously. Thanks to David for reporting the failure - of tests. + into test-6.exp. This test was failing because it didn't have + the -b option previously. Thanks to David for reporting the + failure of tests. * src/Options.cpp : Changed the option case 'h' to include the - following line " -b/t Code for Linear Search". + following line " -b/t Code for Linear Search". Fri Oct 9 01:06:56 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu> * src/Options.cpp : - * src/Key_List.cpp (output_linear_search_function): - Changed option -z to -b for generating linear search. Removed - <len> parameter from the lookup code. We dont need <len> in the - generated code in the case of linear/binary search options. + * src/Key_List.cpp (output_linear_search_function): Changed option + -z to -b for generating linear search. Removed <len> parameter + from the lookup code. We dont need <len> in the generated code + in the case of linear/binary search options. Thu Oct 8 17:40:19 1998 Vishal Kachroo <vishal@merengue.cs.wustl.edu> @@ -94,7 +88,6 @@ Wed Oct 7 01:20:35 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu> Updated thif file to the current help message. Thanks to Hans for reporting this. - Tue Oct 6 11:51:47 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu> * src/Key_List.cpp (Key_List): Fixed g++ warnings. @@ -105,18 +98,19 @@ Tue Oct 6 02:48:37 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu> Search code generated from GPERF. * src/Options.cpp (parse_args): Added the -B option for the binary - search. + search. * src/Options.h (enum Option_Type): Added the BINARYSEARCH in the - enumeration. + enumeration. - * src/Key_List.cpp : Added the function output_binary_search_function - (void). Changed the output function to include the Binary Search option. - Used option[BINARYSEARCH] to distinguish the binary search case from the - hashing case. + * src/Key_List.cpp : Added the function + output_binary_search_function(void). Changed the output function + to include the Binary Search option. Used option[BINARYSEARCH] + to distinguish the binary search case from the hashing case. - * src/Key_List.h : Added the prototype for output_binary_search_function. - Also added the key_sort variable to enable sorting based on key values. + * src/Key_List.h : Added the prototype for + output_binary_search_function. Also added the key_sort variable + to enable sorting based on key values. Mon Oct 5 18:24:15 1998 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> @@ -139,51 +133,50 @@ Sat Oct 3 19:36:52 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu> * src/Options.h: * src/Options.cpp: * src/Key_List.h: - * src/Key_List.cpp: - Reverted all the changes done for Binary Search. + * src/Key_List.cpp: Reverted all the changes done for Binary + Search. Sat Oct 3 17:51:10 1998 Carlos O'Ryan <coryan@cs.wustl.edu> - * tests/test-6.exp: - Added the new -B option. + * tests/test-6.exp: Added the new -B option. Sat Oct 3 13:47:40 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu> * src/Key_List.cpp (output_binary_search_function): Added a new - line after binary search code. + line after binary search code. Sat Oct 3 10:11:15 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu> * src/Options.cpp (parse_args): Changed the option for binary - search to '-B' + search to '-B' Fri Oct 2 21:38:54 1998 Vishal Kachroo <vishal@merengue.cs.wustl.edu> * src/Options.cpp (parse_args): Added the -b option for the binary - search. + search. * src/Options.h (enum Option_Type): Added the BINARYSEARCH in the - enumeration. - - * src/Key_List.cpp : Added the function output_binary_search_function - (void). Changed the output function to include the Binary Search option. - Used option[BINARYSEARCH] to distinguish the binary search case from the - hashing case. + enumeration. - * src/Key_List.h : Added the prototype for output_binary_search_function. - Also added the key_sort variable to enable sorting based on key values. + * src/Key_List.cpp : Added the function + output_binary_search_function (void). Changed the output + function to include the Binary Search option. Used + option[BINARYSEARCH] to distinguish the binary search case from + the hashing case. + * src/Key_List.h : Added the prototype for + output_binary_search_function. Also added the key_sort variable + to enable sorting based on key values. Thu Oct 1 12:40:59 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu> * src/Options.cpp (parse_args): Comments for Vishal to incorporate - Binary Seach on to GPERF. + Binary Seach on to GPERF. Wed Sep 30 16:55:53 1998 Carlos O'Ryan <coryan@cs.wustl.edu> - * tests/Makefile: - Updated dependencies, added a realclean target to remove the - output from the tests. + * tests/Makefile: Updated dependencies, added a realclean target + to remove the output from the tests. Wed Sep 30 12:41:29 1998 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> @@ -192,15 +185,15 @@ Wed Sep 30 12:41:29 1998 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> Mon Sep 28 13:18:05 1998 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> - * tests: Updated all the test-*.exp files to reflect the - latest "unsigned" changes. + * tests: Updated all the test-*.exp files to reflect the latest + "unsigned" changes. * src/Key_List.cpp (output_hash_function): Fixed another use of int to be unsigned int. * tests/test.cpp: Fixed the signature of in_word_set() to be - consistent with the new gperf. Thanks to David Levine and - Carlos O'Ryan for this fix. + consistent with the new gperf. Thanks to David Levine and + Carlos O'Ryan for this fix. Sun Sep 27 00:04:18 1998 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> diff --git a/apps/gperf/src/Bool_Array.cpp b/apps/gperf/src/Bool_Array.cpp index baf74e31a2e..926c9bc2ecd 100644 --- a/apps/gperf/src/Bool_Array.cpp +++ b/apps/gperf/src/Bool_Array.cpp @@ -72,13 +72,13 @@ Bool_Array::open (u_long s) } int -Bool_Array::find (u_long index) +Bool_Array::find (u_long slot) { - if (storage_array_[index] == generation_number_) + if (storage_array_[slot] == generation_number_) return 1; else { - storage_array_[index] = generation_number_; + storage_array_[slot] = generation_number_; return 0; } } diff --git a/apps/gperf/src/Key_List.cpp b/apps/gperf/src/Key_List.cpp index a17a01491f9..9bbf0607d16 100644 --- a/apps/gperf/src/Key_List.cpp +++ b/apps/gperf/src/Key_List.cpp @@ -641,9 +641,9 @@ Key_List::output_switch (int use_keyword_table) temp->hash_value, links->key); if (pointer_and_type_enabled) - ACE_OS::printf (" resword = &wordlist[%d];\n", links->index); + ACE_OS::printf (" resword = &wordlist[%d];\n", links->slot); else if (use_keyword_table) - ACE_OS::printf (" resword = wordlist[%d];\n", links->index); + ACE_OS::printf (" resword = wordlist[%d];\n", links->slot); else ACE_OS::printf (" resword = \"%s\";\n", links->key); ACE_OS::printf (" if (%s) return resword;\n", comp_buffer); @@ -660,17 +660,17 @@ Key_List::output_switch (int use_keyword_table) temp = temp->next) { if (pointer_and_type_enabled) - ACE_OS::printf (" resword = &wordlist[%d];\n", temp->index); + ACE_OS::printf (" resword = &wordlist[%d];\n", temp->slot); else if (use_keyword_table) - ACE_OS::printf (" resword = wordlist[%d];", temp->index); + ACE_OS::printf (" resword = wordlist[%d];", temp->slot); else ACE_OS::printf (" resword = \"%s\";\n", temp->key); ACE_OS::printf (" if (%s) return resword;\n", comp_buffer); } if (pointer_and_type_enabled) - ACE_OS::printf (" resword = &wordlist[%d];\n", temp->index); + ACE_OS::printf (" resword = &wordlist[%d];\n", temp->slot); else if (use_keyword_table) - ACE_OS::printf (" resword = wordlist[%d];", temp->index); + ACE_OS::printf (" resword = wordlist[%d];", temp->slot); else ACE_OS::printf (" resword = \"%s\";\n", temp->key); ACE_OS::printf (" return %s ? resword : 0;\n", comp_buffer); @@ -680,9 +680,9 @@ Key_List::output_switch (int use_keyword_table) else { if (pointer_and_type_enabled) - ACE_OS::printf (" resword = &wordlist[%d];", temp->index); + ACE_OS::printf (" resword = &wordlist[%d];", temp->slot); else if (use_keyword_table) - ACE_OS::printf (" resword = wordlist[%d];", temp->index); + ACE_OS::printf (" resword = wordlist[%d];", temp->slot); else ACE_OS::printf (" resword = \"%s\";", temp->key); if (option[LENTABLE] && !option[DUP]) @@ -744,7 +744,7 @@ void Key_List::output_keylength_table (void) { const int max_column = 15; - int index = 0; + int slot = 0; int column = 0; char *indent = option[GLOBAL] ? "" : " "; List_Node *temp; @@ -756,11 +756,11 @@ Key_List::output_keylength_table (void) max_key_len <= UCHAR_MAX ? "char" : (max_key_len <= USHRT_MAX ? "short" : "long"), indent, indent); - for (temp = head; temp; temp = temp->next, index++) + for (temp = head; temp; temp = temp->next, slot++) { - if (index < temp->hash_value) - for ( ; index < temp->hash_value; index++) + if (slot < temp->hash_value) + for ( ; slot < temp->hash_value; slot++) ACE_OS::printf ("%3d,%s", 0, ++column % (max_column - 1) ? "" : "\n "); ACE_OS::printf ("%3d,%s", temp->length, ++column % (max_column - 1 ) ? "" : "\n "); @@ -779,7 +779,7 @@ Key_List::output_keyword_table (void) char *l_brace = *head->rest ? "{" : ""; char *r_brace = *head->rest ? "}," : ""; char *indent = option[GLOBAL] ? "" : " "; - int index = 0; + int slot = 0; List_Node *temp; ACE_OS::printf ("%sstatic %s%swordlist[] =\n%s%s{\n", @@ -797,14 +797,14 @@ Key_List::output_keyword_table (void) int column; - for (column = 1; index < head->hash_value; column++) + for (column = 1; slot < head->hash_value; column++) { ACE_OS::printf ("%s\"\"%s,%s %s", l_brace, option.fill_default (), r_brace, column % 9 ? "" : "\n "); - index++; + slot++; } if (0 < head->hash_value && column % 10) @@ -812,17 +812,17 @@ Key_List::output_keyword_table (void) // Generate an array of reserved words at appropriate locations. - for (temp = head ; temp; temp = temp->next, index++) + for (temp = head ; temp; temp = temp->next, slot++) { - temp->index = index; + temp->slot = slot; - if (!option[SWITCH] && (total_duplicates == 0 || !option[DUP]) && index < temp->hash_value) + if (!option[SWITCH] && (total_duplicates == 0 || !option[DUP]) && slot < temp->hash_value) { int column; ACE_OS::printf (" "); - for (column = 1; index < temp->hash_value; index++, column++) + for (column = 1; slot < temp->hash_value; slot++, column++) ACE_OS::printf ("%s\"\",%s %s", l_brace, r_brace, column % 9 ? "" : "\n "); if (column % 10) @@ -831,9 +831,9 @@ Key_List::output_keyword_table (void) { ACE_OS::printf ("%s\"%s\", %s%s", l_brace, temp->key, temp->rest, r_brace); if (option[DEBUG]) - ACE_OS::printf (" /* hash value = %d, index = %d */", + ACE_OS::printf (" /* hash value = %d, slot = %d */", temp->hash_value, - temp->index); + temp->slot); putchar ('\n'); continue; } @@ -841,21 +841,21 @@ Key_List::output_keyword_table (void) ACE_OS::printf (" %s\"%s\", %s%s", l_brace, temp->key, temp->rest, r_brace); if (option[DEBUG]) - ACE_OS::printf (" /* hash value = %d, index = %d */", + ACE_OS::printf (" /* hash value = %d, slot = %d */", temp->hash_value, - temp->index); + temp->slot); putchar ('\n'); // Deal with links specially. if (temp->link) for (List_Node *links = temp->link; links; links = links->link) { - links->index = ++index; + links->slot = ++slot; ACE_OS::printf (" %s\"%s\", %s%s", l_brace, links->key, links->rest, r_brace); if (option[DEBUG]) - ACE_OS::printf (" /* hash value = %d, index = %d */", + ACE_OS::printf (" /* hash value = %d, slot = %d */", links->hash_value, - links->index); + links->slot); putchar ('\n'); } @@ -1189,10 +1189,10 @@ Key_List::count_duplicates (List_Node *link, if (option[DEBUG]) ACE_DEBUG ((LM_DEBUG, - "%s linked keyword = %s, index = %d, hash_value = %d\n", + "%s linked keyword = %s, slot = %d, hash_value = %d\n", type, ptr->key, - ptr->index, + ptr->slot, ptr->hash_value)); } @@ -1206,7 +1206,7 @@ Key_List::update_lookup_array (int lookup_array[], Duplicate_Entry *dup_ptr, int value) { - lookup_array[i1] = -dup_ptr->index; + lookup_array[i1] = -dup_ptr->slot; lookup_array[i2] = -dup_ptr->count; lookup_array[dup_ptr->hash_value] = value; } @@ -1243,17 +1243,17 @@ Key_List::output_lookup_array (void) for (List_Node *temp = head; temp; temp = temp->next) { int hash_value = temp->hash_value; - // Store the keyword's index location into the + // Store the keyword's slot location into the // <lookup_array> at the <hash_value>. If this is a // non-duplicate, then this value will point directly to the // keyword. - lookup_array[hash_value] = temp->index; + lookup_array[hash_value] = temp->slot; if (option[DEBUG]) ACE_DEBUG ((LM_DEBUG, - "keyword = %s, index = %d, hash_value = %d, lookup_array[hash_value] = %d\n", + "keyword = %s, slot = %d, hash_value = %d, lookup_array[hash_value] = %d\n", temp->key, - temp->index, + temp->slot, temp->hash_value, lookup_array[temp->hash_value])); @@ -1266,7 +1266,7 @@ Key_List::output_lookup_array (void) { // We'll handle the duplicates here. dup_ptr->hash_value = hash_value; - dup_ptr->index = temp->index; + dup_ptr->slot = temp->slot; dup_ptr->count = 1; // Count the number of "static" duplicates, i.e., @@ -1292,10 +1292,10 @@ Key_List::output_lookup_array (void) { if (option[DEBUG]) ACE_DEBUG ((LM_DEBUG, - "dup_ptr[%d]: hash_value = %d, index = %d, count = %d\n", + "dup_ptr[%d]: hash_value = %d, slot = %d, count = %d\n", dup_ptr - duplicates, dup_ptr->hash_value, - dup_ptr->index, + dup_ptr->slot, dup_ptr->count)); int i; @@ -1397,14 +1397,14 @@ Key_List::output_lookup_function (void) if (option[DUP] && total_duplicates > 0) { - ACE_OS::printf (" int index = lookup[key];\n\n" - " if (index >= 0 && index < MAX_HASH_VALUE)\n"); + ACE_OS::printf (" int slot = lookup[key];\n\n" + " if (slot >= 0 && slot < MAX_HASH_VALUE)\n"); if (option[OPTIMIZE]) - ACE_OS::printf (" return %swordlist[index];\n", option[TYPE] && option[POINTER] ? "&" : ""); + ACE_OS::printf (" return %swordlist[slot];\n", option[TYPE] && option[POINTER] ? "&" : ""); else { ACE_OS::printf (" {\n" - " %schar *s = wordlist[index]", option[CONSTANT] ? "const " : ""); + " %schar *s = wordlist[slot]", option[CONSTANT] ? "const " : ""); if (array_type_ != Key_List::default_array_type) ACE_OS::printf (".%s", option.key_name ()); @@ -1413,12 +1413,12 @@ Key_List::output_lookup_function (void) option[STRCASECMP] ? "charmap[*str]" : "*str", option[COMP] ? (option[STRCASECMP] ? "strncasecmp (str + 1, s + 1, len - 1)" : "strncmp (str + 1, s + 1, len - 1)") : (option[STRCASECMP] ? "strcasecmp (str + 1, s + 1)" : "strcmp (str + 1, s + 1)"), - option[TYPE] && option[POINTER] ? "&wordlist[index]" : "s"); - ACE_OS::printf (" else if (index < 0 && index >= -MAX_HASH_VALUE)\n" + option[TYPE] && option[POINTER] ? "&wordlist[slot]" : "s"); + ACE_OS::printf (" else if (slot < 0 && slot >= -MAX_HASH_VALUE)\n" " return 0;\n"); } ACE_OS::printf (" else\n {\n" - " unsigned int offset = key + index + (index > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE);\n" + " unsigned int offset = key + slot + (slot > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE);\n" " %s%s*base = &wordlist[-lookup[offset]];\n" " %s%s*ptr = base + -lookup[offset + 1];\n\n" " while (--ptr >= base)\n ", @@ -1755,7 +1755,7 @@ Key_List::dump (void) : ACE_OS::strlen ("keysig"); ACE_DEBUG ((LM_DEBUG, - "\nList contents are:\n(hash value, key length, index, %*s, %*s, duplicates):\n", + "\nList contents are:\n(hash value, key length, slot, %*s, %*s, duplicates):\n", keysig_width, "keysig", keyword_width, @@ -1767,7 +1767,7 @@ Key_List::dump (void) "%11d,%11d,%6d, %*s, %*s", ptr->hash_value, ptr->length, - ptr->index, + ptr->slot, keysig_width, ptr->keysig, keyword_width, diff --git a/apps/gperf/src/Key_List.h b/apps/gperf/src/Key_List.h index 1fe86eb62b0..0992f8136ec 100644 --- a/apps/gperf/src/Key_List.h +++ b/apps/gperf/src/Key_List.h @@ -41,11 +41,11 @@ public: int hash_value; // Hash value for this particular duplicate set. - int index; - // Index into the main keyword storage array. + int slot; + // Slot into the main keyword storage array. int count; - // Number of consecutive duplicates at this index. + // Number of consecutive duplicates at this slot. }; class Key_List @@ -165,7 +165,7 @@ private: // hash value. static int determined_[Vectors::ALPHA_SIZE]; - // Sets the index location for all keysig characters that are now + // Sets the slot location for all keysig characters that are now // determined. }; diff --git a/apps/gperf/src/List_Node.cpp b/apps/gperf/src/List_Node.cpp index 450831ecb52..0f5fb5052ff 100644 --- a/apps/gperf/src/List_Node.cpp +++ b/apps/gperf/src/List_Node.cpp @@ -29,10 +29,6 @@ ACE_RCSID(src, List_Node, "$Id$") #include "Vectors.h" -// Defined as a macro in string.h on some systems, which causes -// conflicts. -#undef index - // Sorts the key set alphabetically to speed up subsequent operation // Uses insertion sort since the set is probably quite small. @@ -74,7 +70,7 @@ List_Node::List_Node (char *k, int len) key (k), rest (option[TYPE] ? k + len + 1 : ACE_const_cast(char*, "")), length (len), - index (0) + slot (0) { char *ptr = new char[(option[ALLCHARS] ? len : option.max_keysig_size ()) + 1]; keysig = ptr; diff --git a/apps/gperf/src/List_Node.h b/apps/gperf/src/List_Node.h index 8592462ed8c..1665099740d 100644 --- a/apps/gperf/src/List_Node.h +++ b/apps/gperf/src/List_Node.h @@ -72,7 +72,7 @@ public: int occurrence; // A metric for frequency of key set occurrences. - int index; + int slot; // Position of this node relative to other nodes. }; |