|
||||
File indexing completed on 2025-01-18 10:04:08
0001 // Copyright (c) 1999-2014 OPEN CASCADE SAS 0002 // 0003 // This file is part of Open CASCADE Technology software library. 0004 // 0005 // This library is free software; you can redistribute it and/or modify it under 0006 // the terms of the GNU Lesser General Public License version 2.1 as published 0007 // by the Free Software Foundation, with special exception defined in the file 0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0009 // distribution for complete text of the license and disclaimer of any warranty. 0010 // 0011 // Alternatively, this file may be used under the terms of Open CASCADE 0012 // commercial license or contractual agreement. 0013 0014 #ifndef Interface_Translates_HeaderFile 0015 #define Interface_Translates_HeaderFile 0016 0017 // Interface_Translates.hxx 0018 0019 // This set of macros provides some simple translation formula, i.e. 0020 // from a HSequence to an HArray and reverse 0021 // Include files for the types of HSequence and HArray1 remain to be called 0022 // Other kinds of translations remain to be completely written 0023 0024 // from HSequence to HArray1 : creates the HArray1 if HSequence not empty 0025 // from HArray1 to HSequence : the HSequence must have been already created 0026 0027 // SeqToArray(seq,arr,TColStd_HArray1OfReal) will : 0028 // consider <seq> input HSequence (here, must be TColStd_HSequenceOfReal) 0029 // consider <arr> output HArray1, declared but to be created 0030 // do nothing if <seq> is null or empty; else 0031 // create <arr> as TColStd_HArrayOfReal(1,seq->Length()) 0032 // then fill each value of <arr> with the homologous from <seq> 0033 0034 // SeqToArrayFrom(seq,arr,TColStd_HArray1OfReal,lowind) will : 0035 // consider <lowind> as an Integer (variable or constant) which defines 0036 // the desired lower index if different from one 0037 // do the same thing as SeqToArray if <lowind> equates 1 0038 // else fixes lower index of <arr> as <lowind> 0039 0040 // SeqToArrayCast(seq,arr,Interface_HArray1OfHAsciiString,TCollection_HAsciiString) will : 0041 // do as SeqToArray, but array values are Handles to be casted 0042 // (if <seq> does not work with the same type, e.g. Standard_Transient) 0043 // fill array value by the result of DownCast of the type <typent> 0044 0045 // ArrayToSeq(arr,seq) will fill <seq> a sequence with the items of <arr> a 0046 // HArray1. <seq> and <arr> are already created (<seq> can be empty or not) 0047 // Items from <arr> are considered as compatible with items from <seq> 0048 // (no DownCast required for Handles) 0049 0050 0051 #define SeqToArrayFrom(seq,arr,typarr,lowind) \ 0052 if (!seq.IsNull()) {\ 0053 Standard_Integer numseq, lenseq = seq->Length();\ 0054 if (lenseq > 0) {\ 0055 arr = new typarr (lowind,lenseq+1-lowind);\ 0056 for (numseq = 1; numseq <= lenseq; numseq ++)\ 0057 arr->SetValue (numseq+1-lowind, seq->Value(numseq));\ 0058 }\ 0059 } 0060 0061 #define SeqToArray(seq,arr,typarr) \ 0062 if (!seq.IsNull()) {\ 0063 Standard_Integer numseq, lenseq = seq->Length();\ 0064 if (lenseq > 0) {\ 0065 arr = new typarr (1,lenseq);\ 0066 for (numseq = 1; numseq <= lenseq; numseq ++)\ 0067 arr->SetValue (numseq, seq->Value(numseq));\ 0068 }\ 0069 } 0070 0071 #define SeqToArrayCast(seq,arr,typarr,typent) \ 0072 if (!seq.IsNull()) {\ 0073 Standard_Integer numseq, lenseq = seq->Length();\ 0074 if (lenseq > 0) {\ 0075 arr = new typarr (1,lenseq);\ 0076 for (numseq = 1; numseq <= lenseq; numseq ++)\ 0077 arr->SetValue (numseq, Handle(typent)::DownCast(seq->Value(numseq)));\ 0078 }\ 0079 } 0080 0081 #define ArrayToSeq (arr,seq)\ 0082 {\ 0083 Standard_Integer nument, numlow = arr->Lower() , numup = arr->Upper();\ 0084 for (nument = numlow; nument <= numup; nument ++)\ 0085 seq->Append(arr->Value(nument));\ 0086 } 0087 0088 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |