blob: c723bf9a61dfee4721494dd33263d8187309fd3a (
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
//=============================================================================
/**
* @file executor_exs_attr_init.cpp
*
* $Id$
*
* Visitor generating code in the exec impl source for
* the initialization of attribute members in the constructor.
*
*
* @author Jeff Parsons
*/
//=============================================================================
be_visitor_executor_exs_attr_init::be_visitor_executor_exs_attr_init (
be_visitor_context *ctx)
: be_visitor_component_scope (ctx),
semicolon_generated_ (false)
{
}
be_visitor_executor_exs_attr_init::~be_visitor_executor_exs_attr_init (void)
{
}
int
be_visitor_executor_exs_attr_init::visit_attribute (
be_attribute *node)
{
if (node->imported ())
{
return 0;
}
AST_Decl::NodeType nt = this->node_->node_type ();
// Executor attribute code generated for porttype attributes
// always in connectors and only for mirrorports in components.
if (this->in_ext_port_ && nt == AST_Decl::NT_component)
{
return 0;
}
os_ << this->ctx_->port_prefix ().c_str ()
<< node->local_name () << "_ (";
be_visitor_attr_init nrt_visitor (this->ctx_);
int status =
node->field_type ()->accept (&nrt_visitor);
if (status == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_executor_exs_attr_init::")
ACE_TEXT ("visit_attribute - ")
ACE_TEXT ("accept with null value ")
ACE_TEXT ("visitor failed\n")),
-1);
}
os_ << ")";
return 0;
}
int
be_visitor_executor_exs_attr_init::pre_process (be_decl *node)
{
if (node->imported ())
{
return 0;
}
AST_Decl::NodeType nt = this->node_->node_type ();
// Executor attribute code generated for porttype attributes
// always in connectors and only for mirrorports in components.
if (this->in_ext_port_ && nt == AST_Decl::NT_component)
{
return 0;
}
if (node->node_type () == AST_Decl::NT_attr)
{
if (this->semicolon_generated_)
{
os_ << be_nl
<< ", ";
}
else
{
os_ << be_idt_nl
<< ": " << be_idt;
this->semicolon_generated_ = true;
}
}
return 0;
}
bool
be_visitor_executor_exs_attr_init::attr_generated (void) const
{
return this->semicolon_generated_;
}
|