Public Member Functions | Static Public Member Functions | Private Attributes | Friends

TAO_PSDL_Scope Class Reference

#include <PSDL_Scope.h>

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

List of all members.

Public Member Functions

 TAO_PSDL_Scope (void)
virtual ~TAO_PSDL_Scope (void)
virtual int add_module (ACE_CString identifier)
virtual int add_interface (ACE_CString identifier)
virtual int add_struct (ACE_CString identifier)
virtual int add_typedef (ACE_CString identifier, ACE_CString identifier_type)
virtual int add_const_decl (ACE_CString identifier, ACE_CString identifier_type)
virtual int add_except_decl (ACE_CString identifier, ACE_CString identifier_type)
virtual int add_exception (ACE_CString identifier)
virtual int add_op_dcl (ACE_CString identifier)
virtual int add_member_decl (ACE_CString identifier, ACE_CString identifier_type)
virtual TAO_PSDL_Scopepop_top_scope (void)
 Return the top scope.
virtual void push_scope (TAO_PSDL_Scope *scope)
 Push the scope that is passed into the stack of scopes.
virtual TAO_PSDL_Scopeparent_scope (void)
 Return the pointer to the parent scope.
virtual Scope_Mapscope_map (void)
 Return the pointer to Scope_Map of the instance.
virtual void dump (CORBA::ULong depth)
 Function to help indent the output of the parse tree.
virtual int find (const ACE_CString &identifier_name, ACE_CString &identifier_type)
 Function to find the TAO_PSDL_Scope for the given identifier_name.
virtual int find (const ACE_CString &identifier_name)
virtual int get_module_name (const ACE_CString &identifier_name, ACE_CString &module_name)
virtual int get_interface_name (const ACE_CString &identifier_name, ACE_CString &interface_name)
virtual ACE_CString identifier_type (void)
virtual ACE_CString module_name (void)
virtual ACE_CString interface_name (void)
int add_module_to_scope (ACE_CString identifier, TAO_PSDL_Scope *scope)
int add_interface_to_scope (ACE_CString identifier, TAO_PSDL_Scope *scope)
int add_interface_dcl_to_scope (ACE_CString identifier, TAO_PSDL_Scope *scope)
int add_struct_to_scope (ACE_CString identifier, TAO_PSDL_Scope *scope)
int add_typedef_to_scope (ACE_CString identifier, ACE_CString identifier_type, TAO_PSDL_Scope *scope)
int add_const_decl_to_scope (ACE_CString identifier, ACE_CString identifier_type, TAO_PSDL_Scope *scope)
int add_except_decl_to_scope (ACE_CString identifier, ACE_CString identifier_type, TAO_PSDL_Scope *scope)
int add_exception_to_scope (ACE_CString identifier, TAO_PSDL_Scope *scope)
int add_scoped_decl_to_scope (ACE_CString identifier, ACE_CString identifier_type, TAO_PSDL_Scope *scope)
int add_enum_decl_to_scope (ACE_CString identifier, ACE_CString identifier_type, TAO_PSDL_Scope *scope)
int add_op_dcl_to_scope (ACE_CString identifier, TAO_PSDL_Scope *scope)
int add_member_decl_to_scope (ACE_CString identifier, ACE_CString identifier_type, TAO_PSDL_Scope *scope)
void set_root_scope (void)
 Set the root scope the very first time.
void set_stub_prefix (const char *filename)
const ACE_CStringget_stub_prefix (void)
void header_initialization (TAO_PSDL_Stream *ps_sh)
void stub_initialization (TAO_PSDL_Stream *ps_si)
TAO_PSDL_Streamget_sh (void)
 Get the pointer to the TAO_PSDL_Stream for the stub header.
TAO_PSDL_Streamget_si (void)
TAO_PSDL_Streamget_sinline (void)
int check_identifier (ACE_CString identifier, TAO_PSDL_Scope *scope)
void check_name_in_scope (ACE_CString identifier, TAO_PSDL_Scope *scope)
void print_depth (CORBA::ULong depth)
void set_scope (void)
 Method used to set the scope back to the previous one.
void set_interface_scope (void)
 Set interface scope to the previous one.
void set_module_scope (void)
 Set module scope to the previous one.
void save_identifier (ACE_CString identifier)
 Methods to save and retrieve the identifier values.
ACE_CString get_identifier (void)
void set_name_space (ACE_CString name_space)
 Accessor methods to the name of the name_space: Module name.
ACE_CString get_name_space (void)
void set_interface_name (ACE_CString interface_name)
 Accessor methods to the name of the current interface.
ACE_CString get_interface_name (void)
void to_lower_case (ACE_CString &identifier)
ACE_CString convert_str (int identifier_type)

Static Public Member Functions

static TAO_PSDL_Scopeinstance (void)
 Return a unique instance.

Private Attributes

TAO_PSDL_Scope ** psdl_scope_
ACE_Array_Base< TAO_PSDL_Scope * > ast_scope_
ACE_Array_Base< ACE_CStringmodule_names_
 Arrays to save the module and interface names.
ACE_Array_Base< ACE_CStringinterface_names_
unsigned long psdl_scope_top_
 Count of the members in the psdl_scope_.
TAO_PSDL_Root_Scoperoot_scope_
 Pointer to the instance of the TAO_PSDL_Root_Scope.
ACE_CString identifier_
ACE_CString name_space_
 Save for use while writing to stubs.
ACE_CString interface_name_
ACE_CString stub_prefix_
 Name of the filename that is passed to the compiler psdl_tao.
TAO_PSDL_Streamps_sh_
TAO_PSDL_Streamps_si_
TAO_PSDL_Streamps_sin_

Friends

class TAO_Singleton< TAO_PSDL_Scope, TAO_SYNCH_MUTEX >

Detailed Description

Definition at line 53 of file PSDL_Scope.h.


Constructor & Destructor Documentation

TAO_PSDL_Scope::TAO_PSDL_Scope ( void   ) 
TAO_PSDL_Scope::~TAO_PSDL_Scope ( void   )  [virtual]

Definition at line 36 of file PSDL_Scope.cpp.

{
}


Member Function Documentation

int TAO_PSDL_Scope::add_const_decl ( ACE_CString  identifier,
ACE_CString  identifier_type 
) [virtual]
int TAO_PSDL_Scope::add_const_decl_to_scope ( ACE_CString  identifier,
ACE_CString  identifier_type,
TAO_PSDL_Scope scope 
)

Definition at line 284 of file PSDL_Scope.cpp.

{
  this->to_lower_case (identifier);
  this->to_lower_case (identifier_type);

  // First check if the identifier_type is either a predefined type
  // or if it is defined before. If it is defined before, we will
  // proceed.
  this->check_name_in_scope (identifier_type, scope);

  if (this->check_identifier (identifier, scope) == -1)
    {
      TAO_PSDL_Simple_Scope *psdl_simple =
            new TAO_PSDL_Simple_Scope (scope,
                                       identifier_type);

      scope->scope_map ()->bind (identifier,
                                 psdl_simple);

    }
  else
    {
      ACE_DEBUG ((LM_ERROR,
                  "Error: const_decl re-defined %s\n",
                  identifier.c_str ()));

      ACE_OS::exit (1);

      return -1;
    }

  return 0;
}

int TAO_PSDL_Scope::add_enum_decl_to_scope ( ACE_CString  identifier,
ACE_CString  identifier_type,
TAO_PSDL_Scope scope 
)

Definition at line 486 of file PSDL_Scope.cpp.

{
  this->to_lower_case (identifier);
  this->to_lower_case (identifier_type);

  TAO_PSDL_Simple_Scope *psdl_simple =
    new TAO_PSDL_Simple_Scope (scope,
                               identifier_type);

  scope->scope_map ()->bind (identifier,
                             psdl_simple);
  return 0;
}

int TAO_PSDL_Scope::add_except_decl ( ACE_CString  identifier,
ACE_CString  identifier_type 
) [virtual]
int TAO_PSDL_Scope::add_except_decl_to_scope ( ACE_CString  identifier,
ACE_CString  identifier_type,
TAO_PSDL_Scope scope 
)

Definition at line 328 of file PSDL_Scope.cpp.

{
  this->to_lower_case (identifier);
  this->to_lower_case (identifier_type);

  if (this->check_identifier (identifier, scope) == -1)
    {
      TAO_PSDL_Simple_Scope *psdl_simple =
        new TAO_PSDL_Simple_Scope (scope,
                                   identifier_type);

      scope->scope_map ()->bind (identifier,
                                 psdl_simple);
    }
  else
    {
      ACE_DEBUG ((LM_DEBUG,
                  "Error: exception_name %s re-defined\n",
                  identifier.c_str ()));

      ACE_OS::exit (1);

      return -1;
    }

  return 0;
}

int TAO_PSDL_Scope::add_exception ( ACE_CString  identifier  )  [virtual]

Reimplemented in TAO_PSDL_Interface_Scope, and TAO_PSDL_Module_Scope.

Definition at line 433 of file PSDL_Scope.cpp.

{
  return 0;
}

int TAO_PSDL_Scope::add_exception_to_scope ( ACE_CString  identifier,
TAO_PSDL_Scope scope 
)

Definition at line 439 of file PSDL_Scope.cpp.

{
  this->to_lower_case (identifier);

  if (this->check_identifier (identifier, scope) == -1)
    {
      TAO_PSDL_Exception_Scope *psdl_exception =
        new TAO_PSDL_Exception_Scope (scope);

      scope->scope_map ()->bind (identifier,
                                  psdl_exception);

      TAO_PSDL_Scope::instance ()->push_scope (psdl_exception);
    }
  else
    {
      ACE_DEBUG ((LM_DEBUG,
                  "Error: exception %s re-defined: aborting\n",
                  identifier.c_str ()));

      ACE_OS::exit (1);

      return -1;
    }

  return 0;
}

int TAO_PSDL_Scope::add_interface ( ACE_CString  identifier  )  [virtual]

Reimplemented in TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, and TAO_PSDL_Root_Scope.

Definition at line 168 of file PSDL_Scope.cpp.

{
  return 0;
}

int TAO_PSDL_Scope::add_interface_dcl_to_scope ( ACE_CString  identifier,
TAO_PSDL_Scope scope 
)

Definition at line 140 of file PSDL_Scope.cpp.

{
  this->to_lower_case (identifier);

  if (this->check_identifier (identifier, scope) == -1)
    {
      TAO_PSDL_Simple_Scope *psdl_simple =
        new TAO_PSDL_Simple_Scope (scope,
                                   "forward_dcl");

      scope->scope_map ()->bind (identifier,
                                 psdl_simple);
    }
  else
    {
      ACE_DEBUG ((LM_DEBUG,
                  "Error: interface_name %s re-defined\n",
                  identifier.c_str ()));

      ACE_OS::exit (1);
      return -1;
    }

  return 0;
}

int TAO_PSDL_Scope::add_interface_to_scope ( ACE_CString  identifier,
TAO_PSDL_Scope scope 
)

Definition at line 174 of file PSDL_Scope.cpp.

{
  this->to_lower_case (identifier);

  if (this->check_identifier (identifier, scope) == -1)
    {
      TAO_PSDL_Interface_Scope *psdl_interface =
        new TAO_PSDL_Interface_Scope (scope);

      scope->scope_map ()->bind (identifier,
                                  psdl_interface);

      TAO_PSDL_Scope::instance ()->push_scope (psdl_interface);
    }
  else
    {
      ACE_DEBUG ((LM_DEBUG,
                  "Error: interface_name %s re-defined\n",
                  identifier.c_str ()));

      ACE_OS::exit (1);
      return -1;
    }

  return 0;
}

int TAO_PSDL_Scope::add_member_decl ( ACE_CString  identifier,
ACE_CString  identifier_type 
) [virtual]

Reimplemented in TAO_PSDL_Exception_Scope, and TAO_PSDL_Op_Dcl_Scope.

Definition at line 395 of file PSDL_Scope.cpp.

{
  return 0;
}

int TAO_PSDL_Scope::add_member_decl_to_scope ( ACE_CString  identifier,
ACE_CString  identifier_type,
TAO_PSDL_Scope scope 
)

Definition at line 402 of file PSDL_Scope.cpp.

{
  this->to_lower_case (identifier);
  this->to_lower_case (identifier_type);

  if (this->check_identifier (identifier, scope) == -1)
    {
      TAO_PSDL_Simple_Scope *psdl_simple =
        new TAO_PSDL_Simple_Scope (scope,
                                   identifier_type);

      scope->scope_map ()->bind (identifier,
                                 psdl_simple);
    }
  else
    {
      ACE_DEBUG ((LM_DEBUG,
                  "Error: member_decl %s re-defined\n",
                  identifier.c_str ()));

      ACE_OS::exit (1);

      return -1;
    }

  return 0;
}

int TAO_PSDL_Scope::add_module ( ACE_CString  identifier  )  [virtual]

The add functions are overridden by the derived classes to add the respective types in their scopes. The return value is a '0' if successful and '-1' if it ends up as a failure.

Reimplemented in TAO_PSDL_Module_Scope, TAO_PSDL_Root_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 99 of file PSDL_Scope.cpp.

{
  return 0;
}

int TAO_PSDL_Scope::add_module_to_scope ( ACE_CString  identifier,
TAO_PSDL_Scope scope 
)

As the function name implies, the following methods help add the respective types to the scope passed in. The return value is a '0' on success and '-1' on a failure.

@ Rather than here .. you must have actually save the identifier name in the instance of the module itself .. or may be I should rather figure out a

Definition at line 105 of file PSDL_Scope.cpp.

{
  ACE_CString lower_identifier = identifier;
  this->to_lower_case (lower_identifier);

  if (this->check_identifier (lower_identifier, scope) == -1)
    {
      TAO_PSDL_Module_Scope *psdl_module =
        new TAO_PSDL_Module_Scope (scope);

      scope->scope_map ()->bind (lower_identifier,
                                 psdl_module);

      size_t cur_size = this->module_names_.size ();

      /// @@ Rather than here .. you must have actually save the
      /// identifier name in the instance of the module itself .. or
      /// may be I should rather figure out a
      this->module_names_.size (cur_size + 1);
      this->module_names_[cur_size] = identifier;

      TAO_PSDL_Scope::instance ()->push_scope (psdl_module);
    }
  else
    {
      ACE_DEBUG ((LM_DEBUG,
                  "Error: module name re-defined: ABORTING\n"));
      return -1;
    }

  return 0;
}

int TAO_PSDL_Scope::add_op_dcl ( ACE_CString  identifier  )  [virtual]

Reimplemented in TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Root_Scope, and TAO_PSDL_Simple_Scope.

Definition at line 359 of file PSDL_Scope.cpp.

{
  return 0;
}

int TAO_PSDL_Scope::add_op_dcl_to_scope ( ACE_CString  identifier,
TAO_PSDL_Scope scope 
)

Definition at line 365 of file PSDL_Scope.cpp.

{
  this->to_lower_case (op_name);

  if (this->check_identifier (op_name, scope) == -1)
    {
      TAO_PSDL_Op_Dcl_Scope *psdl_op_dcl =
        new TAO_PSDL_Op_Dcl_Scope (scope);

      scope->scope_map ()->bind (op_name,
                                  psdl_op_dcl);

      TAO_PSDL_Scope::instance ()->push_scope (psdl_op_dcl);
    }
  else
    {
      ACE_DEBUG ((LM_DEBUG,
                  "Error: op_name %s re-defined\n",
                  op_name.c_str ()));

      ACE_OS::exit (1);

      return -1;
    }

  return 0;
}

int TAO_PSDL_Scope::add_scoped_decl_to_scope ( ACE_CString  identifier,
ACE_CString  identifier_type,
TAO_PSDL_Scope scope 
)

Definition at line 469 of file PSDL_Scope.cpp.

{
  this->to_lower_case (identifier);
  this->to_lower_case (identifier_type);

  TAO_PSDL_Simple_Scope *psdl_simple =
    new TAO_PSDL_Simple_Scope (scope,
                               identifier_type);

  scope->scope_map ()->bind (identifier,
                             psdl_simple);
  return 0;
}

int TAO_PSDL_Scope::add_struct ( ACE_CString  identifier  )  [virtual]

Reimplemented in TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Root_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 203 of file PSDL_Scope.cpp.

{
  return 0;
}

int TAO_PSDL_Scope::add_struct_to_scope ( ACE_CString  identifier,
TAO_PSDL_Scope scope 
)

Definition at line 209 of file PSDL_Scope.cpp.

{
  this->to_lower_case (struct_name);

  if (this->check_identifier (struct_name, scope) == -1)
    {
      TAO_PSDL_Struct_Scope *psdl_struct =
        new TAO_PSDL_Struct_Scope (scope);

      scope->scope_map ()->bind (struct_name,
                                 psdl_struct);

      TAO_PSDL_Scope::instance ()->push_scope (psdl_struct);

    }
  else
    {
      ACE_DEBUG ((LM_DEBUG,
                  "Error: identifier re-defined: ABORTING\n"));

      ACE_OS::exit (1);

      return -1;
    }

  return 0;
}

int TAO_PSDL_Scope::add_typedef ( ACE_CString  identifier,
ACE_CString  identifier_type 
) [virtual]
int TAO_PSDL_Scope::add_typedef_to_scope ( ACE_CString  identifier,
ACE_CString  identifier_type,
TAO_PSDL_Scope scope 
)

Definition at line 246 of file PSDL_Scope.cpp.

{
  this->to_lower_case (identifier);
  this->to_lower_case (identifier_type);

  if (this->check_identifier (identifier, scope) == -1)
    {
      TAO_PSDL_Simple_Scope *psdl_simple =
        new TAO_PSDL_Simple_Scope (scope,
                                   identifier_type);

      scope->scope_map ()->bind (identifier,
                                 psdl_simple);
    }
  else
    {
      ACE_DEBUG ((LM_ERROR,
                  "Error: trying to redefine typedef %s\n",
                  identifier.c_str ()));

      ACE_OS::exit (1);

      return -1;
    }

  return 0;
}

int TAO_PSDL_Scope::check_identifier ( ACE_CString  identifier,
TAO_PSDL_Scope scope 
)

As the name suggests, check if the identifier name is already used for something else in the sc

Definition at line 51 of file PSDL_Scope.cpp.

{
  int result = 0;

  this->to_lower_case (identifier);

  // Check in the ROOT_SCOPE
  if (scope->scope_map () != 0)
    result = scope->scope_map ()->find (identifier);

  if (result != 0)
    {
      // Didnt find in this scope. Check in the parents scope
      // since that also counts.
      if (scope->parent_scope () != 0)
        {
          result =
            this->check_identifier (identifier,
                                    scope->parent_scope ());
        }
    }

  return result;
}

void TAO_PSDL_Scope::check_name_in_scope ( ACE_CString  identifier,
TAO_PSDL_Scope scope 
)

This is to check if a forward declaration has been done already.

Definition at line 78 of file PSDL_Scope.cpp.

{
  // This method is to be used in the cases when the identifier should
  // have been declared before: for example, forward declarations.

  // Check if it is a user-defined type defined in this scope.
  int check_result = this->check_identifier (identifier,
                                             scope);

  if (check_result == -1)
    {
      ACE_DEBUG ((LM_DEBUG,
                  "Identifier %s not defined before in the scope..aborting..\n",
                  identifier.c_str ()));

      ACE_OS::exit (1);
    }
}

ACE_CString TAO_PSDL_Scope::convert_str ( int  identifier_type  ) 

Helper method to convert the int value of the identifier type to its string equivalent based on the conversion values generated by the Yacc Parser (please see PSDL_y.h for the conversion values).

Definition at line 811 of file PSDL_Scope.cpp.

{
  switch (identifier_type)
    {
    case 258:
      return "module";
    case 264:
      return "abstract";
    case 288:
      return "octet";
    case 290:
      return "object";
    case 291:
      return "struct";
    case 295:
      return "long";
    case 296:
      return "short";
    case 298:
      return "char";
    case 300:
      return "typedef";
    case 301:
      return "native";
    case 316:
      return "void";
    case 317:
      return "in";
    case 324:
      return "exception";
    case 325:
      return "interface";
    case 326:
      return "local";
    case 332:
      return "char *";
    case 337:
      return "enum";
    case 338:
      return "sequence";
    default:
      return "unknown";
    };
}

void TAO_PSDL_Scope::dump ( CORBA::ULong  depth  )  [virtual]

Function to help indent the output of the parse tree.

Reimplemented in TAO_PSDL_Exception_Scope, TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Op_Dcl_Scope, TAO_PSDL_Root_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 753 of file PSDL_Scope.cpp.

{
  this->psdl_scope_[0]->dump (depth);
}

int TAO_PSDL_Scope::find ( const ACE_CString identifier_name  )  [virtual]

Function to check if a particular identifier_name exists in the scope.

Reimplemented in TAO_PSDL_Exception_Scope, TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Root_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 769 of file PSDL_Scope.cpp.

{
  int result = this->root_scope_->find (identifier_name);

  return result;
}

int TAO_PSDL_Scope::find ( const ACE_CString identifier_name,
ACE_CString identifier_type 
) [virtual]

Function to find the TAO_PSDL_Scope for the given identifier_name.

Reimplemented in TAO_PSDL_Exception_Scope, TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Root_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 759 of file PSDL_Scope.cpp.

{
  int result = this->root_scope_->find (identifier_name,
                                        identifier_type);

  return result;
}

ACE_CString TAO_PSDL_Scope::get_identifier ( void   ) 

Definition at line 747 of file PSDL_Scope.cpp.

{
  return this->identifier_;
}

int TAO_PSDL_Scope::get_interface_name ( const ACE_CString identifier_name,
ACE_CString interface_name 
) [virtual]

To get the name of the interface to which an identifier_name belongs. returns '0' on succes and '-1' on failure.

Reimplemented in TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, and TAO_PSDL_Root_Scope.

Definition at line 785 of file PSDL_Scope.cpp.

{
  return this->root_scope_->get_interface_name (identifier_name,
                                                interface_name);
}

ACE_CString TAO_PSDL_Scope::get_interface_name ( void   ) 

Definition at line 895 of file PSDL_Scope.cpp.

{
  return this->interface_name_;
}

int TAO_PSDL_Scope::get_module_name ( const ACE_CString identifier_name,
ACE_CString module_name 
) [virtual]

To get the name of the module to which an identifier_name belongs. returns '0' on succes and '-1' on failure.

Reimplemented in TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, and TAO_PSDL_Root_Scope.

Definition at line 777 of file PSDL_Scope.cpp.

{
  return this->root_scope_->get_module_name (identifier_name,
                                             module_name);
}

ACE_CString TAO_PSDL_Scope::get_name_space ( void   ) 

Definition at line 883 of file PSDL_Scope.cpp.

{
  return this->name_space_;
}

TAO_PSDL_Stream * TAO_PSDL_Scope::get_sh ( void   ) 

Get the pointer to the TAO_PSDL_Stream for the stub header.

Definition at line 526 of file PSDL_Scope.cpp.

{
  if (this->ps_sh_ == 0)
    {
      ACE_NEW_RETURN (this->ps_sh_,
                      TAO_PSDL_Stream,
                      0);

      ACE_CString file_name =
        TAO_PSDL_Scope::instance ()->get_stub_prefix () + "C.h";

      this->ps_sh_->open (file_name.c_str ());

      this->header_initialization (this->ps_sh_);
    }

  return this->ps_sh_;
}

TAO_PSDL_Stream * TAO_PSDL_Scope::get_si ( void   ) 

Get the pointer to the TAO_PSDL_Stream for the stub implementation file.

Definition at line 546 of file PSDL_Scope.cpp.

{
  if (this->ps_si_ == 0)
    {
      ACE_NEW_RETURN (this->ps_si_,
                      TAO_PSDL_Stream,
                      0);

      ACE_CString file_name =
        TAO_PSDL_Scope::instance ()->get_stub_prefix () + "C.cpp";

      this->ps_si_->open (file_name.c_str ());

      this->stub_initialization (this->ps_si_);
    }

  return this->ps_si_;
}

TAO_PSDL_Stream * TAO_PSDL_Scope::get_sinline ( void   ) 

Get the pointer to the TAO_PSDL_Stream for the stub inline file.

Definition at line 566 of file PSDL_Scope.cpp.

{
  if (this->ps_sin_ == 0)
    {
      ACE_NEW_RETURN (this->ps_sin_,
                      TAO_PSDL_Stream,
                      0);

      ACE_CString file_name =
        TAO_PSDL_Scope::instance ()->get_stub_prefix () + "C.i";

      this->ps_sin_->open (file_name.c_str ());
    }

  return this->ps_sin_;
}

const ACE_CString & TAO_PSDL_Scope::get_stub_prefix ( void   ) 

Definition at line 520 of file PSDL_Scope.cpp.

{
  return this->stub_prefix_;
}

void TAO_PSDL_Scope::header_initialization ( TAO_PSDL_Stream ps_sh  ) 

These methods help write the header files that needs to be included and other initialization part to the stubs.

Definition at line 584 of file PSDL_Scope.cpp.

{
  ps_sh->reset ();

  *ps_sh << "#ifndef _TAO_PSDL_" << this->get_stub_prefix () << "C_H_";
  ps_sh->nl ();

  *ps_sh << "#define _TAO_PSDL_" << this->get_stub_prefix () << "C_H_";
  ps_sh->nl ();

  *ps_sh << "#include \"tao/corba.h\"";
  ps_sh->nl ();

  *ps_sh << "#if !defined (ACE_LACKS_PRAGMA_ONCE)";
  ps_sh->nl ();
  *ps_sh << "# pragma once";
  ps_sh->nl ();
  *ps_sh << "#endif /* ACE_LACKS_PRAGMA_ONCE */";
  ps_sh->nl ();

  ps_sh->nl ();

  *ps_sh << "#if defined (TAO_EXPORT_MACRO)";
  ps_sh->nl ();
  *ps_sh << "#undef TAO_EXPORT_MACRO";
  ps_sh->nl ();
  *ps_sh << "#endif";
  ps_sh->nl ();
  *ps_sh << "#define TAO_EXPORT_MACRO";
  ps_sh->nl ();

  ps_sh->nl ();

  *ps_sh << "#if defined (TAO_EXPORT_NESTED_CLASSES)";
  ps_sh->nl ();
  *ps_sh << "#  if defined (TAO_EXPORT_NESTED_MACRO)";
  ps_sh->nl ();
  *ps_sh << "#    undef TAO_EXPORT_NESTED_MACRO";
  ps_sh->nl ();
  *ps_sh << "#  endif /* defined (TAO_EXPORT_NESTED_MACRO) */";
  ps_sh->nl ();
  *ps_sh << "#  define TAO_EXPORT_NESTED_MACRO";
  ps_sh->nl ();
  *ps_sh << "#endif /* TAO_EXPORT_NESTED_CLASSES */";
  ps_sh->nl ();

  ps_sh->nl ();

  *ps_sh << "#if defined(_MSC_VER)";
  ps_sh->nl ();
  *ps_sh << "#pragma warning(push)";
  ps_sh->nl ();
  *ps_sh << "#pragma warning(disable:4250)";
  ps_sh->nl ();
  *ps_sh << "#endif /* _MSC_VER */";
  ps_sh->nl ();

  ps_sh->nl ();

  ps_sh->nl ();

}

ACE_CString TAO_PSDL_Scope::identifier_type ( void   )  [virtual]

Each identifier will have an instance of a derived type of TAO_PSDL_Scope *.. the following method is an accessor to the type of the identifier name

Reimplemented in TAO_PSDL_Exception_Scope, TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 793 of file PSDL_Scope.cpp.

{
  return "null";
}

TAO_PSDL_Scope * TAO_PSDL_Scope::instance ( void   )  [static]

Return a unique instance.

Definition at line 871 of file PSDL_Scope.cpp.

ACE_CString TAO_PSDL_Scope::interface_name ( void   )  [virtual]
ACE_CString TAO_PSDL_Scope::module_name ( void   )  [virtual]
TAO_PSDL_Scope * TAO_PSDL_Scope::parent_scope ( void   )  [virtual]

Return the pointer to the parent scope.

Reimplemented in TAO_PSDL_Exception_Scope, TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Op_Dcl_Scope, TAO_PSDL_Root_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 901 of file PSDL_Scope.cpp.

{
  return 0;
}

TAO_PSDL_Scope * TAO_PSDL_Scope::pop_top_scope ( void   )  [virtual]

Return the top scope.

Definition at line 686 of file PSDL_Scope.cpp.

{
  // Return the top Scope
  if (this->psdl_scope_top_ <= 0)
    return 0;

  return this->psdl_scope_ [this->psdl_scope_top_ - 1];
}

void TAO_PSDL_Scope::print_depth ( CORBA::ULong  depth  ) 

This wont be necessary in the final version .. its helpful to print the symbol table to the std output for now.

Definition at line 858 of file PSDL_Scope.cpp.

{
  for (CORBA::ULong i=0; i != depth; ++i)
    {
      ACE_DEBUG ((LM_DEBUG,
                  "-"));
    }

  ACE_DEBUG ((LM_DEBUG,
              ">"));
}

void TAO_PSDL_Scope::push_scope ( TAO_PSDL_Scope scope  )  [virtual]

Push the scope that is passed into the stack of scopes.

Definition at line 728 of file PSDL_Scope.cpp.

{
  // Push a new scope.
  ++this->psdl_scope_top_;
  this->psdl_scope_ [this->psdl_scope_top_ - 1] = scope;

  // save for later.
  size_t cur_size = this->ast_scope_.size ();
  this->ast_scope_.size (cur_size + 1);
  this->ast_scope_[cur_size] = scope;
}

void TAO_PSDL_Scope::save_identifier ( ACE_CString  identifier  ) 

Methods to save and retrieve the identifier values.

Definition at line 741 of file PSDL_Scope.cpp.

{
  this->identifier_ = identifier;
}

Scope_Map * TAO_PSDL_Scope::scope_map ( void   )  [virtual]

Return the pointer to Scope_Map of the instance.

Reimplemented in TAO_PSDL_Exception_Scope, TAO_PSDL_Interface_Scope, TAO_PSDL_Module_Scope, TAO_PSDL_Op_Dcl_Scope, TAO_PSDL_Root_Scope, TAO_PSDL_Simple_Scope, and TAO_PSDL_Struct_Scope.

Definition at line 907 of file PSDL_Scope.cpp.

{
  return 0;
}

void TAO_PSDL_Scope::set_interface_name ( ACE_CString  interface_name  ) 

Accessor methods to the name of the current interface.

Definition at line 889 of file PSDL_Scope.cpp.

{
  this->interface_name_ = interface_name;
}

void TAO_PSDL_Scope::set_interface_scope ( void   ) 

Set interface scope to the previous one.

Definition at line 706 of file PSDL_Scope.cpp.

{
  size_t cur_size = this->interface_names_.size ();

  // Resetting the module_names_
  this->interface_names_.size (cur_size -1);
  this->set_scope ();
}

void TAO_PSDL_Scope::set_module_scope ( void   ) 

Set module scope to the previous one.

Definition at line 696 of file PSDL_Scope.cpp.

{
  size_t cur_size = this->module_names_.size ();

  // Resetting the module_names_
  this->module_names_.size (cur_size -1);
  this->set_scope ();
}

void TAO_PSDL_Scope::set_name_space ( ACE_CString  name_space  ) 

Accessor methods to the name of the name_space: Module name.

Definition at line 877 of file PSDL_Scope.cpp.

{
  this->name_space_ = name_space;
}

void TAO_PSDL_Scope::set_root_scope ( void   ) 

Set the root scope the very first time.

Definition at line 503 of file PSDL_Scope.cpp.

{
  // This method is called to push the root_scope the first time.
  if (this->root_scope_ == 0)
    {
      this->root_scope_ = new TAO_PSDL_Root_Scope ();
      TAO_PSDL_Scope::instance ()->push_scope (this->root_scope_);
    }
}

void TAO_PSDL_Scope::set_scope ( void   ) 

Method used to set the scope back to the previous one.

Definition at line 716 of file PSDL_Scope.cpp.

{
  // Remove the top scope. Its no longer needed.
  if (this->psdl_scope_top_ <= 0)
    {
      return;
    }

  --this->psdl_scope_top_;
}

void TAO_PSDL_Scope::set_stub_prefix ( const char *  filename  ) 

Set and get the name of the stub that has to be generated. The name is based on the input file that is passed to the compiler.

Definition at line 514 of file PSDL_Scope.cpp.

{
  this->stub_prefix_ = filename;
}

void TAO_PSDL_Scope::stub_initialization ( TAO_PSDL_Stream ps_si  ) 

Definition at line 648 of file PSDL_Scope.cpp.

{

  ps_si->reset ();

  *ps_si << "#include \"" << this->get_stub_prefix () << "C.h\"";
  ps_si->nl ();
  *ps_si << "#include \"tao/Stub.h\"";
  ps_si->nl ();
  *ps_si << "#include \"tao/PortableInterceptor.h\"";
  ps_si->nl ();

  ps_si->nl ();

  *ps_si << "#if TAO_HAS_INTERCEPTORS == 1";
  ps_si->nl ();
  *ps_si << "#include \"tao/RequestInfo_Util.h\"";
  ps_si->nl ();
  *ps_si << "#include \"tao/ClientRequestInfo_i.h\"";
  ps_si->nl ();
  *ps_si << "#endif  /* TAO_HAS_INTERCEPTORS == 1 */";
  ps_si->nl ();

  ps_si->nl ();

  ps_si->nl ();

  *ps_si << "#if !defined (__ACE_INLINE__)";
  ps_si->nl ();
  *ps_si << "#include \"" << this->get_stub_prefix () << "C.i\"";
  ps_si->nl ();
  *ps_si << "#endif /* !defined INLINE */";
  ps_si->nl ();
  ps_si->nl ();

}

void TAO_PSDL_Scope::to_lower_case ( ACE_CString identifier  ) 

Definition at line 41 of file PSDL_Scope.cpp.

{
  size_t len = identifier.length ();
  for (size_t i = 0; i <= len; ++i)
    {
      identifier[i] = ACE_OS::ace_tolower (identifier[i]);
    }
}


Friends And Related Function Documentation

friend class TAO_Singleton< TAO_PSDL_Scope, TAO_SYNCH_MUTEX > [friend]

Definition at line 64 of file PSDL_Scope.h.


Member Data Documentation

Save the psdl_scopes for use while writing to stubs.

Definition at line 261 of file PSDL_Scope.h.

Identifier used for the save_identifier and get_identifier methods.

Definition at line 275 of file PSDL_Scope.h.

Definition at line 265 of file PSDL_Scope.h.

Arrays to save the module and interface names.

Definition at line 264 of file PSDL_Scope.h.

Save for use while writing to stubs.

Definition at line 278 of file PSDL_Scope.h.

Pointers to the TAO_PSDL_Streams for the stub header, implementation and inline files.

Definition at line 286 of file PSDL_Scope.h.

Definition at line 287 of file PSDL_Scope.h.

Definition at line 288 of file PSDL_Scope.h.

Array of TAO_PSDL_Scope pointers to be used with the singleton instance.

Definition at line 257 of file PSDL_Scope.h.

unsigned long TAO_PSDL_Scope::psdl_scope_top_ [private]

Count of the members in the psdl_scope_.

Definition at line 268 of file PSDL_Scope.h.

Pointer to the instance of the TAO_PSDL_Root_Scope.

Definition at line 271 of file PSDL_Scope.h.

Name of the filename that is passed to the compiler psdl_tao.

Definition at line 282 of file PSDL_Scope.h.


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