summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp')
-rw-r--r--TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp463
1 files changed, 0 insertions, 463 deletions
diff --git a/TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp b/TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp
deleted file mode 100644
index d404bd70da2..00000000000
--- a/TAO/TAO_IDL/be/be_visitor_typedef/typedef.cpp
+++ /dev/null
@@ -1,463 +0,0 @@
-//
-// $Id$
-//
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO IDL
-//
-// = FILENAME
-// typedef.cpp
-//
-// = DESCRIPTION
-// Generic visitor generating code for Typedefs
-//
-// = AUTHOR
-// Aniruddha Gokhale
-//
-// ============================================================================
-
-#include "idl.h"
-#include "idl_extern.h"
-#include "be.h"
-
-#include "be_visitor_typedef.h"
-
-ACE_RCSID(be_visitor_typedef, typedef, "$Id$")
-
-
-// ******************************************************
-// Generic Typedef visitor
-// ******************************************************
-
-be_visitor_typedef::be_visitor_typedef (be_visitor_context *ctx)
- : be_visitor_decl (ctx)
-{
-}
-
-be_visitor_typedef::~be_visitor_typedef (void)
-{
-}
-
-// visit the Typedef node and its scope
-int be_visitor_typedef::visit_typedef (be_typedef *)
-{
- return -1; // must be overridden
-}
-
-// =all common visit methods for typedef visitor
-
-// visit a array
-int
-be_visitor_typedef::visit_array (be_array *node)
-{
- // instantiate a visitor context with a copy of our context. This info
- // will be modified based on what type of node we are visiting
- be_visitor_context ctx (*this->ctx_);
- ctx.node (node); // set the node to be the node being visited. The scope is
- // still the same
-
-
- // this switch is acceptable rather than having derived visitors overriding
- // this method and differing only in what state they set
-
- switch (this->ctx_->state ())
- {
- case TAO_CodeGen::TAO_TYPEDEF_CH:
- ctx.state (TAO_CodeGen::TAO_ARRAY_CH);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CS:
- ctx.state (TAO_CodeGen::TAO_ARRAY_CS);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CI:
- ctx.state (TAO_CodeGen::TAO_ARRAY_CI);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_ARRAY_ANY_OP_CH);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_ARRAY_ANY_OP_CS);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_ARRAY_CDR_OP_CH);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_ARRAY_CDR_OP_CS);
- break;
- default:
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_array - "
- "Bad context state\n"
- ), -1);
- }
- }
-
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_array - "
- "NUL visitor\n"
- ), -1);
- }
-
- // let the node accept this visitor
- if (node->accept (visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_array - "
- "failed to accept visitor\n"
- ), -1);
- }
- delete visitor;
- return 0;
-}
-
-//visit an enum
-int
-be_visitor_typedef::visit_enum (be_enum *node)
-{
- // instantiate a visitor context with a copy of our context. This info
- // will be modified based on what type of node we are visiting
- be_visitor_context ctx (*this->ctx_);
- ctx.node (node); // set the node to be the node being visited. The scope is
- // still the same
-
- // this switch is acceptable rather than having derived visitors overriding
- // this method and differing only in what state they set
-
- switch (this->ctx_->state ())
- {
- case TAO_CodeGen::TAO_TYPEDEF_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_CH);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_CS);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CH);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_ANY_OP_CS);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CH);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_ENUM_CDR_OP_CS);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CI:
- return 0; // nothing to be done
- default:
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_enum - "
- "Bad context state\n"
- ), -1);
- }
- }
-
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_enum - "
- "NUL visitor\n"
- ), -1);
- }
-
- // let the node accept this visitor
- if (node->accept (visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_enum - "
- "failed to accept visitor\n"
- ), -1);
- }
- delete visitor;
- return 0;
-}
-
-// visit an predefined type
-int
-be_visitor_typedef::visit_predefined_type (be_predefined_type *)
-{
- return 0;
-}
-
-// visit an sequence
-int
-be_visitor_typedef::visit_sequence (be_sequence *node)
-{
- // instantiate a visitor context with a copy of our context. This info
- // will be modified based on what type of node we are visiting
- be_visitor_context ctx (*this->ctx_);
- ctx.node (node); // set the node to be the node being visited. The scope is
- // still the same
-
- // this switch is acceptable rather than having derived visitors overriding
- // this method and differing only in what state they set
-
- switch (this->ctx_->state ())
- {
- case TAO_CodeGen::TAO_TYPEDEF_CH:
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_CH);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CI:
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_CI);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CS:
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_CS);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_ANY_OP_CH);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_ANY_OP_CS);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CH);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_SEQUENCE_CDR_OP_CS);
- break;
- default:
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_sequence - "
- "Bad context state\n"
- ), -1);
- }
- }
-
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_sequence - "
- "NUL visitor\n"
- ), -1);
- }
-
- // let the node accept this visitor
- if (node->accept (visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_sequence - "
- "failed to accept visitor\n"
- ), -1);
- }
- delete visitor;
- return 0;
-}
-
-// visit an structure
-int
-be_visitor_typedef::visit_string (be_string *node)
-{
- // instantiate a visitor context with a copy of our context. This info
- // will be modified based on what type of node we are visiting
- be_visitor_context ctx (*this->ctx_);
- ctx.node (node); // set the node to be the node being visited. The scope is
- // still the same
-
- // this switch is acceptable rather than having derived visitors overriding
- // this method and differing only in what state they set
-
- switch (this->ctx_->state ())
- {
- case TAO_CodeGen::TAO_TYPEDEF_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CH);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CI:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CI);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CS);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
- case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
- case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH:
- case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS:
- return 0; // nothing to be done
- default:
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_string - "
- "Bad context state\n"
- ), -1);
- }
- }
-
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_string - "
- "NUL visitor\n"
- ), -1);
- }
-
- // let the node accept this visitor
- if (node->accept (visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_string - "
- "failed to accept visitor\n"
- ), -1);
- }
- delete visitor;
- return 0;
-}
-
-// visit an structure
-int
-be_visitor_typedef::visit_structure (be_structure *node)
-{
- // instantiate a visitor context with a copy of our context. This info
- // will be modified based on what type of node we are visiting
- be_visitor_context ctx (*this->ctx_);
- ctx.node (node); // set the node to be the node being visited. The scope is
- // still the same
-
- // this switch is acceptable rather than having derived visitors overriding
- // this method and differing only in what state they set
-
- switch (this->ctx_->state ())
- {
- case TAO_CodeGen::TAO_TYPEDEF_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CH);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CI:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CI);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CS);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CH);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_ANY_OP_CS);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CH);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_STRUCT_CDR_OP_CS);
- break;
- default:
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_structure - "
- "Bad context state\n"
- ), -1);
- }
- }
-
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_structure - "
- "NUL visitor\n"
- ), -1);
- }
-
- // let the node accept this visitor
- if (node->accept (visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_structure - "
- "failed to accept visitor\n"
- ), -1);
- }
- delete visitor;
- return 0;
-}
-
-// visit an union
-int
-be_visitor_typedef::visit_union (be_union *node)
-{
- // instantiate a visitor context with a copy of our context. This info
- // will be modified based on what type of node we are visiting
- be_visitor_context ctx (*this->ctx_);
- ctx.node (node); // set the node to be the node being visited. The scope is
- // still the same
-
- // this switch is acceptable rather than having derived visitors overriding
- // this method and differing only in what state they set
-
- switch (this->ctx_->state ())
- {
- case TAO_CodeGen::TAO_TYPEDEF_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_CH);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CI:
- ctx.state (TAO_CodeGen::TAO_UNION_CI);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_CS);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CH);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_ANY_OP_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_ANY_OP_CS);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CH:
- ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CH);
- break;
- case TAO_CodeGen::TAO_TYPEDEF_CDR_OP_CS:
- ctx.state (TAO_CodeGen::TAO_UNION_CDR_OP_CS);
- break;
- default:
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_union - "
- "Bad context state\n"
- ), -1);
- }
- }
-
- be_visitor *visitor = tao_cg->make_visitor (&ctx);
- if (!visitor)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_union - "
- "NUL visitor\n"
- ), -1);
- }
-
- // let the node accept this visitor
- if (node->accept (visitor) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR,
- "(%N:%l) be_visitor_typedef::"
- "visit_union - "
- "failed to accept visitor\n"
- ), -1);
- }
- delete visitor;
- return 0;
-}