summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2003-02-20 17:32:05 +0000
committerbala <balanatarajan@users.noreply.github.com>2003-02-20 17:32:05 +0000
commitf535851adc99039505fbdb5c2daea10a647eb954 (patch)
tree339cb0b17bde01eec9e41a7281adb12328f0a08d
parent317d73ab248696382fbdadd5cffd61c5c98baafa (diff)
downloadATCD-f535851adc99039505fbdb5c2daea10a647eb954.tar.gz
ChangeLogTag: Thu Feb 20 12:29:17 2003 Balachandran Natarajan <bala@isis-server.isis.vanderbilt.edu>
-rw-r--r--TAO/tao/ChangeLog29
-rw-r--r--TAO/tao/IIOP_Profile.cpp40
-rw-r--r--TAO/tao/IIOP_Profile.h6
-rw-r--r--TAO/tao/Profile.cpp84
-rw-r--r--TAO/tao/Profile.h24
-rw-r--r--TAO/tao/Profile.i45
-rw-r--r--TAO/tao/Strategies/DIOP_Profile.cpp19
-rw-r--r--TAO/tao/Strategies/DIOP_Profile.h8
-rw-r--r--TAO/tao/Strategies/SHMIOP_Profile.cpp19
-rw-r--r--TAO/tao/Strategies/SHMIOP_Profile.h4
-rw-r--r--TAO/tao/Strategies/UIOP_Profile.cpp42
-rw-r--r--TAO/tao/Strategies/UIOP_Profile.h4
12 files changed, 178 insertions, 146 deletions
diff --git a/TAO/tao/ChangeLog b/TAO/tao/ChangeLog
index 44cb27f16c9..2fae2e4183d 100644
--- a/TAO/tao/ChangeLog
+++ b/TAO/tao/ChangeLog
@@ -1,3 +1,32 @@
+Thu Feb 20 12:29:17 2003 Balachandran Natarajan <bala@isis-server.isis.vanderbilt.edu>
+
+ * tao/Profile.h:
+ * tao/Profile.cpp:
+ * tao/Profile.i: Moved the ObjectKey from the inherited classes
+ to the base class. Added a new protected constructor which can
+ be used by the inherited classes to initialize the ObjectKey
+ properly. Also added a new method set_tagged_components () which
+ is a helper method useful for creating Tagged_Components of an
+ IOR from a CDR stream. Uninlined the constructor, destructor and
+ the methods for refcounted memory management.
+
+ * tao/IIOP_Profile.h:
+ * tao/IIOP_Profile.cpp:
+ * tao/Strategies/DIOP_Profile.h:
+ * tao/Strategies/DIOP_Profile.cpp:
+ * tao/Strategies/UIOP_Profile.h:
+ * tao/Strategies/UIOP_Profile.cpp:
+ * tao/Strategies/SHMIOP_Profile.h:
+ * tao/Strategies/SHMIOP_Profile.cpp: Removed the ObjectKey from
+ the following classes since it has now been moved to the base
+ class.
+
+ Used the protected constructor in the base class while base
+ member initializations.
+
+ Call the set_tagged_componets () to place a list of
+ IIOPEndpoints in the Tagged_Components contained in the profile.
+
Thu Feb 20 12:10:13 2003 Balachandran Natarajan <bala@isis-server.isis.vanderbilt.edu>
* tao/Tagged_Components.h:
diff --git a/TAO/tao/IIOP_Profile.cpp b/TAO/tao/IIOP_Profile.cpp
index 1345c66b0a1..3a0273ff5ae 100644
--- a/TAO/tao/IIOP_Profile.cpp
+++ b/TAO/tao/IIOP_Profile.cpp
@@ -34,11 +34,13 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (const ACE_INET_Addr &addr,
const TAO_ObjectKey &object_key,
const TAO_GIOP_Message_Version &version,
TAO_ORB_Core *orb_core)
- : TAO_Profile (IOP::TAG_INTERNET_IOP, orb_core, version),
+ : TAO_Profile (IOP::TAG_INTERNET_IOP,
+ orb_core,
+ object_key,
+ version),
endpoint_ (addr,
orb_core->orb_params ()->use_dotted_decimal_addresses ()),
- count_ (1),
- object_key_ (object_key)
+ count_ (1)
{
}
@@ -48,10 +50,12 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (const char* host,
const ACE_INET_Addr &addr,
const TAO_GIOP_Message_Version &version,
TAO_ORB_Core *orb_core)
- : TAO_Profile (IOP::TAG_INTERNET_IOP, orb_core, version),
+ : TAO_Profile (IOP::TAG_INTERNET_IOP,
+ orb_core,
+ object_key,
+ version),
endpoint_ (host, port, addr),
- count_ (1),
- object_key_ (object_key)
+ count_ (1)
{
}
@@ -60,8 +64,7 @@ TAO_IIOP_Profile::TAO_IIOP_Profile (TAO_ORB_Core *orb_core)
orb_core,
TAO_GIOP_Message_Version (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR)),
endpoint_ (),
- count_ (1),
- object_key_ ()
+ count_ (1)
{
}
@@ -500,27 +503,8 @@ TAO_IIOP_Profile::encode_endpoints (void)
== 0)
|| (out_cdr << endpoints) == 0)
return -1;
- CORBA::ULong length = out_cdr.total_length ();
-
- IOP::TaggedComponent tagged_component;
- tagged_component.tag = TAO_TAG_ENDPOINTS;
- tagged_component.component_data.length (length);
- CORBA::Octet *buf =
- tagged_component.component_data.get_buffer ();
-
- for (const ACE_Message_Block *iterator = out_cdr.begin ();
- iterator != 0;
- iterator = iterator->cont ())
- {
- CORBA::ULong i_length = iterator->length ();
- ACE_OS::memcpy (buf, iterator->rd_ptr (), i_length);
-
- buf += i_length;
- }
- // Add component with encoded endpoint data to this profile's
- // TaggedComponents.
- tagged_components_.set_component (tagged_component);
+ this->set_tagged_components (out_cdr);
return 0;
}
diff --git a/TAO/tao/IIOP_Profile.h b/TAO/tao/IIOP_Profile.h
index 997da2f7e8d..1612397d97b 100644
--- a/TAO/tao/IIOP_Profile.h
+++ b/TAO/tao/IIOP_Profile.h
@@ -23,8 +23,6 @@
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "tao/Object_KeyC.h"
#include "tao/IIOP_Endpoint.h"
@@ -175,10 +173,6 @@ protected:
/// Number of endpoints in the list headed by <endpoint_>.
size_t count_;
-
-private:
- /// object_key associated with this profile.
- TAO_ObjectKey object_key_;
};
#if defined (__ACE_INLINE__)
diff --git a/TAO/tao/Profile.cpp b/TAO/tao/Profile.cpp
index 69274a5f53c..9b508a7592d 100644
--- a/TAO/tao/Profile.cpp
+++ b/TAO/tao/Profile.cpp
@@ -17,6 +17,40 @@ ACE_RCSID(tao, Profile, "$Id$")
// ****************************************************************
+TAO_Profile::TAO_Profile (CORBA::ULong tag,
+ TAO_ORB_Core *orb_core,
+ const TAO_ObjectKey &obj_key,
+ const TAO_GIOP_Message_Version &version)
+ : version_ (version)
+ , are_policies_parsed_ (0)
+ , stub_ (0)
+ , policy_list_ (0)
+ , addressing_mode_ (0)
+ , tagged_profile_ (0)
+ , object_key_ (obj_key)
+ , tag_ (tag)
+ , orb_core_ (orb_core)
+ , forward_to_ (0)
+ , refcount_ (1)
+{
+}
+
+TAO_Profile::TAO_Profile (CORBA::ULong tag,
+ TAO_ORB_Core *orb_core,
+ const TAO_GIOP_Message_Version &version)
+ : version_ (version)
+ , are_policies_parsed_ (0)
+ , stub_ (0)
+ , policy_list_ (0)
+ , addressing_mode_ (0)
+ , tagged_profile_ (0)
+ , object_key_ ()
+ , tag_ (tag)
+ , orb_core_ (orb_core)
+ , forward_to_ (0)
+ , refcount_ (1)
+{
+}
TAO_Profile::~TAO_Profile (void)
{
@@ -24,6 +58,30 @@ TAO_Profile::~TAO_Profile (void)
delete this->tagged_profile_;
}
+CORBA::ULong
+TAO_Profile::_incr_refcnt (void)
+{
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->refcount_lock_, 0);
+
+ return this->refcount_++;
+}
+
+CORBA::ULong
+TAO_Profile::_decr_refcnt (void)
+{
+ {
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->refcount_lock_, 0);
+ this->refcount_--;
+ if (this->refcount_ != 0)
+ return this->refcount_;
+ }
+
+ // refcount is 0, so delete us!
+ // delete will call our ~ destructor which in turn deletes stuff.
+ delete this;
+ return 0;
+}
+
void
TAO_Profile::add_tagged_component (const IOP::TaggedComponent &component
ACE_ENV_ARG_DECL)
@@ -94,6 +152,32 @@ TAO_Profile::create_tagged_profile (void)
}
void
+TAO_Profile::set_tagged_components (TAO_OutputCDR &out_cdr)
+{
+ CORBA::ULong length = out_cdr.total_length ();
+
+ IOP::TaggedComponent tagged_component;
+ tagged_component.tag = TAO_TAG_ENDPOINTS;
+ tagged_component.component_data.length (length);
+ CORBA::Octet *buf =
+ tagged_component.component_data.get_buffer ();
+
+ for (const ACE_Message_Block *iterator = out_cdr.begin ();
+ iterator != 0;
+ iterator = iterator->cont ())
+ {
+ CORBA::ULong i_length = iterator->length ();
+ ACE_OS::memcpy (buf, iterator->rd_ptr (), i_length);
+
+ buf += i_length;
+ }
+
+ // Add component with encoded endpoint data to this profile's
+ // TaggedComponents.
+ tagged_components_.set_component (tagged_component);
+}
+
+void
TAO_Profile::policies (CORBA::PolicyList *policy_list
ACE_ENV_ARG_DECL)
{
diff --git a/TAO/tao/Profile.h b/TAO/tao/Profile.h
index bac298eae34..8fdab0af3bd 100644
--- a/TAO/tao/Profile.h
+++ b/TAO/tao/Profile.h
@@ -13,16 +13,16 @@
#ifndef TAO_PROFILE_H
#define TAO_PROFILE_H
#include "ace/pre.h"
-
-#include "corbafwd.h"
+#include "tao/Tagged_Components.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-#include "Tagged_Components.h"
-#include "PolicyC.h"
-#include "GIOP_Message_Version.h"
+// @@ This include needs to go after Ossama's checkin
+#include "tao/PolicyC.h"
+#include "tao/GIOP_Message_Version.h"
+#include "tao/Object_KeyC.h"
class TAO_MProfile;
class TAO_Stub;
@@ -199,9 +199,19 @@ public:
protected:
+ /// To be used by inherited classes
+ TAO_Profile (CORBA::ULong tag,
+ TAO_ORB_Core *orb_core,
+ const TAO_ObjectKey &key,
+ const TAO_GIOP_Message_Version &version);
+
/// Creates an encapsulation of the ProfileBody struct in the <cdr>
virtual void create_profile_body (TAO_OutputCDR &cdr) const = 0;
+ /// Helper method that encodes the endpoints for RTCORBA as
+ /// tagged_components.
+ void set_tagged_components (TAO_OutputCDR &cdr);
+
private:
/// this object keeps ownership of this object
@@ -252,8 +262,10 @@ protected:
/// Our tagged profile
IOP::TaggedProfile *tagged_profile_;
-private:
+ /// object_key associated with this profile.
+ TAO_ObjectKey object_key_;
+private:
/// IOP protocol tag.
CORBA::ULong tag_;
diff --git a/TAO/tao/Profile.i b/TAO/tao/Profile.i
index d624473abf9..e1ede5cbfaa 100644
--- a/TAO/tao/Profile.i
+++ b/TAO/tao/Profile.i
@@ -1,23 +1,6 @@
// -*- C++ -*-
// $Id$
-ACE_INLINE
-TAO_Profile::TAO_Profile (CORBA::ULong tag,
- TAO_ORB_Core *orb_core,
- const TAO_GIOP_Message_Version &version)
- : version_ (version),
- are_policies_parsed_ (0),
- stub_ (0),
- policy_list_ (0),
- addressing_mode_ (0),
- tagged_profile_ (0),
- tag_ (tag),
- orb_core_ (orb_core),
- forward_to_ (0),
- refcount_ (1)
-{
-}
-
ACE_INLINE CORBA::ULong
TAO_Profile::tag (void) const
{
@@ -36,34 +19,6 @@ TAO_Profile::orb_core (void) const
return this->orb_core_;
}
-ACE_INLINE CORBA::ULong
-TAO_Profile::_incr_refcnt (void)
-{
- // OK, think I got it. When this object is created (guard) the
- // lock is automatically acquired (refcount_lock_). Then when
- // we leave this method the destructir for guard is called which
- // releases the lock!
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->refcount_lock_, 0);
-
- return this->refcount_++;
-}
-
-ACE_INLINE CORBA::ULong
-TAO_Profile::_decr_refcnt (void)
-{
- {
- ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->refcount_lock_, 0);
- this->refcount_--;
- if (this->refcount_ != 0)
- return this->refcount_;
- }
-
- // refcount is 0, so delete us!
- // delete will call our ~ destructor which in turn deletes stuff.
- delete this;
- return 0;
-}
-
ACE_INLINE void
TAO_Profile::forward_to (TAO_MProfile *mprofiles)
{
diff --git a/TAO/tao/Strategies/DIOP_Profile.cpp b/TAO/tao/Strategies/DIOP_Profile.cpp
index d46518d31d6..725b7047ebb 100644
--- a/TAO/tao/Strategies/DIOP_Profile.cpp
+++ b/TAO/tao/Strategies/DIOP_Profile.cpp
@@ -36,11 +36,13 @@ TAO_DIOP_Profile::TAO_DIOP_Profile (const ACE_INET_Addr &addr,
const TAO_ObjectKey &object_key,
const TAO_GIOP_Message_Version &version,
TAO_ORB_Core *orb_core)
- : TAO_Profile (TAO_TAG_UDP_PROFILE, orb_core, version),
+ : TAO_Profile (TAO_TAG_UDP_PROFILE,
+ orb_core,
+ object_key,
+ version),
endpoint_ (addr,
orb_core->orb_params ()->use_dotted_decimal_addresses ()),
- count_ (1),
- object_key_ (object_key)
+ count_ (1)
{
}
@@ -50,10 +52,12 @@ TAO_DIOP_Profile::TAO_DIOP_Profile (const char* host,
const ACE_INET_Addr &addr,
const TAO_GIOP_Message_Version &version,
TAO_ORB_Core *orb_core)
- : TAO_Profile (TAO_TAG_UDP_PROFILE, orb_core, version),
+ : TAO_Profile (TAO_TAG_UDP_PROFILE,
+ orb_core,
+ object_key,
+ version),
endpoint_ (host, port, addr),
- count_ (1),
- object_key_ (object_key)
+ count_ (1)
{
}
@@ -62,8 +66,7 @@ TAO_DIOP_Profile::TAO_DIOP_Profile (TAO_ORB_Core *orb_core)
orb_core,
TAO_GIOP_Message_Version (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR)),
endpoint_ (),
- count_ (1),
- object_key_ ()
+ count_ (1)
{
}
diff --git a/TAO/tao/Strategies/DIOP_Profile.h b/TAO/tao/Strategies/DIOP_Profile.h
index 0d9bc4a240c..e65c3728be7 100644
--- a/TAO/tao/Strategies/DIOP_Profile.h
+++ b/TAO/tao/Strategies/DIOP_Profile.h
@@ -27,8 +27,6 @@
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "tao/Object_KeyC.h"
#include "DIOP_Endpoint.h"
#include "ace/Synch.h"
@@ -182,12 +180,6 @@ protected:
/// Number of endpoints in the list headed by <endpoint_>.
size_t count_;
-
-private:
-
- /// Object_key associated with this profile.
- TAO_ObjectKey object_key_;
-
};
#if defined (__ACE_INLINE__)
diff --git a/TAO/tao/Strategies/SHMIOP_Profile.cpp b/TAO/tao/Strategies/SHMIOP_Profile.cpp
index fa764a11dc9..1f9cd54cc98 100644
--- a/TAO/tao/Strategies/SHMIOP_Profile.cpp
+++ b/TAO/tao/Strategies/SHMIOP_Profile.cpp
@@ -34,11 +34,13 @@ TAO_SHMIOP_Profile::TAO_SHMIOP_Profile (const ACE_MEM_Addr &addr,
const TAO_ObjectKey &object_key,
const TAO_GIOP_Message_Version &version,
TAO_ORB_Core *orb_core)
- : TAO_Profile (TAO_TAG_SHMEM_PROFILE, orb_core, version),
+ : TAO_Profile (TAO_TAG_SHMEM_PROFILE,
+ orb_core,
+ object_key,
+ version),
endpoint_ (addr,
orb_core->orb_params ()->use_dotted_decimal_addresses ()),
- count_ (1),
- object_key_ (object_key)
+ count_ (1)
{
}
@@ -48,10 +50,12 @@ TAO_SHMIOP_Profile::TAO_SHMIOP_Profile (const char* host,
const ACE_INET_Addr &addr,
const TAO_GIOP_Message_Version &version,
TAO_ORB_Core *orb_core)
- : TAO_Profile (TAO_TAG_SHMEM_PROFILE, orb_core, version),
+ : TAO_Profile (TAO_TAG_SHMEM_PROFILE,
+ orb_core,
+ object_key,
+ version),
endpoint_ (host, port, addr),
- count_ (1),
- object_key_ (object_key)
+ count_ (1)
{
}
@@ -60,8 +64,7 @@ TAO_SHMIOP_Profile::TAO_SHMIOP_Profile (TAO_ORB_Core *orb_core)
orb_core,
TAO_GIOP_Message_Version (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR)),
endpoint_ (),
- count_ (1),
- object_key_ ()
+ count_ (1)
{
}
diff --git a/TAO/tao/Strategies/SHMIOP_Profile.h b/TAO/tao/Strategies/SHMIOP_Profile.h
index 208aaca97bc..0bba7999976 100644
--- a/TAO/tao/Strategies/SHMIOP_Profile.h
+++ b/TAO/tao/Strategies/SHMIOP_Profile.h
@@ -28,7 +28,6 @@
#include "strategies_export.h"
#include "tao/Profile.h"
-#include "tao/Object_KeyC.h"
#include "SHMIOP_Endpoint.h"
#include "ace/Synch.h"
@@ -174,9 +173,6 @@ private:
/// Number of endpoints in the list headed by <endpoint_>.
size_t count_;
-
- /// Object_key associated with this profile.
- TAO_ObjectKey object_key_;
};
#if defined (__ACE_INLINE__)
diff --git a/TAO/tao/Strategies/UIOP_Profile.cpp b/TAO/tao/Strategies/UIOP_Profile.cpp
index 5c47ed50aeb..20c24db4252 100644
--- a/TAO/tao/Strategies/UIOP_Profile.cpp
+++ b/TAO/tao/Strategies/UIOP_Profile.cpp
@@ -36,10 +36,12 @@ TAO_UIOP_Profile::TAO_UIOP_Profile (const ACE_UNIX_Addr &addr,
const TAO_ObjectKey &object_key,
const TAO_GIOP_Message_Version &version,
TAO_ORB_Core *orb_core)
- : TAO_Profile (TAO_TAG_UIOP_PROFILE, orb_core, version),
+ : TAO_Profile (TAO_TAG_UIOP_PROFILE,
+ orb_core,
+ object_key,
+ version),
endpoint_ (addr),
- count_ (1),
- object_key_ (object_key)
+ count_ (1)
{
}
@@ -48,10 +50,12 @@ TAO_UIOP_Profile::TAO_UIOP_Profile (const char *,
const ACE_UNIX_Addr &addr,
const TAO_GIOP_Message_Version &version,
TAO_ORB_Core *orb_core)
- : TAO_Profile (TAO_TAG_UIOP_PROFILE, orb_core, version),
+ : TAO_Profile (TAO_TAG_UIOP_PROFILE,
+ orb_core,
+ object_key,
+ version),
endpoint_ (addr),
- count_ (1),
- object_key_ (object_key)
+ count_ (1)
{
}
@@ -59,10 +63,9 @@ TAO_UIOP_Profile::TAO_UIOP_Profile (TAO_ORB_Core *orb_core)
: TAO_Profile (TAO_TAG_UIOP_PROFILE,
orb_core,
TAO_GIOP_Message_Version (TAO_DEF_GIOP_MAJOR,
- TAO_DEF_GIOP_MINOR)),
+ TAO_DEF_GIOP_MINOR)),
endpoint_ (),
- count_ (1),
- object_key_ ()
+ count_ (1)
{
}
@@ -447,27 +450,8 @@ TAO_UIOP_Profile::encode_endpoints (void)
== 0)
|| (out_cdr << endpoints) == 0)
return -1;
- CORBA::ULong length = out_cdr.total_length ();
-
- IOP::TaggedComponent tagged_component;
- tagged_component.tag = TAO_TAG_ENDPOINTS;
- tagged_component.component_data.length (length);
- CORBA::Octet *buf =
- tagged_component.component_data.get_buffer ();
-
- for (const ACE_Message_Block *iterator = out_cdr.begin ();
- iterator != 0;
- iterator = iterator->cont ())
- {
- CORBA::ULong i_length = iterator->length ();
- ACE_OS::memcpy (buf, iterator->rd_ptr (), i_length);
-
- buf += i_length;
- }
- // Add component with encoded endpoint data to this profile's
- // TaggedComponents.
- tagged_components_.set_component (tagged_component);
+ this->set_tagged_components (out_cdr);
return 0;
}
diff --git a/TAO/tao/Strategies/UIOP_Profile.h b/TAO/tao/Strategies/UIOP_Profile.h
index d5bf3fc61de..fc6c84d5d34 100644
--- a/TAO/tao/Strategies/UIOP_Profile.h
+++ b/TAO/tao/Strategies/UIOP_Profile.h
@@ -29,7 +29,6 @@
#include "strategies_export.h"
#include "tao/Profile.h"
-#include "tao/Object_KeyC.h"
#include "UIOP_Connection_Handler.h"
#include "UIOP_Endpoint.h"
@@ -173,9 +172,6 @@ private:
/// Number of endpoints in the list headed by <endpoint_>.
size_t count_;
-
- /// Object_key associated with this profile.
- TAO_ObjectKey object_key_;
};
#if defined (__ACE_INLINE__)