// Copyright (c) 1998-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #include #include #include #include //#include #include #ifdef OBJS #include // taille a partir de laquelle la tableau cre son propre container // #define DBC_TAILLE_PLAFOND_CREATION_SEGMENT 10000 #include #include // just use for internal generic identifiaction of Item // static PStandard_ArrayNode DBC_tmpItem; #endif #ifdef OO2 #include #endif // -------------------------------------------------------------------- // BaseArray implementation : Temporary arrays known as variable-size arrays. // BaseArray of BaseArray is not supported in this version. // // Last Revision : Feb,10 1992 J.P Tirault // . Implementation of Lock/Unlock methods : // . Implementation of ShallowCopy,ShallowDump,IsSameState. // // Last Revision : April,4 1992 J.P Tirault, R Barreto // . Implementation for Object store. // . Implementation for Memory. // // Last Revision : September,17 1992 J.P Tirault // . Free old area in Resize method. // Last revision : January,18 1995 N. Massip // . Implementation for ObjectStore // with an c++ persistent array // This version store all the information for the Item // in case of non primitive type, the handle, the Standard oid, // and the object itself are stored // if the oid_standard disapear, it may become interresting to // store only the object itself. So a special version who store // only the Object is join in comment with each function who // may be different, the Haeder of this ccomment is like this : // // For no Handle Storing /* */ // Last revision : April 19 1992 N. Massip // . Implementation for o2 technology // with an o2_array for 4.5 // should be d_Varray for 4.6 // Use an Collection of StandardDB_O2Handle // for none primitive type to avoid to import // Handle(Standard_Persistent). // -------------------------------------------------------------------- // Last revision : January 1996 JMS/CLE // portage OBJY 3.8 // -------------------------------------------------------------------- // Constructor // -------------------------------------------------------------------- DBC_BaseArray::DBC_BaseArray (const Standard_Integer Size) #ifdef OBJY //==== Call the father's constructor. : myData((unsigned int) Size) #endif #ifdef OO2 : myData((unsigned int) Size) #endif { Standard_NegativeValue_Raise_if((Size < 0), "Attempt to create aBaseArray with a bad size"); mySize = Size; // Standard_Integer i; #ifdef OBJSold INTERNAL_MODE_OODB_START { os_segment *seg = Storage_CurrentContainer(); if ( Size > DBC_TAILLE_PLAFOND_CREATION_SEGMENT ) { os_database *db = seg->database_of(); Storage_CurrentContainer() = db->create_segment(); } myData = Standard_PersistentAllocation(DBC_tmpItem, Size); Storage_CurrentContainer() = seg; } INTERNAL_MODE_OODB_END; #endif } DBC_BaseArray::DBC_BaseArray () #ifdef OBJY //==== Call the father's constructor. : myData(0) #endif #ifdef OO2 : myData((unsigned int) 0) #endif { mySize = 0; #ifdef OBJS myData = NULL; #endif } // -------------------------------------------------------------------- // Constructor // -------------------------------------------------------------------- DBC_BaseArray::DBC_BaseArray (const DBC_BaseArray& Other) #ifdef OBJY //==== Call the father's constructor. : myData(Other.myData) #endif // utilisable pour d_array mais pas o2_list #ifdef OO2 //==== Call the father's constructor. : myData(Other.myData) #endif { mySize = Other.mySize; #ifdef OBJSold INTERNAL_MODE_OODB_START { myData = Standard_PersistentAllocation(DBC_tmpItem, mySize); for(Standard_Integer i=0; i