//
// name
//
char * DataAcquisitionController_i::name (void)
{
  CORBA::String_var str =
    CORBA::string_dup (DAC::EXECUTION_CONTEXT::instance ()->name ().c_str ());

  return str._retn ();
}
Example #2
0
void
StringOutTest (CORBA::String_out so)
{
  CORBA::String_var sv;
  sv = "StringOutTest";
  so = sv._retn ();
}
void
TAO::SL3::CredentialsCurator:: register_acquirer_factory (
  const char * acquisition_method,
  TAO::SL3::CredentialsAcquirerFactory * factory)
{
  if (acquisition_method == 0 || factory == 0)
    throw CORBA::BAD_PARAM ();

  CORBA::String_var method = CORBA::string_dup (acquisition_method);

  ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->lock_);

  const int result =
    this->acquirer_factories_.bind (method.in (), factory);

  if (result == 1)  // Entry already exists in table.
    throw CORBA::BAD_INV_ORDER ();
  else if (result == -1)  // Failure.
    throw CORBA::INTERNAL ();


  // CredentialsCurator now owns the acquisition method id.
  (void) method._retn ();

  // Otherwise success!
}
Example #4
0
char *
A_i::method_s (::Test::A::FailOn where,
               const char *,
               ::CORBA::String_out arg2,
               char *&arg3)
{
  CORBA::String_var res;
  switch (where)
    {
    case ::Test::A::ARG1:
      // must be never reached.
      break;
    case ::Test::A::ARG2:
      arg2 = CORBA::string_dup (::Test::FailStr);
      break;
    case ::Test::A::ARG3:
      CORBA::string_free (arg3);
      arg3 = CORBA::string_dup (::Test::FailStr);
      break;
    case ::Test::A::RETN:
      res = CORBA::string_dup (::Test::FailStr);
      break;
    }
  return res._retn ();
}
Example #5
0
char *
Delegated_Bottom_Impl::bottom_quote (void)
{
  ACE_DEBUG ((LM_DEBUG,
              ACE_TEXT ("Delegating the call: <bottom_quote>\n")));

  CORBA::String_var msg =
    this->delegate_->bottom_quote ();
  return msg._retn ();
}
Example #6
0
char *
Task::locate (const char *)
{
  CORBA::Object_var fwdObj = orb_->string_to_object(anotherIOR);
  CORBA::String_var fwdString = orb_->object_to_string(fwdObj.in ());

  ACE_DEBUG ((LM_DEBUG,
              "IN LOCATOR!  Forwarding client to: %C\n",
              fwdString.in ()));

  return fwdString._retn();
}
Example #7
0
char *
Inner_i::answer (const char * question)
{
  ACE_UNUSED_ARG (question); // doesn't matter

  CORBA::String_var answer =
    CORBA::string_dup ("I didn't know dogs could talk!");

  int delay = 5/this->divisor_; // throw exception if divisor = 0

  ACE_OS::sleep(delay); // make the caller wait a bit
  return answer._retn();
}
//
// get_schema
//
char * DataAcquisitionController_i::get_schema (const char * name, const char * einode)
{
  using DAC::EXECUTION_CONTEXT;
  DAC::Database & db = EXECUTION_CONTEXT::instance ()->get_database ();

  // Init and query probe instances
  ACE_CString schema;
  db.schema (name, einode, schema);

  // Init CORBA datatype
  CORBA::String_var str =
    CORBA::string_dup (schema.c_str ());

  return str._retn ();
}
Example #9
0
char *
foo_i::foo_op (const char * inarg)
{
  CORBA::String_var retval = CORBA::string_dup ("bad");

  if (ACE_OS::strcmp (inarg, "foo_op") == 0)
    {
      retval = CORBA::string_dup ("good");
    }
  else
    {
      throw BadInput ("expected \"foo_op\"\n");
    }

  return retval._retn ();
}
Example #10
0
char *
INS_Locator::locate (const char* object_key)
{
  ACE_ASSERT (object_key != 0);
  try
    {
      CORBA::String_var located =
        this->imr_locator_.activate_server_by_object (object_key);
      return located._retn();
    }
  catch (CORBA::Exception &)
    {
      throw CORBA::TRANSIENT (CORBA::SystemException::_tao_minor_code
                              (TAO_IMPLREPO_MINOR_CODE, 0),
                              CORBA::COMPLETED_NO);
    }
}
Example #11
0
File: Echo_i.cpp Project: CCJY/ATCD
char *
Echo_i::echo_string (const char *mesg)
{
  // The pointer mesg was NULL, return.
  if (mesg == 0)
    return 0;

  CORBA::String_var str = CORBA::string_dup (mesg);

  // if <CORBA::string_dup> returns a 0 pointer, an exception is
  // raised.

  if (str.in () == 0)
    throw CORBA::NO_MEMORY ();

  // Got thru! now, make a deep copy of the mesg string and send it
  // back to the client.

  return str._retn ();
  // The _retn is used as it allows the conversion of
  // CORBA::String_var to char* without causing any compiler errors.
}
Example #12
0
 //
 // result_file
 //
 char * PingComponent::result_file (void)
 {
   CORBA::String_var str = CORBA::string_dup (this->result_file_.c_str ());
   return str._retn ();
 }
void
TAO::PG_Object_Group_Storable::read (TAO::Storable_Base & stream)
{
  stream.rewind ();

  ACE_CString group_name;
  stream >> group_name;

  PG_Object_Group::set_name(group_name.c_str());

  stream >> this->distribute_;

  stream >> this->role_;

  ///// primary_location_ /////
  read_cdr (stream, this->primary_location_);

  ///// reference_ /////
  ACE_CString reference_ior;
  stream >> reference_ior;
  this->reference_ = this->orb_->string_to_object (reference_ior.c_str ());

  ///// tagged_component_ /////
  read_cdr (stream, this->tagged_component_);

  ///// type_id_ /////
  // special note: A memory leak appears when the type_id_ is read into directly.
  // reading into a temporary string and handing that to the type_id_ does not leak.
  CORBA::String_var tmp;
  read_cdr(stream, tmp);
  this->type_id_ = tmp._retn();

  ///// properties_ /////
  PortableGroup::Criteria properties;
  read_cdr (stream, properties);
  PG_Object_Group::set_properties_dynamically (properties);

  ///// members_ /////
  int num_members;
  stream >> num_members;

  if (num_members == 0)
    this->empty_ = 1;
  else
    this->empty_ = 0;

  this->clear_members_map ();

  for (int i = 0; i < num_members; ++i)
    {
      ///// location used as members_ key /////
      PortableGroup::Location the_location;
      read_cdr (stream, the_location);

      ///// member /////
      ACE_CString member_ior;
      stream >> member_ior;
      CORBA::Object_var member =
        this->orb_->string_to_object (member_ior.c_str ());
      if (CORBA::is_nil (member.in ()))
        {
          if (TAO_debug_level > 0)
            {
              ORBSVCS_DEBUG ((LM_DEBUG,
                              ACE_TEXT ("(%P|%t) PG_Object_Group_Storable::")
                              ACE_TEXT ("string_to_object failed\n")));
            }
          throw CORBA::INV_OBJREF ();
        }

      ///// location /////
      PortableGroup::Location location;
      read_cdr (stream, location);

      ///// factory /////
      ACE_CString factory_ior;
      stream >> factory_ior;
      CORBA::Object_var obj =
        this->orb_->string_to_object (factory_ior.c_str ());
      PortableGroup::GenericFactory_var factory =
        PortableGroup::GenericFactory::_narrow (obj.in());

      ///// factory_id (typedef of CORBA::Any) /////
      PortableGroup::GenericFactory::FactoryCreationId factory_id;
      read_cdr (stream, factory_id);

      ///// is_primary /////
      int is_primary;
      stream >> is_primary;

      MemberInfo * info = 0;
      ACE_NEW_THROW_EX (info, MemberInfo(member.in (),
                                         the_location,
                                         factory.in (),
                                         factory_id),
                        CORBA::NO_MEMORY());

      info->is_primary_ = is_primary;

      if (this->members_.bind (the_location, info) != 0)
        {
          throw CORBA::NO_MEMORY();
        }
    }
}
Example #14
0
 char *get_string ()
 {
   CORBA::String_var str ("hello");
   return str._retn ();
 }