📄 psdl_type_dcl_visitor.cpp
字号:
*ps_sh << "#if !defined (_" << name_space.c_str () << "_" << identifier.c_str () << "___VAR_CH_)"; ps_sh->nl ();
*ps_sh << "#define _" << name_space.c_str () << "_" << identifier.c_str () << "___VAR_CH_"; ps_sh->nl ();
ps_sh->nl ();
*ps_sh << "// *************************************************************"; ps_sh->nl ();
*ps_sh << "// class " << name_space.c_str () << "::" << identifier.c_str () << "_var"; ps_sh->nl ();
*ps_sh << "// *************************************************************"; ps_sh->nl ();
ps_sh->nl ();
*ps_sh << "class " << identifier.c_str () << "_var"; ps_sh->nl ();
*ps_sh << "{"; ps_sh->nl ();
ps_sh->incr_indent ();
*ps_sh << "public:"; ps_sh->nl ();
*ps_sh << identifier.c_str () << "_var (void);"; ps_sh->nl ();
*ps_sh << identifier.c_str () << "_var (" << identifier.c_str () << " *);"; ps_sh->nl ();
*ps_sh << identifier.c_str () << "_var (const " << identifier.c_str () << "_var &);"; ps_sh->nl ();
*ps_sh << "~" << identifier.c_str () << "_var (void);"; ps_sh->nl ();
ps_sh->nl ();
*ps_sh << identifier.c_str () << "_var &operator= (" << identifier.c_str () << " *);"; ps_sh->nl ();
*ps_sh << identifier.c_str () << "_var &operator= (const " << identifier.c_str () << "_var &);"; ps_sh->nl ();
*ps_sh << identifier.c_str () << " *operator-> (void);"; ps_sh->nl ();
*ps_sh << "const " << identifier.c_str () << " *operator-> (void) const;"; ps_sh->nl ();
ps_sh->nl ();
*ps_sh << "operator const " << identifier.c_str () << " &() const;"; ps_sh->nl ();
*ps_sh << "operator " << identifier.c_str () << " &();"; ps_sh->nl ();
*ps_sh << "operator " << identifier.c_str () << " &() const;"; ps_sh->nl ();
*ps_sh << "operator " << identifier.c_str () << " *&(); // variable-size base types only"; ps_sh->nl ();
ps_sh->nl ();
*ps_sh << identifier.c_str () << "Component & operator[] (CORBA::ULong index);"; ps_sh->nl ();
*ps_sh << "const " << identifier.c_str () << "Component & operator[] (CORBA::ULong index) const;";
ps_sh->nl ();
ps_sh->nl ();
*ps_sh << "// in, inout, out, _retn "; ps_sh->nl ();
*ps_sh << "const " << identifier.c_str () << " &in (void) const;"; ps_sh->nl ();
*ps_sh << identifier.c_str () << " &inout (void);"; ps_sh->nl ();
*ps_sh << identifier.c_str () << " *&out (void);"; ps_sh->nl ();
*ps_sh << identifier.c_str () << " *_retn (void);"; ps_sh->nl ();
*ps_sh << identifier.c_str () << " *ptr (void) const;";
ps_sh->decr_indent (0);
ps_sh->nl ();
ps_sh->nl ();
*ps_sh << "private:";
ps_sh->incr_indent (0);
ps_sh->nl ();
*ps_sh << identifier.c_str () << " *ptr_;"; ps_sh->nl ();
*ps_sh << "};";
ps_sh->nl ();
ps_sh->nl ();
ps_sh->nl ();
*ps_sh << "#endif /* end #if !defined */"; ps_sh->nl ();
ps_sh->nl ();
ps_sh->nl ();
*ps_sh << "#if !defined (_" << name_space.c_str () << "_" << identifier.c_str () << "___OUT_CH_)"; ps_sh->nl ();
*ps_sh << "#define _" << name_space.c_str () << "_" << identifier.c_str () << "___OUT_CH_"; ps_sh->nl ();
ps_sh->nl ();
*ps_sh << "class " << identifier.c_str () << "_out"; ps_sh->nl ();
*ps_sh << "{"; ps_sh->nl ();
ps_sh->incr_indent ();
*ps_sh << "public:"; ps_sh->nl ();
*ps_sh << identifier.c_str () << "_out (" << identifier.c_str () << " *&);"; ps_sh->nl ();
*ps_sh << identifier.c_str () << "_out (" << identifier.c_str () << "_var &);"; ps_sh->nl ();
*ps_sh << identifier.c_str () << "_out (const " << identifier.c_str () << "_out &);"; ps_sh->nl ();
*ps_sh << identifier.c_str () << "_out &operator= (const " << identifier.c_str () << "_out &);"; ps_sh->nl ();
*ps_sh << identifier.c_str () << "_out &operator= (" << identifier.c_str () << " *);"; ps_sh->nl ();
*ps_sh << "operator " << identifier.c_str () << " *&();"; ps_sh->nl ();
*ps_sh << identifier.c_str () << " *&ptr (void);"; ps_sh->nl ();
*ps_sh << identifier.c_str () << " *operator-> (void);"; ps_sh->nl ();
*ps_sh << identifier.c_str () << "Component & operator[] (CORBA::ULong index);"; ps_sh->nl ();
ps_sh->nl ();
*ps_sh << "private:"; ps_sh->nl ();
*ps_sh << identifier.c_str () << " *&ptr_;"; ps_sh->nl ();
*ps_sh << "// Assignment from T_var not allowed."; ps_sh->nl ();
*ps_sh << "void operator= (const " << identifier.c_str () << "_var &);"; ps_sh->nl ();
*ps_sh << "};"; ps_sh->nl ();
ps_sh->decr_indent ();
ps_sh->nl ();
ps_sh->nl ();
*ps_sh << "#endif /* end #if !defined */"; ps_sh->nl ();
*ps_sh << "TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr "
<< "_tc_" << identifier.c_str () << ";"; ps_sh->nl ();
}
void
TAO_PSDL_Type_Dcl_Visitor::print_for_simple_typedefs (void)
{
ACE_CString type;
// Get the base type of the identifier name
this->base_type (this->identifiers_ [0], type);
// Get a pointer to PSDL_Stream of the stub header.
TAO_PSDL_Stream *ps_sh = TAO_PSDL_Scope::instance ()->get_sh ();
if (ACE_OS::strcmp (type.c_str (), "char *") == 0)
{
ps_sh->reset ();
ps_sh->nl ();
*ps_sh << "typedef " << type.c_str () << " "
<< this->identifiers_ [1].c_str () << ";";
}
ps_sh->nl ();
*ps_sh << "typedef " << this->version_for_stub (type).c_str () << " "
<< this->identifiers_[1].c_str ();
if (ACE_OS::strcmp (type.c_str (), "char *") == 0)
*ps_sh << "_var;";
else
*ps_sh << ";";
ps_sh->nl ();
*ps_sh << "typedef " << this->version_for_stub (type).c_str () << "_out"
<< " " << this->identifiers_[1].c_str () << "_out;"; ps_sh->nl ();
*ps_sh << "TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr"
<< " _tc_" << this->identifiers_[1].c_str () << ";"; ps_sh->nl ();
ps_sh->nl ();
// Generates code for the stub implementation files.
this->gen_code_for_si ();
}
void
TAO_PSDL_Type_Dcl_Visitor::gen_code_for_si (void)
{
TAO_PSDL_Stream *ps_si = TAO_PSDL_Scope::instance ()->get_si ();
ps_si->reset ();
ps_si->indent (); // start from current indentation level
// Generate the typecode information here
*ps_si << "static const CORBA::Long _oc_";
// Flat name generation.
*ps_si << this->identifiers_[1];
*ps_si << "[] =";
ps_si->nl ();
*ps_si << "{";
ps_si->nl ();
// Some invocation call to put in the stuff that goes between
// braces.
*ps_si << "// Typecode related information should go in here";
ps_si->nl ();
*ps_si << "};";
ps_si->nl ();
ps_si->nl ();
*ps_si << "static CORBA::TypeCode _tc_TAO_tc_";
*ps_si << this->identifiers_[1];
*ps_si << " (";
ps_si->nl ();
ps_si->incr_indent ();
*ps_si << "CORBA::tk_alias,";
ps_si->nl ();
*ps_si << "sizeof (_oc_" << this->identifiers_[1] << "),";
ps_si->nl ();
*ps_si << "(char *) &_oc_";
*ps_si << this->identifiers_[1] << ",";
ps_si->nl ();
*ps_si << "0,";
ps_si->nl ();
*ps_si << "sizeof (" << this->identifiers_[1] << ")";
ps_si->nl ();
*ps_si << ");";
ps_si->decr_indent ();
ps_si->nl ();
ps_si->nl ();
*ps_si << "::CORBA::TypeCode_ptr _tc_" << this->identifiers_[1] << " =";
ps_si->nl ();
ps_si->incr_indent ();
*ps_si << "&_tc_TAO_tc_" << this->identifiers_[1] << ";";
ps_si->decr_indent ();
ps_si->nl ();
ps_si->nl ();
return;
}
int
TAO_PSDL_Type_Dcl_Visitor::visit_predefined_type (TAO_PSDL_Predefined_Type *predefined_type)
{
if (predefined_type->type_one () != 0)
{
this->identifiers_ [this->count_] =
TAO_PSDL_Scope::instance ()->convert_str (predefined_type->type_one ());
if (this->count_ == 0)
{
// @@ implies this is the type.
this->predefined_type_ [this->count_] = 1;
}
++this->count_;
}
if (predefined_type->type_two () != 0)
{}
if (predefined_type->type_three () != 0)
{}
if (predefined_type->type_of_variable_one () != 0)
{
if (predefined_type->type_of_variable_one ()->accept (this) == -1)
return -1;
}
if (predefined_type->type_of_variable_two () != 0)
{}
if (predefined_type->type_of_variable_three () != 0)
{}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -