Public Member Functions | Private Member Functions

TAO_PSDL_Enum_Type_Visitor Class Reference

#include <PSDL_Enum_Type_Visitor.h>

Inheritance diagram for TAO_PSDL_Enum_Type_Visitor:
Inheritance graph
[legend]
Collaboration diagram for TAO_PSDL_Enum_Type_Visitor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TAO_PSDL_Enum_Type_Visitor ()
 ~TAO_PSDL_Enum_Type_Visitor ()
int visit_identifier (TAO_PSDL_Identifier *identifier)
int visit_enumerator (TAO_PSDL_Enumerator *enumerator)
int visit_predefined_type (TAO_PSDL_Predefined_Type *predefined_type)

Private Member Functions

void print_class_for_enum_type (ACE_CString enum_type_name)

Detailed Description

Definition at line 32 of file PSDL_Enum_Type_Visitor.h.


Constructor & Destructor Documentation

TAO_PSDL_Enum_Type_Visitor::TAO_PSDL_Enum_Type_Visitor ( void   ) 

Definition at line 9 of file PSDL_Enum_Type_Visitor.cpp.

{
}

TAO_PSDL_Enum_Type_Visitor::~TAO_PSDL_Enum_Type_Visitor ( void   ) 

Definition at line 13 of file PSDL_Enum_Type_Visitor.cpp.

{
}


Member Function Documentation

void TAO_PSDL_Enum_Type_Visitor::print_class_for_enum_type ( ACE_CString  enum_type_name  )  [private]

Definition at line 85 of file PSDL_Enum_Type_Visitor.cpp.

{
// Get a pointer to PSDL_Stream of the stub header.
  TAO_PSDL_Stream *ps_sh = TAO_PSDL_Scope::instance ()->get_sh ();
  
  ps_sh->nl ();

  *ps_sh << "typedef " << enum_type_name << " &"
         << enum_type_name << "_out;\n";

  *ps_sh<< "TAO_NAMESPACE_STORAGE_CLASS ::CORBA::TypeCode_ptr "
       << "_tc_" << enum_type_name << ";\n";

  ps_sh->nl ();

}

int TAO_PSDL_Enum_Type_Visitor::visit_enumerator ( TAO_PSDL_Enumerator enumerator  )  [virtual]

Reimplemented from TAO_PSDL_Node_Visitor.

Definition at line 30 of file PSDL_Enum_Type_Visitor.cpp.

{
  // Gets the enum name and saves it in the global array of
  // identifiers.
  if (enumerator->identifier ()->accept (this) == -1)
    return -1;

  // Get a pointer to PSDL_Stream of the stub header.
  TAO_PSDL_Stream *ps_sh = TAO_PSDL_Scope::instance ()->get_sh ();
  
  *ps_sh<< "  " << this->identifiers_ [this->count_ - 1]
       << ";\n";

  // Get the enum members and save them.
  if (enumerator->enumerator () != 0)
    if (enumerator->enumerator ()->accept (this) == -1)
      return -1;

  return 0;
}

int TAO_PSDL_Enum_Type_Visitor::visit_identifier ( TAO_PSDL_Identifier identifier  )  [virtual]

Reimplemented from TAO_PSDL_Node_Visitor.

Definition at line 18 of file PSDL_Enum_Type_Visitor.cpp.

{
  // Save the identifiers for future use.
  this->identifiers_.size (this->count_ + 1);

  this->identifiers_ [this->count_] = identifier->value ();

  ++this->count_;
  return 0;
}

int TAO_PSDL_Enum_Type_Visitor::visit_predefined_type ( TAO_PSDL_Predefined_Type predefined_type  )  [virtual]

Reimplemented from TAO_PSDL_Node_Visitor.

Definition at line 52 of file PSDL_Enum_Type_Visitor.cpp.

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

  ACE_CString enum_type_name = this->identifiers_ [this->count_ - 1];

  // Get a pointer to PSDL_Stream of the stub header.
  TAO_PSDL_Stream *ps_sh = TAO_PSDL_Scope::instance ()->get_sh ();
  
  *ps_sh<< "enum " << enum_type_name.c_str () << "\n";
  *ps_sh<< "{\n";

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

  *ps_sh<< "};\n";

  // Print the code that should go into the generated header file.
  // @@ Update this method to get the code that should go to
  // implementation method (as applies).
  this->print_class_for_enum_type (enum_type_name);

  return 0;
}


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