Ejemplo n.º 1
0
void be_Type::GenerateStreamOps (be_ClientHeader& source)
{
   ostream & os = source.Stream ();
   be_Tab tab (source);

   // insertion

   os << tab << DLLMACRO << "inline void" << nl
   << "IOP::put(DDS::Codec::OutStream& os, const "
   << ScopedName() << "& v" << XBE_Ev::arg (XBE_ENV_ARGN) << ")" << nl;
   os << "{" << nl;
   tab.indent();
   os << tab << "DDS::Codec::Param putArg = ";
   os << "{ " << Scope(TypeCodeTypeName()) << ", ";
   os << "(" << TypeName() << "*)" << "&v, DDS::PARAM_IN ";
   os << "};" << nl;
   os << tab << "os.put (&putArg, 1" << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;
   tab.outdent();
   os << "}" << nl << nl;

   //
   // extraction
   //
   os << DLLMACRO << "inline void" << nl
   << "IOP::get(DDS::Codec::InStream& is, "
   << ScopedName() << "& v" << XBE_Ev::arg (XBE_ENV_ARGN) << ")" << nl;
   os << "{" << nl;
   tab.indent();
   os << tab << "DDS::Codec::Param getArg = ";
   os << "{ " << Scope(TypeCodeTypeName()) << ", ";
   os << "&v, DDS::PARAM_OUT };" << nl;
   os << tab << "is.get (&getArg, 1" << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;
   tab.outdent();
   os << "}" << nl << nl;
}
Ejemplo n.º 2
0
DDS::Boolean be_enum::make_put_param_for_stub
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & arg,
   VarType vt
) const
{
   DDS::Boolean ret = FALSE;

   if (vt == VT_InParam || vt == VT_InOutParam)
   {
      os << tab << "{ " << Scope(TypeCodeTypeName()) << ", ";

      switch (vt)
      {
         case VT_InParam:
         os << "(void*)&" << arg << ", DDS::PARAM_IN ";
         break;

         case VT_InOutParam:
         os << "&" << arg << ", DDS::PARAM_INOUT ";
         break;

         default: assert (0);
      }

      os << "}";
      ret = TRUE;
   }

   return ret;
}
Ejemplo n.º 3
0
ostream & be_enum::put_for_array
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & arg,
   const DDS_StdString & index,
   unsigned long uid
)
{
   // declare the put param

   os << tab << "DDS::Codec::Param put = ";

   // populate it

   os << "{ " << Scope(TypeCodeTypeName()) << ", ";
   os << "(void*)&" << arg << "[" << index << "], DDS::PARAM_IN ";
   os << "}";
   os << ";" << nl << nl;

   // call put

   os << tab << "os.put (&put, 1" << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;

   return os;
}
Ejemplo n.º 4
0
ostream & be_enum::get_for_array
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & arg,
   const DDS_StdString & index,
   unsigned long uid
)
{
   // declare the get param

   os << tab << "DDS::Codec::Param get  = ";

   // populate it

   os << "{ " << Scope(TypeCodeTypeName()) << ", ";
   os << "&" << arg << "[" << index << "], DDS::PARAM_OUT ";
   os << "}";
   os << ";" << nl << nl;

   // call get

   os << tab << "is.get (&get, 1" << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;

   return os;
}
Ejemplo n.º 5
0
DDS::Boolean be_structure::make_get_param_for_stub
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & arg,
   VarType vt
) const
{
   DDS::Boolean ret = FALSE;

   if (vt == VT_InOutParam || vt == VT_OutParam || vt == VT_Return)
   {
      os << tab << "{ " << Scope(TypeCodeTypeName()) << ", ";

      if (m_isFixedLength)
      {
         switch (vt)
         {
            case VT_Return:
            case VT_InOutParam:
            case VT_OutParam:
            os << "&" << arg << ", DDS::PARAM_OUT ";
            default:
            break;
         }
      }
      else
      {
         switch (vt)
         {
            case VT_InOutParam:
            os << "&" << arg << ", DDS::PARAM_OUT ";
            break;

            case VT_OutParam:
            os << arg << ".out(), DDS::PARAM_OUT ";
            break;

            case VT_Return:
            os << arg << ", DDS::PARAM_OUT ";
            break;
            
            default:
               break;
         }
      }

      os << "}";
      ret = TRUE;
   }

   return ret;
}
Ejemplo n.º 6
0
be_typedef::be_typedef (AST_Type *bt, UTL_ScopedName *n, const UTL_Pragmas &p)
:
   AST_Decl (AST_Decl::NT_typedef, n, p),
   AST_Typedef (bt, n, p),
   m_generateBase (FALSE),
   m_generated (FALSE),
   m_baseBeType (0)
{
   AST_Type* astType = base_type();
   be_array* ba;
   be_sequence* bs;

   localName = local_name()->get_string();
   enclosingScope = be_Type::EnclosingScopeString(this);
   m_baseBeType = get_base_be_type();

   //
   // make sure the base type has a name (if anonymous)
   //

   bs = (be_sequence*)astType->narrow((long) & be_sequence::type_id);
   if (bs)
   {
      m_generateBase = bs->SetName(enclosingScope, localName);
   }
   else if ((ba = (be_array*)astType->narrow((long) & be_array::type_id)))
   {
      m_generateBase = ba->SetName(enclosingScope, localName);
   }

   //
   // now initialize the base's type and typemap
   //
   m_baseBeType->Initialize();

   m_baseBeType->HasTypeDef (pbtrue);

   InitializeTypeMap (this);

   m_typecode = m_baseBeType->m_typecode;
   m_typecode->id = get_decl_pragmas().get_repositoryID()->get_string();
   m_typecode->name_of_type = localName;

   DDS_StdString scopedname = NoColons(enclosingScope + "_" + localName);

   TypeCodeTypeName(BE_Globals::TCPrefix + localName);

   MetaTypeTypeName(BE_Globals::MTPrefix + scopedname);

   TypeCodeRepName(BE_Globals::TCRepPrefix + scopedname);

   TypeCodeBaseName(BE_Globals::TCBasePrefix + scopedname);
}
Ejemplo n.º 7
0
ostream & be_string::get_for_array
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & arg,
   const DDS_StdString & index,
   unsigned long uid
)
{
   DDS_StdString garg = (DDS_StdString) "_getArg_";
   garg += uid;
  
   if (m_typecode->kind == DDS::tk_string)
   {
      /* 
         In Strings are shallow copied so disable String_mgr 
         from releasing string when PARAM_IN.
      */

      os << tab << arg << "[" << index  << "]"  << " = (char*) 0;" << nl;     

      os << tab << "DDS::Codec::Param " << garg
         << " = { " << Scope (TypeCodeTypeName ())
         << ", &" << arg << "[" << index  << "].m_ptr"
         << ", mode };" << nl;
      os << tab << "if (mode == DDS::PARAM_IN) "
         << arg << "[" << index  << "].m_rel = 0;" << nl;
   }
   else
   {
      os << tab << "DDS::Codec::Param " << garg << " = { " 
         << Scope (TypeCodeTypeName ())
         << ", &(" << arg << "[" << index << "].m_ptr), mode };" << nl;
   }
   os << tab << "is.get (&" << garg << ", 1"
      << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;
   
   return os; 
}
Ejemplo n.º 8
0
DDS::Boolean be_structure::make_get_param_for_union
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & sptr,
   const DDS_StdString & fld,
   unsigned long uid
)
{
   if (m_isFixedLength)
   {
      os << tab << "{ " << Scope(TypeCodeTypeName())
      << ", &" << sptr << "->" << fld << ", DDS::PARAM_OUT }";
   }
   else
   {
      os << tab << "{ " << Scope(TypeCodeTypeName())
      << ", " << sptr << "->" << fld << ", DDS::PARAM_OUT }";
   }

   return TRUE;
}
Ejemplo n.º 9
0
DDS::Boolean be_sequence::make_get_param_for_union
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & sptr,
   const DDS_StdString & fld,
   unsigned long uid
)
{
   os << tab << "{ " << Scope(TypeCodeTypeName())
   << ", " << sptr << "->" << fld << ", DDS::PARAM_OUT }";
   return TRUE;
}
Ejemplo n.º 10
0
DDS::Boolean
be_enum::make_put_param_for_union(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & sptr,
   const DDS_StdString & fld,
   unsigned long uid)
{
   os << tab << "{ " << Scope(TypeCodeTypeName()) << ", "
   << "(void*)&" << sptr << "->" << fld << ", DDS::PARAM_IN "
   << "}";

   return TRUE;
}
Ejemplo n.º 11
0
DDS::Boolean be_string::make_put_param_for_union
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & sptr,
   const DDS_StdString & fld,
   unsigned long uid
)
{
   os << tab << "{ " << TypeCodeTypeName () << ", ";
   os << "&" << sptr << "->" << fld << ", DDS::PARAM_IN }";

   return TRUE;
}
Ejemplo n.º 12
0
DDS::Boolean be_string::make_get_param_for_struct
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & sptr,
   const DDS_StdString & fld,
   unsigned long uid
)
{
   /* For structs attribute is implemented as a String_mgr */

   os << tab << "{ " << TypeCodeTypeName () << ", ";
   os << "&" << sptr << "->" << fld << ".m_ptr, DDS::PARAM_OUT }";

   return TRUE;
}
Ejemplo n.º 13
0
ostream & be_Type::put_for_sequence
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & arg,
   const DDS_StdString & index,
   unsigned long uid
)
{
   os << tab << "DDS::Codec::Param putArg" << uid << " = { " << Scope(TypeCodeTypeName())
      << ", &" << arg << "[" << index << "], DDS::PARAM_IN };" << nl << nl;
   os << tab << "os.put (&putArg" << uid << ", 1" 
      << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;

   return os;
}
Ejemplo n.º 14
0
ostream & be_Type::get_for_array
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & arg,
   const DDS_StdString & index,
   unsigned long uid
)
{
   os << tab << "DDS::Codec::Param getArg" << uid << " = { " << Scope(TypeCodeTypeName())
      << ", &" << arg << "[" << index << "], DDS::PARAM_OUT };" << nl << nl;
   os << tab << "is.get (&getArg" << uid << ", 1"
      << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;

   return os;
}
Ejemplo n.º 15
0
DDS::Boolean be_sequence::make_get_param_for_struct
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & sptr,
   const DDS_StdString & fld,
   unsigned long uid
)
{
   //
   // only called for primitive sequences
   //
   os << tab << "{ " << Scope (TypeCodeTypeName ())
      << ", &" << sptr << "->" << fld << ", DDS::PARAM_OUT " << "}";

   return TRUE;
}
Ejemplo n.º 16
0
ostream & be_sequence::get_for_sequence
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & data,
   const DDS_StdString & index,
   unsigned long uid
)
{
   DDS_StdString get_val = BE_Globals::ScopeOf(ScopedName()) + "::"
      + TypeCodeTypeName() + "->get_val";

   os << tab << get_val << "(is, (void*)&"
      << data << "[" << index << "], DDS::PARAM_OUT"
      << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;

   return os;
}
Ejemplo n.º 17
0
ostream & be_string::get_for_sequence
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & arg,
   const DDS_StdString & index,
   unsigned long uid
)
{
   DDS_StdString garg = (DDS_StdString)"_getArg_";
   garg += uid;

   os << tab << "DDS::Codec::Param " << garg << " = { " << Scope (TypeCodeTypeName ())
      << ", &" << arg << "[" << index << "], DDS::PARAM_OUT };" << nl;
   os << tab << "is.get (&" << garg << ", 1"
      << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;

   return os;
}
Ejemplo n.º 18
0
ostream & be_string::put_for_array
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & arg,
   const DDS_StdString & index,
   unsigned long uid
)
{
   DDS_StdString parg = (DDS_StdString) "_putArg_";
   parg += uid;
   
   os << tab << "DDS::Codec::Param " << parg << " = { " << Scope (TypeCodeTypeName())
      << ", &(" << arg << "[" << index << "].m_ptr), mode };" << nl;
   os << tab << "os.put (&" << parg << ", 1"
      << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl; 
   
   return os;
}
Ejemplo n.º 19
0
DDS::Boolean be_structure::make_get_param_for_struct
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & sptr,
   const DDS_StdString & fld,
   unsigned long uid
)
{
#if defined(OPTIMIZE)
   os << tab << m_tc_get_val << "(is, (void*&)__" << fld
   << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;
#else

   os << tab << "{ " << Scope(TypeCodeTypeName())
   << ", &" << sptr << "->" << fld << ", DDS::PARAM_OUT }";
#endif

   return TRUE;
}
Ejemplo n.º 20
0
DDS::Boolean be_string::make_get_param_for_stub
(
   ostream & os,
   be_Tab & tab,
   const DDS_StdString & argname,
   VarType vt
) const
{
   DDS::Boolean ret = FALSE;

   if (vt == VT_InOutParam || vt == VT_OutParam || vt == VT_Return)
   {
      os << tab << "{ " << TypeCodeTypeName () << ", ";

      switch (vt)
      {
         case VT_Return:
         os << "&" << argname << ", DDS::PARAM_OUT ";
         break;

         case VT_InOutParam:
         os << "&" << argname << ", DDS::PARAM_INOUT ";
         break;

         case VT_OutParam:
         os << "&" << argname << ".m_ptr, DDS::PARAM_OUT ";
         break;

         default:
         assert (0);
      }

      os << "}";
      ret = TRUE;
   }

   return ret;
}