Public Member Functions | Static Public Member Functions | Private Attributes

TAO::Any_Array_Impl_T< T_slice, T_forany > Class Template Reference

Template Any class for array types. More...

#include <Any_Array_Impl_T.h>

Inheritance diagram for TAO::Any_Array_Impl_T< T_slice, T_forany >:
Inheritance graph
[legend]
Collaboration diagram for TAO::Any_Array_Impl_T< T_slice, T_forany >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Any_Array_Impl_T (_tao_destructor destructor, CORBA::TypeCode_ptr, T_slice *const)
virtual ~Any_Array_Impl_T (void)
virtual CORBA::Boolean marshal_value (TAO_OutputCDR &)
CORBA::Boolean demarshal_value (TAO_InputCDR &)
virtual void _tao_decode (TAO_InputCDR &)
virtual const void * value (void) const
virtual void free_value (void)

Static Public Member Functions

static void insert (CORBA::Any &, _tao_destructor destructor, CORBA::TypeCode_ptr, T_slice *const)
static CORBA::Boolean extract (const CORBA::Any &, _tao_destructor, CORBA::TypeCode_ptr, T_slice *&)

Private Attributes

T_slice * value_

Detailed Description

template<typename T_slice, typename T_forany>
class TAO::Any_Array_Impl_T< T_slice, T_forany >

Template Any class for array types.

Used for arrays

Definition at line 37 of file Any_Array_Impl_T.h.


Constructor & Destructor Documentation

template<typename T_slice , typename T_forany >
TAO::Any_Array_Impl_T< T_slice, T_forany >::Any_Array_Impl_T ( _tao_destructor  destructor,
CORBA::TypeCode_ptr  tc,
T_slice * const  val 
)

Definition at line 24 of file Any_Array_Impl_T.cpp.

  : Any_Impl (destructor,
              tc),
    value_ (val)
{
}

template<typename T_slice , typename T_forany >
TAO::Any_Array_Impl_T< T_slice, T_forany >::~Any_Array_Impl_T ( void   )  [virtual]

Definition at line 36 of file Any_Array_Impl_T.cpp.

{
}


Member Function Documentation

template<typename T_slice , typename T_forany >
void TAO::Any_Array_Impl_T< T_slice, T_forany >::_tao_decode ( TAO_InputCDR cdr  )  [virtual]

Reimplemented from TAO::Any_Impl.

Definition at line 165 of file Any_Array_Impl_T.cpp.

{
  if (! this->demarshal_value (cdr))
    {
      throw ::CORBA::MARSHAL ();
    }
}

template<typename T_slice , typename T_forany >
CORBA::Boolean TAO::Any_Array_Impl_T< T_slice, T_forany >::demarshal_value ( TAO_InputCDR cdr  ) 

Definition at line 10 of file Any_Array_Impl_T.inl.

{
  T_forany tmp (this->value_);
  return (cdr >> tmp);
}

template<typename T_slice , typename T_forany >
CORBA::Boolean TAO::Any_Array_Impl_T< T_slice, T_forany >::extract ( const CORBA::Any any,
_tao_destructor  destructor,
CORBA::TypeCode_ptr  tc,
T_slice *&  _tao_elem 
) [static]

Definition at line 58 of file Any_Array_Impl_T.cpp.

{
  _tao_elem = 0;

  try
    {
      CORBA::TypeCode_ptr any_tc = any._tao_get_typecode ();
      CORBA::Boolean const _tao_equiv = any_tc->equivalent (tc);

      if (_tao_equiv == false)
        {
          return false;
        }

      TAO::Any_Impl *impl = any.impl ();

      if (!impl->encoded ())
        {
          TAO::Any_Array_Impl_T<T_slice, T_forany> *narrow_impl =
            dynamic_cast <TAO::Any_Array_Impl_T <T_slice, T_forany> *> (impl);

          if (narrow_impl == 0)
            {
              return false;
            }

          _tao_elem = reinterpret_cast <T_slice*> (narrow_impl->value_);
          return true;
        }

      TAO::Any_Array_Impl_T<T_slice, T_forany> *replacement = 0;
      typedef TAO::Any_Array_Impl_T<T_slice, T_forany> ARRAY_ANY_IMPL;
      ACE_NEW_RETURN (replacement,
                      ARRAY_ANY_IMPL (destructor,
                                      any_tc,
                                      T_forany::tao_alloc ()),
                      false);

      auto_ptr<TAO::Any_Array_Impl_T<T_slice, T_forany> > replacement_safety (
          replacement
        );

      // We know this will work since the unencoded case is covered above.
      TAO::Unknown_IDL_Type * const unk =
        dynamic_cast<TAO::Unknown_IDL_Type *> (impl);

      if (!unk)
        return false;

      // We don't want the rd_ptr of unk to move, in case it is
      // shared by another Any. This copies the state, not the buffer.
      TAO_InputCDR for_reading (unk->_tao_get_cdr ());

      CORBA::Boolean const good_decode =
        replacement->demarshal_value (for_reading);

      if (good_decode)
        {
          _tao_elem = reinterpret_cast <T_slice*> (replacement->value_);
          const_cast<CORBA::Any &> (any).replace (replacement);
          replacement_safety.release ();
          return true;
        }

      // Duplicated by Any_Impl base class constructor.
      ::CORBA::release (any_tc);
    }
  catch (const ::CORBA::Exception&)
    {
    }

  return false;
}

template<typename T_slice , typename T_forany >
void TAO::Any_Array_Impl_T< T_slice, T_forany >::free_value ( void   )  [virtual]

Reimplemented from TAO::Any_Impl.

Definition at line 151 of file Any_Array_Impl_T.cpp.

{
  if (this->value_destructor_ != 0)
    {
      (*this->value_destructor_) (this->value_);
      this->value_destructor_ = 0;
    }

  this->value_ = 0;
  ::CORBA::release (this->type_);
}

template<typename T_slice , typename T_forany >
void TAO::Any_Array_Impl_T< T_slice, T_forany >::insert ( CORBA::Any any,
_tao_destructor  destructor,
CORBA::TypeCode_ptr  tc,
T_slice * const  value 
) [static]

Definition at line 42 of file Any_Array_Impl_T.cpp.

{
  TAO::Any_Array_Impl_T<T_slice, T_forany> *new_impl = 0;
  typedef TAO::Any_Array_Impl_T<T_slice, T_forany> ARRAY_ANY_IMPL;
  ACE_NEW (new_impl,
           ARRAY_ANY_IMPL (destructor,
                           tc,
                           value));
  any.replace (new_impl);
}

template<typename T_slice , typename T_forany >
CORBA::Boolean TAO::Any_Array_Impl_T< T_slice, T_forany >::marshal_value ( TAO_OutputCDR cdr  )  [virtual]

Implements TAO::Any_Impl.

Definition at line 137 of file Any_Array_Impl_T.cpp.

{
  return (cdr << T_forany (this->value_));
}

template<typename T_slice , typename T_forany >
const void * TAO::Any_Array_Impl_T< T_slice, T_forany >::value ( void   )  const [virtual]

Definition at line 144 of file Any_Array_Impl_T.cpp.

{
  return this->value_;
}


Member Data Documentation

template<typename T_slice , typename T_forany >
T_slice* TAO::Any_Array_Impl_T< T_slice, T_forany >::value_ [private]

Definition at line 63 of file Any_Array_Impl_T.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines