Functions

be_produce.cpp File Reference

#include "global_extern.h"
#include "TAO_IFR_BE_Export.h"
#include "be_extern.h"
#include "fe_extern.h"
#include "ast_root.h"
#include "ifr_visitor_macro.h"
#include "ifr_removing_visitor.h"
#include "ifr_adding_visitor.h"
Include dependency graph for be_produce.cpp:

Go to the source code of this file.

Functions

TAO_IFR_BE_Export void BE_cleanup (void)
TAO_IFR_BE_Export void BE_abort (void)
int BE_ifr_repo_init (void)
TAO_IFR_BE_Export void BE_produce (void)

Function Documentation

TAO_IFR_BE_Export void BE_abort ( void   ) 

Definition at line 92 of file be_produce.cpp.

{
  ACE_ERROR ((LM_ERROR,
              ACE_TEXT ("Fatal Error - Aborting\n")));

  // BE_cleanup will be called after the exception is caught.
  throw Bailout ();
}

TAO_IFR_BE_Export void BE_cleanup ( void   ) 

Definition at line 85 of file be_produce.cpp.

{
  idl_global->destroy ();
}

int BE_ifr_repo_init ( void   ) 

Definition at line 102 of file be_produce.cpp.

{
  try
  {
    CORBA::Object_var object =
      be_global->orb ()->resolve_initial_references ("InterfaceRepository");

    if (CORBA::is_nil (object.in ()))
      {
        ACE_ERROR_RETURN ((
            LM_ERROR,
            ACE_TEXT ("Null objref from resolve_initial_references\n")
          ),
          -1
        );
      }

    CORBA::Repository_var repo =
      CORBA::Repository::_narrow (object.in ());

    if (CORBA::is_nil (repo.in ()))
      {
        ACE_ERROR_RETURN ((
            LM_ERROR,
            ACE_TEXT ("CORBA::Repository::_narrow failed\n")
          ),
          -1
        );
      }

    be_global->repository (repo._retn ());
  }
  catch (CORBA::ORB::InvalidName &)
  {
    ACE_ERROR ((LM_ERROR,
                ACE_TEXT ("resolution of Interface Repository failed\n")));
    throw Bailout ();
  }

  return 0;
}

TAO_IFR_BE_Export void BE_produce ( void   ) 

Definition at line 146 of file be_produce.cpp.

{
  try
    {
      int status = BE_ifr_repo_init ();

      if (status != 0)
        {
          return;
        }

      // Get the root node.
      AST_Decl *d = idl_global->root ();
      AST_Root *root = AST_Root::narrow_from_decl (d);

      if (root == 0)
        {
          ACE_ERROR ((LM_ERROR,
                      ACE_TEXT ("(%N:%l) BE_produce - ")
                      ACE_TEXT ("No Root\n")));

          BE_abort ();
        }

      if (be_global->removing ())
        {
          ifr_removing_visitor visitor;

          TAO_IFR_VISITOR_WRITE_GUARD;

          // If the visitor is dispatched this way, we need to override
          // only visit_scope() for the removing visitor.
          if (visitor.visit_scope (root) == -1)
            {
              ACE_ERROR ((
                  LM_ERROR,
                  ACE_TEXT ("(%N:%l) BE_produce -")
                  ACE_TEXT (" failed to accept removing visitor\n")
                ));

              BE_abort ();
            }
        }
      else
        {
          ifr_adding_visitor visitor (d, 0, be_global->allow_duplicate_typedefs ());

          TAO_IFR_VISITOR_WRITE_GUARD;

          if (root->ast_accept (&visitor) == -1)
            {
              ACE_ERROR ((
                  LM_ERROR,
                  ACE_TEXT ("(%N:%l) BE_produce -")
                  ACE_TEXT (" failed to accept adding visitor\n")
                ));

              BE_abort ();
            }
        }
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception (ACE_TEXT ("BE_produce"));

    }

  // Clean up.
  BE_cleanup ();
}

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Defines