Public Types | Public Member Functions | Private Attributes

TAO_Target_Specification Class Reference

A class to encapsulate all the ways of specifying targets. More...

#include <target_specification.h>

List of all members.

Public Types

enum  TAO_Target_Address { Key_Addr = 0, Profile_Addr, Reference_Addr }

Public Member Functions

 TAO_Target_Specification (void)
 Ctor.
void target_specifier (const TAO::ObjectKey &key)
void target_specifier (IOP::TaggedProfile &profile)
 Set the target specification by passing in an IOP::TaggedProfile.
void target_specifier (IOP::IOR &ior, CORBA::ULong prof_index)
const TAO::ObjectKey * object_key (void)
const IOP::TaggedProfile * profile (void)
CORBA::ULong iop_ior (IOP::IOR *&ior)
TAO_Target_Address specifier (void)
 Access the TArget_Address specifier.

Private Attributes

union {
   TAO::ObjectKey *   object_key_
   IOP::TaggedProfile *   profile_
   IOP::IOR *   ior_
u_
 The union of all the possibilities.
TAO_Target_Address specifier_
 The enum identifier.
CORBA::ULong profile_index_
 The profile index.

Detailed Description

A class to encapsulate all the ways of specifying targets.

Definition at line 57 of file target_specification.h.


Member Enumeration Documentation

Enumerator:
Key_Addr 
Profile_Addr 
Reference_Addr 

Definition at line 63 of file target_specification.h.

  {
    // Note that this could be extended for other protocols
    Key_Addr = 0,
    Profile_Addr,
    Reference_Addr
  };


Constructor & Destructor Documentation

TAO_Target_Specification::TAO_Target_Specification ( void   ) 

Ctor.

Definition at line 8 of file target_specification.inl.


Member Function Documentation

CORBA::ULong TAO_Target_Specification::iop_ior ( IOP::IOR *&  ior  ) 

Returns a pointer to IOP::IOR through the parameters and the index of the selected profile as a return parameter after a check of the stored specifier. If the stored specifier is not of the right type then this would return a NULL.

Definition at line 69 of file target_specification.inl.

{
  if (this->specifier_ == TAO_Target_Specification::Reference_Addr)
    {
      ior = this->u_.ior_;
      return this->profile_index_;
    }

  ior = 0;
  return 0;
}

const TAO::ObjectKey * TAO_Target_Specification::object_key ( void   ) 

Returns the object key after a check of the stored specifier. If the stored specifier is not of the right type then this would return a NULL

Definition at line 51 of file target_specification.inl.

{
  if (this->specifier_ == TAO_Target_Specification::Key_Addr)
    return this->u_.object_key_;

  return 0;
}

const IOP::TaggedProfile * TAO_Target_Specification::profile ( void   ) 

Returns the IOP::TaggedProfile after a check of the stored specifier. If the stored specifier is not of the right type then this would return a NULL

Definition at line 60 of file target_specification.inl.

{
  if (this->specifier_ == TAO_Target_Specification::Profile_Addr)
    return this->u_.profile_;

  return 0;
}

TAO_Target_Specification::TAO_Target_Address TAO_Target_Specification::specifier ( void   ) 

Access the TArget_Address specifier.

Definition at line 82 of file target_specification.inl.

{
  return this->specifier_;
}

void TAO_Target_Specification::target_specifier ( IOP::TaggedProfile &  profile  ) 

Set the target specification by passing in an IOP::TaggedProfile.

Definition at line 32 of file target_specification.inl.

{
  this->specifier_ = TAO_Target_Specification::Profile_Addr;
  this->u_.profile_ = const_cast<IOP::TaggedProfile *> (&profile);

}

void TAO_Target_Specification::target_specifier ( const TAO::ObjectKey &  key  ) 

Set the target specification by giving the object key.

Note:
Please do not pass in a identifiers that is allocated on stack. These methods does not make a copy but holds the pointer passed in.

Definition at line 16 of file target_specification.inl.

{
  this->specifier_ = TAO_Target_Specification::Key_Addr;
  // @@ Bala: this is a good recipe for a crash, if the <key> was on
  //    the stack or is otherwise destroyed then you are in big
  //    trouble.
  // @@ Carlos: As suggested by you I have documented that in the
  //    headerfile.
  // @@ Bala: beware, documentation is good, code that works in
  // general is better....  but you are probably right in this case, i
  // suspect this stuff goes right in the critical path, right? So
  // making a copy of the object key would be too expensive..
  this->u_.object_key_ = const_cast<TAO::ObjectKey *> (&key);
}

void TAO_Target_Specification::target_specifier ( IOP::IOR &  ior,
CORBA::ULong  prof_index 
)

Specify the target by passing in the IOP::IOR with a profile index. Please see the header file IOPC.h on why a profile index is required.

Definition at line 41 of file target_specification.inl.

{
  this->specifier_ = TAO_Target_Specification::Reference_Addr;
  this->u_.ior_ = const_cast<IOP::IOR *> (&ior);
  this->profile_index_ = prof_index;

}


Member Data Documentation

Definition at line 118 of file target_specification.h.

Definition at line 116 of file target_specification.h.

Definition at line 117 of file target_specification.h.

The profile index.

Definition at line 125 of file target_specification.h.

The enum identifier.

Definition at line 122 of file target_specification.h.

union { ... } TAO_Target_Specification::u_ [private]

The union of all the possibilities.


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