|
|
|||
File indexing completed on 2026-09-20 09:18:09
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,NCollection_HArray1<double>) will : 0028 // consider <seq> input HSequence (here, must be NCollection_HSequence<double>) 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,NCollection_HArray1<double>,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,NCollection_HArray1<occ::handle<TCollection_HAsciiString>>,TCollection_HAsciiString) 0041 // will : 0042 // do as SeqToArray, but array values are Handles to be casted 0043 // (if <seq> does not work with the same type, e.g. Standard_Transient) 0044 // fill array value by the result of DownCast of the type <typent> 0045 0046 // ArrayToSeq(arr,seq) will fill <seq> a sequence with the items of <arr> a 0047 // HArray1. <seq> and <arr> are already created (<seq> can be empty or not) 0048 // Items from <arr> are considered as compatible with items from <seq> 0049 // (no DownCast required for Handles) 0050 0051 #define SeqToArrayFrom(seq, arr, typarr, lowind) \ 0052 if (!seq.IsNull()) \ 0053 { \ 0054 int numseq, lenseq = seq->Length(); \ 0055 if (lenseq > 0) \ 0056 { \ 0057 arr = new typarr(lowind, lenseq + 1 - lowind); \ 0058 for (numseq = 1; numseq <= lenseq; numseq++) \ 0059 arr->SetValue(numseq + 1 - lowind, seq->Value(numseq)); \ 0060 } \ 0061 } 0062 0063 #define SeqToArray(seq, arr, typarr) \ 0064 if (!seq.IsNull()) \ 0065 { \ 0066 int numseq, lenseq = seq->Length(); \ 0067 if (lenseq > 0) \ 0068 { \ 0069 arr = new typarr(1, lenseq); \ 0070 for (numseq = 1; numseq <= lenseq; numseq++) \ 0071 arr->SetValue(numseq, seq->Value(numseq)); \ 0072 } \ 0073 } 0074 0075 #define SeqToArrayCast(seq, arr, typarr, typent) \ 0076 if (!seq.IsNull()) \ 0077 { \ 0078 int numseq, lenseq = seq->Length(); \ 0079 if (lenseq > 0) \ 0080 { \ 0081 arr = new typarr(1, lenseq); \ 0082 for (numseq = 1; numseq <= lenseq; numseq++) \ 0083 arr->SetValue(numseq, Handle(typent)::DownCast(seq->Value(numseq))); \ 0084 } \ 0085 } 0086 0087 #define ArrayToSeq \ 0088 (arr, seq) \ 0089 { \ 0090 int nument, numlow = arr->Lower(), numup = arr->Upper(); \ 0091 for (nument = numlow; nument <= numup; nument++) \ 0092 seq->Append(arr->Value(nument)); \ 0093 } 0094 0095 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|