summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-01-17 00:04:26 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-01-17 00:04:26 +0000
commit57d2f1771fd4a15925d918e387757e99bda60940 (patch)
tree753fcfe45ae68f87c13e386ef8a0c12c3b4b356e
parentc6c823d8780c5e1696bdfd291810a515ab890dcb (diff)
downloadATCD-57d2f1771fd4a15925d918e387757e99bda60940.tar.gz
ChangeLogTag:Fri Jan 16 18:01:03 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r--TAO/ChangeLog-98c20
-rw-r--r--TAO/TAO_IDL/be/be_interface.cpp2
-rw-r--r--TAO/tao/objtable.cpp33
-rw-r--r--TAO/tao/objtable.h16
-rw-r--r--TAO/tao/poa.cpp10
-rw-r--r--TAO/tao/poa.h10
-rw-r--r--TAO/tao/sequence_T.cpp60
-rw-r--r--TAO/tao/sequence_T.i23
8 files changed, 103 insertions, 71 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index b9f3c6cc029..410341d5ba0 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,3 +1,23 @@
+Fri Jan 16 18:01:03 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
+
+ * The Event Service works on Solaris/SunCC again.
+
+ * tao/poa.h:
+ * tao/poa.cpp:
+ * tao/objtable.h:
+ * tao/objtable.cpp:
+ * tao/connect.cpp:
+ The object table, and POA use a real TAO_Unbounded_Sequence,
+ removing some nasty casts.
+
+ * tao/sequence_T.i:
+ * tao/sequence_T.cpp:
+ Fixed some memory allocation problems in operator=
+
+ * TAO_IDL/be/be_interface.cpp:
+ No need to cast the object key when calling POA::bind(), it
+ takes a TAO_opaque now.
+
Thu Jan 15 17:15:29 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
* TAO/TAO_IDL/be/be_interface.cpp:
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp
index 4cafb54f34f..2de95f3ee1f 100644
--- a/TAO/TAO_IDL/be/be_interface.cpp
+++ b/TAO/TAO_IDL/be/be_interface.cpp
@@ -622,7 +622,7 @@ int be_interface::gen_server_skeletons (void)
// *ss << "this->sub_ = this; // set the most derived type to be us" << nl;
*ss << "// @@ TODO this cast is while we still have sequences " << nl
<< "// implemented using the old CORBA_SEQUENCE template " << nl;
- *ss << "if (oa) oa->bind (ACE_static_cast(CORBA::OctetSeq&,data->profile.object_key), this); " <<
+ *ss << "if (oa) oa->bind (data->profile.object_key, this); " <<
"// register ourselves\n";
ss->decr_indent ();
*ss << "}\n\n";
diff --git a/TAO/tao/objtable.cpp b/TAO/tao/objtable.cpp
index d0495f4e5b6..70ef7aadbcd 100644
--- a/TAO/tao/objtable.cpp
+++ b/TAO/tao/objtable.cpp
@@ -49,25 +49,25 @@ TAO_Dynamic_Hash_ObjTable::~TAO_Dynamic_Hash_ObjTable (void)
}
int
-TAO_Dynamic_Hash_ObjTable::bind (const CORBA::OctetSeq &key,
+TAO_Dynamic_Hash_ObjTable::bind (const TAO_opaque &key,
CORBA::Object_ptr obj)
{
// the key is an octet sequence. Hence, we cannot simply cast the buffer to a
// char* as it may result in an arbitrary name. Hence we must first convert
// it to a string and then save a copy of the string in the table.
- ACE_CString objkey ((char *)key.buffer, key.length);
+ ACE_CString objkey ((char *)&key[0], key.length ());
return this->hash_.bind (CORBA::string_dup (objkey.rep ()), obj);
}
int
-TAO_Dynamic_Hash_ObjTable::find (const CORBA::OctetSeq &key,
+TAO_Dynamic_Hash_ObjTable::find (const TAO_opaque &key,
CORBA::Object_ptr &obj)
{
// the key is an octet sequence. Hence, we cannot simply cast the buffer to a
// char* as it may result in an arbitrary name due to absence of a NULL
// terminating character. Hence we must first convert it to a string of the
// specified length.
- ACE_CString objkey ((char *)key.buffer, key.length);
+ ACE_CString objkey ((char *)&key[0], key.length ());
return this->hash_.find (objkey.rep(), obj); // no string_dup necessary here
}
@@ -85,7 +85,7 @@ TAO_Linear_ObjTable::~TAO_Linear_ObjTable (void)
}
int
-TAO_Linear_ObjTable::bind (const CORBA::OctetSeq &key,
+TAO_Linear_ObjTable::bind (const TAO_opaque &key,
CORBA::Object_ptr obj)
{
CORBA::ULong i = this->next_;
@@ -93,10 +93,12 @@ TAO_Linear_ObjTable::bind (const CORBA::OctetSeq &key,
if (i < this->tablesize_)
{
// store the string and the corresponding object pointer
- this->tbl_[i].opname_ = CORBA::string_alloc (key.length); // allocates one
+ this->tbl_[i].opname_ = CORBA::string_alloc (key.length ()); // allocates one
// more
- ACE_OS::memset (this->tbl_[i].opname_, '\0', key.length+1);
- ACE_OS::strncpy (this->tbl_[i].opname_, (char *)key.buffer, key.length);
+ ACE_OS::memset (this->tbl_[i].opname_, '\0', key.length () + 1);
+ ACE_OS::strncpy (this->tbl_[i].opname_,
+ (char *)&key[0],
+ key.length ());
this->tbl_[i].obj_ = obj;
this->next_++; // point to the next available slot
return 0; // success
@@ -107,16 +109,17 @@ TAO_Linear_ObjTable::bind (const CORBA::OctetSeq &key,
// find if the key exists
int
-TAO_Linear_ObjTable::find (const CORBA::OctetSeq &key,
+TAO_Linear_ObjTable::find (const TAO_opaque &key,
CORBA::Object_ptr &obj)
{
ACE_ASSERT (this->next_ <= this->tablesize_);
- // ACE_CString objkey ((char *)key.buffer, key.length);
+ // ACE_CString objkey ((char *)&key[0], key.length ());
for (CORBA::ULong i = 0; i < this->next_; i++)
{
// linearly search thru the table
- if (!ACE_OS::strncmp (this->tbl_[i].opname_, (char *)key.buffer, key.length))
+ if (!ACE_OS::strncmp (this->tbl_[i].opname_, (char *)&key[0],
+ key.length ()))
{
// keys match. Return the object pointer
obj = this->tbl_[i].obj_;
@@ -158,12 +161,12 @@ TAO_Active_Demux_ObjTable::~TAO_Active_Demux_ObjTable ()
// bind the object based on the key
int
-TAO_Active_Demux_ObjTable::bind (const CORBA::OctetSeq &key,
+TAO_Active_Demux_ObjTable::bind (const TAO_opaque &key,
CORBA::Object_ptr obj)
{
// The active demux strategy works on the assumption that the key is a
// stringified form of an index into the table
- ACE_CString objkey ((char *)key.buffer, key.length);
+ ACE_CString objkey ((char *)&key[0], key.length ());
CORBA::ULong i = ACE_OS::atoi (objkey.rep ());
if (i < this->tablesize_)
@@ -183,10 +186,10 @@ TAO_Active_Demux_ObjTable::bind (const CORBA::OctetSeq &key,
}
int
-TAO_Active_Demux_ObjTable::find (const CORBA::OctetSeq &key,
+TAO_Active_Demux_ObjTable::find (const TAO_opaque &key,
CORBA::Object_ptr& obj)
{
- ACE_CString objkey ((char *)key.buffer, key.length);
+ ACE_CString objkey ((char *)&key[0], key.length ());
CORBA::ULong i = ACE_OS::atoi (objkey.rep ());
ACE_ASSERT (i < this->tablesize_); // cannot be equal to
diff --git a/TAO/tao/objtable.h b/TAO/tao/objtable.h
index a67bf60816c..8917861f48a 100644
--- a/TAO/tao/objtable.h
+++ b/TAO/tao/objtable.h
@@ -22,13 +22,13 @@ class TAO_Object_Table
// to pointers to CORBA objects.
{
public:
- virtual int find (const CORBA::OctetSeq &key,
+ virtual int find (const TAO_opaque &key,
CORBA::Object_ptr &obj) = 0;
// Find object associated with <{key}>, setting <{obj}> to the
// pointer and returning a non-negative integer. If not found,
// <{obj}> is unchanged and the value <-1> is returned.
- virtual int bind (const CORBA::OctetSeq &key,
+ virtual int bind (const TAO_opaque &key,
CORBA::Object_ptr obj) = 0;
// Associated <{key}> with <{obj}>, returning 0 if object is
// registered successfully, 1 if it's already registered, and -1 if
@@ -54,13 +54,13 @@ public:
~TAO_Dynamic_Hash_ObjTable (void);
// destructor
- virtual int bind (const CORBA::OctetSeq &key,
+ virtual int bind (const TAO_opaque &key,
CORBA::Object_ptr obj);
// Registers a CORBA::Object into the object table and associates
// the key with it. Returns -1 on failure, 0 on success, 1 on
// duplicate.
- virtual int find (const CORBA::OctetSeq &key,
+ virtual int find (const TAO_opaque &key,
CORBA::Object_ptr &obj);
// Looks up an object in the object table using <{key}>. Returns
// non-negative integer on success, or -1 on failure.
@@ -98,13 +98,13 @@ public:
~TAO_Linear_ObjTable (void);
- virtual int bind (const CORBA::OctetSeq &key,
+ virtual int bind (const TAO_opaque &key,
CORBA::Object_ptr obj);
// Registers a CORBA::Object into the object table and associates the
// key with it. Returns -1 on failure, 0 on success, 1 on
// duplicate.
- virtual int find (const CORBA::OctetSeq &key,
+ virtual int find (const TAO_opaque &key,
CORBA::Object_ptr &obj);
// Looks up an object in the object table using <{key}>. Returns
// non-negative integer on success, or -1 on failure.
@@ -139,13 +139,13 @@ public:
~TAO_Active_Demux_ObjTable (void);
- virtual int bind (const CORBA::OctetSeq &key,
+ virtual int bind (const TAO_opaque &key,
CORBA::Object_ptr obj);
// Registers a CORBA::Object into the object table and associates
// the key with it. Returns -1 on failure, 0 on success, 1 on
// duplicate.
- virtual int find (const CORBA::OctetSeq &key,
+ virtual int find (const TAO_opaque &key,
CORBA::Object_ptr &obj);
// Looks up an object in the object table using <{key}>. Returns
// non-negative integer on success, or -1 on failure.
diff --git a/TAO/tao/poa.cpp b/TAO/tao/poa.cpp
index e73831c80bc..4e74e271f8f 100644
--- a/TAO/tao/poa.cpp
+++ b/TAO/tao/poa.cpp
@@ -66,7 +66,7 @@ CORBA_POA::~CORBA_POA (void)
// Create an objref
CORBA::Object_ptr
-CORBA_POA::create (CORBA::OctetSeq &key,
+CORBA_POA::create (TAO_opaque &key,
CORBA::String type_id,
CORBA::Environment &env)
{
@@ -82,7 +82,7 @@ CORBA_POA::create (CORBA::OctetSeq &key,
data = new IIOP_Object (id,
IIOP::Profile (TAO_ORB_Core_instance ()->orb_params ()->addr (),
- ACE_static_cast(TAO_opaque&,key)));
+ key));
if (data != 0)
env.clear ();
else
@@ -254,7 +254,7 @@ CORBA_POA::get_poa (CORBA::ORB_ptr orb,
return 0;
}
-void CORBA_POA::dispatch (CORBA::OctetSeq &key,
+void CORBA_POA::dispatch (TAO_opaque &key,
CORBA::ServerRequest &req,
void *context,
CORBA::Environment &env)
@@ -308,14 +308,14 @@ void CORBA_POA::dispatch (CORBA::OctetSeq &key,
}
int
-CORBA_POA::find (const CORBA::OctetSeq &key,
+CORBA_POA::find (const TAO_opaque &key,
CORBA::Object_ptr &obj)
{
return objtable_->find (key, obj);
}
int
-CORBA_POA::bind (const CORBA::OctetSeq &key,
+CORBA_POA::bind (const TAO_opaque &key,
CORBA::Object_ptr obj)
{
return objtable_->bind (key, obj);
diff --git a/TAO/tao/poa.h b/TAO/tao/poa.h
index 0bb0a7e8c27..e0aa20f9c2c 100644
--- a/TAO/tao/poa.h
+++ b/TAO/tao/poa.h
@@ -47,7 +47,7 @@ public:
// @@ Hum, does this still make sense now that it's in POA?
/* virtual */
- CORBA::Object_ptr create (CORBA::OctetSeq& obj_id,
+ CORBA::Object_ptr create (TAO_opaque& obj_id,
CORBA::String type_id,
CORBA::Environment& env);
// Create a reference to an object, using identifying information
@@ -159,26 +159,26 @@ public:
// are administered using system-specific mechanisms and policies.
CORBA::OctetSeq *get_key (CORBA::Object_ptr obj,
- CORBA::Environment &env);
+ CORBA::Environment &env);
// NON-STANDARD CALL. When dispatching a request to an object, you
// need to be able to get the object key you used to create the
// reference. It's the main way servers distinguish two object
// references from each other.
- void dispatch (CORBA::OctetSeq &key,
+ void dispatch (TAO_opaque &key,
CORBA::ServerRequest &req,
void *context,
CORBA::Environment &env);
// Find the object for the request and pass it up the chain. Errors
// are returned in <env>.
- virtual int bind (const CORBA::OctetSeq &key,
+ virtual int bind (const TAO_opaque &key,
CORBA::Object_ptr obj);
// Registers a CORBA::Object into the object table and associates the
// key with it. Returns -1 on failure, 0 on success, 1 on
// duplicate.
- virtual int find (const CORBA::OctetSeq &key,
+ virtual int find (const TAO_opaque &key,
CORBA::Object_ptr &obj);
// Looks up an object in the object table using <{key}>. Returns
// non-negative integer on success, or -1 on failure.
diff --git a/TAO/tao/sequence_T.cpp b/TAO/tao/sequence_T.cpp
index 369311a28c7..4f276dd7cf4 100644
--- a/TAO/tao/sequence_T.cpp
+++ b/TAO/tao/sequence_T.cpp
@@ -14,8 +14,8 @@
#endif /* __ACE_INLINE__ */
template <class T>
-TAO_Unbounded_Sequence<T>::TAO_Unbounded_Sequence
-(const TAO_Unbounded_Sequence<T> &rhs)
+TAO_Unbounded_Sequence<T>::
+TAO_Unbounded_Sequence (const TAO_Unbounded_Sequence<T> &rhs)
: TAO_Unbounded_Base_Sequence (rhs)
{
this->buffer_ = TAO_Unbounded_Sequence<T>::allocbuf (this->maximum_);
@@ -38,6 +38,8 @@ TAO_Unbounded_Sequence<T>::operator=
}
this->TAO_Base_Sequence::operator= (rhs);
+ this->buffer_ = TAO_Unbounded_Sequence<T>::allocbuf (this->maximum_);
+ this->release_ = 1;
T* tmp = ACE_reinterpret_cast(T*,this->buffer_);
for (CORBA::ULong i = 0; i < this->length_; ++i)
tmp[i] = rhs[i];
@@ -46,6 +48,16 @@ TAO_Unbounded_Sequence<T>::operator=
}
template<class T>
+TAO_Unbounded_Sequence<T>::~TAO_Unbounded_Sequence (void)
+{
+ if (this->buffer_ == 0 || this->release_ == 0)
+ return;
+ T* tmp = ACE_reinterpret_cast (T*,this->buffer_);
+ delete[] tmp;
+ this->buffer_ = 0;
+}
+
+template<class T>
void TAO_Unbounded_Sequence<T>::_allocate_buffer (CORBA::ULong length)
{
T* tmp;
@@ -63,8 +75,38 @@ void TAO_Unbounded_Sequence<T>::_allocate_buffer (CORBA::ULong length)
this->buffer_ = tmp;
}
-template<class T>
-TAO_Unbounded_Sequence<T>::~TAO_Unbounded_Sequence (void)
+// ****************************************************************
+// Bounded_Sequence
+// ****************************************************************
+
+template <class T, CORBA::ULong MAX>
+TAO_Bounded_Sequence<T,MAX>::
+TAO_Bounded_Sequence (const TAO_Bounded_Sequence<T,MAX> &rhs)
+ : TAO_Bounded_Base_Sequence (rhs)
+{
+ this->buffer_ = TAO_Bounded_Sequence<T,MAX>::allocbuf (MAX);
+ T* tmp = ACE_reinterpret_cast(T*,this->buffer_);
+ for (CORBA::ULong i = 0; i < this->length_; ++i)
+ tmp[i] = rhs[i];
+}
+
+template <class T, CORBA::ULong MAX> TAO_Bounded_Sequence<T,MAX> &
+TAO_Bounded_Sequence<T,MAX>::operator= (const TAO_Bounded_Sequence<T,MAX> &rhs)
+{
+ if (this != &rhs)
+ {
+ this->TAO_Base_Sequence::operator= (rhs);
+ this->buffer_ = TAO_Unbounded_Sequence<T>::allocbuf (this->maximum_);
+ this->release_ = 1;
+ T* tmp = ACE_reinterpret_cast(T*,this->buffer_);
+ for (CORBA::ULong i = 0; i < this->length_; ++i)
+ tmp[i] = seq[i];
+ }
+ return *this;
+}
+
+template<class T, CORBA::ULong MAX>
+TAO_Bounded_Sequence<T,MAX>::~TAO_Bounded_Sequence (void)
{
if (this->buffer_ == 0 || this->release_ == 0)
return;
@@ -82,16 +124,6 @@ void TAO_Bounded_Sequence<T,MAX>::_allocate_buffer (CORBA::ULong)
this->maximum_ = MAX;
}
-template<class T, CORBA::ULong MAX>
-TAO_Bounded_Sequence<T,MAX>::~TAO_Bounded_Sequence (void)
-{
- if (this->buffer_ == 0 || this->release_ == 0)
- return;
- T* tmp = ACE_reinterpret_cast (T*,this->buffer_);
- delete[] tmp;
- this->buffer_ = 0;
-}
-
// *************************************************************
// class TAO_Object_Manager
// *************************************************************
diff --git a/TAO/tao/sequence_T.i b/TAO/tao/sequence_T.i
index 6047ada87af..e2ae782032f 100644
--- a/TAO/tao/sequence_T.i
+++ b/TAO/tao/sequence_T.i
@@ -86,29 +86,6 @@ TAO_Bounded_Sequence<T,MAX>::TAO_Bounded_Sequence (CORBA::ULong length,
{
}
-template <class T, CORBA::ULong MAX> ACE_INLINE
-TAO_Bounded_Sequence<T,MAX>::TAO_Bounded_Sequence (const TAO_Bounded_Sequence<T,MAX> &rhs)
- : TAO_Bounded_Base_Sequence (rhs)
-{
- this->buffer_ = TAO_Bounded_Sequence<T,MAX>::allocbuf (MAX);
- T* tmp = ACE_reinterpret_cast(T*,this->buffer_);
- for (CORBA::ULong i = 0; i < this->length_; ++i)
- tmp[i] = rhs[i];
-}
-
-template <class T, CORBA::ULong MAX> ACE_INLINE TAO_Bounded_Sequence<T,MAX> &
-TAO_Bounded_Sequence<T,MAX>::operator= (const TAO_Bounded_Sequence<T,MAX> &rhs)
-{
- if (this != &rhs)
- {
- this->TAO_Base_Sequence::operator= (rhs);
- T* tmp = ACE_reinterpret_cast(T*,this->buffer_);
- for (CORBA::ULong i = 0; i < this->length_; ++i)
- tmp[i] = seq[i];
- }
- return *this;
-}
-
template <class T, CORBA::ULong MAX> ACE_INLINE T &
TAO_Bounded_Sequence<T,MAX>::operator[] (CORBA::ULong i)
{