summaryrefslogtreecommitdiff
path: root/TAO/tao
diff options
context:
space:
mode:
authorAngelo Corsaro <angelo@icorsaro.net>2000-06-11 06:51:07 +0000
committerAngelo Corsaro <angelo@icorsaro.net>2000-06-11 06:51:07 +0000
commit8992db0082ef9b72686c5a4f99c29633fe2824d9 (patch)
treed674be19a55058f3760ef343c742bf7c27f5fed1 /TAO/tao
parent11f19fcfe178283fbacaccc83e7a911c1547038a (diff)
downloadATCD-8992db0082ef9b72686c5a4f99c29633fe2824d9.tar.gz
ChangeLogTag: Sun Jun 11 01:45:10 2000 Angelo Corsaro <corsaro@cs.wustl.edu>
Diffstat (limited to 'TAO/tao')
-rw-r--r--TAO/tao/MProfile.h19
-rw-r--r--TAO/tao/MProfile.i41
-rw-r--r--TAO/tao/ORB_Core.cpp13
-rw-r--r--TAO/tao/POA.cpp4
-rw-r--r--TAO/tao/Profile.cpp72
-rw-r--r--TAO/tao/Profile.h16
-rw-r--r--TAO/tao/Stub.h3
-rw-r--r--TAO/tao/Stub.i7
8 files changed, 114 insertions, 61 deletions
diff --git a/TAO/tao/MProfile.h b/TAO/tao/MProfile.h
index eac409da8ff..dd924bffdb3 100644
--- a/TAO/tao/MProfile.h
+++ b/TAO/tao/MProfile.h
@@ -155,6 +155,25 @@ public:
// profile and the results are averaged together.
// NON-THREAD SAFE.
+ void policy_list (CORBA::PolicyList *policy_list);
+ // Sets the policies list associated with the profiles
+ // owned by the TAO_MProfile.
+
+ CORBA::PolicyList * policy_list (void);
+ // Gets the policies list associated with the profiles
+ // owned by the TAO_MProfile.
+
+protected:
+
+ void create_policy_list (void);
+ // This method handle the dynamic allocation of the data member
+ // <policy_list_>.
+
+protected:
+
+ CORBA::PolicyList *policy_list_;
+ // Stores the policy list for the profile of this MProfile.
+
protected:
TAO_Profile **pfiles (void) const;
// return the complete list of profiles, this object retains
diff --git a/TAO/tao/MProfile.i b/TAO/tao/MProfile.i
index e87a921640f..d0f8a2b002c 100644
--- a/TAO/tao/MProfile.i
+++ b/TAO/tao/MProfile.i
@@ -4,6 +4,7 @@
ACE_INLINE
TAO_MProfile::TAO_MProfile (CORBA::ULong sz)
: forward_from_(0),
+ policy_list_ (0),
pfiles_ (0),
current_ (0),
size_ (0),
@@ -15,6 +16,7 @@ TAO_MProfile::TAO_MProfile (CORBA::ULong sz)
ACE_INLINE
TAO_MProfile::TAO_MProfile (const TAO_MProfile &mprofiles)
: forward_from_(0),
+ policy_list_ (0),
pfiles_ (0),
current_ (0),
size_ (0),
@@ -36,6 +38,13 @@ TAO_MProfile::operator= (const TAO_MProfile& rhs)
ACE_INLINE
TAO_MProfile::~TAO_MProfile (void)
{
+ if (policy_list_ != 0)
+ {
+ for (CORBA::ULong i = 0; i < policy_list_->length (); i++)
+ (*policy_list_)[i]->destroy ();
+ }
+ delete policy_list_;
+
this->cleanup ();
}
@@ -140,7 +149,6 @@ TAO_MProfile::rewind (void)
current_ = 0;
}
-ACE_INLINE int
TAO_MProfile::give_profile (TAO_Profile *pfile)
{
// skip by the used slots
@@ -240,3 +248,34 @@ TAO_MProfile::add_profile (TAO_Profile *pfile)
-1);
return last_ - 1;
}
+
+
+ACE_INLINE void
+TAO_MProfile::policy_list (CORBA::PolicyList *policy_list)
+{
+ this->policy_list_ = policy_list;
+}
+
+ACE_INLINE CORBA::PolicyList*
+TAO_MProfile::policy_list (void)
+{
+ if (policy_list_ == 0)
+ create_policy_list ();
+ return policy_list_;
+}
+
+ACE_INLINE void
+TAO_MProfile::create_policy_list (void)
+{
+ // Precondition: Make sure that the policy list
+ // has not already allocated.
+ ACE_ASSERT (this->policy_list_ == 0);
+
+ ACE_NEW (this->policy_list_, CORBA::PolicyList ());
+
+ // Post-Condition: Make sure that the memory get allcated
+ // for real.
+ ACE_ASSERT (this->policy_list_ != 0);
+
+ // @@ Marina & Irfan I would raise an exception in this case.
+}
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index 19ea5dd3e1d..3ff911c174b 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -1596,6 +1596,13 @@ TAO_ORB_Core::create_stub_object (const TAO_ObjectKey &key,
}
+
+
+ ACE_NEW_THROW_EX (stub,
+ TAO_Stub (id._retn (), mp, this),
+ CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
+ CORBA::COMPLETED_MAYBE));
+
// Add the Polices contained in "policy_list" to each profile
// so that those policies will be exposed to the client in the IOR.
// In particular each CORBA::Policy has to be converted in to
@@ -1609,20 +1616,18 @@ TAO_ORB_Core::create_stub_object (const TAO_ObjectKey &key,
{
// Set the "iterator" to the beginning of MProfile.
mp.rewind();
+ mp.policy_list (policy_list);
TAO_Profile * profile;
for (CORBA::ULong i = 0; i < mp.profile_count (); ++i)
{
// Get the ith profile
profile = mp.get_next ();
+ profile->the_stub (stub);
profile->policies (policy_list);
}
}
- ACE_NEW_THROW_EX (stub,
- TAO_Stub (id._retn (), mp, this),
- CORBA::NO_MEMORY (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_MAYBE));
ACE_CHECK_RETURN (stub);
return stub;
diff --git a/TAO/tao/POA.cpp b/TAO/tao/POA.cpp
index 791dfb94820..66a049a8711 100644
--- a/TAO/tao/POA.cpp
+++ b/TAO/tao/POA.cpp
@@ -4232,6 +4232,10 @@ TAO_POA::client_exposed_policies (CORBA::Short object_priority,
(*client_exposed_policies)[current_length] = priority_model_policy;
}
+#else /* TAO_HAS_RT_CORBA == 1 */
+
+ ACE_UNUSED_ARG (object_priority);
+
#endif /* TAO_HAS_RT_CORBA == 1 */
return client_exposed_policies;
diff --git a/TAO/tao/Profile.cpp b/TAO/tao/Profile.cpp
index 70b3f5b39bf..a7dac4136e9 100644
--- a/TAO/tao/Profile.cpp
+++ b/TAO/tao/Profile.cpp
@@ -5,6 +5,7 @@
#include "tao/MessagingC.h"
#include "tao/Policy_Factory.h"
+#include "tao/Stub.h"
#if !defined (__ACE_INLINE__)
#include "tao/Profile.i"
@@ -16,12 +17,6 @@ ACE_RCSID(tao, Profile, "$Id$")
TAO_Profile::~TAO_Profile (void)
{
- if (policy_list_ != 0)
- {
- for (CORBA::ULong i = 0; i < policy_list_->length (); i++)
- (*policy_list_)[i]->destroy ();
- }
- delete policy_list_;
}
@@ -46,11 +41,6 @@ TAO_Profile::policies (CORBA::PolicyList *policy_list)
ACE_ASSERT (policy_list != 0);
- create_policy_list (policy_list->length ());
-
- // Make a deep copy.
- *this->policy_list_ = *policy_list;
-
// @@ Angelo, address memory management: every profile takes
// ownership of the same copy and will try to destroy.
@@ -67,16 +57,16 @@ TAO_Profile::policies (CORBA::PolicyList *policy_list)
CORBA::ULong length;
CORBA::Octet *buf = 0;
- policy_value_seq.length (policy_list_->length ());
+ policy_value_seq.length (policy_list->length ());
// This loop iterates through CORBA::PolicyList to convert
// each CORBA::Policy into a CORBA::PolicyValue
- for (size_t i = 0; i < policy_list_->length (); i++)
+ for (size_t i = 0; i < policy_list->length (); i++)
{
ACE_NEW (pv_ptr, Messaging::PolicyValue);
- pv_ptr->ptype = (*policy_list_)[i]->policy_type ();
+ pv_ptr->ptype = (*policy_list)[i]->policy_type ();
- (*policy_list_)[i]->_tao_encode (out_CDR);
+ (*policy_list)[i]->_tao_encode (out_CDR);
length = out_CDR.total_length ();
pv_ptr->pvalue.length (length);
@@ -136,8 +126,11 @@ CORBA::PolicyList&
TAO_Profile::policies (void)
{
#if (TAO_HAS_CORBA_MESSAGING == 1)
-
- if (!are_policies_parsed_)
+
+ CORBA::PolicyList *policies = stub_->base_profiles ().policy_list ();
+ if (!are_policies_parsed_
+ && (policies->length () == 0))
+ // None has already parsed the policies.
{
IOP::TaggedComponent tagged_component;
tagged_component.tag = Messaging::TAG_POLICIES;
@@ -164,7 +157,9 @@ TAO_Profile::policies (void)
CORBA::Policy *policy = 0;
CORBA::ULong length = policy_value_seq.length ();
- create_policy_list (length);
+ // Get the policy list from the MProfile.
+ CORBA::PolicyList *policies = stub_->base_profiles ().policy_list ();
+ policies->length (length);
for (CORBA::ULong i = 0; i < length; i++)
{
@@ -178,7 +173,7 @@ TAO_Profile::policies (void)
policy_value_seq[i].pvalue.length ());
policy->_tao_decode (in_CDR);
- (*policy_list_)[i] = policy;
+ (*policies)[i] = policy;
}
else
{
@@ -189,47 +184,28 @@ TAO_Profile::policies (void)
}
}
}
- else // Create an empty list if no policies were exposed.
+ else
{
- // @@ Angelo, something isn't right with this code.
- // create_policy_list allocates something ... should it?
- create_policy_list (0);
- // @@ Angelo, check that the list was created for real.
-
- // @@ Marina Right now I put an assertion in the
- // <create_policy_list> method. If there is no
- // memory and no memory can be allocated shouldn't
- // we terminate?
}
}
-#else /* (TAO_HAS_CORBA_MESSAGING == 1) */
-
- create_policy_list (0);
-
#endif /* (TAO_HAS_CORBA_MESSAGING == 1) */
-
- return *policy_list_;
+
+ return *(stub_->base_profiles ().policy_list ());
}
void
-TAO_Profile::create_policy_list (int length)
+TAO_Profile::the_stub (TAO_Stub *stub)
{
- // Precondition: Make sure that the policy list
- // has not already allocated.
- ACE_ASSERT (this->policy_list_ == 0);
-
- ACE_NEW (this->policy_list_, CORBA::PolicyList (length));
-
- // Post-Condition: Make sure that the memory get allcated
- // for real.
- ACE_ASSERT (this->policy_list_ != 0);
-
- this->policy_list_->length (length);
+ this->stub_ = stub;
+}
- // @@ Marina & Irfan I would raise an exception in this case.
+TAO_Stub*
+TAO_Profile::the_stub (void)
+{
+ return stub_;
}
// ****************************************************************
diff --git a/TAO/tao/Profile.h b/TAO/tao/Profile.h
index 166dfc99bd5..d27ce97661e 100644
--- a/TAO/tao/Profile.h
+++ b/TAO/tao/Profile.h
@@ -29,6 +29,7 @@
#include "tao/PolicyC.h"
class TAO_MProfile;
+class TAO_Stub;
class TAO_Export TAO_Profile
{
@@ -127,16 +128,12 @@ public:
virtual CORBA::PolicyList& policies (void);
// Accessor for the client exposed policies of this profile.
-private:
+ virtual void the_stub (TAO_Stub *stub);
+ // Sets the TAO_Stub to which this profile is associated.
- void create_policy_list (int length);
- // This method handle the dynamic allocation of the data member
- // <policy_list_>
+ virtual TAO_Stub* the_stub (void);
+ // Gets the TAO_MProfile that holds the TAO_Profile instance.
- // @@ Angelo, please add a comment explaining what it does and why
- // it's needed.
-
- // @@ Marina DONE.
private:
TAO_MProfile *forward_to_i (void);
// this object keeps ownership of this object
@@ -153,6 +150,9 @@ protected:
// Flag indicating whether the lazy decoding of the client exposed
// policies has taken place.
+ TAO_Stub *stub_;
+ // Pointer to the TAO_Stub to which this profile is related.
+
CORBA::PolicyList *policy_list_;
// Client exposed policies of this profile.
diff --git a/TAO/tao/Stub.h b/TAO/tao/Stub.h
index f8a06da5340..145ebd0bb3d 100644
--- a/TAO/tao/Stub.h
+++ b/TAO/tao/Stub.h
@@ -247,6 +247,9 @@ public:
const TAO_MProfile& base_profiles (void) const;
// Obtain a reference to the basic profile set.
+ TAO_MProfile& base_profiles (void);
+ // Obtain a reference to the basic profile set.
+
// manage forward and base profiles.
TAO_Profile *next_profile (void);
// THREAD SAFE. If forward_profiles is null then this will
diff --git a/TAO/tao/Stub.i b/TAO/tao/Stub.i
index 0e80536460a..77f14eecdc8 100644
--- a/TAO/tao/Stub.i
+++ b/TAO/tao/Stub.i
@@ -230,6 +230,13 @@ TAO_Stub::base_profiles (void) const
return this->base_profiles_;
}
+ACE_INLINE TAO_MProfile&
+TAO_Stub::base_profiles (void)
+{
+ return this->base_profiles_;
+}
+
+
ACE_INLINE TAO_ORB_Core*
TAO_Stub::orb_core (void) const
{