summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_decl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL/be/be_decl.cpp')
-rw-r--r--TAO/TAO_IDL/be/be_decl.cpp71
1 files changed, 69 insertions, 2 deletions
diff --git a/TAO/TAO_IDL/be/be_decl.cpp b/TAO/TAO_IDL/be/be_decl.cpp
index cf488f0f387..b11ee3133ff 100644
--- a/TAO/TAO_IDL/be/be_decl.cpp
+++ b/TAO/TAO_IDL/be/be_decl.cpp
@@ -44,7 +44,8 @@ be_decl::be_decl (void)
flatname_ (0),
repoID_ (0),
prefix_ (0),
- size_type_ (be_decl::SIZE_UNKNOWN)
+ size_type_ (be_decl::SIZE_UNKNOWN),
+ encap_len_ (-1)
{
}
@@ -69,7 +70,8 @@ be_decl::be_decl (AST_Decl::NodeType type,
flatname_ (0),
repoID_ (0),
prefix_ (0),
- size_type_ (be_decl::SIZE_UNKNOWN)
+ size_type_ (be_decl::SIZE_UNKNOWN),
+ encap_len_ (-1)
{
}
@@ -78,6 +80,19 @@ be_decl::~be_decl (void)
{
}
+int
+be_decl::gen_encapsulation (void)
+{
+ // do nothing
+ return 0;
+}
+
+long
+be_decl::tc_encap_len (void)
+{
+ return -1;
+}
+
// return our size type
be_decl::SIZE_TYPE
be_decl::size_type (void)
@@ -402,6 +417,29 @@ be_decl::prefix (void)
return this->prefix_;
}
+// converts a string name into an array of 4 byte longs
+int
+be_decl::tc_name2long (const char *name, ACE_UINT32 *&larr, long &arrlen)
+{
+ const int bytes_per_word = sizeof(ACE_UINT32);
+ static ACE_UINT32 buf [NAMEBUFSIZE];
+ long slen;
+ long i;
+
+ slen = ACE_OS::strlen (name) + 1; // 1 for NULL terminating
+
+ // compute the number of bytes necessary to hold the name rounded to
+ // the next multiple of 4 (i.e., size of long)
+ arrlen = slen / bytes_per_word + (slen % bytes_per_word ? 1:0);
+
+ ACE_OS::memset (buf, 0, sizeof(buf));
+ larr = buf;
+ ACE_OS::memcpy (buf, name, slen);
+ for (i = 0; i < arrlen; i++)
+ larr [i] = ACE_HTONL (larr [i]);
+ return 0;
+}
+
idl_bool
be_decl::is_nested (void)
{
@@ -416,6 +454,35 @@ be_decl::is_nested (void)
return I_FALSE;
}
+// return the length in bytes to hold the repoID inside a typecode. This
+// comprises 4 bytes indicating the length of the string followed by the actual
+// string represented as longs.
+long
+be_decl::repoID_encap_len (void)
+{
+ long slen;
+
+ slen = ACE_OS::strlen (this->repoID ()) + 1; // + 1 for NULL terminating char
+ // the number of bytes to hold the string must be a multiple of 4 since this
+ // will be represented as an array of longs
+ return 4 + 4 * (slen/4 + (slen%4 ? 1:0));
+}
+
+// return the length in bytes to hold the name inside a typecode. This
+// comprises 4 bytes indicating the length of the string followed by the actual
+// string represented as longs.
+long
+be_decl::name_encap_len (void)
+{
+ long slen;
+
+ slen = ACE_OS::strlen (this->local_name ()->get_string ()) + 1;
+
+ // the number of bytes to hold the string must be a multiple of 4 since this
+ // will be represented as an array of longs
+ return 4 + 4 * (slen/4 + (slen%4 ? 1:0));
+}
+
// compute the size type of the node in question
int
be_decl::compute_size_type (void)