Exemplo n.º 1
0
void
TAO_DynArray_i::init (CORBA::TypeCode_ptr tc)
{
  CORBA::TCKind kind = TAO_DynAnyFactory::unalias (tc);

  if (kind != CORBA::tk_array)
    {
      throw DynamicAny::DynAnyFactory::InconsistentTypeCode ();
    }

  this->type_ = CORBA::TypeCode::_duplicate (tc);

  CORBA::ULong numfields = this->get_tc_length (tc);

  // Resize the array.
  this->da_members_.size (numfields);

  this->init_common ();

  CORBA::TypeCode_var elemtype = this->get_element_type ();

  for (CORBA::ULong i = 0; i < numfields; ++i)
    {
      // Recursively initialize each element.
      this->da_members_[i] =
        TAO::MakeDynAnyUtils::make_dyn_any_t<CORBA::TypeCode_ptr> (
          elemtype.in (),
          elemtype.in (),
          this->allow_truncation_ );
    }
}
Exemplo n.º 2
0
bool
TAO::TypeCode::Case<StringType, TypeCodeType>::equivalent (
    CORBA::ULong index,
    CORBA::TypeCode_ptr tc
) const
{
    // Member names are ignore when determining equivalence.

    // Check case TypeCodes.
    CORBA::TypeCode_ptr const lhs_tc = this->type ();
    CORBA::TypeCode_var const rhs_tc =
        tc->member_type (index
                        );

    CORBA::Boolean const equivalent_members =
        lhs_tc->equivalent (rhs_tc.in ()
                           );

    if (!equivalent_members)
        return 0;

    // Check case label.
    // The label must be equal when determining equivalence, too.
    return this->equal_label (index,
                              tc
                             );
}
Exemplo n.º 3
0
void
TAO_DynEnum_i::set_as_string (const char *value_as_string)
{
  CORBA::TypeCode_var ct = TAO_DynAnyFactory::strip_alias (this->type_.in ());

  CORBA::ULong count = ct.in ()->member_count ();

  CORBA::ULong i;
  const char *temp = 0;

  for (i = 0; i < count; ++i)
    {
      temp = ct.in ()->member_name (i);

      if (!ACE_OS::strcmp (value_as_string, temp))
        {
          break;
        }
    }

  if (i < count)
    {
      this->value_ = i;
    }
  else
    {
      throw DynamicAny::DynAny::InvalidValue ();
    }
}
Exemplo n.º 4
0
VALUE rCORBA_Request_arguments(VALUE self)
{
  CORBA::Request_ptr _req =  r2tao_Request_r2t(self);
  R2TAO_TRY
  {
    CORBA::ULong arg_len = _req->arguments ()->count ();
    VALUE rargs = rb_ary_new ();
    for (CORBA::ULong a=0; a<arg_len ;++a)
    {
      VALUE rarg = rb_ary_new ();
      CORBA::NamedValue_ptr arg = _req->arguments ()->item (a);

      rb_ary_push (rarg, rb_str_new2 (arg->name ()));
      if (ACE_BIT_ENABLED (arg->flags (), CORBA::ARG_IN))
        rb_ary_push (rarg, ULONG2NUM (r2tao_IN_ARG));
      else if (ACE_BIT_ENABLED (arg->flags (), CORBA::ARG_OUT))
        rb_ary_push (rarg, ULONG2NUM (r2tao_OUT_ARG));
      else if (ACE_BIT_ENABLED (arg->flags (), CORBA::ARG_INOUT))
        rb_ary_push (rarg, ULONG2NUM (r2tao_INOUT_ARG));
      CORBA::TypeCode_var atc = arg->value ()->type ();
      VALUE arg_rtc = r2tao_Typecode_t2r(atc.in (), _req->target ()->_get_orb ());
      rb_ary_push (rarg, arg_rtc);
      VALUE arg_val = r2tao_Typecode_Any2Ruby (*arg->value (), atc.in (),
                                                arg_rtc, arg_rtc,
                                                _req->target ()->_get_orb ());
      rb_ary_push (rarg, arg_val);
      rb_ary_push (rargs, rarg);
    }
    return rargs;
  }
  R2TAO_CATCH;
  return Qnil;
}
Exemplo n.º 5
0
CORBA::TypeCode_ptr
TAO_ValueBoxDef_i::type_i (void)
{
  ACE_TString id;
  this->repo_->config ()->get_string_value (this->section_key_,
                                            "id",
                                            id);

  ACE_TString name;
  this->repo_->config ()->get_string_value (this->section_key_,
                                            "name",
                                            name);

  ACE_TString boxed_type_path;
  this->repo_->config ()->get_string_value (this->section_key_,
                                            "boxed_type",
                                            boxed_type_path);

  TAO_IDLType_i *impl =
    TAO_IFR_Service_Utils::path_to_idltype (boxed_type_path,
                                            this->repo_);

  CORBA::TypeCode_var tc = impl->type_i ();

  return this->repo_->tc_factory ()->create_value_box_tc (id.c_str (),
                                                          name.c_str (),
                                                          tc.in ());
}
Exemplo n.º 6
0
    CORBA::TypeCode_ptr
    DynAlias_Handler::create_typecode (const DataType &type)
    {
      DANCE_TRACE("DynAlias_Handler::create_typecode");

      if (!type.alias_p ())
        {
          DANCE_DEBUG (DANCE_LOG_TERMINAL_ERROR,
            (LM_ERROR, ACE_TEXT ("ERROR: Alias type description required")));
          throw Config_Error (ACE_TEXT (""),
            ACE_TEXT ("Did not find expected alias type description, tk_kind"\
                      "may be wrong."));
        }

      CORBA::TypeCode_var tc =
        DYNANY_HANDLER->orb ()->create_alias_tc
        (ACE_TEXT_ALWAYS_CHAR (type.alias ().typeId ().c_str ()),
         ACE_TEXT_ALWAYS_CHAR (type.alias ().name ().c_str ()),
         DYNANY_HANDLER->create_typecode (type.alias ().elementType ()));

      DYNANY_HANDLER->register_typecode (type.alias ().typeId (),
                                         tc.in ());

      return tc._retn ();
    }
Exemplo n.º 7
0
TAO_Literal_Constraint::
TAO_Literal_Constraint (CORBA::Any* any)
{
  CORBA::Any& any_ref = *any;
  CORBA::TypeCode_var type = any_ref.type ();
  // @@ No where to throw exception back.
  CORBA::TCKind corba_type = CORBA::tk_null;
  try
    {
      corba_type = type->kind ();
    }
  catch (const CORBA::Exception&)
    {
      // @@ Seth: Don't know what else to do.  Make sure we can tell
      // when this constructor fails.
      return;
    }

  this->type_ = TAO_Literal_Constraint::comparable_type (type.in ());
  switch (this->type_)
    {
    case TAO_SIGNED:
      this->op_.integer_ = 0;
      if (corba_type == CORBA::tk_short)
        {
          CORBA::Short sh;
          any_ref >>= sh;
          this->op_.integer_ = static_cast<CORBA::LongLong> (sh);
        }
      else if (corba_type == CORBA::tk_long)
Exemplo n.º 8
0
//-----------------------------------------------------------------------------//
std::string CCorbaErrorHelper::ToString(const CORBA::Exception& err)
{
	CORBA::Any tmp;
	tmp <<= err;
	CORBA::TypeCode_var tc = tmp.type();
	return std::string(tc->name());
}
Exemplo n.º 9
0
CORBA::Boolean
TAO::TypeCode::Struct<char const *,
                      CORBA::TypeCode_ptr const *,
                      TAO::TypeCode::Struct_Field<char const *,
                                                  CORBA::TypeCode_ptr const *> const *,
                      TAO::Null_RefCount_Policy>::equivalent_i (
  CORBA::TypeCode_ptr tc) const
{
  // Perform a structural comparison, excluding the name() and
  // member_name() operations.

  CORBA::ULong const tc_nfields =
    tc->member_count ();

  if (tc_nfields != this->nfields_)
    return false;

  for (CORBA::ULong i = 0; i < this->nfields_; ++i)
    {
      CORBA::TypeCode_ptr const lhs =
        Traits<char const *>::get_typecode (this->fields_[i].type);
      CORBA::TypeCode_var const rhs =
        tc->member_type (i);

      CORBA::Boolean const equiv_members =
        lhs->equivalent (rhs.in ());

      if (!equiv_members)
        return false;
    }

  return true;
}
Exemplo n.º 10
0
CORBA::TypeCode_ptr
TAO_AliasDef_i::type_i (void)
{
  ACE_TString id;
  this->repo_->config ()->get_string_value (this->section_key_,
                                            ACE_TEXT("id"),
                                            id);

  ACE_TString name;
  this->repo_->config ()->get_string_value (this->section_key_,
                                            ACE_TEXT("name"),
                                            name);

  ACE_TString original_type;
  this->repo_->config ()->get_string_value (this->section_key_,
                                            ACE_TEXT("original_type"),
                                            original_type);

  TAO_IDLType_i *impl =
    TAO_IFR_Service_Utils::path_to_idltype (original_type,
                                            this->repo_);
  if (0 == impl)
  {
     throw CORBA::OBJECT_NOT_EXIST();
  }

  CORBA::TypeCode_var tc = impl->type_i ();

  return this->repo_->tc_factory ()->create_alias_tc (id.c_str (),
                                                      name.c_str (),
                                                      tc.in ());
}
Exemplo n.º 11
0
bool
TAO::TypeCode::Case<StringType, TypeCodeType>::equal (CORBA::ULong index,
        CORBA::TypeCode_ptr tc
                                                     ) const
{
    // Check case names.
    char const * const lhs_name = this->name ();
    char const * const rhs_name = tc->member_name (index
                                                  );

    if (ACE_OS::strcmp (lhs_name, rhs_name) != 0)
        return false;

    // Check case TypeCodes.
    CORBA::TypeCode_ptr const lhs_tc = this->type ();
    CORBA::TypeCode_var const rhs_tc =
        tc->member_type (index
                        );

    CORBA::Boolean const equal_members =
        lhs_tc->equal (rhs_tc.in ()
                      );

    if (!equal_members)
        return false;

    // Check case label.
    return this->equal_label (index,
                              tc
                             );
}
Exemplo n.º 12
0
CORBA::Boolean
TAO::TypeCode::Value<StringType,
                     TypeCodeType,
                     FieldArrayType,
                     RefCountPolicy>::equivalent_i (CORBA::TypeCode_ptr tc) const
{
  CORBA::ValueModifier const tc_type_modifier =
    tc->type_modifier ();

  if (tc_type_modifier != this->type_modifier_)
    return false;

  CORBA::TypeCode_var rhs_concrete_base_type =
    tc->concrete_base_type ();

  CORBA::Boolean const equivalent_concrete_base_types =
    this->equivalent (rhs_concrete_base_type.in ());

  if (!equivalent_concrete_base_types)
    return false;

  // Perform a structural comparison, excluding the name() and
  // member_name() operations.

  CORBA::ULong const tc_nfields =
    tc->member_count ();

  if (tc_nfields != this->nfields_)
    return false;

  for (CORBA::ULong i = 0; i < this->nfields_; ++i)
    {
      Value_Field<StringType, TypeCodeType> const & lhs_field =
        this->fields_[i];

      CORBA::Visibility const lhs_visibility =
        lhs_field.visibility;
      CORBA::Visibility const rhs_visibility =
        tc->member_visibility (i);

      if (lhs_visibility != rhs_visibility)
        return false;

      CORBA::TypeCode_ptr const lhs_tc =
        Traits<StringType>::get_typecode (lhs_field.type);
      CORBA::TypeCode_var const rhs_tc =
        tc->member_type (i);

      CORBA::Boolean const equiv_types =
        lhs_tc->equivalent (rhs_tc.in ()
                           );

      if (!equiv_types)
        return false;
    }

  return true;
}
Exemplo n.º 13
0
char *
TAO_DynEnum_i::get_as_string (void)
{
  CORBA::TypeCode_var ct = TAO_DynAnyFactory::strip_alias (this->type_.in ());

  const char *retval = ct.in ()->member_name (this->value_);

  return CORBA::string_dup (retval);
}
Exemplo n.º 14
0
//----------------------------------------------------------------------
CORBA::TCKind
AnyAide::getRealType(const CORBA::Any& any)
{
    //have to create an _var type because this is actually a CORBA object
    CORBA::TypeCode_var tc;
    //get the type from the any
    tc = any.type();

    //return the kind...simple enough.
    return tc->kind();
}
Exemplo n.º 15
0
CORBA::TypeCode_ptr
AliasDef_impl::type
()
throw(CORBA::SystemException)
{
	DEBUG_OUTLINE ( "AliasDef_impl::type() called" );

    vector < Contained_impl* > helper_seq;
	CORBA::TypeCode_var tc = build_recursive_type_code(helper_seq);
	if ( helper_seq.size() != 0 )
		throw CORBA::BAD_INV_ORDER();	// Is this correct?
    return tc._retn();
}
Exemplo n.º 16
0
static ostream &
operator<< (ostream & os, const CORBA::Exception & e)
{
    CORBA::Any tmp;
    tmp <<= e;
    CORBA::TypeCode_var tc = tmp.type ();
    const char * p = tc->name ();
    if (*p != '\0')
        os << p;
    else
        os << tc->id ();
    return os;
}
Exemplo n.º 17
0
// Get the length from the (possibly aliased) typecode.
CORBA::ULong
TAO_DynArray_i::get_tc_length (CORBA::TypeCode_ptr tc)
{
  CORBA::TypeCode_var tctmp = CORBA::TypeCode::_duplicate (tc);
  CORBA::TCKind kind = tctmp->kind ();

  while (kind == CORBA::tk_alias)
    {
      tctmp = tctmp->content_type ();
      kind = tctmp->kind ();
    }

  return tctmp->length ();
}
Exemplo n.º 18
0
void
TAO_DynEnum_i::set_as_ulong (CORBA::ULong value_as_ulong)
{
  CORBA::TypeCode_var ct = TAO_DynAnyFactory::strip_alias (this->type_.in ());
  CORBA::ULong const max = ct.in ()->member_count ();

  if (value_as_ulong < max)
    {
      this->value_ = value_as_ulong;
    }
  else
    {
      throw DynamicAny::DynAny::InvalidValue ();
    }
}
Exemplo n.º 19
0
CORBA::Boolean
TAO_Log_Constraint_Visitor::struct_does_contain (
    const CORBA::Any *any,
    TAO_ETCL_Literal_Constraint &item
)
{
    try
    {
        TAO_DynStruct_i dyn_struct;
        dyn_struct.init (*any);

        DynamicAny::NameValuePairSeq_var members =
            dyn_struct.get_members ();

        CORBA::ULong length = members->length ();
        CORBA::TypeCode_var tc;
        CORBA::TCKind kind;

        for (CORBA::ULong i = 0; i < length; ++i)
        {
            tc = members[i].value.type ();
            kind = TAO_DynAnyFactory::unalias (tc.in ());

            // The literal and the struct member must be
            // of the same simple type.
            CORBA::Boolean match = this->simple_type_match (item.expr_type (),
                                   kind);

            if (!match)
            {
                return false;
            }

            TAO_ETCL_Literal_Constraint element (&members[i].value);

            if (item == element)
            {
                return true;
            }
        }
    }
    catch (const CORBA::Exception&)
    {
        return false;
    }

    return false;
}
Exemplo n.º 20
0
//-----------------------------------------------------------------------------//
std::string CCorbaErrorHelper::ToString(const CORBA::SystemException& err)
{
	std::string errDescription;
	TCHAR buf[50];
	memset(buf, 0, sizeof(TCHAR) * 50);
	
	CORBA::Any tmp;
	tmp <<= err;
	CORBA::TypeCode_var tc = tmp.type();

	errDescription = std::string(tc->name()) + _T(" Description: ") + err.NP_minorString();
	errDescription += _T(" Minor code: ");
	errDescription += _ltoa_s(err.minor(), buf, 50, 10);

	return errDescription;
}
Exemplo n.º 21
0
void
Client_Request_Interceptor::receive_exception (
    PortableInterceptor::ClientRequestInfo_ptr ri)
{
  ++this->exception_count_;
  ACE_DEBUG ((LM_DEBUG, "received exception %d\n",
              this->exception_count_));
  if (CORBA::is_nil (this->orb_.in ()))
  {
    int argc = 0;
    ACE_TCHAR **argv = 0;
    this->orb_ = CORBA::ORB_init (argc, argv, this->orb_id_.in ());
  }

  if (this->exception_count_ == 1)
    {
      ACE_DEBUG ((LM_DEBUG, "forwarding client to the second server\n"));
      CORBA::Object_var first_forward =
        this->orb_->string_to_object (this->first_forward_str_.in ());

      // Notice that this is not a permanent forward.
      throw PortableInterceptor::ForwardRequest (first_forward.in ());
    }
  else if (this->exception_count_ == 2)
    {
      ACE_DEBUG ((LM_DEBUG, "forwarding client to the third server\n"));
      CORBA::Object_var second_forward =
        this->orb_->string_to_object (this->second_forward_str_.in ());

      // Notice that this is not a permanent forward.
      throw PortableInterceptor::ForwardRequest (second_forward.in ());
    }
  else if (this->exception_count_ == 3)
    {
      CORBA::Any_var ex = ri->received_exception ();

      CORBA::TypeCode_var tc;
      const char * id = 0;
      tc = ex->type ();
      id = tc->id ();

      if (ACE_OS_String::strcmp (id,
                                 "IDL:omg.org/CORBA/TRANSIENT:1.0") == 0)
          throw ::CORBA::TRANSIENT (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO);
    }
}
Exemplo n.º 22
0
CORBA::Boolean
TAO_Log_Constraint_Visitor::array_does_contain (
    const CORBA::Any *any,
    TAO_ETCL_Literal_Constraint &item
)
{
    try
    {
        CORBA::TypeCode_var type = any->type ();
        CORBA::TCKind kind = TAO_DynAnyFactory::unalias (type.in ());

        // The literal and the array elements must be
        // of the same simple type.
        CORBA::Boolean match = this->simple_type_match (item.expr_type (),
                               kind);

        if (!match)
        {
            return false;
        }


        TAO_DynArray_i dyn_array;
        dyn_array.init (*any);

        DynamicAny::AnySeq_var any_seq = dyn_array.get_elements ();

        CORBA::ULong length = any_seq->length ();

        for (CORBA::ULong i = 0; i < length; ++i)
        {
            TAO_ETCL_Literal_Constraint element (&any_seq[i]);

            if (item == element)
            {
                return true;
            }
        }
    }
    catch (const CORBA::Exception&)
    {
        return false;
    }

    return false;
}
/* execute *****************************************************************
    - executes a process on the device
************************************************************************* */
CF::ExecutableDevice::ProcessID_Type ExecutableDevice_impl::execute (
    const char* name, 
    const CF::Properties& options, 
    const CF::Properties& parameters) 
        throw (CORBA::SystemException, 
                CF::Device::InvalidState, 
                CF::ExecutableDevice::InvalidFunction, 
                CF::ExecutableDevice::InvalidParameters, 
                CF::ExecutableDevice::InvalidOptions, 
                CF::InvalidFileName, 
                CF::ExecutableDevice::ExecuteFail)
{
    CORBA::TypeCode_var tc;                       // CORBA type code
    const char* tempStr;                          // temporary character string
    CF::ExecutableDevice::ProcessID_Type PID;     // process ID
    int size = 2 * parameters.length () + 2;      // length of the POSIX argv arguments
    char** argv = new char *[size];               // POSIX arguments
    CORBA::ULong stackSize, priority;             // CORBA unsigned longs for options storage

    // verify device is in the correct state
    if (!isUnlocked () || isDisabled ()) {
        DEBUG(5, ExecutableDevice_impl, "Cannot execute. System is either LOCKED, SHUTTING DOWN or DISABLED.")
        throw (CF::Device::InvalidState("Cannot execute. System is either LOCKED, SHUTTING DOWN or DISABLED."));
    }

    priority = 0;                                 // this is the default value for the priority (it's actually meaningless in this version)
    stackSize = 4096;                             // this is the default value for the stacksize (it's actually meaningless in this version)

    {
    // verify valid options, both STACK_SIZE_ID and PRIORITY_ID must have unsigned-long types
    CF::Properties invalidOptions;
    invalidOptions.length(0);

    for (unsigned i = 0; i < options.length (); i++) {
        tc = options[i].value.type ();

        // extract priority and stack size from the options list
        if (strcmp (options[i].id, CF::ExecutableDevice::PRIORITY_ID)) {
            if (tc->kind () == CORBA::tk_ulong) {
                options[i].value >>= priority; 
            } else {
                LOG_ERROR(ExecutableDevice_impl, "Incorrect type provided for option PRIORITY");
                invalidOptions.length(invalidOptions.length() + 1);
                invalidOptions[invalidOptions.length() - 1] = options[i];
            }
        } else if (strcmp (options[i].id, CF::ExecutableDevice::STACK_SIZE_ID)) {
Exemplo n.º 24
0
CORBA::TCKind DynStructImpl::current_member_kind()
   throw(DynamicAny::DynAny::TypeMismatch,
         DynamicAny::DynAny::InvalidValue, CORBA::SystemException)
{
   if (_destroyed)
   {
      throw CORBA::OBJECT_NOT_EXIST("DynAny destroyed");
   }

   if (_current == -1)
   {
      throw DynamicAny::DynAny::InvalidValue(); // "No member (current = -1)"
   }

   CORBA::TypeCode_var type = _base_type->member_type(_current);
   return type->kind();
}
Exemplo n.º 25
0
CORBA::Boolean
TAO::TypeCode::Struct<char const *,
                      CORBA::TypeCode_ptr const *,
                      TAO::TypeCode::Struct_Field<char const *,
                                                  CORBA::TypeCode_ptr const *> const *,
                      TAO::Null_RefCount_Policy>::equal_i (
  CORBA::TypeCode_ptr tc) const
{
  // This call shouldn't throw since CORBA::TypeCode::equal() verified
  // that the TCKind is the same as our's prior to invoking this
  // method, meaning that member_count() is supported.

  CORBA::ULong const tc_nfields =
    tc->member_count ();

  if (tc_nfields != this->nfields_)
    return false;

  for (CORBA::ULong i = 0; i < this->nfields_; ++i)
    {
      Struct_Field<char const *, CORBA::TypeCode_ptr const *> const &
        lhs_field = this->fields_[i];

      char const * const lhs_name =
        Traits<char const *>::get_string (lhs_field.name);
      char const * const rhs_name = tc->member_name (i
                                                    );

      if (ACE_OS::strcmp (lhs_name, rhs_name) != 0)
        return false;

      CORBA::TypeCode_ptr const lhs_tc =
        Traits<char const *>::get_typecode (lhs_field.type);
      CORBA::TypeCode_var const rhs_tc =
        tc->member_type (i);

      CORBA::Boolean const equal_members =
        lhs_tc->equal (rhs_tc.in ());

      if (!equal_members)
        return false;
    }

  return true;
}
  virtual void push_structured_event(CosNotification::StructuredEvent const& event)
    throw(CosEventComm::Disconnected)
  {
    cout << "domain_name: " << event.header.fixed_header.event_type.domain_name
	 << "  type_name: " << event.header.fixed_header.event_type.type_name << " " << flush;

    if (false) {
    Miro::Client client;
    DynamicAny::DynAnyFactory_var daf =
      client.resolveInit<DynamicAny::DynAnyFactory>("DynAnyFactory");
    DynamicAny::DynAny_var da = daf->create_dyn_any(event.remainder_of_body);
    
    CORBA::TypeCode_var tc = da->type();

    if (tc->kind() == CORBA::tk_struct) {
      CORBA::String_var name = tc->name();
      CORBA::String_var id = tc->id();

      DynamicAny::DynStruct_var ds =
	DynamicAny::DynStruct::_narrow(da);

      for (CORBA::ULong i = 0; i < ds->component_count(); ++i) {
	DynamicAny::DynAny_var member = ds->current_component();
	CORBA::String_var name = ds->current_member_name();
	if (std::string("timestamp") == name.in()) {
	  long long int i =  member->get_ulonglong();
	  ACE_Time_Value t;
	  ORBSVCS_Time::Absolute_TimeT_to_Time_Value(t, i);
	  cout << "latency: " << ACE_OS::gettimeofday() - t << endl;
	  break;
	}
	ds->next();
      }
    }
    else {
      cerr << "unknown event layout" << endl;
    }
    }
    ACE_Time_Value t;
    t.set(time_out);
    ACE_OS::sleep(t);

    cout << "waking up after sleep" << endl;
  }
Exemplo n.º 27
0
int
TAO_Log_Constraint_Visitor::visit_default (ETCL_Default *def)
{
  ETCL_Constraint *comp = def->component ();

  if (comp == 0)
    {
      return -1;
    }

  if (comp->accept (this) != 0)
    {
      return -1;
    }

  try
    {
      CORBA::TypeCode_var tc = this->current_member_->type ();

      // If the current member is not a union, this call will
      // throw BadKind and the catch block will return -1.
      CORBA::Long default_index = tc->default_index ();

      // No default index.
      if (default_index == -1)
        {
          TAO_ETCL_Literal_Constraint result (false);
          this->queue_.enqueue_head (result);
          return 0;
        }

      // Okay, there's a default index, but is it active?

      TAO_ETCL_Literal_Constraint disc_value;
      this->queue_.dequeue_head (disc_value);
      TAO_ETCL_Literal_Constraint default_index_value (default_index);
      return (disc_value == default_index_value);
    }
  catch (const CORBA::Exception&)
    {
      return -1;
    }
}
Exemplo n.º 28
0
void
DynAnyAnalyzer::analyze_basic_seq (CORBA::TypeCode_ptr tc,
                                   DynamicAny::DynAny_ptr da)
{
  CORBA::TypeCode_var ct = tc->content_type ();
  CORBA::TCKind tk = ct->kind ();

  tab (level_);

  if (debug_)
    {
      ACE_DEBUG ((LM_DEBUG,
                  "BASIC TYPE SEQUENCE\n"));
    }

  switch (tk)
    {
      CASEBS (boolean, Boolean, "  Value (bool) = %d\n");
      CASEBS (octet, Octet, "  Value (octet) = %c\n");
      CASEBS (char, Char, "  Value (char) = %c\n");
      CASEBS (wchar, WChar, "  Value (wchar) = %u\n");
      CASEBS (short, Short, "  Value (short) = %d\n");
      CASEBS (ushort, UShort, "  Value (ushort) = %u\n");
      CASEBS (long, Long, "  Value (long) = %d\n");
      CASEBS (ulong, ULong, "  Value (ulong) = %u\n");
      CASEBS (longlong, LongLong, "  Value (longlong) = %Ld\n");
      CASEBS (ulonglong, ULongLong, "  Value (ulonglong) = %Lu\n");
      CASEBS (float, Float, "  Value (float) = %f\n");
      CASEBS (double, Double, "  Value (double) = %f\n");
      case CORBA::tk_longdouble:
      default:
        tab (level_);

        if (debug_)
          {
            ACE_DEBUG ((LM_DEBUG,
                        "  unhandled typecode = %d\n",
                        static_cast<int> (tk)));
          }

        break;
    }
}
Exemplo n.º 29
0
CORBA::WCharSeq* DynArrayImpl::get_wchar_seq()
   throw(DynamicAny::DynAny::TypeMismatch,
         DynamicAny::DynAny::InvalidValue, CORBA::SystemException)
{
   if (_destroyed)
   {
      throw CORBA::OBJECT_NOT_EXIST("DynAny destroyed");
   }

   CORBA::TypeCode_var type = get_component_type(0);
   if (type->equivalent(CORBA::_tc_wchar))
   {
      return DynComposite::get_wchar_members();
   }
   else
   {
      return DynComposite::get_wchar_seq();
   }
}
Exemplo n.º 30
0
CORBA::Boolean
TAO_DynSequence_i::equal (DynamicAny::DynAny_ptr rhs)
{
  if (this->destroyed_)
    {
      throw ::CORBA::OBJECT_NOT_EXIST ();
    }

  CORBA::TypeCode_var tc = rhs->type ();

  CORBA::Boolean equivalent = tc->equivalent (this->type_.in ());

  if (!equivalent)
    {
      return false;
    }

  if (rhs->component_count () != this->component_count_)
    {
      return false;
    }

  DynamicAny::DynAny_var tmp;
  CORBA::Boolean member_equal;

  for (CORBA::ULong i = 0; i < this->component_count_; ++i)
    {
      rhs->seek (static_cast<CORBA::Long> (i));

      tmp = rhs->current_component ();

      // Recursive step.
      member_equal = tmp->equal (this->da_members_[i].in ());

      if (!member_equal)
        {
          return false;
        }
    }

  return true;
}