Changeset a32b204 for translator/InitTweak/Association.h
- Timestamp:
- May 17, 2015, 1:19:35 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 0dd3a2f
- Parents:
- b87a5ed
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/InitTweak/Association.h
rb87a5ed ra32b204 70 70 71 71 virtual long int add_single( long int idx, Expression *newExpr) { 72 if ( expr == 0 ) //|| *expr == *newExpr )72 if ( expr == 0 ) //|| *expr == *newExpr ) 73 73 expr = newExpr; 74 74 return 0; … … 76 76 77 77 virtual long int add_single( std::string str, Expression *newExpr) { 78 if ( expr == 0 ) //|| *expr == *newExpr )78 if ( expr == 0 ) //|| *expr == *newExpr ) 79 79 expr = newExpr; 80 80 return 0; … … 114 114 long int ret; 115 115 116 if ( idx >= (long int)ordering.size() ) throw AssocException("extra (spurious) members");116 if ( idx >= (long int)ordering.size() ) throw AssocException("extra (spurious) members"); 117 117 118 118 if ( ordering[ idx ] == "") … … 127 127 128 128 virtual long int add_single( std::string idx, Expression *expr) { 129 if ( idx == "" )129 if ( idx == "" ) 130 130 std::cerr << "Checkpoint 1" << std::endl; 131 131 else { … … 143 143 if ( table.find( str ) != table.end() ) return; 144 144 ordering.push_back( str ); 145 if ( str != "" ) {145 if ( str != "" ) { 146 146 std::pair<long int, Association *> p( ordering.size() - 1, 0 ); 147 147 table.insert( std::pair< std::string, std::pair<long int, Association *> >(str, p) ); … … 151 151 152 152 virtual void set_member( std::string str, Association *assoc ) { 153 if ( str == "" )153 if ( str == "" ) 154 154 anonym.push_back( assoc ); 155 155 else if ( table.find( str ) == table.end() ) … … 162 162 163 163 virtual Association *operator[]( int idx ) { 164 if ( ordering[idx] == "" ) {164 if ( ordering[idx] == "" ) { 165 165 std::cerr << "Error, anonymous members not implemented yet" << std::endl; 166 166 throw 0; … … 187 187 virtual void display( std::ostream &os ) { 188 188 os << "Point association: " << std::endl; 189 for ( map_type::iterator i = table.begin(); i != table.end(); i++ ) {189 for ( map_type::iterator i = table.begin(); i != table.end(); i++ ) { 190 190 os << "Member [" << i->first << ", index = " << i->second.first << "]"; 191 191 if ( i->second.second != 0 ) … … 244 244 diet::diet_tree<int> tree; 245 245 /* 246 for ( diet_tree<int>::iterator i = tree.begin(); i != tree.end(); i++ )246 for ( diet_tree<int>::iterator i = tree.begin(); i != tree.end(); i++ ) 247 247 std::cout << "--(" << (*i).first << ", " << (*i).second << ")--" << std::endl; 248 248 diet_tree<int> tree;
Note: See TracChangeset
for help on using the changeset viewer.