summaryrefslogtreecommitdiff
path: root/modules/TAO/TAO_IDL/be/be_null_return_emitter.cpp
blob: 0186e11e2b41aa2bc4f07248ddbbdde47a143587 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO_IDL_BE
//
// = FILENAME
//    be_null_return_emitter.cpp
//
// = DESCRIPTION
//    Emits 'return x;' for all CORBA types and ACE-supported
//    platforms.
//
// = AUTHOR
//    Jeff Parsons
//
// ============================================================================

#include "be_null_return_emitter.h"
#include "be_visitor_null_return_value.h"
#include "be_visitor_context.h"
#include "be_helper.h"
#include "be_typedef.h"
#include "be_structure.h"
#include "be_union.h"

be_null_return_emitter::be_null_return_emitter (
    be_visitor_context *ctx)
  : ctx_ (ctx),
    os_ (*ctx->stream ())
{
}

be_null_return_emitter::~be_null_return_emitter (void)
{
}

int
be_null_return_emitter::emit (be_type *node)
{
  os_ << "return ";
  
  be_visitor_null_return_value visitor (this->ctx_);
  
  if (node->accept (&visitor) == -1)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("be_null_return_emitter::")
                         ACE_TEXT ("emit(be_decl *) - accept() ")
                         ACE_TEXT ("failed for %C\n"),
                         node->full_name ()),
                        -1);
    }
    
  os_ << ";";
  
  return 0;
}