1 // AST_StructureFwd nodes denote forward declarations of IDL structs.
2 // AST_StructureFwd nodes have a field containing the full declaration
3 // of the struct, which is initialized when that declaration is
6 #include "ast_structure_fwd.h"
7 #include "ast_structure.h"
8 #include "ast_visitor.h"
9 #include "utl_identifier.h"
11 AST_Decl::NodeType
const
12 AST_StructureFwd::NT
= AST_Decl::NT_struct_fwd
;
14 AST_StructureFwd::AST_StructureFwd (AST_Structure
*full_defn
,
17 AST_Decl (AST_Decl::NT_struct_fwd
,
19 AST_Type (AST_Decl::NT_struct_fwd
,
21 pd_full_definition (full_defn
),
26 AST_StructureFwd::~AST_StructureFwd (void)
30 // Redefinition of inherited virtual operations.
32 // Dump this AST_StructureFwd node to the ostream o.
34 AST_StructureFwd::dump (ACE_OSTREAM_TYPE
&o
)
36 this->dump_i (o
, "struct ");
37 this->local_name ()->dump (o
);
41 AST_StructureFwd::ast_accept (ast_visitor
*visitor
)
43 return visitor
->visit_structure_fwd (this);
49 AST_StructureFwd::full_definition (void)
51 return this->pd_full_definition
;
55 AST_StructureFwd::set_full_definition (AST_Structure
*nfd
)
57 this->pd_full_definition
->destroy ();
58 delete this->pd_full_definition
;
59 this->pd_full_definition
= nfd
;
61 // In case it's not already set.
62 this->is_defined_
= true;
66 AST_StructureFwd::is_defined (void)
68 return this->is_defined_
;
72 AST_StructureFwd::set_as_defined (void)
74 this->is_defined_
= true;
78 AST_StructureFwd::destroy (void)
80 if (!this->is_defined_
&& 0 != this->pd_full_definition
)
82 this->pd_full_definition
->destroy ();
83 delete this->pd_full_definition
;
84 this->pd_full_definition
= 0;
87 this->AST_Type::destroy ();
91 AST_StructureFwd::is_fwd (void)
93 return true; // This is a fwd declared type
96 // We don't actually want the forward declaration,
97 // but want to return the full definition member,
98 // whether defined yet or not.
100 AST_StructureFwd::adjust_found (
106 AST_Structure
*s
= this->full_definition ();
107 return (full_def_only
&& !s
->is_defined () ? 0 : s
);
113 IMPL_NARROW_FROM_DECL (AST_StructureFwd
)