lestes::lang::cplus::sem::ss_compound_stmt Class Reference

Class for compound statement. More...

#include <ss_statement.g.hh>

Inheritance diagram for lestes::lang::cplus::sem::ss_compound_stmt:

lestes::lang::cplus::sem::ss_statement lestes::intercode::ss_base_with_location lestes::intercode::ss_base lestes::intercode::intercode lestes::std::object lestes::std::mem::keystone List of all members.

Public Types

enum  behavior_type { NORMAL, NO_CREATE, NO_LEAVE }

Public Member Functions

ptr< ss_decl_seqdecl_seq_get () const
 The method decl_seq_get returns the value of the field ss_compound_stmt::decl_seq.
ptr< ::lestes::std::list<
srp< ss_statement > > > 
statements_get () const
 The method statements_get returns the value of the field ss_compound_stmt::statements.
ptr< ss_spdestructor_sp_get () const
 The method destructor_sp_get returns the value of the field ss_compound_stmt::destructor_sp.
void destructor_sp_set (const ptr< ss_sp > &)
 The method destructor_sp_set sets the field ss_compound_stmt::destructor_sp to the given value.
behavior_type behavior_get () const
 The method behavior_get returns the value of the field ss_compound_stmt::behavior.
void behavior_set (behavior_type)
 The method behavior_set sets the field ss_compound_stmt::behavior to the given value.
virtual void accept_ss_statement_visitor (ptr< ss_statement_visitor > v)
virtual ptr< reflection_listreflection_get () const
 for purposes of dumping
virtual ptr< field_list_listfield_values_get () const
 for purposes of dumping

Static Public Member Functions

static ptr< ss_compound_stmtroot_instance ()
 Returns pointer to the instance of root (grandparent) ss_compound_stmt.
static ptr< ss_compound_stmtcreate (ptr< ::lestes::std::source_location > a__ss_base_with_location__location, ptr< ::lestes::std::list< srp< ss_label > > > a__ss_statement__labels, ptr< ss_compound_stmt > a__ss_statement__parent, ptr< ss_sp > a__ss_statement__psp, ptr< ss_sp > a__ss_statement__nsp, ptr< ::lestes::std::list< srp< ss_sp > > > a__ss_statement__sequence_points, ptr< ss_decl_seq > a__ss_compound_stmt__decl_seq, ptr< ::lestes::std::list< srp< ss_statement > > > a__ss_compound_stmt__statements, ptr< ss_sp > a__ss_compound_stmt__destructor_sp, behavior_type a__ss_compound_stmt__behavior)
 First generated factory method for class ss_compound_stmt.
static ptr< ss_compound_stmtcreate (ptr< ::lestes::std::source_location > a__ss_base_with_location__location, ptr< ::lestes::std::list< srp< ss_label > > > a__ss_statement__labels, ptr< ss_compound_stmt > a__ss_statement__parent, ptr< ss_sp > a__ss_statement__psp, ptr< ss_sp > a__ss_statement__nsp, ptr< ::lestes::std::list< srp< ss_sp > > > a__ss_statement__sequence_points, ptr< ss_decl_seq > a__ss_compound_stmt__decl_seq, ptr< ::lestes::std::list< srp< ss_statement > > > a__ss_compound_stmt__statements, ptr< ss_sp > a__ss_compound_stmt__destructor_sp)
 Second generated factory method for class ss_compound_stmt.

Protected Member Functions

 ss_compound_stmt (ptr< ::lestes::std::source_location > a__ss_base_with_location__location, ptr< ::lestes::std::list< srp< ss_label > > > a__ss_statement__labels, ptr< ss_compound_stmt > a__ss_statement__parent, ptr< ss_sp > a__ss_statement__psp, ptr< ss_sp > a__ss_statement__nsp, ptr< ::lestes::std::list< srp< ss_sp > > > a__ss_statement__sequence_points, ptr< ss_decl_seq > a__ss_compound_stmt__decl_seq, ptr< ::lestes::std::list< srp< ss_statement > > > a__ss_compound_stmt__statements, ptr< ss_sp > a__ss_compound_stmt__destructor_sp, behavior_type a__ss_compound_stmt__behavior)
 Generated constructor for class ss_compound_stmt.
virtual void gc_mark ()
 Marking routine for class ss_compound_stmt.

Private Attributes

srp< ss_decl_seqdecl_seq
 The sequence of declaration declared in this compound statement.Used as scope.
srp< ::lestes::std::list<
srp< ss_statement > > > 
statements
 The sequence of statements in this compound statement.
srp< ss_spdestructor_sp
 Special sequence point for separating statements in compound_stmt and destructors for local variables created in current compound_stmt, which shall be destroyed at the end [].
behavior_type behavior

Static Private Attributes

static ptr< ss_compound_stmtthe_root_instance = the_root_instance
static ptr< reflection_listreflection = reflection

Detailed Description

Class for compound statement.

Definition at line 128 of file ss_statement.g.hh.


Member Enumeration Documentation

enum lestes::lang::cplus::sem::ss_compound_stmt::behavior_type

Enumerator:
NORMAL 
NO_CREATE 
NO_LEAVE 

Definition at line 130 of file ss_statement.g.hh.

00130                            {
00131                 NORMAL,
00132                 NO_CREATE,
00133                 NO_LEAVE
00134         };


Constructor & Destructor Documentation

lestes::lang::cplus::sem::ss_compound_stmt::ss_compound_stmt ( ptr< ::lestes::std::source_location a__ss_base_with_location__location,
ptr< ::lestes::std::list< srp< ss_label > > >  a__ss_statement__labels,
ptr< ss_compound_stmt a__ss_statement__parent,
ptr< ss_sp a__ss_statement__psp,
ptr< ss_sp a__ss_statement__nsp,
ptr< ::lestes::std::list< srp< ss_sp > > >  a__ss_statement__sequence_points,
ptr< ss_decl_seq a__ss_compound_stmt__decl_seq,
ptr< ::lestes::std::list< srp< ss_statement > > >  a__ss_compound_stmt__statements,
ptr< ss_sp a__ss_compound_stmt__destructor_sp,
behavior_type  a__ss_compound_stmt__behavior 
) [protected]

Generated constructor for class ss_compound_stmt.

Generated constructor for class ss_compound_stmt.

Author:
lsg

Definition at line 263 of file ss_statement.g.cc.

Referenced by create(), and root_instance().

00273         : ss_statement(a__ss_base_with_location__location,
00274                 a__ss_statement__labels,
00275                 a__ss_statement__parent,
00276                 a__ss_statement__psp,
00277                 a__ss_statement__nsp,
00278                 a__ss_statement__sequence_points), decl_seq(checked(a__ss_compound_stmt__decl_seq)), statements(checked(a__ss_compound_stmt__statements)), destructor_sp(checked(a__ss_compound_stmt__destructor_sp)), behavior(a__ss_compound_stmt__behavior)
00279 {}


Member Function Documentation

ptr< ss_decl_seq > lestes::lang::cplus::sem::ss_compound_stmt::decl_seq_get (  )  const

The method decl_seq_get returns the value of the field ss_compound_stmt::decl_seq.

Returns:
The value of ss_compound_stmt::decl_seq.
Author:
lsg

Definition at line 160 of file ss_statement.g.cc.

References decl_seq.

00161 {
00162         return decl_seq;
00163 }

ptr<::lestes::std::list< srp< ss_statement > > > lestes::lang::cplus::sem::ss_compound_stmt::statements_get (  )  const

The method statements_get returns the value of the field ss_compound_stmt::statements.

Returns:
The value of ss_compound_stmt::statements.
Author:
lsg

Definition at line 169 of file ss_statement.g.cc.

References statements.

00170 {
00171         return statements;
00172 }

ptr< ss_sp > lestes::lang::cplus::sem::ss_compound_stmt::destructor_sp_get (  )  const

The method destructor_sp_get returns the value of the field ss_compound_stmt::destructor_sp.

Returns:
The value of ss_compound_stmt::destructor_sp.
Author:
lsg

Definition at line 178 of file ss_statement.g.cc.

References destructor_sp.

00179 {
00180         return destructor_sp;
00181 }

void lestes::lang::cplus::sem::ss_compound_stmt::destructor_sp_set ( const ptr< ss_sp > &  x  ) 

The method destructor_sp_set sets the field ss_compound_stmt::destructor_sp to the given value.

Parameters:
[in] x The new value to set ss_compound_stmt::destructor_sp to.
Author:
lsg

Definition at line 187 of file ss_statement.g.cc.

References destructor_sp.

00188 {
00189         ss_compound_stmt::destructor_sp = x;
00190 }

ss_compound_stmt::behavior_type lestes::lang::cplus::sem::ss_compound_stmt::behavior_get (  )  const

The method behavior_get returns the value of the field ss_compound_stmt::behavior.

Returns:
The value of ss_compound_stmt::behavior.
Author:
lsg

Definition at line 196 of file ss_statement.g.cc.

References behavior.

00197 {
00198         return behavior;
00199 }

void lestes::lang::cplus::sem::ss_compound_stmt::behavior_set ( behavior_type  x  ) 

The method behavior_set sets the field ss_compound_stmt::behavior to the given value.

Parameters:
[in] x The new value to set ss_compound_stmt::behavior to.
Author:
lsg

Definition at line 205 of file ss_statement.g.cc.

References behavior.

00206 {
00207         ss_compound_stmt::behavior = x;
00208 }

ptr< ss_compound_stmt > lestes::lang::cplus::sem::ss_compound_stmt::root_instance (  )  [static]

Returns pointer to the instance of root (grandparent) ss_compound_stmt.

When called for the first time, constructs the grandparent of all instances of ss_compound_stmt. This means that you can simply recognize it, just compare your ptr to the return value of this method.

Note that the instance is its own parent. Also note that when creating it, root ss_decl_seq must be created too. This is achieved by calling ss_decl_seq::root_instance(), which might in turn call us back. The code is prepared for this. You can choose which of the two methods you call first.

Returns:
Pointer to the instance of root ss_compound_stmt.

Definition at line 72 of file ss_statement.cc.

References lestes::intercode::intercode::create(), loc, NORMAL, lestes::lang::cplus::sem::ss_statement::nsp, lestes::lang::cplus::sem::ss_statement::psp, lestes::lang::cplus::sem::ss_decl_seq::root_instance(), ss_compound_stmt(), and the_root_instance.

Referenced by lestes::lang::cplus::sem::or_builtin_operator_declaration_creator::construct_builtin_op(), lestes::lang::cplus::sem::or_builtin_operator_declaration_creator::instance(), main(), and lestes::lang::cplus::sem::ss_decl_seq::root_instance().

00073 {
00074         if (!the_root_instance) {
00075                 /* this calls us recursively */
00076                 ptr < ss_decl_seq > root_decl_seq = ss_decl_seq::root_instance();
00077 
00078                 /* It is somewhat complicated to tell when the control flow
00079                  * reaches the following statement.
00080                  *
00081                  * Firstly, someone from the ``outer world'' might call
00082                  * ss_decl_seq::root_instance(). Then the root instance object
00083                  * of the type ss_decl_seq gets constructed and we get called
00084                  * after the ss_decl_seq root object already exists. Therefore
00085                  * it is safe to call ss_decl_seq::root_instance() to get that
00086                  * object, because the function will return immediately with
00087                  * the allready constucted, albeit incompletelly initialized
00088                  * object.
00089                  *
00090                  * Secondly, someone from the ``outer world'' might call us in
00091                  * the first place. Then We would initiate the first ever
00092                  * ss_decl_seq::root_instance() call. The same applies as for
00093                  * the first case.
00094                  *
00095                  * It is perhaps easiest to state the invariants.
00096                  * \invariant If ss_decl_seq::root_instance() is called first,
00097                  * then the ss_decl_seq::the_root_instance is created but not
00098                  * fully initialized before ss_statement::root_instance() is
00099                  * called for the first time.
00100                  * \invariant The ss_decl_seq::root_instance() function will
00101                  * call ss_statement::root_instance() on its first invocation
00102                  * only.
00103                  *
00104                  * Therefore, it can be concluded, that the following statement
00105                  * will be executed only after the second (and not necessarily
00106                  * the first) invocation of ss_decl_seq::root_instance() has
00107                  * finished.
00108                  *
00109                  * The only remaining question is in what state will be the
00110                  * following statement encountered. The
00111                  * ss_decl_seq::root_instance() will return a partially
00112                  * initialized ss_decl_seq instance. If the
00113                  * ss_decl_seq::root_instance() was called in the first place,
00114                  * the statement will be executed only once.  If, however, the
00115                  * ss_statement::root_instance() was called in the first place,
00116                  * then the statement will be encountered twice.  The condition
00117                  * will evaluate to false in the first encounter, so the
00118                  * control flow will proceed to the ss_statement root instance
00119                  * creation.  The condition will evaluate to true on the second
00120                  * encounter, because the root instance was created after the
00121                  * first encounter.
00122                  */
00123                 if (the_root_instance)
00124                         return the_root_instance;
00125 
00126                 /* A non-null location is needed.  We can obtain the location
00127                  * from the ss_decl_seq's root instance */
00128                 ptr < source_location > loc = root_decl_seq->location_get();
00129                 /* create some sequence points */
00130                 ptr < ss_sp > psp = ss_sp::create(loc, NULL, NULL, 0),
00131                         nsp = ss_sp::create(loc, NULL, NULL, 0),
00132                         dsp = ss_sp::create(loc, NULL, NULL, 0);
00133                 /* link them together */
00134                 psp->nsp_set(dsp);
00135                 dsp->nsp_set(nsp);
00136                 dsp->psp_set(psp);
00137                 nsp->psp_set(dsp);
00138                 the_root_instance = new ss_compound_stmt(
00139                                 loc,
00140                                 list< srp<ss_label> >::create(), NULL, psp, nsp,
00141                                 list< srp<ss_sp> >::create(),
00142                                 root_decl_seq,
00143                                 list< srp<ss_statement> >::create(), dsp,
00144                                 NORMAL
00145                                 );
00146                 /* insert sequence points to the list */
00147                 the_root_instance->sequence_points_get()->push_back(psp);
00148                 the_root_instance->sequence_points_get()->push_back(nsp);
00149                 the_root_instance->sequence_points_get()->push_back(dsp);
00150                 /* See documentation for the method above... */
00151                 the_root_instance->parent_set_once_hack( the_root_instance );
00152                 /* we do not set decl_seq when calling new above, as the root decl_seq might not
00153                  * be created yet. it calls us back, so we avoid recursion by setting it here
00154                  */
00155                 //the_root_instance->decl_seq = ss_decl_seq::root_instance();
00156         }
00157         return the_root_instance;
00158 }

void lestes::lang::cplus::sem::ss_compound_stmt::accept_ss_statement_visitor ( ptr< ss_statement_visitor v  )  [virtual]

Implements lestes::lang::cplus::sem::ss_statement.

Definition at line 210 of file ss_statement.g.cc.

00211 {
00212         return v->visit_ss_compound_stmt( this );
00213 }

ptr< ss_compound_stmt > lestes::lang::cplus::sem::ss_compound_stmt::create ( ptr< ::lestes::std::source_location a__ss_base_with_location__location,
ptr< ::lestes::std::list< srp< ss_label > > >  a__ss_statement__labels,
ptr< ss_compound_stmt a__ss_statement__parent,
ptr< ss_sp a__ss_statement__psp,
ptr< ss_sp a__ss_statement__nsp,
ptr< ::lestes::std::list< srp< ss_sp > > >  a__ss_statement__sequence_points,
ptr< ss_decl_seq a__ss_compound_stmt__decl_seq,
ptr< ::lestes::std::list< srp< ss_statement > > >  a__ss_compound_stmt__statements,
ptr< ss_sp a__ss_compound_stmt__destructor_sp,
behavior_type  a__ss_compound_stmt__behavior 
) [static]

First generated factory method for class ss_compound_stmt.

This factory method for class ss_compound_stmt takes values of all fields as arguments.

Author:
lsg

Definition at line 219 of file ss_statement.g.cc.

References ss_compound_stmt().

00229 {
00230         return ptr< ss_compound_stmt > ( new ss_compound_stmt(a__ss_base_with_location__location,
00231                 a__ss_statement__labels,
00232                 a__ss_statement__parent,
00233                 a__ss_statement__psp,
00234                 a__ss_statement__nsp,
00235                 a__ss_statement__sequence_points,
00236                 a__ss_compound_stmt__decl_seq,
00237                 a__ss_compound_stmt__statements,
00238                 a__ss_compound_stmt__destructor_sp,
00239                 a__ss_compound_stmt__behavior) );
00240 }

ptr< ss_compound_stmt > lestes::lang::cplus::sem::ss_compound_stmt::create ( ptr< ::lestes::std::source_location a__ss_base_with_location__location,
ptr< ::lestes::std::list< srp< ss_label > > >  a__ss_statement__labels,
ptr< ss_compound_stmt a__ss_statement__parent,
ptr< ss_sp a__ss_statement__psp,
ptr< ss_sp a__ss_statement__nsp,
ptr< ::lestes::std::list< srp< ss_sp > > >  a__ss_statement__sequence_points,
ptr< ss_decl_seq a__ss_compound_stmt__decl_seq,
ptr< ::lestes::std::list< srp< ss_statement > > >  a__ss_compound_stmt__statements,
ptr< ss_sp a__ss_compound_stmt__destructor_sp 
) [static]

Second generated factory method for class ss_compound_stmt.

This factory method for class ss_compound_stmt uses initializers.

Author:
lsg

Definition at line 246 of file ss_statement.g.cc.

References NORMAL, and ss_compound_stmt().

00255 {
00256         return ptr< ss_compound_stmt > ( new ss_compound_stmt(a__ss_base_with_location__location, a__ss_statement__labels, a__ss_statement__parent, a__ss_statement__psp, a__ss_statement__nsp, a__ss_statement__sequence_points, a__ss_compound_stmt__decl_seq, a__ss_compound_stmt__statements, a__ss_compound_stmt__destructor_sp, NORMAL) );
00257 }

ptr< object::reflection_list > lestes::lang::cplus::sem::ss_compound_stmt::reflection_get (  )  const [virtual]

for purposes of dumping

Reimplemented from lestes::lang::cplus::sem::ss_statement.

Definition at line 281 of file ss_statement.g.cc.

References lestes::std::list< T >::create(), reflection, and lestes::lang::cplus::sem::ss_statement::reflection_get().

00282 {
00283         if (!reflection) {
00284                 typedef class_reflection::field_metadata md;
00285                 typedef class_reflection::field_metadata_list mdlist;
00286                 ptr<mdlist> mdl = mdlist::create();
00287                 mdl->push_back( md::create( "decl_seq", "ss_decl_seq" ) );
00288                 mdl->push_back( md::create( "statements", "list&lt; srp&lt; ss_statement &gt; &gt;" ) );
00289                 mdl->push_back( md::create( "destructor_sp", "ss_sp" ) );
00290                 mdl->push_back( md::create( "the_root_instance", "ss_compound_stmt" ) );
00291                 mdl->push_back( md::create( "behavior", "behavior_type" ) );
00292                 reflection = reflection_list::create( ss_statement::reflection_get() );
00293                 reflection->push_back( class_reflection::create( "ss_compound_stmt", mdl ) );
00294         }
00295         return reflection;
00296 }

ptr< object::field_list_list > lestes::lang::cplus::sem::ss_compound_stmt::field_values_get (  )  const [virtual]

for purposes of dumping

Reimplemented from lestes::lang::cplus::sem::ss_statement.

Definition at line 298 of file ss_statement.g.cc.

References lestes::std::list< T >::create(), and lestes::lang::cplus::sem::ss_statement::field_values_get().

00299 {
00300         ptr < field_list_list > result = ss_statement::field_values_get();
00301         result->push_back( value_list::create() );
00302         result->back()->push_back( this->decl_seq );
00303         result->push_back( value_list::create() );
00304         result->back()->push_back( this->statements );
00305         result->push_back( value_list::create() );
00306         result->back()->push_back( this->destructor_sp );
00307         result->push_back( value_list::create() );
00308         result->back()->push_back( this->the_root_instance );
00309         result->push_back( value_list::create() );
00310         result->back()->push_back( objectize< behavior_type > ::create( this->behavior ) );
00311         return result;
00312 }

void lestes::lang::cplus::sem::ss_compound_stmt::gc_mark ( void   )  [protected, virtual]

Marking routine for class ss_compound_stmt.

Marking routine is used for garbage collection.

Author:
lsg

Reimplemented from lestes::lang::cplus::sem::ss_statement.

Definition at line 319 of file ss_statement.g.cc.

References lestes::lang::cplus::sem::ss_statement::gc_mark().

00320 {
00321         ss_statement::gc_mark();
00322 }


Member Data Documentation

srp< ss_decl_seq > lestes::lang::cplus::sem::ss_compound_stmt::decl_seq [private]

The sequence of declaration declared in this compound statement.Used as scope.

Definition at line 210 of file ss_statement.g.hh.

Referenced by decl_seq_get().

srp< ::lestes::std::list< srp< ss_statement > > > lestes::lang::cplus::sem::ss_compound_stmt::statements [private]

The sequence of statements in this compound statement.

Declarations declared in this compound statement have their associated decl_stmt inserted to the statement list.

Definition at line 216 of file ss_statement.g.hh.

Referenced by statements_get().

srp< ss_sp > lestes::lang::cplus::sem::ss_compound_stmt::destructor_sp [private]

Special sequence point for separating statements in compound_stmt and destructors for local variables created in current compound_stmt, which shall be destroyed at the end [].

Definition at line 218 of file ss_statement.g.hh.

Referenced by destructor_sp_get(), and destructor_sp_set().

ptr< ss_compound_stmt > lestes::lang::cplus::sem::ss_compound_stmt::the_root_instance = the_root_instance [static, private]

Definition at line 219 of file ss_statement.g.hh.

Referenced by root_instance().

behavior_type lestes::lang::cplus::sem::ss_compound_stmt::behavior [private]

Definition at line 220 of file ss_statement.g.hh.

Referenced by behavior_get(), and behavior_set().

ptr< object::reflection_list > lestes::lang::cplus::sem::ss_compound_stmt::reflection = reflection [static, private]

Reimplemented from lestes::lang::cplus::sem::ss_statement.

Definition at line 221 of file ss_statement.g.hh.

Referenced by reflection_get().


The documentation for this class was generated from the following files:
Generated on Mon Feb 12 18:25:27 2007 for lestes by doxygen 1.5.1-20070107