Changeset 1120
 Timestamp:
 Aug 7, 2003, 10:47:14 PM (17 years ago)
 Location:
 toimperative/trunk/runtime
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

toimperative/trunk/runtime/rf_vector.hh
r1098 r1120 30 30 31 31 inline bool operator == (Object const& _obj) const ; 32 33 inline void vector_to_exp (Expr& _exp); 34 inline void vector_init (size_t _length, Expr const& _fill); 35 inline void vector_fill (Expr const& _fill); 36 inline void vector_replace (size_t _length, Expr const& exp); 37 inline void subvector_fill (size_t _index, size_t _length, Expr const& _fill); 32 inline const Vector& operator = (Vector const&); 38 33 }; 39 34 
toimperative/trunk/runtime/rf_vector.ih
r1098 r1120 10 10 namespace rftype 11 11 { 12 13 /*inline Vector::Vector(Vector const& _vector) 14 { 15 new(this) Vector(_vector.length); 16 for (size_t i = 0; i < _vector.length; i++) 17 self[i] = _vector[i]; 18 }*/ 12 19 13 20 inline Vector::Vector (size_t _length /* = 0 */) : … … 39 46 if (!v) 40 47 FATAL ("Invalid argument"); 41 for (size_t i = 0; i < (v>get_length()); i++)42 self[index++] = (*v)[i];43 48 } 44 49 } … … 52 57 self[i] = _vector[_index + i]; 53 58 } 54 55 59 56 60 inline unsigned Vector::get_type () const … … 82 86 } 83 87 84 inline void Vector::vector_to_exp (Expr& _exp)88 inline const Vector& Vector::operator= (Vector const& _vector) 85 89 { 86 for (size_t i = 0; i < get_length(); i++) 87 _exp = _exp + self[i]; 90 if (this != &_vector) { 91 this>~Vector(); 92 new (this) Vector(_vector.get_length()); 93 for (size_t i = 0; i < _vector.get_length(); i++) 94 self[i] = _vector[i]; 95 } 96 return self; 88 97 } 89 90 inline void Vector::vector_init (size_t _length, Expr const& _fill) 91 { 92 size_t n = get_length(); 93 if (n < _length) 94 expand (_length  n); 95 else 96 if (n > _length) 97 decrease(n  _length); 98 n = _length; 99 for ( ; n ; n) 100 self[n1] = _fill(); 101 } 102 103 inline void Vector::vector_replace (size_t _length, Expr const& _exp) 104 { 105 size_t n = get_length(); 106 if (n < _length) 107 expand (_length  n); 108 else 109 if (n > _length) 110 decrease(n  _length); 111 Term* p = _exp.get_first(); 112 Term* q = _exp.get_last(); 113 n = 0; 114 for ( ; p < q ; p++) 115 self[n++] = (Expr(p))(); 116 } 117 118 inline void Vector::vector_fill (Expr const& _fill) 119 { 120 for (size_t i = 0; i < get_length(); i++) 121 self[i] = _fill(); 122 } 123 124 inline void Vector::subvector_fill (size_t _index, size_t _length, Expr const& _fill) 125 { 126 for (size_t i = 0; i < _length; i++) 127 self[_index + i] = _fill(); 128 } 98 129 99 130 100 }
Note: See TracChangeset
for help on using the changeset viewer.