Ejemplo n.º 1
0
void be_structure::generate_tc_get_val (be_Source & source)
{
   ostream & os = source.Stream ();
   be_Tab tab (source);
   unsigned long uid = 0;

   // declare reader body

   os << "void " << m_tc_get_val << nl;
   os << "(" << nl;
   tab.indent ();
   os << tab << "DDS::Codec::InStream & is," << nl;
   os << tab << "void * arg," << nl;
   os << tab << "DDS::ParameterMode mode" << nl;
   if (XBE_Ev::generate ())
   {
      os << tab << XBE_Ev::arg (XBE_ENV_ARGN, false) << nl;
   }
   tab.outdent ();
   os << ")" << nl;
   os << "{" << nl;
   tab.indent ();

   // first, cast that pesky void *

   os << tab << ScopedName () << " * p = (" << ScopedName () << "*) arg;" << nl;

   // now, let's get our fields

   getter (os, tab, "p", uid);

   tab.outdent ();
   os << tab << "}" << nl << nl;
}
Ejemplo n.º 2
0
void
be_attribute::GenerateVirtual
(
   be_Source& source,
   const DDS_StdString& className
)
{
   ostream & os = source.Stream();
   be_Tab tab(source);
   DDS_StdString responsibility = NameToString(name());

   if (fieldType)
   {
      // PURE VIRTUAL GET ATTRIBUTE
      os << tab << "virtual " << GetSignature(AT_Declaration, className);
      os << " = 0;" << nl;

      // PURE VIRTUAL SET ATTRIBUTE
      if (!readonly())
      {
         os << tab << "virtual " << SetSignature(AT_Declaration, className, pbtrue);
         os << " = 0;" << nl;
      }
   }
}
Ejemplo n.º 3
0
void be_Type::generate_tc_ctor_val (be_Source & source)
{
   ostream & os = source.Stream ();

   // declare ctor body
   os << "static void * " << m_tc_ctor_val << " ()" << nl;
   os << "{" << nl;
   os << "   return new " << ScopedName () << ";" << nl;
   os << "}" << nl << nl;
}
Ejemplo n.º 4
0
void be_Type::generate_tc_assign_val (be_Source & source)
{
   ostream & os = source.Stream ();

   // declare assign body

   os << "static void " << m_tc_assign_val << " (void * dest, void * src)" << nl;
   os << "{" << nl;

   // just cast and assign

   os << "   *(" << ScopedName () << "*) dest = *(" << ScopedName () << "*) src;" << nl;
   os << "}" << nl << nl;
}
Ejemplo n.º 5
0
void
be_operation::GenerateVirtual
(
   be_Source & source, 
   const DDS_StdString & implclassname
)
{
   ostream & os = source.Stream ();
   be_Tab tab (source);
   be_Type *rettype =
      (be_Type *) return_type ()->narrow ((long) &be_Type::type_id);

   (void) rettype;
   assert (rettype);

   os << tab << "virtual " << BaseSignature (implclassname);
   os << " = 0;" << nl;
}
Ejemplo n.º 6
0
void be_Type::generate_tc_dtor_val (be_Source & source, pbbool isCounted)
{
   ostream & os = source.Stream ();

   // declare dtor body
   os << "static void " << m_tc_dtor_val << " (void * arg)" << nl;
   os << "{" << nl;

   // Cast and delete as appropriate

   if (isCounted)
   {
      os << "   DDS::release";
   }
   else
   {
      os << "   delete"; 
   }
   os << " ((" << ScopedName() << "*) arg);" << nl;
   os << "}" << nl << nl;
}
Ejemplo n.º 7
0
void be_sequence::generate_tc_get_val (be_Source & source)
{
   be_predefined_type * prtype = be_predefined_type::_narrow (base_type ());
   ostream & os = source.Stream ();
   be_Tab tab (source);

   // declare reader body

   os << tab << "void " << m_tc_get_val << nl;
   os << tab << "(" << nl;
   tab.indent ();
   os << tab << "DDS::Codec::InStream & is," << nl;
   os << tab << "void * arg," << nl;
   os << tab << "DDS::ParameterMode mode" << nl;
   if (XBE_Ev::generate ())
   {
      os << tab << XBE_Ev::arg (XBE_ENV_ARGN, false) << nl;
   }
   tab.outdent ();
   os << tab << ")" << nl;
   os << tab << "{" << nl;
   tab.indent ();

   /* Sequences of 1/2/4 byte types handled as special cases */

   if
   (
      prtype &&
      ! IsBounded () &&
      (
         (prtype->pt () == AST_PredefinedType::PT_octet) ||
         (prtype->pt () == AST_PredefinedType::PT_char) ||
         (prtype->pt () == AST_PredefinedType::PT_long) ||
         (prtype->pt () == AST_PredefinedType::PT_ulong) ||
         (prtype->pt () == AST_PredefinedType::PT_float) ||
         (prtype->pt () == AST_PredefinedType::PT_short) ||
         (prtype->pt () == AST_PredefinedType::PT_ushort)
      )
   )
   {
      os << tab << "DDS::Codec::Param p = {";

      if
      (
         (prtype->pt () == AST_PredefinedType::PT_octet) ||
         (prtype->pt () == AST_PredefinedType::PT_char)
      )
      {
         os << "DDS::_tc_sequence";
      }
      else if
      (
         (prtype->pt () == AST_PredefinedType::PT_short) ||
         (prtype->pt () == AST_PredefinedType::PT_ushort)
      )
      {
         os << "DDS::_tc_sequence2";
      }
      else
      {
         os << "DDS::_tc_sequence4";
      }

      os << ", arg, mode };" << nl
         << tab << "is.get (&p, 1"
         << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;
   }
   else
   {
      os << tab << ScopedName () << " * p = (" 
         << ScopedName () << "*) arg;" << nl;

      getter (os, tab, "p", 0);
   }
   tab.outdent ();
   os << tab << "}" << nl << nl;
}
Ejemplo n.º 8
0
void be_sequence::generate_tc_put_val (be_Source & source)
{
   be_predefined_type * prtype = be_predefined_type::_narrow (base_type ());
   ostream & os = source.Stream ();
   be_Tab tab (source);

   // declare writer body

   os << tab << "void " << m_tc_put_val << nl;
   os << tab << "(" << nl;
   tab.indent ();
   os << tab << "DDS::Codec::OutStream & os," << nl;
   os << tab << "const void * arg," << nl;
   os << tab << "DDS::ParameterMode mode" << nl;
   if (XBE_Ev::generate ())
   {
      os << tab << XBE_Ev::arg (XBE_ENV_ARGN, false) << nl;
   }
   tab.outdent ();
   os << tab << ")" << nl;
   os << tab << "{" << nl;
   tab.indent ();

   /* Sequences of 1/2/4 byte types handled as special cases */

   if 
   (
      prtype &&
      ! IsBounded () &&
      (
         (prtype->pt () == AST_PredefinedType::PT_octet) ||
         (prtype->pt () == AST_PredefinedType::PT_char) ||
         (prtype->pt () == AST_PredefinedType::PT_long) ||
         (prtype->pt () == AST_PredefinedType::PT_ulong) ||
         (prtype->pt () == AST_PredefinedType::PT_float) ||
         (prtype->pt () == AST_PredefinedType::PT_short) ||
         (prtype->pt () == AST_PredefinedType::PT_ushort)
      )
   )
   {
      os << tab << "DDS::Codec::Param p = { ";

      if
      (
         (prtype->pt () == AST_PredefinedType::PT_octet) ||
         (prtype->pt () == AST_PredefinedType::PT_char)
      )
      {
         os << "DDS::_tc_sequence";
      }
      else if
      (
         (prtype->pt () == AST_PredefinedType::PT_short) ||
         (prtype->pt () == AST_PredefinedType::PT_ushort)
      )
      {
         os << "DDS::_tc_sequence2";
      }
      else
      {
         os << "DDS::_tc_sequence4";
      }

      os << ", (void*) arg, mode };" << nl
         << tab << "os.put (&p, 1"
         << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl;
   }
   else
   {
      // since the put param must be a sequence pointer pointer,
      // that's what the writer takes.  The putter, however,

      os << tab << ScopedName () << " * p = (" 
         << ScopedName () << "*) arg;" << nl;

      // now put the data

      putter (os, tab, "p", 0);
   }

   tab.outdent ();
   os << tab << "}" << nl << nl;
}