0025790: Drop unimplemented method ShallowCopy() from TCollection_HSequence.cdl
[occt.git] / src / TCollection / TCollection_Array1.gxx
CommitLineData
b311480e 1// Copyright (c) 1993-1999 Matra Datavision
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
d5f74e42 6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
b311480e 14
7fd59977 15#include <Standard_DimensionMismatch.hxx>
7fd59977 16
7fd59977 17
efef9da8
RL
18//=======================================================================
19//function : Init
20//purpose :
21//=======================================================================
22
23void TCollection_Array1::Init (const Array1Item& V) {
24 Array1Item* p = &ChangeValue(myLowerBound);
25 const Standard_Integer n = Length();
26 for(Standard_Integer i = 0; i < n; i++) {
27 p[i] = V;
28 }
29}
30
7fd59977 31//=======================================================================
32//function : Assign
33//purpose :
34//=======================================================================
35
36const TCollection_Array1& TCollection_Array1::Assign
37 (const TCollection_Array1& Right)
38{
39 if (&Right != this) {
40 Standard_Integer max = Length() ;
41 Standard_DimensionMismatch_Raise_if(max != Right.Length(),
42 "DimensionMismatch in Array1::Operator=");
43
44 Array1Item* p = &ChangeValue(myLowerBound);
45 const Array1Item* q = &Right.Value(Right.Lower());
46 for (Standard_Integer i=0; i<max; i++){
47 *p++ = *q++;
48 }
49 }
50 return *this;
51}
52
53
54
55
56