diff options
Diffstat (limited to 'TAO/TAO_IDL/be/be_interface.cpp')
-rw-r--r-- | TAO/TAO_IDL/be/be_interface.cpp | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/TAO/TAO_IDL/be/be_interface.cpp b/TAO/TAO_IDL/be/be_interface.cpp index b926dfc27d4..35a1dd9211a 100644 --- a/TAO/TAO_IDL/be/be_interface.cpp +++ b/TAO/TAO_IDL/be/be_interface.cpp @@ -804,6 +804,95 @@ be_interface::gen_out_impl (void) return 0; } +// generate typecode. +// Typecode for interface comprises the enumerated value followed by the +// encapsulation of the parameters + +int +be_interface::gen_typecode (void) +{ + TAO_OutStream *cs; // output stream + TAO_NL nl; // end line + TAO_CodeGen *cg = TAO_CODEGEN::instance (); + + cs = cg->client_stubs (); + cs->indent (); // start from whatever indentation level we were at + + *cs << "CORBA::tk_objref, // typecode kind" << nl; + *cs << this->tc_encap_len () << ", // encapsulation length\n"; + // now emit the encapsulation + return this->gen_encapsulation (); +} + +// generate encapsulation +// An encapsulation for ourselves will be necessary when we are part of some +// other IDL type and a typecode for that other type is being generated. This +// will comprise our typecode kind. IDL types with parameters will additionally +// have the encapsulation length and the entire typecode description +int +be_interface::gen_encapsulation (void) +{ + TAO_OutStream *cs; // output stream + TAO_NL nl; // end line + TAO_CodeGen *cg = TAO_CODEGEN::instance (); + long i, arrlen; + ACE_UINT32 *arr; + + cs = cg->client_stubs (); + cs->indent (); // start from whatever indentation level we were at + + // XXXASG - byte order must be based on what m/c we are generating code - + // TODO + *cs << "TAO_ENCAP_BYTE_ORDER, // byte order" << nl; + // generate repoID + *cs << (ACE_OS::strlen (this->repoID ())+1) << ", "; + (void)this->tc_name2long (this->repoID (), arr, arrlen); + for (i=0; i < arrlen; i++) + { + cs->print ("ACE_NTOHL (0x%x), ", arr[i]); + } + *cs << " // repository ID = " << this->repoID () << nl; + // generate name + *cs << (ACE_OS::strlen (this->local_name ()->get_string ())+1) << ", "; + (void)this->tc_name2long(this->local_name ()->get_string (), arr, arrlen); + for (i=0; i < arrlen; i++) + { + cs->print ("ACE_NTOHL (0x%x), ", arr[i]); + } + *cs << " // name = " << this->local_name () << ",\n"; + + return 0; +} + +// compute size of typecode +long +be_interface::tc_size (void) +{ + return 4 + 4 + this->tc_encap_len (); +} + +// compute the encapsulation length +long +be_interface::tc_encap_len (void) +{ + if (this->encap_len_ == -1) // not computed yet + { + long slen; + + // Macro to avoid "warning: unused parameter" type warning. + ACE_UNUSED_ARG (slen); + + this->encap_len_ = 4; // holds the byte order flag + + this->encap_len_ += this->repoID_encap_len (); // for repoID + + // do the same thing for the local name + this->encap_len_ += this->name_encap_len (); + + } + return this->encap_len_; +} + // helper. int be_interface::gen_operation_table (void) |