comma::AggregateExpr Class Reference

#include <AggExpr.h>

Inheritance diagram for comma::AggregateExpr:
Inheritance graph
[legend]
Collaboration diagram for comma::AggregateExpr:
Collaboration graph
[legend]

List of all members.

Classes

class  KeyIterator

Public Member Functions

 ~AggregateExpr ()
 AggregateExpr (Location loc)
bool empty () const
 Returns true if this aggregate is empty.
bool hasStaticIndices () const
 Returns true if the indices defined by this aggregate are statically known.
unsigned numComponents () const
 If hasStaticIndices is true, returns the total number of components defined by this aggregate.
bool isPurelyPositional () const
 Returns true if this aggregate consists of positional components exclusively.
bool isPurelyKeyed () const
 Returns true if this aggregate consists of keyed components exclusively.
bool hasOthers () const
 Returns true if this aggregate has a others component.
Location getOthersLoc () const
 Returns the location of the others reserved word, or an invalid location if hasOthers() returns false.
void addOthersExpr (Location loc, Expr *component)
void setOthersExpr (Expr *expr)
 Replaces an existing others expression.
Positional Components.

An AggregateExpr node contains a (possibly empty) set of positional expressions. The following methods provide access to these components.



bool hasPositionalComponents () const
 Returns true if this aggregate contains any positional components.
unsigned numPositionalComponents () const
 Returns the number of positional components in this aggregate.
void addComponent (Expr *expr)
 Adds a positional component to this aggregate expression.
Keyed Components.



void addComponent (ComponentKeyList *keyList)
 Adds a ComponentKeyList this KeyedAggExpr.
bool hasKeyedComponents () const
 Returns true if this aggregate contains any keyed components.
unsigned numKeyLists () const
 Returns the number of key lists provided by this aggregate.
unsigned numKeys () const
 Returns the total number of keys provided by this aggregate.



ExprgetOthersExpr ()
const ExprgetOthersExpr () const

Static Public Member Functions

static bool classof (const AggregateExpr *node)
 Support isa and dyn_cast.
static bool classof (const Ast *node)

Positional Component Iterators.



typedef std::vector< Expr * >
::iterator 
pos_iterator
typedef std::vector< Expr * >
::const_iterator 
const_pos_iterator
pos_iterator pos_begin ()
pos_iterator pos_end ()
const_pos_iterator pos_begin () const
const_pos_iterator pos_end () const

ComponentKeyList Iterators.

Iterators over the key lists associated with this aggregate.



typedef std::vector
< ComponentKeyList * >
::iterator 
kl_iterator
typedef std::vector
< ComponentKeyList * >
::const_iterator 
const_kl_iterator
kl_iterator kl_begin ()
kl_iterator kl_end ()
const_kl_iterator kl_begin () const
const_kl_iterator kl_end () const

Key Iterators.

Iterators over each key associated with this aggregate.

These iterators traverse the set of keys in the order they were added to the aggregate node.



typedef KeyIterator key_iterator
key_iterator key_begin ()
key_iterator key_end ()

Detailed Description

Definition at line 378 of file AggExpr.h.


Member Typedef Documentation

typedef std::vector<ComponentKeyList*>::const_iterator comma::AggregateExpr::const_kl_iterator

Definition at line 495 of file AggExpr.h.

typedef std::vector<Expr*>::const_iterator comma::AggregateExpr::const_pos_iterator

Definition at line 460 of file AggExpr.h.

Definition at line 578 of file AggExpr.h.

typedef std::vector<ComponentKeyList*>::iterator comma::AggregateExpr::kl_iterator

Definition at line 491 of file AggExpr.h.

typedef std::vector<Expr*>::iterator comma::AggregateExpr::pos_iterator

Definition at line 456 of file AggExpr.h.


Constructor & Destructor Documentation

AggregateExpr::~AggregateExpr (  ) 

Definition at line 134 of file AggExpr.cpp.

comma::AggregateExpr::AggregateExpr ( Location  loc  )  [inline]

Constructs an empty AggregateExpr. Components of this aggregate are introduced via calls to addComponent().

Definition at line 385 of file AggExpr.h.


Member Function Documentation

void comma::AggregateExpr::addComponent ( ComponentKeyList keyList  )  [inline]

Adds a ComponentKeyList this KeyedAggExpr.

Definition at line 474 of file AggExpr.h.

void comma::AggregateExpr::addComponent ( Expr expr  )  [inline]

Adds a positional component to this aggregate expression.

The order in which this method is called determines the order of the components.

Definition at line 450 of file AggExpr.h.

void comma::AggregateExpr::addOthersExpr ( Location  loc,
Expr component 
) [inline]

Associates an expression with the others component of this aggregate.

Aggregates cannot hold multiple others components. This method will assert if called more than once.

Parameters:
loc Location of the others reserved word.
component The expression associated with others.

Definition at line 608 of file AggExpr.h.

static bool comma::AggregateExpr::classof ( const Ast node  )  [inline, static]

Reimplemented from comma::Expr.

Definition at line 624 of file AggExpr.h.

static bool comma::AggregateExpr::classof ( const AggregateExpr node  )  [inline, static]

Support isa and dyn_cast.

Reimplemented from comma::Expr.

Definition at line 623 of file AggExpr.h.

bool AggregateExpr::empty (  )  const

Returns true if this aggregate is empty.

An aggregate is empty if there are no components associated with the expression and there is no others clause. Aggregate expression nodes should never be empty in a well-formed Comma program.

Definition at line 146 of file AggExpr.cpp.

const Expr* comma::AggregateExpr::getOthersExpr (  )  const [inline]

Returns the expression associated with a others component or null if there is no others expression.

Definition at line 593 of file AggExpr.h.

Expr* comma::AggregateExpr::getOthersExpr (  )  [inline]

Returns the expression associated with a others component or null if there is no others expression.

Definition at line 592 of file AggExpr.h.

Location comma::AggregateExpr::getOthersLoc (  )  const [inline]

Returns the location of the others reserved word, or an invalid location if hasOthers() returns false.

Definition at line 598 of file AggExpr.h.

bool comma::AggregateExpr::hasKeyedComponents (  )  const [inline]

Returns true if this aggregate contains any keyed components.

Definition at line 479 of file AggExpr.h.

bool comma::AggregateExpr::hasOthers (  )  const [inline]

Returns true if this aggregate has a others component.

Definition at line 587 of file AggExpr.h.

bool comma::AggregateExpr::hasPositionalComponents (  )  const [inline]

Returns true if this aggregate contains any positional components.

Definition at line 437 of file AggExpr.h.

bool AggregateExpr::hasStaticIndices (  )  const

Returns true if the indices defined by this aggregate are statically known.

In particular, if this aggregate contains any keyed components, the keys must be static expressions, ranges, or discrete types. Positional components are always considered to define static indices.

Note:
This predicate is indifferent to whether this aggregate has an others clause.

Definition at line 159 of file AggExpr.cpp.

bool comma::AggregateExpr::isPurelyKeyed (  )  const [inline]

Returns true if this aggregate consists of keyed components exclusively.

Note:
This predicate is indifferent to whether this aggregate has an others clause.

Definition at line 428 of file AggExpr.h.

bool comma::AggregateExpr::isPurelyPositional (  )  const [inline]

Returns true if this aggregate consists of positional components exclusively.

Note:
This predicate is indifferent to whether this aggregate has an others clause.

Definition at line 421 of file AggExpr.h.

key_iterator comma::AggregateExpr::key_begin (  )  [inline]

Definition at line 579 of file AggExpr.h.

key_iterator comma::AggregateExpr::key_end (  )  [inline]

Definition at line 580 of file AggExpr.h.

const_kl_iterator comma::AggregateExpr::kl_begin (  )  const [inline]

Definition at line 496 of file AggExpr.h.

kl_iterator comma::AggregateExpr::kl_begin (  )  [inline]

Definition at line 492 of file AggExpr.h.

const_kl_iterator comma::AggregateExpr::kl_end (  )  const [inline]

Definition at line 497 of file AggExpr.h.

kl_iterator comma::AggregateExpr::kl_end (  )  [inline]

Definition at line 493 of file AggExpr.h.

unsigned AggregateExpr::numComponents (  )  const

If hasStaticIndices is true, returns the total number of components defined by this aggregate.

Note:
For aggregates with a dynamic (non-static) keyed component or an others clause, this method will return 0.
This method scans the entire aggregate and recomputes the number of components on each call. Use sparingly as aggregates can potentially be quite large.

Definition at line 172 of file AggExpr.cpp.

unsigned comma::AggregateExpr::numKeyLists (  )  const [inline]

Returns the number of key lists provided by this aggregate.

Definition at line 482 of file AggExpr.h.

unsigned AggregateExpr::numKeys (  )  const

Returns the total number of keys provided by this aggregate.

Definition at line 151 of file AggExpr.cpp.

unsigned comma::AggregateExpr::numPositionalComponents (  )  const [inline]

Returns the number of positional components in this aggregate.

Definition at line 442 of file AggExpr.h.

const_pos_iterator comma::AggregateExpr::pos_begin (  )  const [inline]

Definition at line 461 of file AggExpr.h.

pos_iterator comma::AggregateExpr::pos_begin (  )  [inline]

Definition at line 457 of file AggExpr.h.

const_pos_iterator comma::AggregateExpr::pos_end (  )  const [inline]

Definition at line 464 of file AggExpr.h.

pos_iterator comma::AggregateExpr::pos_end (  )  [inline]

Definition at line 458 of file AggExpr.h.

void comma::AggregateExpr::setOthersExpr ( Expr expr  )  [inline]

Replaces an existing others expression.

Definition at line 615 of file AggExpr.h.


The documentation for this class was generated from the following files:

Generated on 1 Feb 2010 for Comma by  doxygen 1.6.1