Changeset 1165


Ignore:
Timestamp:
Aug 12, 2003, 11:10:45 PM (17 years ago)
Author:
sveta
Message:
  • Constructor for Table_Copy is added.
Location:
to-imperative/trunk/runtime
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/runtime/rf_table.hh

    r1123 r1165  
    3333
    3434  inline Table ();
     35  inline Table (Table const&);
    3536  inline ~Table();
    3637  inline void unbind (Expr& _key);
     
    3839  inline bool in_table (Expr const& _key);
    3940  inline Expr domain ();
    40   inline void table_copy (Table& _tab);
    4141  inline void replace_table (Table const& _tab);
    4242  inline void bind (Expr const& _key, Expr const& _val);
  • to-imperative/trunk/runtime/rf_table.ih

    r1126 r1165  
    2222  count ++;
    2323}
     24
     25inline Table::Table(Table const& _tab)
     26  : Object()
     27{
     28  count++;
     29  if (_tab.root == TableNode::nil)
     30    root = TableNode::nil;
     31  else {
     32    TableNode* node = new TableNode;
     33    root = node;
     34    node->p = TableNode::nil;
     35    copy_tree(*(_tab.root), *node);
     36  }
     37}       
     38
    2439
    2540inline unsigned Table::get_type () const
     
    116131    return true;
    117132}
    118 
    119  
    120 //
    121 // Table_copy : this - sourceTable, newTable - result
    122 inline void Table::table_copy (Table& _new_table)
    123 
    124   TableNode* node;
    125   if (root != TableNode::nil) {
    126     node = new TableNode;
    127     node->p = TableNode::nil;       
    128     _new_table.root = node;   // p - root 
    129     copy_tree(*root, *node);  // p - root
    130   }
    131 }
    132 
    133133 
    134134//
Note: See TracChangeset for help on using the changeset viewer.