1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Compare commits

..

10 Commits

Author SHA1 Message Date
ddzama
c0418c96db ??????: Fix error of TKernal and TMath compilation.
Error occured if using c++20 standard with new oneTBB 2021.5.0.
The error was:
   Error C2672 'tbb::v1::parallel_for_each': no matching overloaded function found TKernel
   could be 'void tbb::detail::d2::parallel_for_each(Iterator,Iterator,const Body &)' TKernel
   'tbb::detail::d2::parallel_for_each': the associated constraints are not satisfied TKernel
Note, that if we use c++14 or c++17, all ok, error does not occures.
To solve the problem, i have to modify `UniversalIterator` class:
`value_type` instead `UniversalIterator` converted to `IteratorInterface*`
`pointer` = `reference` = `value_type`
Method `DownCast` moved into `FunctorInterface` abstract class.
argument `UniversalIterator& item` of the unary fuctions converted to `IteratorInterface*`.
The proposed solution solved the compilation error.
2022-08-29 13:45:15 +03:00
ddzama
83cc25e05b moving to intel oneTBB 2021* 2022-08-29 13:45:15 +03:00
ddzama
8b536fff48 0032986: Fix error of compilation WPF_D3D, WPF_WinForms and WinForms with MSVC 2022. 2022-08-29 13:44:36 +03:00
ddzama
ac76263667 0032986: Fix error of compilation CSharp samples/OCCTProxy project with MSVC 2022. 2022-08-29 13:44:36 +03:00
ddzama
efc007f044 0032921: Set C++11 standard for several projects.
Several projects depends on Qt library 0f 5.11.2 version.
TKDFBrowser
TKMessageView
TKShapeView
TKTInspector
TInspectorEXE
TKTreeModel
TKMessageModel
TKVInspector
TKToolsDraw
TKTInspectorAPI
TKView

When using C++20 language standard, compilation errors occures because
of incompatibility of 5.11.2 version of Qt library interface with C++20 standard.
Therefore, these projects stay on C++11 language standard.
2022-08-29 13:32:30 +03:00
ddzama
c45ac27846 0032921: Update CMAKE requirements in documentation. 2022-08-29 12:47:38 +03:00
ddzama
4a1eddc2c9 0032921: Add description of new CMAKE variable BUILD_CPP_STANDARD into documantation. 2022-08-29 12:47:38 +03:00
ddzama
f001c6f012 0032921: more flexible CMAKE_CXX_COMPILER_ID identification (fixups previous commit!) 2022-08-29 12:47:38 +03:00
ddzama
8271ac6728 0032921: require minimum CMAKE version 3.1 (for enabling CMAKE_CXX_STANDARD)
If we require CMAKE minimal version 3.1, rather than 2.8,
by default new policies are employed:
from CMP0024 to CMP0054.
Unique problematic policy is CMP0054:
`Only interpret if() arguments as variables or keywords when unquoted.`

Requiring of 3.1 as minimal version without preserving old behavior of 54th policy breaks MSVC compilation.
If we require cmake_policy (SET CMP0054 OLD), compilation finishs without errors.
New behavior of CMP0054 leads to changes in next target MSVC vcxproj files:
 - TKV3d
 - TKOpenGl
 - TKOpenGlTest
 - TKOpenGles
 - TKOpenGlesTest
Difference is absense of HAVE_OPENGL/HAVE_OPENGLES definitions.
So, source of error has been localizedin file occt_toolkit.cmake, in lines ~325 and ~327.
In accordance with old CMP0054 policy "CSF_OpenGlLibs" interprets as variable CSF_OpenGlLibs, rather than just a string.
Contrary, new policy interpret "CSF_OpenGlLibs" as a string.
To employ new policy, began since CMAKE 3.1 we should replace "CSF_OpenGlLibs" to "${CSF_OpenGlLibs}"
and "CSF_OpenGlesLibs" to "${CSF_OpenGlesLibs}".

P.S.

When cmake policy CMP0054 is set to NEW
expression
  "${CURRENT_CSF}" STREQUAL "CSF_OpenGlLibs"
is false,
while if policy CMP0054 is set to OLD
expression
  "${CURRENT_CSF}" STREQUAL "CSF_OpenGlLibs"
is true.
If replace "CSF_OpenGlLibs" to "${CSF_OpenGlLibs}"
expression is true independent on CMP0054 policy.
Notice, that OLD policy had beed taken place by default on master before
this ticket integration.
2022-08-29 12:47:38 +03:00
ddzama
293b9f436b 0032921: Configuratiuon, CMake - allow selecting C++ standard
Make C++ standard to be enable from cmake settings:
Now, user can choose standard by setting cmake variable CPP_STANDARD.
Available next standard items: C++11, C++14, C++17, C++20, C++23.
2022-08-29 12:47:38 +03:00
147 changed files with 416 additions and 15417 deletions

View File

@@ -10,22 +10,6 @@ set (CMAKE_CONFIGURATION_TYPES Release Debug RelWithDebInfo CACHE INTERNAL "" FO
set (BUILD_CPP_STANDARD "C++11" CACHE STRING "Select using c++ standard.")
set_property(CACHE BUILD_CPP_STANDARD PROPERTY STRINGS "C++11" "C++14" "C++17" "C++20" "C++23")
# Set desired C++ standard
if ("${BUILD_CPP_STANDARD}" STREQUAL "C++11")
set (CMAKE_CXX_STANDARD 11)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++14")
set (CMAKE_CXX_STANDARD 14)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++17")
set (CMAKE_CXX_STANDARD 17)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++20")
set (CMAKE_CXX_STANDARD 20)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++23")
set (CMAKE_CXX_STANDARD 23)
else ()
message (FATAL_ERROR, "misprint in c++ standard name")
endif()
set (CMAKE_CXX_STANDARD_REQUIRED ON)
# macro: include patched file if it exists
macro (OCCT_INCLUDE_CMAKE_FILE BEING_INCLUDED_FILE)
if (BUILD_PATCH AND EXISTS "${BUILD_PATCH}/${BEING_INCLUDED_FILE}.cmake")
@@ -733,14 +717,14 @@ if (NOT DEFINED ANDROID AND CAN_USE_TBB)
add_definitions (-DHAVE_TBB)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/tbb")
else()
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB12")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC")
OCCT_CHECK_AND_UNSET ("INSTALL_TBB")
endif()
else()
OCCT_CHECK_AND_UNSET ("USE_TBB")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBB12")
OCCT_CHECK_AND_UNSET_GROUP ("3RDPARTY_TBBMALLOC")
OCCT_CHECK_AND_UNSET ("INSTALL_TBB")
endif()
@@ -820,12 +804,6 @@ else()
OCCT_CHECK_AND_UNSET ("3RDPARTY_DOT_EXECUTABLE")
endif()
# ExpToCasExe
if (EMSCRIPTEN)
list (REMOVE_ITEM BUILD_TOOLKITS TKExpress)
list (REMOVE_ITEM BUILD_TOOLKITS ExpToCasExe)
endif()
# bison
if (BUILD_YACCLEX)
OCCT_INCLUDE_CMAKE_FILE ("adm/cmake/bison")

View File

@@ -3,5 +3,5 @@ ModelingData TKG2d TKG3d TKGeomBase TKBRep
ModelingAlgorithms TKGeomAlgo TKTopAlgo TKPrim TKBO TKBool TKHLR TKFillet TKOffset TKFeat TKMesh TKXMesh TKShHealing
Visualization TKService TKV3d TKOpenGl TKOpenGles TKMeshVS TKIVtk TKD3DHost
ApplicationFramework TKCDF TKLCAF TKCAF TKBinL TKXmlL TKBin TKXml TKStdL TKStd TKTObj TKBinTObj TKXmlTObj TKVCAF
DataExchange TKXDE TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh TKXDECascade TKExpress ExpToCasExe
DataExchange TKXDE TKXSBase TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP TKIGES TKXCAF TKXDEIGES TKXDESTEP TKSTL TKVRML TKXmlXCAF TKBinXCAF TKRWMesh TKXDECascade
Draw TKDraw TKTopTest TKOpenGlTest TKOpenGlesTest TKD3DHostTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW TKTObjDRAW TKQADraw TKIVtkDraw DRAWEXE

View File

@@ -480,6 +480,3 @@ n TreeModel
n View
n ViewControl
n VInspector
n Express
t TKExpress
x ExpToCasExe

View File

@@ -22,4 +22,6 @@ if (3RDPARTY_DIR)
endforeach()
endif()
find_package (BISON 3.7.4)
# bison 3.2 is required because it provides options to avoid generation of redundant header
# files and embedding of local paths in the generated code
find_package (BISON 3.2)

View File

@@ -26,7 +26,9 @@ if (3RDPARTY_DIR)
endforeach()
endif()
find_package (FLEX 2.6.4)
# flex 2.5.37 is required because closest known lower version, 2.5.3 from WOK 6.8.0,
# generates code which is unusable on Windows (includes unistd.h without any way to avoid this)
find_package (FLEX 2.5.37)
if (NOT FLEX_FOUND OR NOT FLEX_INCLUDE_DIR OR NOT EXISTS "${FLEX_INCLUDE_DIR}/FlexLexer.h")
list (APPEND 3RDPARTY_NOT_INCLUDED FLEX_INCLUDE_DIR)

View File

@@ -12,7 +12,7 @@ endif()
# TBB
if (USE_TBB)
set (CSF_TBB "tbb tbbmalloc")
set (CSF_TBB "tbb12 tbbmalloc")
else()
set (CSF_TBB)
endif()

View File

@@ -130,6 +130,22 @@ elseif (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPIL
endif()
endif()
# Set desired C++ standard
if ("${BUILD_CPP_STANDARD}" STREQUAL "C++11")
set (CMAKE_CXX_STANDARD 11)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++14")
set (CMAKE_CXX_STANDARD 14)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++17")
set (CMAKE_CXX_STANDARD 17)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++20")
set (CMAKE_CXX_STANDARD 20)
elseif ("${BUILD_CPP_STANDARD}" STREQUAL "C++23")
set (CMAKE_CXX_STANDARD 23)
else ()
message (FATAL_ERROR, "misprint in c++ standard name")
endif()
set (CMAKE_CXX_STANDARD_REQUIRED ON)
if (CMAKE_CXX_COMPILER_ID MATCHES "[Cc][Ll][Aa][Nn][Gg]")
if (APPLE)
# CLang can be used with both libstdc++ and libc++, however on OS X libstdc++ is outdated.

View File

@@ -106,12 +106,6 @@ foreach (OCCT_PACKAGE ${USED_PACKAGES})
set (BISON_OUTPUT_FILE_EXT "cxx")
endif()
endforeach()
if (EXISTS ${FLEX_BISON_TARGET_DIR}/FlexLexer.h)
message (STATUS "Info: remove old FLEX header file: ${FLEX_BISON_TARGET_DIR}/FlexLexer.h")
file(REMOVE ${FLEX_BISON_TARGET_DIR}/FlexLexer.h)
endif()
file (STRINGS "${CURRENT_FLEX_FILE}" FILE_FLEX_CONTENT)
foreach (FILE_FLEX_CONTENT_LINE ${FILE_FLEX_CONTENT})
string (REGEX MATCH "%option c\\+\\+" CXX_FLEX_LANGUAGE_FOUND ${FILE_FLEX_CONTENT_LINE})
@@ -127,19 +121,6 @@ foreach (OCCT_PACKAGE ${USED_PACKAGES})
set (BISON_OUTPUT_FILE ${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT})
set (FLEX_OUTPUT_FILE lex.${CURRENT_FLEX_FILE_NAME}.${FLEX_OUTPUT_FILE_EXT})
if (EXISTS ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT})
message (STATUS "Info: remove old output BISON file: ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT}")
file(REMOVE ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.${BISON_OUTPUT_FILE_EXT})
endif()
if (EXISTS ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.hxx)
message (STATUS "Info: remove old output BISON file: ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.hxx")
file(REMOVE ${FLEX_BISON_TARGET_DIR}/${CURRENT_BISON_FILE_NAME}.tab.hxx)
endif()
if (EXISTS ${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE})
message (STATUS "Info: remove old output FLEX file: ${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE}")
file(REMOVE ${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE})
endif()
BISON_TARGET (Parser_${CURRENT_BISON_FILE_NAME} ${CURRENT_BISON_FILE} "${FLEX_BISON_TARGET_DIR}/${BISON_OUTPUT_FILE}"
COMPILE_FLAGS "-p ${CURRENT_BISON_FILE_NAME} -l -M ${CMAKE_SOURCE_DIR}/${RELATIVE_SOURCES_DIR}/=")
FLEX_TARGET (Scanner_${CURRENT_FLEX_FILE_NAME} ${CURRENT_FLEX_FILE} "${FLEX_BISON_TARGET_DIR}/${FLEX_OUTPUT_FILE}"

View File

@@ -69,12 +69,12 @@ else()
set (3RDPARTY_TBB_INCLUDE_DIR "" CACHE PATH "the path to tbb.h" FORCE)
endif()
# common steps for tbb and tbbmalloc
# common steps for tbb12 and tbbmalloc
macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
string (TOUPPER ${PRODUCT_LIBRARY_NAME} upper_PRODUCT_LIBRARY_NAME)
# define required tbb/tbbmalloc variables
# define required tbb12/tbbmalloc variables
if (NOT DEFINED 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY OR NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY_DIR}")
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
endif()
@@ -126,7 +126,7 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
set (${upper_PRODUCT_LIBRARY_NAME}_ARCH_NAME intel64)
endif()
# tbb/tbbmalloc library
# tbb12/tbbmalloc library
if (NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .so .dylib .a)
@@ -178,7 +178,7 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
set (3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_LIBRARY "" CACHE FILEPATH "The path to ${upper_PRODUCT_LIBRARY_NAME} library" FORCE)
endif()
# tbb/tbbmalloc shared library
# tbb12/tbbmalloc shared library
if (WIN32)
if (NOT 3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL OR NOT EXISTS "${3RDPARTY_${upper_PRODUCT_LIBRARY_NAME}_DLL}")
set (CMAKE_FIND_LIBRARY_SUFFIXES .dll)
@@ -230,7 +230,7 @@ macro (TBB_PRODUCT_SEARCH PRODUCT_LIBRARY_NAME)
endif()
endif()
# install tbb/tbbmalloc
# install tbb12/tbbmalloc
if (INSTALL_TBB)
OCCT_MAKE_OS_WITH_BITNESS()
OCCT_MAKE_COMPILER_SHORT_NAME()
@@ -286,9 +286,9 @@ endmacro()
else()
# the library directory for using by the executable
if (WIN32)
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_DLL_DIR})
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB12_DLL_DIR})
else()
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB_LIBRARY_DIR})
set (USED_3RDPARTY_TBB_DIR ${3RDPARTY_TBB12_LIBRARY_DIR})
endif()
endif()
#endif()

View File

@@ -775,19 +775,19 @@ proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir/$aVcLib"
}
if { "$aTbbLibPath" == "" } {
lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}tbb.${::SYS_LIB_SUFFIX}' not found (Intel TBB)"
lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}tbb12.${::SYS_LIB_SUFFIX}' not found (Intel TBB)"
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
}
}
if { "$::tcl_platform(platform)" == "windows" } {
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"]
set aTbbDllPath [wokdep:SearchBin "tbb12.dll" "$anArchIter"]
if { "$aTbbDllPath" == "" } {
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] $aVcLib "$anArchIter" ]
set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
set aTbbDllPath [wokdep:SearchBin "tbb12.dll" "$anArchIter" "$aPath/bin/$aSubDir/$aVcLib"]
if { "$aTbbDllPath" != "" } {
lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/$aVcLib"
} else {
lappend anErrBin$anArchIter "Error: 'tbb.dll' not found (Intel TBB)"
lappend anErrBin$anArchIter "Error: 'tbb12.dll' not found (Intel TBB)"
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
}
}

View File

@@ -1437,7 +1437,7 @@ proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap theRelease} {
set aLibsMap(CSF_FFmpeg) "avcodec avformat swscale avutil"
}
if { "$::HAVE_TBB" == "true" } {
set aLibsMap(CSF_TBB) "tbb tbbmalloc"
set aLibsMap(CSF_TBB) "tbb12 tbbmalloc"
}
if { "$::HAVE_VTK" == "true" } {
if { "$theOS" == "wnt" } {

View File

@@ -23,7 +23,7 @@ CSF_TclLibs = -ltcl8.6
CSF_TclTkLibs = -ltk8.6
HAVE_FREEIMAGE { CSF_FreeImagePlus = -lfreeimage } else:win32 { CSF_FreeImagePlus = -lwindowscodecs -lole32 }
HAVE_FFMPEG { CSF_FFmpeg = -lavcodec -lavformat -lswscale -lavutil }
HAVE_TBB { CSF_TBB = -ltbb -ltbbmalloc }
HAVE_TBB { CSF_TBB = -ltbb12 -ltbbmalloc }
HAVE_ZLIB { CSF_ZLIB = -lzlib }
HAVE_LIBLZMA { CSF_LIBLZMA = -lliblzma }
HAVE_DRACO { CSF_Draco = -ldraco }

View File

@@ -11,7 +11,7 @@ if /I "%VCVER%" == "@COMPILER@" (
set "FREEIMAGE_DIR=@3RDPARTY_FREEIMAGE_DLL_DIRS@"
set "EGL_DIR=@3RDPARTY_EGL_DLL_DIRS@"
set "GLES2_DIR=@3RDPARTY_GLES2_DLL_DIRS@"
set "TBB_DIR=@3RDPARTY_TBB_DLL_DIR@"
set "TBB_DIR=@3RDPARTY_TBB12_DLL_DIR@"
set "VTK_DIR=@3RDPARTY_VTK_DLL_DIR@"
set "FFMPEG_DIR=@3RDPARTY_FFMPEG_DLL_DIR@"
set "OPENVR_DIR=@3RDPARTY_OPENVR_DLL_DIRS@"

View File

@@ -9,7 +9,7 @@ if [ "$1" == "@BIN_LETTER@" ]; then
export TK_DIR="@3RDPARTY_TK_LIBRARY_DIR@"
export FREETYPE_DIR="@3RDPARTY_FREETYPE_LIBRARY_DIR@"
export FREEIMAGE_DIR="@3RDPARTY_FREEIMAGE_LIBRARY_DIRS@"
export TBB_DIR="@3RDPARTY_TBB_LIBRARY_DIR@"
export TBB_DIR="@3RDPARTY_TBB12_LIBRARY_DIR@"
export VTK_DIR="@3RDPARTY_VTK_LIBRARY_DIR@"
export FFMPEG_DIR="@3RDPARTY_FFMPEG_LIBRARY_DIR@"

View File

@@ -128,8 +128,9 @@ You can download its sources from https://freetype.org/
@subsection dev_guides__building_3rdparty_win_3_1 TBB
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
Go to the **Download** page, find the release version you need (e.g. `tbb30_018oss`) and pick the archive for Windows platform.
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Windows platform.
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-win.zip`)
Unpack the downloaded archive of TBB product into the `3rdparty` folder.
@@ -304,9 +305,9 @@ Download the necessary archive from https://freetype.org/ and unpack it.
@subsection dev_guides__building_3rdparty_linux_3_1 TBB
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
Go to the **Download** page, find the release version you need and pick the archive for Linux platform.
To install, unpack the downloaded archive of TBB product.
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Linux platform.
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-lin.tgz`).
@subsection dev_guides__building_3rdparty_linux_3_3 FreeImage
@@ -477,9 +478,9 @@ Download the necessary archive from https://freetype.org/ and unpack it.
@subsection dev_guides__building_3rdparty_osx_3_1 TBB
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/intel/tbb.
Go to the **Download** page, find the release version you need (e.g. `tbb30_018oss`) and pick the archive for Mac OS X platform.
To install, unpack the downloaded archive of TBB product (`tbb30_018oss_osx.tgz`).
This third-party product is installed with binaries from the archive that can be downloaded from https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0.
Go to the **Download** page, find the release version you need (e.g. `oneTBB 2021.5.0`) and pick the archive for Mac OS X platform.
To install, unpack the downloaded archive of TBB product (`oneapi-tbb-2021.5.0-mac.tgz`).
@subsection dev_guides__building_3rdparty_osx_3_3 FreeImage

View File

@@ -341,7 +341,7 @@ The tables below describe the recommended software configurations for which OCCT
| OS | Compiler |
| --------- | ----------- |
| Windows | Microsoft Visual Studio: 2015 Update 3, 2017 <sup>1</sup>, 2019, 2022 <br>, LLVM (ClangCL), GCC 4.3+ (Mingw-w64)|
| Windows | Microsoft Visual Studio: 2013 Update 5, 2015 Update 3, 2017 <sup>1</sup>, 2019, 2022 <br>, LLVM (ClangCL), GCC 4.3+ (Mingw-w64)|
| Linux | GNU gcc 4.3+ <br> LLVM CLang 3.6+ |
| OS X / macOS | XCode 6 or newer |
| Android | NDK r12, GNU gcc 4.9 or newer |
@@ -360,7 +360,7 @@ https://dev.opencascade.org/resources/download/3rd-party-components
| Component | Where to find | Used for | Purpose |
| --------- | ------------- | -------- | -------------------- |
| CMake 3.1+ | https://cmake.org/ | Configuration | Build from sources |
| Intel TBB 4.x or later | https://oneapi-src.github.io/oneTBB/ | All | Parallelization of algorithms (alternative to built-in thread pool) |
| Intel oneTBB 2021.5.0 | https://github.com/oneapi-src/oneTBB/releases/tag/v2021.5.0 | All | Parallelization of algorithms (alternative to built-in thread pool) |
| OpenGL 3.3+, OpenGL ES 2.0+ | System | Visualization | Required for using 3D Viewer |
| OpenVR 1.10+ | https://github.com/ValveSoftware/openvr | Visualization | VR (Virtual Reality) support in 3D Viewer |
| FreeType 2.4+ | https://www.freetype.org/download.html | Visualization | Text rendering in 3D Viewer |
@@ -572,7 +572,7 @@ FreeType 2 is released under two open-source licenses: BSD-like FreeType License
It is a library that helps you to take advantage of multi-core processor performance without having to be a threading expert.
Threading Building Blocks is not just a threads-replacement library. It represents a higher-level, task-based parallelism that
abstracts platform details and threading mechanisms for scalability and performance.
TBB version 2017 is available under Apache 2.0 license, while older versions
oneTBB 2021.5.0 is available under Apache 2.0 license, while older versions
until 4.4 are available under GPLv2 license with the runtime exception (https://www.threadingbuildingblocks.org).
**OpenGL** is an industry standard API for 3D graphics used by OCCT for

View File

@@ -326,8 +326,7 @@ The <i>Geom2dConvert</i> package provides the following:
* a global function which is used to construct a BSpline curve from a bounded curve based on a 2D curve from the Geom2d package,
* a splitting algorithm which computes the points at which a 2D BSpline curve should be cut in order to obtain arcs with the same degree of continuity,
* global functions used to construct the BSpline curves created by this splitting algorithm, or by other types of segmentation of the BSpline curve,
* an algorithm which converts a 2D BSpline curve into a series of adjacent Bezier curves,
* an algorithm which converts an arbitrary 2D curve into a series of adjacent 2D circular arcs and 2D linear segments.
* an algorithm which converts a 2D BSpline curve into a series of adjacent Bezier curves.
The <i>GeomConvert</i> package also provides the following:

View File

@@ -91,6 +91,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ConformanceMode>false</ConformanceMode>
</ClCompile>
<Link>
<OutputFile>$(OutDir)OCCTProxy.dll</OutputFile>
@@ -121,6 +122,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ConformanceMode>false</ConformanceMode>
</ClCompile>
<Link>
<OutputFile>$(OutDir)OCCTProxy.dll</OutputFile>
@@ -145,6 +147,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ConformanceMode>false</ConformanceMode>
</ClCompile>
<Link>
<OutputFile>$(OutDir)OCCTProxy.dll</OutputFile>
@@ -172,6 +175,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ConformanceMode>false</ConformanceMode>
</ClCompile>
<Link>
<OutputFile>$(OutDir)OCCTProxy.dll</OutputFile>

View File

@@ -92,6 +92,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ConformanceMode>false</ConformanceMode>
</ClCompile>
<Link>
<OutputFile>$(OutDir)OCCTProxy_D3D.dll</OutputFile>
@@ -123,6 +124,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ConformanceMode>false</ConformanceMode>
</ClCompile>
<Link>
<OutputFile>$(OutDir)OCCTProxy_D3D.dll</OutputFile>
@@ -147,6 +149,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ConformanceMode>false</ConformanceMode>
</ClCompile>
<Link>
<OutputFile>$(OutDir)OCCTProxy_D3D.dll</OutputFile>
@@ -174,6 +177,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<ConformanceMode>false</ConformanceMode>
</ClCompile>
<Link>
<OutputFile>$(OutDir)OCCTProxy_D3D.dll</OutputFile>

View File

@@ -51,7 +51,7 @@ unix {
DEFINES += OCC_CONVERT_SIGNALS QT_NO_STL
!macx | equals(MACOSX_USE_GLX, true): LIBS += -L$$QMAKE_LIBDIR_X11 $$QMAKE_LIBS_X11 -L$$QMAKE_LIBDIR_OPENGL $$QMAKE_LIBS_OPENGL $$QMAKE_LIBS_THREAD
LIBS += -lfreeimageplus
LIBS += -ltbb -ltbbmalloc
LIBS += -ltbb12 -ltbbmalloc
QMAKE_CXXFLAGS += -std=gnu++11
}

View File

@@ -1,4 +1,4 @@
// Created on: 1997-01-17
// Created on: 1997-01-17
// Created by: Robert COUBLANC
// Copyright (c) 1997-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
@@ -1001,14 +1001,6 @@ void AIS_InteractiveContext::RecomputeSelectionOnly (const Handle(AIS_Interactiv
return;
}
TColStd_ListOfInteger aModes;
ActivatedModes (theIO, aModes);
for (TColStd_ListIteratorOfListOfInteger aModesIter (aModes); aModesIter.More(); aModesIter.Next())
{
mgrSelector->Deactivate (theIO, aModesIter.Value());
}
mgrSelector->RecomputeSelection (theIO);
const Handle(AIS_GlobalStatus)* aStatus = myObjects.Seek (theIO);
@@ -1018,7 +1010,10 @@ void AIS_InteractiveContext::RecomputeSelectionOnly (const Handle(AIS_Interactiv
return;
}
for (TColStd_ListIteratorOfListOfInteger aModesIter (aModes); aModesIter.More(); aModesIter.Next())
TColStd_ListOfInteger aModes;
ActivatedModes (theIO, aModes);
TColStd_ListIteratorOfListOfInteger aModesIter (aModes);
for (; aModesIter.More(); aModesIter.Next())
{
mgrSelector->Activate (theIO, aModesIter.Value());
}

View File

@@ -27,8 +27,6 @@
#include <V3d_Viewer.hxx>
#include <WNT_HIDSpaceMouse.hxx>
#include <iostream>
// =======================================================================
// function : AIS_ViewController
// purpose :
@@ -2248,12 +2246,6 @@ void AIS_ViewController::handleCameraActions (const Handle(AIS_InteractiveContex
myGL.Orientation.ToFitAll = false;
}
if (theView->Viewer()->Grid()->IsActive()
&& theView->Viewer()->GridEcho())
{
theView->Viewer()->Grid()->Update();
}
if (myGL.IsNewGesture)
{
if (myAnchorPointPrs1->HasInteractiveContext())

View File

@@ -16,10 +16,10 @@
IMPLEMENT_STANDARD_RTTIEXT(Aspect_Grid,Standard_Transient)
Aspect_Grid::Aspect_Grid (const Standard_Real theXOrigin,
const Standard_Real theYOrigin,
const Standard_Real theAngle,
const Quantity_Color& theColor,
const Quantity_Color& theTenthColor)
const Standard_Real theYOrigin,
const Standard_Real theAngle,
const Quantity_Color& theColor,
const Quantity_Color& theTenthColor)
: myRotationAngle (theAngle),
myXOrigin (theXOrigin),
myYOrigin (theYOrigin),
@@ -60,7 +60,7 @@ void Aspect_Grid::Rotate (const Standard_Real theAngle)
}
void Aspect_Grid::Translate (const Standard_Real theDx,
const Standard_Real theDy)
const Standard_Real theDy)
{
myXOrigin += theDx;
myYOrigin += theDy;
@@ -69,7 +69,7 @@ void Aspect_Grid::Translate (const Standard_Real theDx,
}
void Aspect_Grid::SetColors (const Quantity_Color& theColor,
const Quantity_Color& theTenthColor)
const Quantity_Color& theTenthColor)
{
myColor = theColor;
myTenthColor = theTenthColor;
@@ -77,16 +77,16 @@ void Aspect_Grid::SetColors (const Quantity_Color& theColor,
}
void Aspect_Grid::Colors (Quantity_Color& theColor,
Quantity_Color& theTenthColor) const
Quantity_Color& theTenthColor) const
{
theColor = myColor;
theTenthColor = myTenthColor;
}
void Aspect_Grid::Hit (const Standard_Real theX,
const Standard_Real theY,
Standard_Real& theGridX,
Standard_Real& theGridY) const
const Standard_Real theY,
Standard_Real& theGridX,
Standard_Real& theGridY) const
{
if (myIsActive)
{

View File

@@ -86,9 +86,6 @@ public:
//! Display the grid at screen.
Standard_EXPORT virtual void Display() = 0;
//!
Standard_EXPORT virtual void Update() = 0;
//! Erase the grid from screen.
Standard_EXPORT virtual void Erase() const = 0;

View File

@@ -27,35 +27,31 @@ Aspect_RectangularGrid::Aspect_RectangularGrid(
const Standard_Real aFirstAngle,
const Standard_Real aSecondAngle,
const Standard_Real aRotationAngle)
: Aspect_Grid (anXOrigin,anYOrigin,aRotationAngle),
myXStep (aXStep),
myYStep (aYStep),
myFirstAngle (aFirstAngle),
mySecondAngle (aSecondAngle)
:Aspect_Grid(anXOrigin,anYOrigin,aRotationAngle),myXStep(aXStep),myYStep(aYStep),myFirstAngle(aFirstAngle),mySecondAngle(aSecondAngle)
{
Standard_NumericError_Raise_if (!CheckAngle (aFirstAngle, mySecondAngle),
"networks are parallel");
Standard_NegativeValue_Raise_if (aXStep < 0.0, "invalid x step");
Standard_NegativeValue_Raise_if (aYStep < 0.0, "invalid y step");
Standard_NullValue_Raise_if (aXStep == 0.0, "invalid x step");
Standard_NullValue_Raise_if (aYStep == 0.0, "invalid y step");
Standard_NumericError_Raise_if(!CheckAngle (aFirstAngle,mySecondAngle),
"networks are parallel");
Standard_NegativeValue_Raise_if(aXStep < 0. , "invalid x step");
Standard_NegativeValue_Raise_if(aYStep < 0. , "invalid y step");
Standard_NullValue_Raise_if(aXStep == 0. , "invalid x step");
Standard_NullValue_Raise_if(aYStep == 0. , "invalid y step");
}
void Aspect_RectangularGrid::SetXStep (const Standard_Real aStep)
{
Standard_NegativeValue_Raise_if (aStep < 0.0, "invalid x step");
Standard_NullValue_Raise_if (aStep == 0.0, "invalid y step");
void Aspect_RectangularGrid::SetXStep(const Standard_Real aStep) {
Standard_NegativeValue_Raise_if(aStep < 0. , "invalid x step");
Standard_NullValue_Raise_if(aStep == 0. , "invalid y step");
myXStep = aStep;
Init();
UpdateDisplay();
}
void Aspect_RectangularGrid::SetYStep (const Standard_Real aStep)
{
Standard_NegativeValue_Raise_if (aStep < 0.0, "invalid x step");
Standard_NullValue_Raise_if (aStep == 0.0, "invalid y step");
void Aspect_RectangularGrid::SetYStep(const Standard_Real aStep) {
Standard_NegativeValue_Raise_if(aStep < 0. , "invalid x step");
Standard_NullValue_Raise_if(aStep == 0. , "invalid y step");
myYStep = aStep;
Init();
UpdateDisplay();
@@ -64,72 +60,67 @@ void Aspect_RectangularGrid::SetYStep (const Standard_Real aStep)
void Aspect_RectangularGrid::SetAngle (const Standard_Real anAngle1,
const Standard_Real anAngle2)
{
Standard_NumericError_Raise_if (!CheckAngle (anAngle1,anAngle2),
"axis are parallel");
Standard_NumericError_Raise_if(!CheckAngle (anAngle1,anAngle2 ),
"axis are parallel");
myFirstAngle = anAngle1;
mySecondAngle = anAngle2;
Init();
UpdateDisplay();
}
void Aspect_RectangularGrid::SetGridValues (
const Standard_Real theXOrigin,
const Standard_Real theYOrigin,
const Standard_Real theXStep,
const Standard_Real theYStep,
const Standard_Real theRotationAngle)
{
void Aspect_RectangularGrid::SetGridValues(
const Standard_Real theXOrigin,
const Standard_Real theYOrigin,
const Standard_Real theXStep,
const Standard_Real theYStep,
const Standard_Real theRotationAngle) {
myXOrigin = theXOrigin;
myYOrigin = theYOrigin;
Standard_NegativeValue_Raise_if (theXStep < 0.0, "invalid x step");
Standard_NullValue_Raise_if (theXStep == 0.0, "invalid x step");
Standard_NegativeValue_Raise_if(theXStep < 0. , "invalid x step");
Standard_NullValue_Raise_if(theXStep == 0. , "invalid x step");
myXStep = theXStep;
Standard_NegativeValue_Raise_if (theYStep < 0.0, "invalid y step");
Standard_NullValue_Raise_if (theYStep == 0.0, "invalid y step");
Standard_NegativeValue_Raise_if(theYStep < 0. , "invalid y step");
Standard_NullValue_Raise_if(theYStep == 0. , "invalid y step");
myYStep = theYStep;
myRotationAngle = theRotationAngle;
Init();
UpdateDisplay();
}
void Aspect_RectangularGrid::Compute (const Standard_Real X,
const Standard_Real Y,
Standard_Real& gridX,
Standard_Real& gridY) const
{
void Aspect_RectangularGrid::Compute(const Standard_Real X,
const Standard_Real Y,
Standard_Real& gridX,
Standard_Real& gridY) const {
Standard_Real D1 = b1 * X - a1 * Y - c1;
Standard_Real D2 = b2 * X - a2 * Y - c2;
Standard_Integer n1 = Standard_Integer (Abs (D1) / myXStep + 0.5);
Standard_Integer n2 = Standard_Integer (Abs (D2) / myYStep + 0.5);
Standard_Real offset1 = c1 + Standard_Real(n1) * Sign (myXStep, D1);
Standard_Real offset2 = c2 + Standard_Real(n2) * Sign (myYStep, D2);
Standard_Real Delta = a1 * b2 - b1 * a2;
gridX = (offset2 * a1 - offset1 * a2) / Delta;
gridY = (offset2 * b1 - offset1 * b2) / Delta;
Standard_Integer n1 = Standard_Integer ( Abs(D1)/myXStep + 0.5);
Standard_Integer n2 = Standard_Integer ( Abs(D2)/myYStep + 0.5);
Standard_Real offset1 = c1 + Standard_Real(n1) * Sign (myXStep , D1);
Standard_Real offset2 = c2 + Standard_Real(n2) * Sign (myYStep , D2);
Standard_Real Delta = a1*b2 - b1*a2;
gridX = ( offset2*a1 - offset1*a2) /Delta;
gridY = ( offset2*b1 - offset1*b2) /Delta;
}
Standard_Real Aspect_RectangularGrid::XStep() const
{
Standard_Real Aspect_RectangularGrid::XStep() const {
return myXStep;
}
Standard_Real Aspect_RectangularGrid::YStep() const
{
Standard_Real Aspect_RectangularGrid::YStep() const {
return myYStep;
}
Standard_Real Aspect_RectangularGrid::FirstAngle() const
{
Standard_Real Aspect_RectangularGrid::FirstAngle() const {
return myFirstAngle;
}
Standard_Real Aspect_RectangularGrid::SecondAngle() const
{
Standard_Real Aspect_RectangularGrid::SecondAngle() const {
return mySecondAngle;
}
void Aspect_RectangularGrid::Init()
{
void Aspect_RectangularGrid::Init () {
//+zov Fixing CTS17856
// a1 = Cos (myFirstAngle + RotationAngle() );
// b1 = Sin (myFirstAngle + RotationAngle() );
@@ -141,39 +132,28 @@ void Aspect_RectangularGrid::Init()
Standard_Real angle1 = myFirstAngle + RotationAngle();
Standard_Real angle2 = mySecondAngle + RotationAngle();
if (angle1 != 0.0)
{
a1 = -Sin (angle1);
if ( angle1 != 0. ) {
a1 = -Sin (angle1);
b1 = Cos (angle1);
c1 = XOrigin() * b1 - YOrigin() * a1;
}
else
{
a1 = 0.0;
b1 = 1.0;
c1 = XOrigin();
} else {
a1 = 0.; b1 = 1.; c1 = XOrigin();
}
if (angle2 != 0.0)
{
angle2 += M_PI / 2.0;
a2 = -Sin (angle2);
if ( angle2 != 0. ) {
angle2 += M_PI / 2.;
a2 = -Sin (angle2);
b2 = Cos (angle2);
c2 = XOrigin() * b2 - YOrigin() * a2;
}
else
{
a2 = -1.0;
b2 = 0.0;
c2 = YOrigin();
} else {
a2 = -1.; b2 = 0.; c2 = YOrigin();
}
//-zov
}
Standard_Boolean Aspect_RectangularGrid::CheckAngle (const Standard_Real alpha,
const Standard_Real beta) const
{
return (Abs (Sin (alpha) * Cos (beta + M_PI / 2.0) - Cos (alpha) * Sin (beta + M_PI / 2.0)) != 0);
Standard_Boolean Aspect_RectangularGrid::CheckAngle(const Standard_Real alpha,
const Standard_Real beta) const {
return (Abs( Sin(alpha) * Cos(beta + M_PI / 2.) - Cos(alpha) * Sin(beta + M_PI / 2.)) != 0) ;
}
//=======================================================================

View File

@@ -15,13 +15,8 @@
// commercial license or contractual agreement.
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Curve2d.hxx>
#include <BRepAlgo.hxx>
#include <BRepLib.hxx>
#include <BRepLib_MakeEdge.hxx>
@@ -30,13 +25,10 @@
#include <ElCLib.hxx>
#include <Geom_Curve.hxx>
#include <Geom_TrimmedCurve.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <Geom2dConvert_ApproxArcsSegments.hxx>
#include <GeomAbs_CurveType.hxx>
#include <GeomConvert.hxx>
#include <GeomConvert_CompCurveToBSplineCurve.hxx>
#include <GeomLProp.hxx>
#include <NCollection_Vector.hxx>
#include <gp_Pnt.hxx>
#include <Precision.hxx>
#include <ShapeFix_Shape.hxx>
@@ -48,7 +40,6 @@
#include <TColStd_SequenceOfBoolean.hxx>
#include <TColStd_SequenceOfReal.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
@@ -56,166 +47,6 @@
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
// The minimal tolerance of approximation (edges can be defined with yet smaller tolerance)
static const Standard_Real MINIMAL_TOLERANCE = 0.0001;
namespace {
struct OrientedCurve
{
Handle(Geom2d_TrimmedCurve) Curve;
Standard_Boolean IsReverse;
inline gp_Pnt2d Point (const Standard_Boolean isEnd) const
{
if (isEnd == IsReverse)
return Curve->StartPoint();
return Curve->EndPoint();
}
};
}
//=======================================================================
//function : ConvertWire
//purpose :
//=======================================================================
TopoDS_Wire BRepAlgo::ConvertWire(const TopoDS_Wire& theWire,
const Standard_Real theAngleTol,
const TopoDS_Face& theFace)
{
TopoDS_Wire aResult;
Standard_Real aMaxTol(0.);
const Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace);
NCollection_Vector<OrientedCurve> vecCurve;
BRepTools_WireExplorer anExpE(theWire, theFace);
// Explore the edges in the current wire, in their connection order
for (; anExpE.More(); anExpE.Next()) {
const TopoDS_Edge& anEdge = anExpE.Current();
BRepAdaptor_Curve2d aCurve(anEdge, theFace);
Standard_Real aTol = BRep_Tool::Tolerance(anEdge);
if (aTol < MINIMAL_TOLERANCE)
aTol = MINIMAL_TOLERANCE;
if (aTol > aMaxTol)
aMaxTol = aTol;
Geom2dConvert_ApproxArcsSegments anAlgo(aCurve, aTol, theAngleTol);
const TColGeom2d_SequenceOfCurve& aResultApprox = anAlgo.GetResult();
// Form the array of approximated elementary curves
if (anEdge.Orientation() == TopAbs_REVERSED) {
for (Standard_Integer iCrv = aResultApprox.Length(); iCrv > 0 ; iCrv--) {
const Handle(Geom2d_Curve)& aCrv = aResultApprox(iCrv);
if (aCrv.IsNull() == Standard_False) {
OrientedCurve& anOCurve = vecCurve.Append(OrientedCurve());
anOCurve.Curve = Handle(Geom2d_TrimmedCurve)::DownCast(aCrv);
anOCurve.IsReverse = Standard_True;
}
}
} else {
for (Standard_Integer iCrv = 1; iCrv <= aResultApprox.Length(); iCrv++) {
const Handle(Geom2d_Curve)& aCrv = aResultApprox(iCrv);
if (aCrv.IsNull() == Standard_False) {
OrientedCurve& anOCurve = vecCurve.Append(OrientedCurve());
anOCurve.Curve = Handle(Geom2d_TrimmedCurve)::DownCast(aCrv);
anOCurve.IsReverse = Standard_False;
}
}
}
}
if (vecCurve.Length() > 0)
{
// Build the first vertex
BRep_Builder aVBuilder;
gp_Pnt2d aPnt[2] = {
vecCurve(0).Point(Standard_False),
vecCurve(vecCurve.Length() - 1).Point(Standard_True)
};
Standard_Real aDist = aPnt[0].Distance(aPnt[1]);
if (aDist > aMaxTol + Precision::Confusion())
aDist = Precision::Confusion();
else {
aDist = 0.5 * aDist + Precision::Confusion();
aPnt[0] = 0.5 * (aPnt[0].XY() + aPnt[1].XY());
}
gp_Pnt aPnt3d;
aSurf->D0(aPnt[0].X(), aPnt[0].Y(), aPnt3d);
TopoDS_Vertex aFirstVertex;
aVBuilder.MakeVertex(aFirstVertex, aPnt3d, aDist);
// Loop creating edges
BRepBuilderAPI_MakeWire aMkWire;
TopoDS_Edge anEdgeRes;
TopoDS_Vertex aVertex = aFirstVertex;
for (Standard_Integer iCrv = 0; iCrv < vecCurve.Length(); iCrv++) {
const OrientedCurve& anOCurve = vecCurve(iCrv);
TopoDS_Vertex aNextVertex;
aPnt[0] = anOCurve.Point(Standard_True);
if (iCrv == vecCurve.Length() - 1) {
aPnt[1] = vecCurve(0).Point(Standard_False);
aDist = aPnt[0].Distance(aPnt[1]);
if (aDist > aMaxTol + Precision::Confusion()) {
aSurf->D0(aPnt[0].X(), aPnt[0].Y(), aPnt3d);
aVBuilder.MakeVertex(aNextVertex, aPnt3d, Precision::Confusion());
} else {
aNextVertex = aFirstVertex;
}
} else {
aPnt[1] = vecCurve(iCrv + 1).Point(Standard_False);
aDist = 0.5 * (aPnt[0].Distance(aPnt[1])) + Precision::Confusion();
aPnt[0] = 0.5 * (aPnt[0].XY() + aPnt[1].XY());
aSurf->D0(aPnt[0].X(), aPnt[0].Y(), aPnt3d);
aVBuilder.MakeVertex(aNextVertex, aPnt3d, aDist);
}
const Standard_Real aParam[2] = {
anOCurve.Curve->FirstParameter(),
anOCurve.Curve->LastParameter()
};
if (anOCurve.IsReverse) {
BRepBuilderAPI_MakeEdge aMkEdge(anOCurve.Curve, aSurf, aNextVertex,
aVertex, aParam[0], aParam[1]);
anEdgeRes = aMkEdge.Edge();
anEdgeRes.Orientation(TopAbs_REVERSED);
} else {
BRepBuilderAPI_MakeEdge aMkEdge(anOCurve.Curve, aSurf, aVertex,
aNextVertex, aParam[0], aParam[1]);
anEdgeRes = aMkEdge.Edge();
}
aVertex = aNextVertex;
aMkWire.Add(anEdgeRes);
}
if (aMkWire.IsDone())
aResult = aMkWire.Wire();
}
return aResult;
}
//=======================================================================
//function : ConvertFace
//purpose :
//=======================================================================
TopoDS_Face BRepAlgo::ConvertFace (const TopoDS_Face& theFace,
const Standard_Real theAngleTolerance)
{
TopoDS_Face aResult;
const Handle(Geom_Surface) aSurf = BRep_Tool::Surface(theFace);
BRepBuilderAPI_MakeFace aMkFace(aSurf,Precision::Confusion());
TopExp_Explorer anExp(theFace, TopAbs_WIRE);
for (; anExp.More(); anExp.Next()) {
const TopoDS_Wire& aWire = TopoDS::Wire(anExp.Current());
const TopoDS_Wire aNewWire = ConvertWire(aWire, theAngleTolerance, theFace);
aMkFace.Add(aNewWire);
}
if (aMkFace.IsDone()) {
aResult = aMkFace.Face();
}
return aResult;
}
//=======================================================================
//function : ConcatenateWire
//purpose :

View File

@@ -21,7 +21,6 @@
#include <TopTools_ListOfShape.hxx>
class TopoDS_Wire;
class TopoDS_Edge;
class TopoDS_Face;
class TopoDS_Shape;
@@ -44,28 +43,6 @@ public:
//! Junction points between edges of wire may be sharp,
//! resulting curve of the resulting edge may be C0.
Standard_EXPORT static TopoDS_Edge ConcatenateWireC0 (const TopoDS_Wire& Wire);
//! Method of wire conversion, calls BRepAlgo_Approx internally.
//! @param theWire
//! Input Wire object.
//! @param theAngleTolerance
//! Angle (in radians) defining the continuity of the wire: if two vectors
//! differ by less than this angle, the result will be smooth (zero angle of
//! tangent lines between curve elements).
//! @return
//! The new TopoDS_Wire object consisting of edges each representing an arc
//! of circle or a linear segment. The accuracy of conversion is defined
//! as the maximal tolerance of edges in theWire.
static Standard_EXPORT TopoDS_Wire ConvertWire
(const TopoDS_Wire& theWire,
const Standard_Real theAngleTolerance,
const TopoDS_Face& theFace);
//! Method of face conversion. The API corresponds to the method ConvertWire.
//! This is a shortcut for calling ConvertWire() for each wire in theFace.
static Standard_EXPORT TopoDS_Face ConvertFace
(const TopoDS_Face& theFace,
const Standard_Real theAngleTolerance);
//! Checks if the shape is "correct". If not, returns
//! <Standard_False>, else returns <Standard_True>.

View File

@@ -197,12 +197,10 @@ Standard_Boolean CheckOn(IntRes2d_IntersectionPoint& thePntInter,
if (aMinDist <= theTolZ) {
IntRes2d_Transition aTrOnLin(IntRes2d_Head);
IntRes2d_Position aPosOnCurve = IntRes2d_Middle;
if ((Abs(aPar - theDeb) <= Precision::Confusion())
|| (aPar < theDeb)) {
if (Abs(aPar - theDeb) <= Precision::Confusion()) {
aPosOnCurve = IntRes2d_Head;
}
else if ((Abs(aPar - theFin) <= Precision::Confusion())
|| (aPar > theFin)) {
else if (Abs(aPar - theFin) <= Precision::Confusion()) {
aPosOnCurve = IntRes2d_End;
}
//
@@ -383,16 +381,8 @@ void BRepClass_Intersector::Perform(const gp_Lin2d& L,
{
Standard_Boolean aStatusOn = Standard_False;
IntRes2d_IntersectionPoint aPntInter;
Standard_Real aDebTol = deb;
Standard_Real aFinTol = fin;
if (aTolZ > Precision::Confusion())
{
aDebTol = deb - aTolZ;
aFinTol = fin + aTolZ;
}
Geom2dAdaptor_Curve aCurAdaptor(aC2D, aDebTol, aFinTol);
aStatusOn = CheckOn(aPntInter, F, L, aCurAdaptor, aTolZ, fin, deb);
aStatusOn = CheckOn(aPntInter, F, L, C, aTolZ, fin, deb);
if (aStatusOn)
{
Append(aPntInter);

View File

@@ -506,14 +506,7 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape& S,
if (!isSolved)
return;
//Removing very small values
Standard_Real aMaxV = Max(Abs(aVec(1)), Max(Abs(aVec(2)), Abs(aVec(3))));
Standard_Real eps = Epsilon(aMaxV);
for (i = 1; i <= 3; ++i)
{
if (Abs(aVec(i)) <= eps)
aVec(i) = 0.;
}
gp_Vec aN (aVec (1), aVec (2), aVec (3));
Handle(Geom_Plane) aPlane = new Geom_Plane (aBaryCenter, aN);
myTolReached = Controle (aPoints, aPlane);

View File

@@ -41,13 +41,10 @@ std::pair<Standard_Real, Standard_Real> BRepMesh_ConeRangeSplitter::GetSplitStep
const Standard_Real aDiffU = aRangeU.second - aRangeU.first;
const Standard_Real aDiffV = aRangeV.second - aRangeV.first;
const Standard_Real aScale = (Du * aRadius);
const Standard_Real aRatio = Max(1., Log(aDiffV / aScale));
const Standard_Integer nbU = (Standard_Integer)(aDiffU / Du);
const Standard_Integer nbV = (Standard_Integer)(aDiffV / aScale / aRatio);
Standard_Integer nbU = (Standard_Integer) (aDiffU / Du);
Standard_Integer nbV = (Standard_Integer) (nbU * (aDiffV) / (aDiffU * aRadius));
Du = aDiffU / (nbU + 1);
Dv = aDiffV / (nbV + static_cast<Standard_Integer>(aRatio));
Dv = aDiffV / (nbV + 1);
theStepsNb.first = nbU;
theStepsNb.second = nbV;

View File

@@ -17,12 +17,9 @@
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRepAlgo.hxx>
#include <BRepAlgo_FaceRestrictor.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepLib.hxx>
#include <BRepOffsetAPI_MakeOffset.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <Extrema_ExtPS.hxx>
@@ -44,49 +41,6 @@
static Standard_Boolean AffichSpine = Standard_False;
#endif
static Standard_Boolean NeedsConvertion (const TopoDS_Wire& theWire)
{
TopoDS_Iterator anIter (theWire);
for (; anIter.More(); anIter.Next())
{
const TopoDS_Edge& anEdge = TopoDS::Edge (anIter.Value());
BRepAdaptor_Curve aBAcurve (anEdge);
GeomAbs_CurveType aType = aBAcurve.GetType();
if (aType != GeomAbs_Line &&
aType != GeomAbs_Circle)
return Standard_True;
}
return Standard_False;
}
static TopoDS_Face ConvertFace (const TopoDS_Face& theFace,
const Standard_Real theAngleTolerance)
{
TopAbs_Orientation anOr = theFace.Orientation();
TopoDS_Face aFace = theFace;
aFace.Orientation (TopAbs_FORWARD);
TopoDS_Face aNewFace = TopoDS::Face (aFace.EmptyCopied());
BRep_Builder aBB;
TopoDS_Iterator anIter (aFace);
for (; anIter.More(); anIter.Next())
{
TopoDS_Wire aWire = TopoDS::Wire (anIter.Value());
if (NeedsConvertion (aWire))
{
TopAbs_Orientation anOrOfWire = aWire.Orientation();
aWire = BRepAlgo::ConvertWire (aWire, theAngleTolerance, aFace);
BRepLib::BuildCurves3d (aWire);
aWire.Orientation (anOrOfWire);
}
aBB.Add (aNewFace, aWire);
}
aNewFace.Orientation (anOr);
return aNewFace;
}
//=======================================================================
//function : BRepOffsetAPI_MakeOffset
//purpose :
@@ -95,8 +49,7 @@ static TopoDS_Face ConvertFace (const TopoDS_Face& theFace,
BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset()
: myIsInitialized( Standard_False),
myJoin(GeomAbs_Arc),
myIsOpenResult(Standard_False),
myIsToApprox(Standard_False)
myIsOpenResult(Standard_False)
{
}
@@ -127,7 +80,6 @@ void BRepOffsetAPI_MakeOffset::Init(const TopoDS_Face& Spine,
myIsInitialized = Standard_True;
myJoin = Join;
myIsOpenResult = IsOpenResult;
myIsToApprox = Standard_False;
TopExp_Explorer exp;
for (exp.Init(myFace,TopAbs_WIRE); exp.More();exp.Next()) {
myWires.Append(exp.Current());
@@ -147,7 +99,6 @@ BRepOffsetAPI_MakeOffset::BRepOffsetAPI_MakeOffset(const TopoDS_Wire& Spine,
myIsInitialized = Standard_True;
myJoin = Join;
myIsOpenResult = IsOpenResult;
myIsToApprox = Standard_False;
}
//=======================================================================
@@ -162,18 +113,6 @@ void BRepOffsetAPI_MakeOffset::Init(const GeomAbs_JoinType Join,
myIsOpenResult = IsOpenResult;
}
//=======================================================================
//function : SetApprox
//purpose : Set approximation flag
// for convertion input contours into ones consisting of
// 2D circular arcs and 2D linear segments only
//=======================================================================
void BRepOffsetAPI_MakeOffset::SetApprox(const Standard_Boolean ToApprox)
{
myIsToApprox = ToApprox;
}
//=======================================================================
//function : BRepOffsetAPI_MakeOffset
//purpose :
@@ -350,46 +289,6 @@ void BRepOffsetAPI_MakeOffset::Perform(const Standard_Real Offset,
try
{
if (myIsToApprox)
{
Standard_Real aTol = 0.01;
if (myFace.IsNull())
{
TopoDS_Face aFace;
Standard_Boolean OnlyPlane = Standard_True;
TopTools_ListIteratorOfListOfShape anItl (myWires);
for (; anItl.More(); anItl.Next())
{
BRepBuilderAPI_MakeFace aFaceMaker (TopoDS::Wire(anItl.Value()), OnlyPlane);
if (aFaceMaker.Error() == BRepBuilderAPI_FaceDone)
{
aFace = aFaceMaker.Face();
break;
}
}
for (anItl.Initialize(myWires); anItl.More(); anItl.Next())
{
const TopoDS_Wire& aWire = TopoDS::Wire(anItl.Value());
if (NeedsConvertion (aWire))
{
TopoDS_Wire aNewWire = BRepAlgo::ConvertWire (aWire, aTol, aFace);
BRepLib::BuildCurves3d (aNewWire);
aNewWire.Orientation (aWire.Orientation());
anItl.ChangeValue() = aNewWire;
}
}
}
else
{
myFace = ConvertFace (myFace, aTol);
BRepLib::BuildCurves3d (myFace);
myWires.Clear();
TopoDS_Iterator anIter (myFace);
for (; anIter.More(); anIter.Next())
myWires.Append (anIter.Value());
}
}
Standard_Integer i = 1;
BRepFill_ListIteratorOfListOfOffsetWire itOW;
TopoDS_Compound Res;

View File

@@ -63,11 +63,6 @@ public:
//! Initialize the evaluation of Offsetting.
Standard_EXPORT void Init (const GeomAbs_JoinType Join = GeomAbs_Arc, const Standard_Boolean IsOpenResult = Standard_False);
//! Set approximation flag
//! for convertion input contours into ones consisting of
//! 2D circular arcs and 2D linear segments only.
Standard_EXPORT void SetApprox (const Standard_Boolean ToApprox);
//! Initializes the algorithm to construct parallels to the wire Spine.
Standard_EXPORT void AddWire (const TopoDS_Wire& Spine);
@@ -101,7 +96,6 @@ private:
Standard_Boolean myLastIsLeft;
GeomAbs_JoinType myJoin;
Standard_Boolean myIsOpenResult;
Standard_Boolean myIsToApprox;
TopoDS_Face myFace;
TopTools_ListOfShape myWires;
BRepFill_ListOfOffsetWire myLeft;

View File

@@ -1530,23 +1530,10 @@ Standard_Integer mkoffset(Draw_Interpretor& di,
char name[100];
BRepOffsetAPI_MakeOffset Paral;
Standard_Boolean ToApprox = Standard_False;
GeomAbs_JoinType theJoinType = GeomAbs_Arc;
Standard_Integer anIndArg = 6;
if (n >= 6)
{
if (strcmp(a[5], "-approx") == 0)
{
ToApprox = Standard_True;
anIndArg++;
}
if (n >= anIndArg && strcmp(a[anIndArg-1], "i") == 0)
theJoinType = GeomAbs_Intersection;
}
if (n >= 6 && strcmp(a[5], "i") == 0)
theJoinType = GeomAbs_Intersection;
Paral.Init(theJoinType);
TopoDS_Shape Base = DBRep::Get(a[2],TopAbs_FACE);
if ( Base.IsNull())
@@ -1566,7 +1553,6 @@ Standard_Integer mkoffset(Draw_Interpretor& di,
Base.Orientation(TopAbs_FORWARD);
Paral.Init(TopoDS::Face(Base), theJoinType);
}
Paral.SetApprox (ToApprox);
Standard_Real U, dU;
Standard_Integer Nb;
@@ -1574,8 +1560,8 @@ Standard_Integer mkoffset(Draw_Interpretor& di,
Nb = Draw::Atoi(a[3]);
Standard_Real Alt = 0.;
if (n > anIndArg)
Alt = Draw::Atof(a[anIndArg]);
if ( n == 7)
Alt = Draw::Atof(a[6]);
Standard_Integer Compt = 1;
@@ -1612,30 +1598,16 @@ Standard_Integer openoffset(Draw_Interpretor& di,
char name[100];
BRepOffsetAPI_MakeOffset Paral;
Standard_Boolean ToApprox = Standard_False;
GeomAbs_JoinType theJoinType = GeomAbs_Arc;
Standard_Integer anIndArg = 6;
if (n >= 6)
{
if (strcmp(a[5], "-approx") == 0)
{
ToApprox = Standard_True;
anIndArg++;
}
if (n >= anIndArg && strcmp(a[anIndArg-1], "i") == 0)
theJoinType = GeomAbs_Intersection;
}
if (n == 6 && strcmp(a[5], "i") == 0)
theJoinType = GeomAbs_Intersection;
Paral.Init(theJoinType, Standard_True);
TopoDS_Shape Base = DBRep::Get(a[2] ,TopAbs_FACE);
if ( Base.IsNull())
{
Base = DBRep::Get(a[2], TopAbs_WIRE);
if (Base.IsNull()) return 1;
Paral.Init(theJoinType, Standard_True);
Paral.AddWire(TopoDS::Wire(Base));
}
else
@@ -1643,7 +1615,6 @@ Standard_Integer openoffset(Draw_Interpretor& di,
Base.Orientation(TopAbs_FORWARD);
Paral.Init(TopoDS::Face(Base), theJoinType, Standard_True);
}
Paral.SetApprox (ToApprox);
Standard_Real U, dU;
Standard_Integer Nb;
@@ -1784,72 +1755,6 @@ Standard_Integer edgeintersector(Draw_Interpretor& di,
}
//=================================================================================
//function : arclinconvert
//purpose : Convert a single face to a face with contour made of arcs and segments
//=================================================================================
static Standard_Integer arclinconvert (Draw_Interpretor& /*dout*/, Standard_Integer n, const char** a)
{
// Check the command arguments
if (n < 3) {
std::cout<<"Error: "<<a[0]<<" - invalid number of arguments"<<std::endl;
std::cout<<"Usage: type help "<<a[0]<<std::endl;
return 1; //TCL_ERROR
}
//read shape
const TopoDS_Shape aShape = DBRep::Get(a[2]);
if (aShape.IsNull()) {
std::cout<<"Error: "<<a[2]<<" is null"<<std::endl;
return 1; //TCL_ERROR
}
TopAbs_ShapeEnum aType = aShape.ShapeType();
if (aType != TopAbs_WIRE &&
aType != TopAbs_FACE)
{
std::cout<<"Error: "<<a[2]<<" is neither wire no face"<<std::endl;
return 1; //TCL_ERROR
}
//read tolerance
Standard_Real aTol = 0.01;
if (n > 3)
aTol = Draw::Atof(a[3]);
std::cout<<"Info: tolerance is set to "<<aTol<<std::endl;
TopoDS_Shape aResult;
if (aType == TopAbs_WIRE)
{
Standard_Boolean OnlyPlane = Standard_False;
BRepBuilderAPI_MakeFace aFaceMaker (TopoDS::Wire(aShape), OnlyPlane);
if (aFaceMaker.Error() != BRepBuilderAPI_FaceDone)
{
std::cout<<"Error: failed to find a face for the wire "<<a[2]<<std::endl;
return 1; //TCL_ERROR
}
TopoDS_Face aFace = aFaceMaker.Face();
TopoDS_Iterator anIter (aFace);
TopoDS_Wire aWire = TopoDS::Wire (anIter.Value());
aResult = BRepAlgo::ConvertWire (aWire, aTol, aFace);
}
else if (aType == TopAbs_FACE)
{
TopoDS_Face aFace = TopoDS::Face(aShape);
aResult = BRepAlgo::ConvertFace (aFace, aTol);
}
if (aResult.IsNull()) {
std::cout<<"Error: could not convert "<<a[2]<<std::endl;
return 1; //TCL_ERROR
}
DBRep::Set(a[1], aResult);
return 0; //TCL_OK
}
//=======================================================================
//function : concatC0wire
//purpose :
@@ -2003,11 +1908,11 @@ void BRepTest::CurveCommands(Draw_Interpretor& theCommands)
profile2d,g);
theCommands.Add("mkoffset",
"mkoffset result face/compound of wires nboffset stepoffset [-approx] [jointype(a/i) [alt]]",__FILE__,
"mkoffset result face/compound of wires nboffset stepoffset [jointype(a/i) [alt]]",__FILE__,
mkoffset,g);
theCommands.Add("openoffset",
"openoffset result face/wire nboffset stepoffset [-approx] [jointype(a/i)]",__FILE__,
"openoffset result face/wire nboffset stepoffset [jointype(a/i)]",__FILE__,
openoffset,g);
theCommands.Add("mkedge",
@@ -2063,12 +1968,6 @@ void BRepTest::CurveCommands(Draw_Interpretor& theCommands)
"reducepcurves shape1 shape2 ...",__FILE__,
reducepcurves, g);
theCommands.Add("arclinconvert",
"arclinconvert result wire/face [tol]",
__FILE__,
arclinconvert,
g);
theCommands.Add("concatC0wire",
"concatC0wire result wire",
__FILE__,

View File

@@ -1,5 +0,0 @@
project(ExpToCasExe)
set (EXECUTABLE_PROJECT ON)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
unset (EXECUTABLE_PROJECT)

View File

@@ -1,2 +0,0 @@
TKernel
TKExpress

View File

@@ -1,395 +0,0 @@
// Created: Mon Nov 1 12:50:27 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <cstring>
#include <Express_Item.hxx>
#include <Express_Schema.hxx>
#include <Message.hxx>
#include <OSD_File.hxx>
#include <OSD_FileSystem.hxx>
#include <OSD_OpenFile.hxx>
#include <TCollection_HAsciiString.hxx>
#include "exptocas.tab.hxx"
//=======================================================================
// function : GetSchema
// purpose : interface to parser
//=======================================================================
Handle(Express_Schema) GetSchema (const char* theFileName)
{
std::ifstream aFileStream;
OSD_OpenStream(aFileStream, theFileName, std::ios_base::in | std::ios_base::binary);
exptocas::scanner aScanner(&aFileStream);
aScanner.yyrestart(&aFileStream);
// uncomment next string for debug of parser
//aScanner.set_debug(1);
exptocas::parser aParser(&aScanner);
aParser.parse();
return Express::Schema();
}
//=======================================================================
// function : LoadList
// purpose : Load list of (class name, package name) from the file
// Package names and optional mark flag are set to items in the schema
//=======================================================================
static Standard_Boolean LoadList (const char *theFileName,
const Handle(Express_Schema)& theSchema,
const Standard_Boolean theMark)
{
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
std::shared_ptr<std::istream> aStreamPtr = aFileSystem->OpenIStream (theFileName, std::ios::in);
Standard_IStream& anIS = *aStreamPtr;
if (aStreamPtr == nullptr)
{
Message::SendFail() << "Error: cannot open " << theFileName;
return Standard_False;
}
Message::SendInfo() << "Loading " << theFileName << "...";
char aBuf[512];
Standard_Integer aLineNum = 0;
// a line entry in file has the next format:
// item_name package_name [shortname [check_flag(0 or 1) [fillshared_flag(0 or 1) [category]]]]
while (anIS.getline (aBuf, 512))
{
char* aCurPos = aBuf;
char* anItemName;
char* aPackageName;
char* aShortName;
char* aCheckFlag;
char* aFillSharedFlag;
char* aCategoryName;
Standard_Size aSepIdx = 0;
aLineNum += 1;
// -------------------------------------------------------------
// first word is an item name
// -------------------------------------------------------------
// skip any whitespace character in the line
while (*aCurPos && (aSepIdx = strcspn (aCurPos, " \t\r\n")) == 0)
{
aCurPos++;
}
// to next line if first word isn't found or comment started
if (*aCurPos == '\0' || *aCurPos == '#')
{
continue;
}
// get the name of the item
anItemName = aCurPos;
// shift the position
if (aCurPos[aSepIdx] == '\0')
{
aCurPos += aSepIdx;
}
else
{
aCurPos[aSepIdx] = '\0';
aCurPos += aSepIdx + 1;
}
Handle(Express_Item) anItem = theSchema->Item (anItemName, Standard_True);
// skip any class name not in schema
if (anItem.IsNull())
{
continue;
}
// -------------------------------------------------------------
// second word is a package name
// -------------------------------------------------------------
// skip any whitespace character in the rest of the line
while (*aCurPos && (aSepIdx = strcspn (aCurPos, " \t\r\n")) == 0)
{
aCurPos++;
}
// to next line if second word isn't found or comment started
if (*aCurPos == '\0' || *aCurPos == '#')
{
continue;
}
// get the name of the package
aPackageName = aCurPos;
// shift the position
if (aCurPos[aSepIdx] == '\0')
{
aCurPos += aSepIdx;
}
else
{
aCurPos[aSepIdx] = '\0';
aCurPos += aSepIdx + 1;
}
// make warning if there is another package for the item
if (anItem->IsPackageNameSet() && anItem->GetPackageName().IsDifferent (aPackageName))
{
Message::SendWarning() << "Warning: Package is redefined for item " << anItemName;
}
anItem->SetPackageName (aPackageName);
anItem->SetGenMode (theMark ? Express_Item::GM_GenByUser : Express_Item::GM_NoGen);
// -------------------------------------------------------------
// third word is an item short name (optional)
// -------------------------------------------------------------
// skip any whitespace character in the line
while (*aCurPos && (aSepIdx = strcspn (aCurPos, " \t\r\n")) == 0)
{
aCurPos++;
}
// to next line if third word isn't found or comment started
if (*aCurPos == '\0' || *aCurPos == '#')
{
continue;
}
// get the short name
aShortName = aCurPos;
// shift the position
if (aCurPos[aSepIdx] == '\0')
{
aCurPos += aSepIdx;
}
else
{
aCurPos[aSepIdx] = '\0';
aCurPos += aSepIdx + 1;
}
if (!std::isalpha (*aShortName))
{
Message::SendWarning() << "Warning: Not recognized a shortname at the line " << aLineNum;
continue;
}
// if short name "-" then just do not set it
if (*aShortName != '-')
{
Handle(TCollection_HAsciiString) anItemShortName = new TCollection_HAsciiString(aShortName);
if (anItemShortName->Length() > 0)
{
anItem->SetShortName (anItemShortName);
}
}
// -------------------------------------------------------------
// fourth word is an item check flag (optional)
// -------------------------------------------------------------
// skip any whitespace character in the line
while (*aCurPos && (aSepIdx = strcspn (aCurPos, " \t\r\n")) == 0)
{
aCurPos++;
}
// to next line if fourth word isn't found or comment started
if (*aCurPos == '\0' || *aCurPos == '#')
{
continue;
}
// get the check flag
aCheckFlag = aCurPos;
// shift the position
if (aCurPos[aSepIdx] == '\0')
{
aCurPos += aSepIdx;
}
else
{
aCurPos[aSepIdx] = '\0';
aCurPos += aSepIdx + 1;
}
if (!(*aCheckFlag == '0' || *aCheckFlag == '1'))
{
Message::SendWarning() << "Warning: Not recognized a check flag at the line " << aLineNum;
continue;
}
Standard_Boolean hasCheck = (*aCheckFlag == '0' ? Standard_False : Standard_True);
anItem->SetCheckFlag (hasCheck);
// -------------------------------------------------------------
// fifth word is an item fill share flag (optional)
// -------------------------------------------------------------
// skip any whitespace character in the line
while (*aCurPos && (aSepIdx = strcspn (aCurPos, " \t\r\n")) == 0)
{
aCurPos++;
}
// to next line if fifth word isn't found or comment started
if (*aCurPos == '\0' || *aCurPos == '#')
{
continue;
}
// get the fill share flag
aFillSharedFlag = aCurPos;
// shift the position
if (aCurPos[aSepIdx] == '\0')
{
aCurPos += aSepIdx;
}
else
{
aCurPos[aSepIdx] = '\0';
aCurPos += aSepIdx + 1;
}
if (!(*aFillSharedFlag == '0' || *aFillSharedFlag == '1'))
{
Message::SendWarning() << "Warning: Not recognized a fill shared flag at the line " << aLineNum;
continue;
}
Standard_Boolean hasFillShared = (*aFillSharedFlag == '0' ? Standard_False : Standard_True);
anItem->SetFillSharedFlag (hasFillShared);
// -------------------------------------------------------------
// sixth word is an item category name (optional)
// -------------------------------------------------------------
// skip any whitespace character in the line
while (*aCurPos && (aSepIdx = strcspn (aCurPos, " \t\r\n")) == 0)
{
aCurPos++;
}
// to next line if sixth word isn't found or comment started
if (*aCurPos == '\0' || *aCurPos == '#')
{
continue;
}
// get the category name
aCategoryName = aCurPos;
aCurPos[aSepIdx] = '\0';
if (!std::isalpha (*aCategoryName))
{
Message::SendWarning() << "Warning: Not recognized a category name at the line " << aLineNum;
continue;
}
// if category name "-" then just do not set it
if (*aCategoryName != '-')
{
Handle(TCollection_HAsciiString) anItemCategoryName = new TCollection_HAsciiString(aCategoryName);
if (anItemCategoryName->Length() > 0)
{
anItem->SetShortName (anItemCategoryName);
}
}
}
Message::SendInfo() << " Done";
return Standard_True;
}
//=======================================================================
// function : main
// purpose :
//=======================================================================
Standard_Integer main (const Standard_Integer argc, const char* argv[])
{
if (argc < 2)
{
Message::SendInfo() << "EXPRESS -> CASCADE/XSTEP classes generator 3.0\n"
"Use: ExpToCas <schema.exp> [<create.lst> [<packaging.lst> [start_index]]]\n"
"Where: \n"
"- schema.exp is a file with EXPRESS schema \n"
"- create.lst is a file with list of types to generate (all if none)\n"
" (or \"-\" for creating all entities in the schema)\n"
"- packaging.lst is a file with classes distribution per package\n"
" in the form of the list (one item per line) \"<TypeName> <Package>\"\n"
" If package not defined for some type, \"StepStep\" assumed\n"
"- start_index - a first number for auxiliary generated files with data\n"
" to copy into StepAP214_Protocol.cxx, RWStepAP214_GeneralModule.cxx and\n"
" RWStepAP214_ReadWriteModule.cxx";
return 0;
}
//=================================
// Step 1: parsing EXPRESS file
// open schema file
OSD_Path aPath (argv[1]);
OSD_File aFile (aPath);
if (!aFile.IsReadable())
{
Message::SendFail() << "Error: Cannot open " << argv[1];
return -1;
}
// parse
Message::SendInfo() << "Starting parsing " << argv[1];
Handle(Express_Schema) aSchema = GetSchema (argv[1]);
if (aSchema.IsNull())
{
Message::SendFail() << "Error: Parsing finished with no result";
return -1;
}
else
{
Message::SendInfo() << "Schema " << aSchema->Name()->ToCString() << " successfully parsed";
}
Message::SendInfo() << "Total " << aSchema->NbItems() << " items";
//=================================
// Step 2: Prepare data for creating classes
// load packaging information
if (argc > 3)
{
if (!LoadList (argv[3], aSchema, Standard_False))
{
return -1;
}
}
// load list of classes to generate
if (argc > 2)
{
if (argv[2][0] == '-')
{
// set mark for all items
for (Standard_Integer num = 1; num <= aSchema->NbItems(); num++)
{
aSchema->Item (num)->SetGenMode (Express_Item::GM_GenByUser);
}
}
else if (!LoadList (argv[2], aSchema, Standard_True))
{
return -1;
}
}
// get starting index
Standard_Integer anIndex = -1;
if (argc > 4)
{
char* aStopSymbol;
anIndex = (Standard_Integer) strtol (argv[4], &aStopSymbol, 10);
if (*aStopSymbol != '\0')
{
Message::SendFail() << "Error: invalid starting index: " << argv[4];
return -1;
}
}
//=================================
// Step 3: Iterate over new items and set the package name if need
const TCollection_AsciiString aUserName("user");
for (Standard_Integer aNum = 1; aNum <= aSchema->NbItems(); aNum++)
{
if (aSchema->Item (aNum)->GetGenMode() == Express_Item::GM_GenByUser)
{
aSchema->Item (aNum)->Use2(aUserName, Express_Item::GetUnknownPackageName());
}
}
//=================================
// Step 4: Iterate by items and generate classes
Standard_Boolean isDone = Standard_False;
Express_Item::SetIndex (anIndex);
do
{
isDone = Standard_False;
for (Standard_Integer aNum = 1; aNum <= aSchema->NbItems(); aNum++)
{
isDone = isDone || aSchema->Item (aNum)->Generate();
}
} while (isDone);
return 0;
}

View File

@@ -1,7 +0,0 @@
exptocas.lex
expltocas.yacc
lex.exptocas.cxx
exptocas.tab.hxx
exptocas.tab.cxx
ExpToCasExe.cxx

View File

@@ -1,220 +0,0 @@
// -*-C++-*-
// FlexLexer.h -- define interfaces for lexical analyzer classes generated
// by flex
// Copyright (c) 1993 The Regents of the University of California.
// All rights reserved.
//
// This code is derived from software contributed to Berkeley by
// Kent Williams and Tom Epperly.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// Neither the name of the University nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE.
// This file defines FlexLexer, an abstract class which specifies the
// external interface provided to flex C++ lexer objects, and yyFlexLexer,
// which defines a particular lexer class.
//
// If you want to create multiple lexer classes, you use the -P flag
// to rename each yyFlexLexer to some other xxFlexLexer. You then
// include <FlexLexer.h> in your other sources once per lexer class:
//
// #undef yyFlexLexer
// #define yyFlexLexer xxFlexLexer
// #include <FlexLexer.h>
//
// #undef yyFlexLexer
// #define yyFlexLexer zzFlexLexer
// #include <FlexLexer.h>
// ...
#ifndef __FLEX_LEXER_H
// Never included before - need to define base class.
#define __FLEX_LEXER_H
#include <iostream>
extern "C++" {
struct yy_buffer_state;
typedef int yy_state_type;
class FlexLexer
{
public:
virtual ~FlexLexer() { }
const char* YYText() const { return yytext; }
int YYLeng() const { return yyleng; }
virtual void
yy_switch_to_buffer( yy_buffer_state* new_buffer ) = 0;
virtual yy_buffer_state* yy_create_buffer( std::istream* s, int size ) = 0;
virtual yy_buffer_state* yy_create_buffer( std::istream& s, int size ) = 0;
virtual void yy_delete_buffer( yy_buffer_state* b ) = 0;
virtual void yyrestart( std::istream* s ) = 0;
virtual void yyrestart( std::istream& s ) = 0;
virtual int yylex() = 0;
// Call yylex with new input/output sources.
int yylex( std::istream& new_in, std::ostream& new_out )
{
switch_streams( new_in, new_out );
return yylex();
}
int yylex( std::istream* new_in, std::ostream* new_out = 0)
{
switch_streams( new_in, new_out );
return yylex();
}
// Switch to new input/output streams. A nil stream pointer
// indicates "keep the current one".
virtual void switch_streams( std::istream* new_in,
std::ostream* new_out ) = 0;
virtual void switch_streams( std::istream& new_in,
std::ostream& new_out ) = 0;
int lineno() const { return yylineno; }
int debug() const { return yy_flex_debug; }
void set_debug( int flag ) { yy_flex_debug = flag; }
protected:
char* yytext;
int yyleng;
int yylineno; // only maintained if you use %option yylineno
int yy_flex_debug; // only has effect with -d or "%option debug"
};
}
#endif // FLEXLEXER_H
#if defined(yyFlexLexer) || ! defined(yyFlexLexerOnce)
// Either this is the first time through (yyFlexLexerOnce not defined),
// or this is a repeated include to define a different flavor of
// yyFlexLexer, as discussed in the flex manual.
# define yyFlexLexerOnce
extern "C++" {
class yyFlexLexer : public FlexLexer {
public:
// arg_yyin and arg_yyout default to the cin and cout, but we
// only make that assignment when initializing in yylex().
yyFlexLexer( std::istream& arg_yyin, std::ostream& arg_yyout );
yyFlexLexer( std::istream* arg_yyin = 0, std::ostream* arg_yyout = 0 );
private:
void ctor_common();
public:
virtual ~yyFlexLexer();
void yy_switch_to_buffer( yy_buffer_state* new_buffer );
yy_buffer_state* yy_create_buffer( std::istream* s, int size );
yy_buffer_state* yy_create_buffer( std::istream& s, int size );
void yy_delete_buffer( yy_buffer_state* b );
void yyrestart( std::istream* s );
void yyrestart( std::istream& s );
void yypush_buffer_state( yy_buffer_state* new_buffer );
void yypop_buffer_state();
virtual int yylex();
virtual void switch_streams( std::istream& new_in, std::ostream& new_out );
virtual void switch_streams( std::istream* new_in = 0, std::ostream* new_out = 0 );
virtual int yywrap();
protected:
virtual int LexerInput( char* buf, int max_size );
virtual void LexerOutput( const char* buf, int size );
virtual void LexerError( const char* msg );
void yyunput( int c, char* buf_ptr );
int yyinput();
void yy_load_buffer_state();
void yy_init_buffer( yy_buffer_state* b, std::istream& s );
void yy_flush_buffer( yy_buffer_state* b );
int yy_start_stack_ptr;
int yy_start_stack_depth;
int* yy_start_stack;
void yy_push_state( int new_state );
void yy_pop_state();
int yy_top_state();
yy_state_type yy_get_previous_state();
yy_state_type yy_try_NUL_trans( yy_state_type current_state );
int yy_get_next_buffer();
std::istream yyin; // input source for default LexerInput
std::ostream yyout; // output sink for default LexerOutput
// yy_hold_char holds the character lost when yytext is formed.
char yy_hold_char;
// Number of characters read into yy_ch_buf.
int yy_n_chars;
// Points to current character in buffer.
char* yy_c_buf_p;
int yy_init; // whether we need to initialize
int yy_start; // start state number
// Flag which is used to allow yywrap()'s to do buffer switches
// instead of setting up a fresh yyin. A bit of a hack ...
int yy_did_buffer_switch_on_eof;
size_t yy_buffer_stack_top; /**< index of top of stack. */
size_t yy_buffer_stack_max; /**< capacity of stack. */
yy_buffer_state ** yy_buffer_stack; /**< Stack as an array. */
void yyensure_buffer_stack(void);
// The following are not always needed, but may be depending
// on use of certain flex features (like REJECT or yymore()).
yy_state_type yy_last_accepting_state;
char* yy_last_accepting_cpos;
yy_state_type* yy_state_buf;
yy_state_type* yy_state_ptr;
char* yy_full_match;
int* yy_full_state;
int yy_full_lp;
int yy_lp;
int yy_looking_for_trail_begin;
int yy_more_flag;
int yy_more_len;
int yy_more_offset;
int yy_prev_more_offset;
};
}
#endif // yyFlexLexer || ! yyFlexLexerOnce

View File

@@ -1,171 +0,0 @@
# STEP express schema to OCCT classes
## 1. Introduction
**ExpToCasExe** is an auxiliary tool to generate code for implementation
of new STEP entities into OCCT.
This tool consists of two packages: **ExpToCasExe** and **TKExpress**.
*ExpToCasExe* package is the basic package for generation.
It parses the express schema, makes a list of entities described in the schema,
and starts generating classes according to the specified lists.
This package has the file *occt_existed_step_entities.lst* witch contains list
of STEP entities implemented in *OCCT* at this moment.
*TKExpress* package generates files with description of the STEP entities
to use in *OCCT* taking into account their dependencies.
Below is a set of generated files using the example
of the *Condition* entity from the *StepAP214* package.
* **StepAP214_Condition.hxx** - contains declaration of the class that describes STEP entity
* **StepAP214_Condition.cxx** - contains definition of the class that describes STEP entity
* **RWStepAP214_RWCondition.hxx** - contains declaration of the class that reads (writes) STEP entity from STEP file
* **RWStepAP214_RWCondition.cxx** - contains definition of the class that reads (writes) STEP entity from STEP file
* **category.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_GeneralModule.cxx* file
* **fillshared.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_GeneralModule.cxx* file
* **inc.txt** - common file for all generated entities with part of code to insert to *StepAP214_Protocol.cxx*
* **newvoid.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_GeneralModule.cxx* file
* **protocol.txt** - common file for all generated entities with part of code to insert to *StepAP214_Protocol.cxx* file
* **readstep.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_ReadWriteModule.cxx* file
* **reco.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_ReadWriteModule.cxx* file
* **rwinc.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_ReadWriteModule.cxx* file
* **steptype.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_ReadWriteModule.cxx* file
* **typebind.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_ReadWriteModule.cxx* file
* **writestep.txt** - common file for all generated entities with part of code to insert to *RWStepAP214_ReadWriteModule.cxx* file
## 2. Build
The build process is automated, but has some specifics. *ExpToCasExe* package contains file *exptocas.lex*
which contains rules for lexical analyzer builder (*FLEX*), and file *exptocas.yacc*
which contains rules for syntax analyzer builder (*GNU Bison*).
During build process *FLEX* and *Bison* generate the next files:
* FlexLexer.h
* lex.exptocas.cxx
* exptocas.tab.cxx
* exptocas.tab.hxx
These files are placed to the source directory ("*src/ExpToCasExe*") due to *CMAKE* script specific.
Then standard Visual Studio build process continues.
There is no necessary to include these files to the *git* repository, due to automatic generation.
To change the behaviour of Express schema parser, the user need to modify original files:
*exptocas.lex* and *exptocas.yacc*.
## 3. Usage
**ExpToCasExe** program has the following call pattern:
~~~~
> ExpToCasExe <schema.exp> [<new.lst> [<existed.lst> [start_index]]]
~~~~
where:
* **schema.exp** - file with STEP Express schema
* **new.lst** - file with list of new STEP entities which we have to generate
* **existed.lst** - file with list of already implemented STEP entities
* **start_index** - a first index for entity registration
(value of it you can receive after analyse of *StepAP214_Protocol.cxx* file)
If *new.lst* file is set to "-" then all entities from Express schema are considered as new.
*new.lst* and *existed.lst* are the text files. Line in file describes the class name
of STEP entity and to witch *OCCT* package it's belong. Line has the following format:
~~~~
item_name package_name [shortname [check_flag(0 or 1) [fillshared_flag(0 or 1) [category]]]]
~~~~
where:
* **item_name** is the class name of the STEP entity (*ProductDefinitionOrReference* for example)
* **package_name** is the name of the *OCCT* package (*StepBasic* for example)
* **shortname** is the short name of the STEP entity
* **check_flag** is the flag to generate the *Check* function in the class
* **fillshared_flag** is the flag to generate the *FillShared* function in the class
* **category** is the name of category to witch entity belongs to
These file can include comments after the symbol "#".
The result of generation consists of several folders:
* two folders (*\_package_name\_* and *RW\_package_name\_*) for each package for which new entities were generated.
* a folder *Registration* with *\*.txt* files with code to copy into common files (see the example in the first section).
For generation, it is easy to copy to separate directory following files:
* **ExpToCasExe.exe**, **TKernel.dll** and **TKExpress.dll** from OCCT
* STEP Express schema
* **occt_existed_step_entities.lst** from package *ExpToCasExe*
create a file with needed entities **new.lst** and from this directory execute command:
~~~~
> ExpToCasExe.exe schema.exp new.lst occt_existed_step_entities.lst 1000
~~~~
## 4. Disclaimer
**NOTE**:
Some STEP schemes may be not fully corresponded to the rules which set in our generator.
If during generation we receive a message about syntax error you can try to edit schema
file in order to avoid it. Such approach is reasonable if number of errors is small.
If there are many errors we have to change existed rules (for debug parser process you can
uncomment string "//aScanner.set_debug(1);" in the file *exptocas.yacc*).
TIP: remove upper case from name after SCHEMA key word.
**NOTE**:
Please, take into account that most of existed entities were generated many years ago.
Some of them can be not corresponded to last versions of schemes.
For example, we don't have classes for entity:
~~~~
ENTITY founded_item
SUPERTYPE OF ((ONEOF(b_spline_curve_knot_locator, b_spline_curve_segment, b_spline_surface_knot_locator,
b_spline_surface_patch, b_spline_surface_strip,
boundary_curve_of_b_spline_or_rectangular_composite_surface, box_domain,
character_glyph_style_outline, character_glyph_style_stroke, composite_curve_segment,
composite_curve_transition_locator, curve_style, curve_style_font, curve_style_font_and_scaling,
curve_style_font_pattern, externally_defined_style, fill_area_style,
interpolated_configuration_segment, kinematic_path_segment, plane_angle_and_length_pair,
plane_angle_and_ratio_pair, point_style, presentation_style_assignment,
rectangular_composite_surface_transition_locator, surface_patch, surface_side_style,
surface_style_boundary, surface_style_control_grid, surface_style_fill_area,
surface_style_parameter_line, surface_style_segmentation_curve, surface_style_silhouette,
surface_style_usage, symbol_style, text_style, view_volume)) ANDOR
(ONEOF(character_glyph_style_outline, character_glyph_style_stroke, curve_style, curve_style_font,
curve_style_font_and_scaling, curve_style_font_pattern, externally_defined_style,
fill_area_style, point_style, presentation_style_assignment, surface_side_style,
surface_style_boundary, surface_style_control_grid, surface_style_fill_area,
surface_style_parameter_line, surface_style_segmentation_curve, surface_style_silhouette,
surface_style_usage, symbol_style, text_style)));
DERIVE
users : SET [0 : ?] OF founded_item_select := using_items(SELF, []);
WHERE
WR1: SIZEOF(users) > 0;
WR2: NOT (SELF IN users);
END_ENTITY;
~~~~
But some of existed entities (for example - *composite_curve_segment*) must be inherited from
this missing entity (at present such existed entities are inherited from *Standard_Transient*):
~~~~
ENTITY composite_curve_segment
SUBTYPE OF (founded_item);
transition : transition_code;
same_sense : BOOLEAN;
parent_curve : curve;
INVERSE
using_curves : BAG[1:?] OF composite_curve FOR segments;
WHERE
wr1 : ('AUTOMOTIVE_DESIGN.BOUNDED_CURVE' IN TYPEOF(parent_curve));
END_ENTITY; -- 10303-42: geometry_schema
~~~~
**NOTE**: To facilitate the work of those who will use this program after you,
it is strongly recommended update the file **occt_existed_step_entities.lst**
after each generation and not to forget to change update date in the first line of this file.

View File

@@ -1,203 +0,0 @@
%{
// Created: Thu Oct 28 12:21:16 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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.
/*****************************************************************************
This LEX scanner is performs lexical analysis of EXPRESS schema file
for EXPRESS -> CASCADE/XSTEP classes generator
On the stage of lexical scanner comments (single- and multi-line),
definitions of CONSTANT, FUNCTION, RULE items and clauses WHERE, INVERSE
and DERIVE of TYPE amd ENTITY items are dismissed (ignored)
Then, keywords such as ENTITY, SUPERTYPE, SET etc., names of items
and special symbols are identified and returned to parser (yacc) as tokens
Also, error processing and current line number tracking functions are defined
*****************************************************************************/
/************************************/
/* Section 1 */
/* definitions */
#include <stdlib.h>
#include <string.h>
#include <TColStd_HSequenceOfHAsciiString.hxx>
#include <Express_HSequenceOfField.hxx>
#include <Express_HSequenceOfItem.hxx>
#include <Express_Field.hxx>
#include <Express_Item.hxx>
#include <Express_Type.hxx>
#include <Express_Schema.hxx>
#include <Express_Reference.hxx>
#include "exptocas.tab.hxx" /* define tokens */
/* Auxiliary functions */
static int fun_level=0;
static int ec_linenum=1;
static int ec_state = 0;
int yywrap(void) { return 1; }
int ec_curline ( void )
{
return ec_linenum;
}
int ec_error ( const std::string& s, const std::string& text )
{
printf ( "\nError at line %d: %s \"%s\"\n", ec_curline(), s.c_str(), text.c_str() );
return 0;
}
%}
/*
c++ generate C++ parser class
*/
%option c++
%option noyywrap
%option yyclass="exptocas::scanner"
%option nounistd
%s TYP ENT
%x COMM SKP RULE FUN
%a 4000
%o 6000
%top{
// Pre-include stdlib.h to avoid redefinition of integer type macros (INT8_MIN and similar in generated code)
#if !defined(_MSC_VER) || (_MSC_VER >= 1600) // Visual Studio 2010+
#include "stdint.h"
#endif
}
%{
// Tell flex which function to define
#ifdef YY_DECL
# undef YY_DECL
#endif
#define YY_DECL int exptocas::scanner::lex (exptocas::parser::semantic_type* yylval)
typedef exptocas::parser::token token;
/************************************/
/* Section 2 */
/* parsing rules */
%}
%%
"--".* { /* Eat line comments */ }
"(*" { ec_state = YYSTATE; BEGIN(COMM); }
<COMM>. { /* Eat multiline comments */ }
<COMM>"*)" { BEGIN(ec_state); }
"SCHEMA" { return yylval->num = token::KSCHEM; }
"END_SCHEMA" { return yylval->num = token::KENDS; }
"TYPE" { BEGIN(TYP); return yylval->num = token::KTYP; }
<TYP,SKP>"END_TYPE" { BEGIN(0); return yylval->num = token::KENDT; }
"ENTITY" { BEGIN(ENT); return yylval->num = token::KENT; }
<ENT,SKP>"END_ENTITY" { BEGIN(0); return yylval->num = token::KENDE; }
<ENT>"INVERSE" |
<ENT>"DERIVE" |
<ENT,TYP>"WHERE" { BEGIN(SKP); }
<SKP>. { /* eat contents of WHERE and DERIVE subclauses of ENTITY and TYPE */ }
"SELECT" { return yylval->num = token::KSEL; }
"ENUMERATION" { return yylval->num = token::KENUM; }
"LIST" { return yylval->num = token::KLIST; }
"ARRAY" { return yylval->num = token::KARR; }
"SET" { return yylval->num = token::KSET; }
"BAG" { return yylval->num = token::KBAG; }
"OF" { return yylval->num = token::KOF; }
"NUMBER" { return yylval->num = token::KNUM; }
"INTEGER" { return yylval->num = token::KINT; }
"REAL" { return yylval->num = token::KDBL; }
"STRING" { return yylval->num = token::KSTR; }
"LOGICAL" { return yylval->num = token::KLOG; }
"BOOLEAN" { return yylval->num = token::KBOOL; }
"OPTIONAL" { return yylval->num = token::KOPT; }
"UNIQUE" { return yylval->num = token::KUNIQ; }
"SELF" { return yylval->num = token::KSELF; }
"ABSTRACT" { return yylval->num = token::KABSTR; }
"SUBTYPE" { return yylval->num = token::KSUBT; }
"SUPERTYPE" { return yylval->num = token::KSPRT; }
"ANDOR" { return yylval->num = token::KANDOR; }
"ONEOF" { return yylval->num = token::K1OF; }
"AND" { return yylval->num = token::KAND; }
"UR"[0-9]+ { yylval->str = strdup ( yytext ); return token::NAME; }
[a-z_][a-z_0-9]* { yylval->str = strdup ( yytext ); return token::NAME; }
[0-9]+ { yylval->num = atoi ( yytext ); return token::NUMBER; }
[,=();?:.\\]|"["|"]" { return yylval->num = yytext[0]; }
<INITIAL,FUN>"FUNCTION" { BEGIN(FUN); fun_level++; }
<FUN>"(*" { ec_state = YYSTATE; BEGIN(COMM); /* eat comments in functions */ }
<FUN>"--".* { /* Eat line comments in functions */ }
<FUN>[A-Za-z_0-9]* { /* eat FUNCTIONs - skip IDs explicitly */ }
<FUN>\'[^\']*\' { /* eat FUNCTIONs - skip strings explicitly */ }
<FUN>. { /* eat FUNCTIONs - skip all other symbols in functions */ }
<FUN>"END_FUNCTION;" { fun_level--; if ( ! fun_level ) BEGIN(0); }
"RULE" { BEGIN(RULE); /* eat RULEs */ }
<RULE>. { /* eat RULEs */ }
<RULE>"END_RULE;" { BEGIN(0); }
"CONSTANT"[ \t\na-z_0-9:=;'()|-]+"END_CONSTANT;" { /* eat CONSTANTs */
char *s = yytext; /* but don't forget to count lines.. */
while ( *s ) if ( *(s++) == '\n' ) ec_linenum++;
}
[ \t]+ { /* eat spaces */ }
[A-Za-z0-9_]+ { ec_error ( "unknown keyword ", yytext ); /* put unrecognized keywords to cerr */ }
. { ec_error ( "unknown symbol ", yytext ); /* put unrecognized data to cerr */ }
<INITIAL,COMM,SKP,RULE,ENT,TYP,FUN>\n { ec_linenum++; /* count lines */ }
%%
/************************************/
/* Section 3 */
/* auxiliary procedures */
exptocas::scanner::scanner(std::istream* in, std::ostream* out)
: exptocasFlexLexer(in, out)
{
}
/*
int main ( void )
{
yylex();
}
*/

File diff suppressed because it is too large Load Diff

View File

@@ -1,910 +0,0 @@
// A Bison parser, made by GNU Bison 3.7.4.
// Skeleton interface for Bison LALR(1) parsers in C++
// Copyright (C) 2002-2015, 2018-2020 Free Software Foundation, Inc.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// As a special exception, you may create a larger work that contains
// part or all of the Bison parser skeleton and distribute that work
// under terms of your choice, so long as that work isn't itself a
// parser generator using the skeleton or a modified version thereof
// as a parser skeleton. Alternatively, if you modify or redistribute
// the parser skeleton itself, you may (at your option) remove this
// special exception, which will cause the skeleton and the resulting
// Bison output files to be licensed under the GNU General Public
// License without this special exception.
// This special exception was added by the Free Software Foundation in
// version 2.2 of Bison.
/**
** \file ExpToCasExe/exptocas.tab.hxx
** Define the exptocas::parser class.
*/
// C++ LALR(1) parser skeleton written by Akim Demaille.
// DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
// especially those whose name start with YY_ or yy_. They are
// private implementation details that can be changed or removed.
#ifndef YY_EXPTOCAS_EXPTOCASEXE_EXPTOCAS_TAB_HXX_INCLUDED
# define YY_EXPTOCAS_EXPTOCASEXE_EXPTOCAS_TAB_HXX_INCLUDED
// "%code requires" blocks.
#include <OSD_OpenFile.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx>
#include <Express_HSequenceOfField.hxx>
#include <Express_HSequenceOfItem.hxx>
#include <Express_Field.hxx>
#include <Express_Item.hxx>
#include <Express_Enum.hxx>
#include <Express_Alias.hxx>
#include <Express_Select.hxx>
#include <Express_Entity.hxx>
#include <Express_Type.hxx>
#include <Express_NamedType.hxx>
#include <Express_PredefinedType.hxx>
#include <Express_Number.hxx>
#include <Express_Integer.hxx>
#include <Express_Boolean.hxx>
#include <Express_Logical.hxx>
#include <Express_Real.hxx>
#include <Express_String.hxx>
#include <Express_ComplexType.hxx>
#include <Express_Array.hxx>
#include <Express_List.hxx>
#include <Express_Set.hxx>
#include <Express_Bag.hxx>
#include <Express_Schema.hxx>
#include <Express_Reference.hxx>
#include <Express.hxx>
namespace exptocas {
class scanner;
};
#ifdef _MSC_VER
// disable MSVC warning C4522: 'exptocas::parser::stack_symbol_type': multiple assignment operators
#pragma warning(disable: 4522)
#endif
# include <cstdlib> // std::abort
# include <iostream>
# include <stdexcept>
# include <string>
# include <vector>
#if defined __cplusplus
# define YY_CPLUSPLUS __cplusplus
#else
# define YY_CPLUSPLUS 199711L
#endif
// Support move semantics when possible.
#if 201103L <= YY_CPLUSPLUS
# define YY_MOVE std::move
# define YY_MOVE_OR_COPY move
# define YY_MOVE_REF(Type) Type&&
# define YY_RVREF(Type) Type&&
# define YY_COPY(Type) Type
#else
# define YY_MOVE
# define YY_MOVE_OR_COPY copy
# define YY_MOVE_REF(Type) Type&
# define YY_RVREF(Type) const Type&
# define YY_COPY(Type) const Type&
#endif
// Support noexcept when possible.
#if 201103L <= YY_CPLUSPLUS
# define YY_NOEXCEPT noexcept
# define YY_NOTHROW
#else
# define YY_NOEXCEPT
# define YY_NOTHROW throw ()
#endif
// Support constexpr when possible.
#if 201703 <= YY_CPLUSPLUS
# define YY_CONSTEXPR constexpr
#else
# define YY_CONSTEXPR
#endif
#ifndef YY_ATTRIBUTE_PURE
# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
# else
# define YY_ATTRIBUTE_PURE
# endif
#endif
#ifndef YY_ATTRIBUTE_UNUSED
# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
# else
# define YY_ATTRIBUTE_UNUSED
# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E))
#else
# define YYUSE(E) /* empty */
#endif
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
#ifndef YY_INITIAL_VALUE
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
# define YY_IGNORE_USELESS_CAST_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
# define YY_IGNORE_USELESS_CAST_END \
_Pragma ("GCC diagnostic pop")
#endif
#ifndef YY_IGNORE_USELESS_CAST_BEGIN
# define YY_IGNORE_USELESS_CAST_BEGIN
# define YY_IGNORE_USELESS_CAST_END
#endif
# ifndef YY_CAST
# ifdef __cplusplus
# define YY_CAST(Type, Val) static_cast<Type> (Val)
# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
# else
# define YY_CAST(Type, Val) ((Type) (Val))
# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
# endif
# endif
# ifndef YY_NULLPTR
# if defined __cplusplus
# if 201103L <= __cplusplus
# define YY_NULLPTR nullptr
# else
# define YY_NULLPTR 0
# endif
# else
# define YY_NULLPTR ((void*)0)
# endif
# endif
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
namespace exptocas {
/// A Bison parser.
class parser
{
public:
#ifndef YYSTYPE
/// Symbol semantic values.
union semantic_type
{
int num;
char *str;
TColStd_HSequenceOfHAsciiString *tlist;
Express_HSequenceOfField *flist;
Express_HSequenceOfItem *ilist;
Express_Field *field;
Express_Item *item;
Express_Type *type;
Express_Schema *schema;
Express_Reference *ref;
};
#else
typedef YYSTYPE semantic_type;
#endif
/// Syntax errors thrown from user actions.
struct syntax_error : std::runtime_error
{
syntax_error (const std::string& m)
: std::runtime_error (m)
{}
syntax_error (const syntax_error& s)
: std::runtime_error (s.what ())
{}
~syntax_error () YY_NOEXCEPT YY_NOTHROW;
};
/// Token kinds.
struct token
{
enum token_kind_type
{
YYEMPTY = -2,
YYEOF = 0, // "end of file"
YYerror = 256, // error
YYUNDEF = 257, // "invalid token"
KSCHEM = 258, // KSCHEM
KENDS = 259, // KENDS
KTYP = 260, // KTYP
KENDT = 261, // KENDT
KENT = 262, // KENT
KENDE = 263, // KENDE
KREF = 264, // KREF
KFROM = 265, // KFROM
KSEL = 266, // KSEL
KENUM = 267, // KENUM
KLIST = 268, // KLIST
KARR = 269, // KARR
KBAG = 270, // KBAG
KSET = 271, // KSET
KOF = 272, // KOF
KNUM = 273, // KNUM
KINT = 274, // KINT
KDBL = 275, // KDBL
KSTR = 276, // KSTR
KLOG = 277, // KLOG
KBOOL = 278, // KBOOL
KOPT = 279, // KOPT
KUNIQ = 280, // KUNIQ
KSELF = 281, // KSELF
KABSTR = 282, // KABSTR
KSUBT = 283, // KSUBT
KSPRT = 284, // KSPRT
KANDOR = 285, // KANDOR
K1OF = 286, // K1OF
KAND = 287, // KAND
NUMBER = 288, // NUMBER
NAME = 289 // NAME
};
/// Backward compatibility alias (Bison 3.6).
typedef token_kind_type yytokentype;
};
/// Token kind, as returned by yylex.
typedef token::yytokentype token_kind_type;
/// Backward compatibility alias (Bison 3.6).
typedef token_kind_type token_type;
/// Symbol kinds.
struct symbol_kind
{
enum symbol_kind_type
{
YYNTOKENS = 46, ///< Number of tokens.
S_YYEMPTY = -2,
S_YYEOF = 0, // "end of file"
S_YYerror = 1, // error
S_YYUNDEF = 2, // "invalid token"
S_KSCHEM = 3, // KSCHEM
S_KENDS = 4, // KENDS
S_KTYP = 5, // KTYP
S_KENDT = 6, // KENDT
S_KENT = 7, // KENT
S_KENDE = 8, // KENDE
S_KREF = 9, // KREF
S_KFROM = 10, // KFROM
S_KSEL = 11, // KSEL
S_KENUM = 12, // KENUM
S_KLIST = 13, // KLIST
S_KARR = 14, // KARR
S_KBAG = 15, // KBAG
S_KSET = 16, // KSET
S_KOF = 17, // KOF
S_KNUM = 18, // KNUM
S_KINT = 19, // KINT
S_KDBL = 20, // KDBL
S_KSTR = 21, // KSTR
S_KLOG = 22, // KLOG
S_KBOOL = 23, // KBOOL
S_KOPT = 24, // KOPT
S_KUNIQ = 25, // KUNIQ
S_KSELF = 26, // KSELF
S_KABSTR = 27, // KABSTR
S_KSUBT = 28, // KSUBT
S_KSPRT = 29, // KSPRT
S_KANDOR = 30, // KANDOR
S_K1OF = 31, // K1OF
S_KAND = 32, // KAND
S_NUMBER = 33, // NUMBER
S_NAME = 34, // NAME
S_35_ = 35, // ','
S_36_ = 36, // ';'
S_37_ = 37, // '='
S_38_ = 38, // '('
S_39_ = 39, // ')'
S_40_ = 40, // '['
S_41_ = 41, // ':'
S_42_ = 42, // ']'
S_43_ = 43, // '?'
S_44_ = 44, // '\\'
S_45_ = 45, // '.'
S_YYACCEPT = 46, // $accept
S_SCHEMA = 47, // SCHEMA
S_ILIST = 48, // ILIST
S_ITEM = 49, // ITEM
S_ENUM = 50, // ENUM
S_SELECT = 51, // SELECT
S_ALIAS = 52, // ALIAS
S_ENTITY = 53, // ENTITY
S_REFERENCE = 54, // REFERENCE
S_TLIST = 55, // TLIST
S_TLIST1 = 56, // TLIST1
S_TYPE = 57, // TYPE
S_TSTD = 58, // TSTD
S_TNAME = 59, // TNAME
S_TSET = 60, // TSET
S_INDEX = 61, // INDEX
S_OPTUNI = 62, // OPTUNI
S_SUBT = 63, // SUBT
S_SUPERT = 64, // SUPERT
S_SUPLST = 65, // SUPLST
S_FLIST = 66, // FLIST
S_FLIST1 = 67, // FLIST1
S_FIELD = 68, // FIELD
S_REDEF = 69, // REDEF
S_SPECIF = 70, // SPECIF
S_OPTNL = 71, // OPTNL
S_UNIQIT = 72, // UNIQIT
S_UNIQLS = 73, // UNIQLS
S_UNIQUE = 74, // UNIQUE
S_SPCLST = 75 // SPCLST
};
};
/// (Internal) symbol kind.
typedef symbol_kind::symbol_kind_type symbol_kind_type;
/// The number of tokens.
static const symbol_kind_type YYNTOKENS = symbol_kind::YYNTOKENS;
/// A complete symbol.
///
/// Expects its Base type to provide access to the symbol kind
/// via kind ().
///
/// Provide access to semantic value.
template <typename Base>
struct basic_symbol : Base
{
/// Alias to Base.
typedef Base super_type;
/// Default constructor.
basic_symbol ()
: value ()
{}
#if 201103L <= YY_CPLUSPLUS
/// Move constructor.
basic_symbol (basic_symbol&& that)
: Base (std::move (that))
, value (std::move (that.value))
{}
#endif
/// Copy constructor.
basic_symbol (const basic_symbol& that);
/// Constructor for valueless symbols.
basic_symbol (typename Base::kind_type t);
/// Constructor for symbols with semantic value.
basic_symbol (typename Base::kind_type t,
YY_RVREF (semantic_type) v);
/// Destroy the symbol.
~basic_symbol ()
{
clear ();
}
/// Destroy contents, and record that is empty.
void clear ()
{
Base::clear ();
}
#if YYDEBUG || 0
/// The user-facing name of this symbol.
const char *name () const YY_NOEXCEPT
{
return parser::symbol_name (this->kind ());
}
#endif // #if YYDEBUG || 0
/// Backward compatibility (Bison 3.6).
symbol_kind_type type_get () const YY_NOEXCEPT;
/// Whether empty.
bool empty () const YY_NOEXCEPT;
/// Destructive move, \a s is emptied into this.
void move (basic_symbol& s);
/// The semantic value.
semantic_type value;
private:
#if YY_CPLUSPLUS < 201103L
/// Assignment operator.
basic_symbol& operator= (const basic_symbol& that);
#endif
};
/// Type access provider for token (enum) based symbols.
struct by_kind
{
/// Default constructor.
by_kind ();
#if 201103L <= YY_CPLUSPLUS
/// Move constructor.
by_kind (by_kind&& that);
#endif
/// Copy constructor.
by_kind (const by_kind& that);
/// The symbol kind as needed by the constructor.
typedef token_kind_type kind_type;
/// Constructor from (external) token numbers.
by_kind (kind_type t);
/// Record that this symbol is empty.
void clear ();
/// Steal the symbol kind from \a that.
void move (by_kind& that);
/// The (internal) type number (corresponding to \a type).
/// \a empty when empty.
symbol_kind_type kind () const YY_NOEXCEPT;
/// Backward compatibility (Bison 3.6).
symbol_kind_type type_get () const YY_NOEXCEPT;
/// The symbol kind.
/// \a S_YYEMPTY when empty.
symbol_kind_type kind_;
};
/// Backward compatibility for a private implementation detail (Bison 3.6).
typedef by_kind by_type;
/// "External" symbols: returned by the scanner.
struct symbol_type : basic_symbol<by_kind>
{};
/// Build a parser object.
parser (exptocas::scanner* scanner_yyarg);
virtual ~parser ();
#if 201103L <= YY_CPLUSPLUS
/// Non copyable.
parser (const parser&) = delete;
/// Non copyable.
parser& operator= (const parser&) = delete;
#endif
/// Parse. An alias for parse ().
/// \returns 0 iff parsing succeeded.
int operator() ();
/// Parse.
/// \returns 0 iff parsing succeeded.
virtual int parse ();
#if YYDEBUG
/// The current debugging stream.
std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
/// Set the current debugging stream.
void set_debug_stream (std::ostream &);
/// Type for debugging levels.
typedef int debug_level_type;
/// The current debugging level.
debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
/// Set the current debugging level.
void set_debug_level (debug_level_type l);
#endif
/// Report a syntax error.
/// \param msg a description of the syntax error.
virtual void error (const std::string& msg);
/// Report a syntax error.
void error (const syntax_error& err);
#if YYDEBUG || 0
/// The user-facing name of the symbol whose (internal) number is
/// YYSYMBOL. No bounds checking.
static const char *symbol_name (symbol_kind_type yysymbol);
#endif // #if YYDEBUG || 0
private:
#if YY_CPLUSPLUS < 201103L
/// Non copyable.
parser (const parser&);
/// Non copyable.
parser& operator= (const parser&);
#endif
/// Stored state numbers (used for stacks).
typedef unsigned char state_type;
/// Compute post-reduction state.
/// \param yystate the current state
/// \param yysym the nonterminal to push on the stack
static state_type yy_lr_goto_state_ (state_type yystate, int yysym);
/// Whether the given \c yypact_ value indicates a defaulted state.
/// \param yyvalue the value to check
static bool yy_pact_value_is_default_ (int yyvalue);
/// Whether the given \c yytable_ value indicates a syntax error.
/// \param yyvalue the value to check
static bool yy_table_value_is_error_ (int yyvalue);
static const short yypact_ninf_;
static const signed char yytable_ninf_;
/// Convert a scanner token kind \a t to a symbol kind.
/// In theory \a t should be a token_kind_type, but character literals
/// are valid, yet not members of the token_type enum.
static symbol_kind_type yytranslate_ (int t);
#if YYDEBUG || 0
/// For a symbol, its name in clear.
static const char* const yytname_[];
#endif // #if YYDEBUG || 0
// Tables.
// YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
// STATE-NUM.
static const short yypact_[];
// YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
// Performed when YYTABLE does not specify something else to do. Zero
// means the default is an error.
static const signed char yydefact_[];
// YYPGOTO[NTERM-NUM].
static const short yypgoto_[];
// YYDEFGOTO[NTERM-NUM].
static const short yydefgoto_[];
// YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
// positive, shift that token. If negative, reduce the rule whose
// number is the opposite. If YYTABLE_NINF, syntax error.
static const unsigned char yytable_[];
static const short yycheck_[];
// YYSTOS[STATE-NUM] -- The (internal number of the) accessing
// symbol of state STATE-NUM.
static const signed char yystos_[];
// YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
static const signed char yyr1_[];
// YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
static const signed char yyr2_[];
#if YYDEBUG
// YYRLINE[YYN] -- Source line where rule number YYN was defined.
static const short yyrline_[];
/// Report on the debug stream that the rule \a r is going to be reduced.
virtual void yy_reduce_print_ (int r) const;
/// Print the state stack on the debug stream.
virtual void yy_stack_print_ () const;
/// Debugging level.
int yydebug_;
/// Debug stream.
std::ostream* yycdebug_;
/// \brief Display a symbol kind, value and location.
/// \param yyo The output stream.
/// \param yysym The symbol.
template <typename Base>
void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
#endif
/// \brief Reclaim the memory associated to a symbol.
/// \param yymsg Why this token is reclaimed.
/// If null, print nothing.
/// \param yysym The symbol.
template <typename Base>
void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
private:
/// Type access provider for state based symbols.
struct by_state
{
/// Default constructor.
by_state () YY_NOEXCEPT;
/// The symbol kind as needed by the constructor.
typedef state_type kind_type;
/// Constructor.
by_state (kind_type s) YY_NOEXCEPT;
/// Copy constructor.
by_state (const by_state& that) YY_NOEXCEPT;
/// Record that this symbol is empty.
void clear () YY_NOEXCEPT;
/// Steal the symbol kind from \a that.
void move (by_state& that);
/// The symbol kind (corresponding to \a state).
/// \a symbol_kind::S_YYEMPTY when empty.
symbol_kind_type kind () const YY_NOEXCEPT;
/// The state number used to denote an empty symbol.
/// We use the initial state, as it does not have a value.
enum { empty_state = 0 };
/// The state.
/// \a empty when empty.
state_type state;
};
/// "Internal" symbol: element of the stack.
struct stack_symbol_type : basic_symbol<by_state>
{
/// Superclass.
typedef basic_symbol<by_state> super_type;
/// Construct an empty symbol.
stack_symbol_type ();
/// Move or copy construction.
stack_symbol_type (YY_RVREF (stack_symbol_type) that);
/// Steal the contents from \a sym to build this.
stack_symbol_type (state_type s, YY_MOVE_REF (symbol_type) sym);
#if YY_CPLUSPLUS < 201103L
/// Assignment, needed by push_back by some old implementations.
/// Moves the contents of that.
stack_symbol_type& operator= (stack_symbol_type& that);
/// Assignment, needed by push_back by other implementations.
/// Needed by some other old implementations.
stack_symbol_type& operator= (const stack_symbol_type& that);
#endif
};
/// A stack with random access from its top.
template <typename T, typename S = std::vector<T> >
class stack
{
public:
// Hide our reversed order.
typedef typename S::iterator iterator;
typedef typename S::const_iterator const_iterator;
typedef typename S::size_type size_type;
typedef typename std::ptrdiff_t index_type;
stack (size_type n = 200)
: seq_ (n)
{}
#if 201103L <= YY_CPLUSPLUS
/// Non copyable.
stack (const stack&) = delete;
/// Non copyable.
stack& operator= (const stack&) = delete;
#endif
/// Random access.
///
/// Index 0 returns the topmost element.
const T&
operator[] (index_type i) const
{
return seq_[size_type (size () - 1 - i)];
}
/// Random access.
///
/// Index 0 returns the topmost element.
T&
operator[] (index_type i)
{
return seq_[size_type (size () - 1 - i)];
}
/// Steal the contents of \a t.
///
/// Close to move-semantics.
void
push (YY_MOVE_REF (T) t)
{
seq_.push_back (T ());
operator[] (0).move (t);
}
/// Pop elements from the stack.
void
pop (std::ptrdiff_t n = 1) YY_NOEXCEPT
{
for (; 0 < n; --n)
seq_.pop_back ();
}
/// Pop all elements from the stack.
void
clear () YY_NOEXCEPT
{
seq_.clear ();
}
/// Number of elements on the stack.
index_type
size () const YY_NOEXCEPT
{
return index_type (seq_.size ());
}
/// Iterator on top of the stack (going downwards).
const_iterator
begin () const YY_NOEXCEPT
{
return seq_.begin ();
}
/// Bottom of the stack.
const_iterator
end () const YY_NOEXCEPT
{
return seq_.end ();
}
/// Present a slice of the top of a stack.
class slice
{
public:
slice (const stack& stack, index_type range)
: stack_ (stack)
, range_ (range)
{}
const T&
operator[] (index_type i) const
{
return stack_[range_ - i];
}
private:
const stack& stack_;
index_type range_;
};
private:
#if YY_CPLUSPLUS < 201103L
/// Non copyable.
stack (const stack&);
/// Non copyable.
stack& operator= (const stack&);
#endif
/// The wrapped container.
S seq_;
};
/// Stack type.
typedef stack<stack_symbol_type> stack_type;
/// The stack.
stack_type yystack_;
/// Push a new state on the stack.
/// \param m a debug message to display
/// if null, no trace is output.
/// \param sym the symbol
/// \warning the contents of \a s.value is stolen.
void yypush_ (const char* m, YY_MOVE_REF (stack_symbol_type) sym);
/// Push a new look ahead token on the state on the stack.
/// \param m a debug message to display
/// if null, no trace is output.
/// \param s the state
/// \param sym the symbol (for its value and location).
/// \warning the contents of \a sym.value is stolen.
void yypush_ (const char* m, state_type s, YY_MOVE_REF (symbol_type) sym);
/// Pop \a n symbols from the stack.
void yypop_ (int n = 1);
/// Constants.
enum
{
yylast_ = 164, ///< Last index in yytable_.
yynnts_ = 30, ///< Number of nonterminal symbols.
yyfinal_ = 4 ///< Termination state number.
};
// User arguments.
exptocas::scanner* scanner;
};
} // exptocas
// "%code provides" blocks.
#if !defined(yyFlexLexer) && !defined(FlexLexerOnce)
#define yyFlexLexer exptocasFlexLexer
#include "FlexLexer.h"
#endif
namespace exptocas {
// To feed data back to bison, the yylex method needs yylval and
// yylloc parameters. Since the exptocasFlexLexer class is defined in the
// system header <FlexLexer.h> the signature of its yylex() method
// can not be changed anymore. This makes it necessary to derive a
// scanner class that provides a method with the desired signature:
class scanner : public exptocasFlexLexer
{
public:
explicit scanner(std::istream* in = 0, std::ostream* out = 0);
int lex(exptocas::parser::semantic_type* yylval);
};
};
#endif // !YY_EXPTOCAS_EXPTOCASEXE_EXPTOCAS_TAB_HXX_INCLUDED

View File

@@ -1,506 +0,0 @@
/*
Copyright (c) 1999-2022 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.
*/
%code top {
// Created: Thu Oct 28 12:21:16 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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.
/*****************************************************************************
This YACC parser implements parsing algorithm for EXPRESS -> CASCADE/XSTEP
classes generator
Input in the form of tokens is obtained from lexical analyser. Then, data
structure representing schema is created on the basis of grammar analysis.
NOTE: The grammar currently implemented is not full.
FUNCTION, RULE and CONSTANT items, WHERE, INVERSE and DERIVE clauses
of TYPE and ENTITY items are not considered (ignored on the level of lexical
scanner).
SUPERTYPE and UNIQUE clauses of ENTITY item are recognized but ignored.
Also, complex constructs such as using call to function in dimensions of
complex time or redefinition of inherited field are ignored.
*****************************************************************************/
}
%language "C++"
%require "3.2"
%parse-param {exptocas::scanner* scanner}
%code requires {
#include <OSD_OpenFile.hxx>
#include <TCollection_HAsciiString.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx>
#include <Express_HSequenceOfField.hxx>
#include <Express_HSequenceOfItem.hxx>
#include <Express_Field.hxx>
#include <Express_Item.hxx>
#include <Express_Enum.hxx>
#include <Express_Alias.hxx>
#include <Express_Select.hxx>
#include <Express_Entity.hxx>
#include <Express_Type.hxx>
#include <Express_NamedType.hxx>
#include <Express_PredefinedType.hxx>
#include <Express_Number.hxx>
#include <Express_Integer.hxx>
#include <Express_Boolean.hxx>
#include <Express_Logical.hxx>
#include <Express_Real.hxx>
#include <Express_String.hxx>
#include <Express_ComplexType.hxx>
#include <Express_Array.hxx>
#include <Express_List.hxx>
#include <Express_Set.hxx>
#include <Express_Bag.hxx>
#include <Express_Schema.hxx>
#include <Express_Reference.hxx>
#include <Express.hxx>
namespace exptocas {
class scanner;
};
#ifdef _MSC_VER
// disable MSVC warning C4522: 'exptocas::parser::stack_symbol_type': multiple assignment operators
#pragma warning(disable: 4522)
#endif
}
%code {
#undef yylex
#define yylex scanner->lex
// disable MSVC warnings in bison code
#ifdef _MSC_VER
#pragma warning(disable:4244 4800)
#endif
/************************************************/
/* ERROR MESSAGE FUNCTION */
/* external functions (from exptocas.l) */
int ec_error ( const std::string& s, const std::string& text );
int ec_curline ( void );
//int yyerror ( char *s )
//{
// printf ( "\nParse error at line %d: %s\n", ec_curline(), s );
// return 0;
//}
/************************************************/
/* FUNCTIONS FOR CREATING SCHEMA REPRESENTATION */
static Express_Schema *mkschema ( char *name, Express_HSequenceOfItem *ilist );
static Express_HSequenceOfItem *mkilist ( Express_Item *item, Express_HSequenceOfItem *seq );
static Express_Item *mkenum ( char *name, TColStd_HSequenceOfHAsciiString *tlist );
static Express_Item *mkselect ( char *name, TColStd_HSequenceOfHAsciiString *tlist );
static Express_Item *mkalias ( char *name, Express_Type *type );
static Express_Item *mkentity ( char *name, TColStd_HSequenceOfHAsciiString *inherit,
Express_HSequenceOfField *field, int isabstract );
static Express_Reference *mkrefs ( char *name, TColStd_HSequenceOfHAsciiString *items);
static TColStd_HSequenceOfHAsciiString *mktlist ( char *name, TColStd_HSequenceOfHAsciiString *tlist );
static TColStd_HSequenceOfHAsciiString *mktlists ( TColStd_HSequenceOfHAsciiString *tlist1, TColStd_HSequenceOfHAsciiString *tlist2 );
static Express_Type *mktstd ( int keyword );
static Express_Type *mktname ( char *name );
static Express_Type *mktset ( int keyword, int ilow, int ihigh, Express_Type *of );
static Express_Field *mkfield ( char *name, Express_Type *type, int optional );
static Express_HSequenceOfField *mkflist ( Express_Field *field, Express_HSequenceOfField *seq );
}
%code provides {
#if !defined(yyFlexLexer) && !defined(FlexLexerOnce)
#define yyFlexLexer exptocasFlexLexer
#include "FlexLexer.h"
#endif
namespace exptocas {
// To feed data back to bison, the yylex method needs yylval and
// yylloc parameters. Since the exptocasFlexLexer class is defined in the
// system header <FlexLexer.h> the signature of its yylex() method
// can not be changed anymore. This makes it necessary to derive a
// scanner class that provides a method with the desired signature:
class scanner : public exptocasFlexLexer
{
public:
explicit scanner(std::istream* in = 0, std::ostream* out = 0);
int lex(exptocas::parser::semantic_type* yylval);
};
};
}
/* Definition of possible types of expressions */
%union {
int num;
char *str;
TColStd_HSequenceOfHAsciiString *tlist;
Express_HSequenceOfField *flist;
Express_HSequenceOfItem *ilist;
Express_Field *field;
Express_Item *item;
Express_Type *type;
Express_Schema *schema;
Express_Reference *ref;
}
/* Definition of keywords */
%token <num> KSCHEM /* SCHEMA keyword */
%token <num> KENDS /* END_SCHEMA keyword */
%token <num> KTYP /* TYPE keyword */
%token <num> KENDT /* END_TYPE keyword */
%token <num> KENT /* ENTITY keyword */
%token <num> KENDE /* END_ENTITY keyword */
%token <num> KREF /* REFERENCE keyword */
%token <num> KFROM /* FROM keyword */
%token <num> KSEL /* SELECT keyword */
%token <num> KENUM /* ENUMERATION keyword */
%token <num> KLIST /* LIST keyword */
%token <num> KARR /* ARRAY keyword */
%token <num> KBAG /* BAG keyword */
%token <num> KSET /* SET keyword */
%token <num> KOF /* OF keyword */
%token <num> KNUM /* NUMBER keyword */
%token <num> KINT /* INTEGER keyword */
%token <num> KDBL /* REAL keyword */
%token <num> KSTR /* STRING keyword */
%token <num> KLOG /* LOGICAL keyword */
%token <num> KBOOL /* BOOLEAN keyword */
%token <num> KOPT /* OPTIONAL keyword */
%token <num> KUNIQ /* UNIQUE keyword */
%token <num> KSELF /* SELF keyword */
%token <num> KABSTR /* ABSTRACT keyword */
%token <num> KSUBT /* SUBTYPE keyword */
%token <num> KSPRT /* SUPERTYPE keyword */
%left <num> KANDOR /* ANDOR keyword (%left is for eliminating shift/reduce conflict on SUPLST) */
%left <num> K1OF /* ONEOF keyword */
%token <num> KAND /* AND keyword */
%token <num> NUMBER /* integer value */
%token <str> NAME /* name of type or entity */
%left ',' /* to eliminate shift/reduce conflict in SUPERTYPE */
/* Definition of expressions and their types */
%type <num> INDEX OPTNL OPTUNI SUPERT SUPLST REDEF SPCLST
%type <tlist> TLIST TLIST1 UNIQIT UNIQLS UNIQUE SUBT SPECIF
%type <type> TYPE TSTD TNAME TSET
%type <item> ENUM SELECT ALIAS ENTITY ITEM
%type <ilist> ILIST
%type <field> FIELD
%type <flist> FLIST FLIST1
%type <schema> SCHEMA
%type <ref> REFERENCE
%%
/************************************************/
/* Definition of parsing rules (expressions) */
/************************************************/
SCHEMA: KSCHEM NAME ';' ILIST KENDS ';' { $$ = mkschema ( $2, $4 ); /* Root: EXPRESS schema */ }
;
ILIST : ITEM { $$ = mkilist ( $1, 0 ); /* list of items for schema */ }
| ITEM ILIST { $$ = mkilist ( $1, $2 ); }
;
ITEM : ENUM
| SELECT
| ALIAS
| REFERENCE
| ENTITY { $$ = $1; /* item of schema (type definition) */ }
;
ENUM : KTYP NAME '=' KENUM KOF TLIST1 ';' KENDT ';' { $$ = mkenum ( $2, $6 ); /* TYPE ENUMERATION definition */ }
;
SELECT: KTYP NAME '=' KSEL TLIST1 ';' KENDT ';' { $$ = mkselect ( $2, $5 ); /* TYPE SELECT definition */ }
;
ALIAS : KTYP NAME '=' TYPE ';' KENDT ';' { $$ = mkalias ( $2, $4 ); /* TYPE '=' definition (alias) */ }
;
ENTITY: KENT NAME SUPERT SUBT ';' FLIST1 UNIQUE KENDE ';' { $$ = mkentity ( $2, $4, $6, 0 ); /* ENTITY definition */ }
| KENT NAME KABSTR SUPERT SUBT ';' FLIST1 UNIQUE KENDE ';' { $$ = mkentity ( $2, $5, $7, 1 ); /* ENTITY definition */ }
;
REFERENCE: KREF KFROM NAME TLIST1 ';' { $$ = mkrefs ( $3, $4 ); /* REFERENCE FROM definition */ }
;
TLIST : NAME { $$ = mktlist ( $1, 0 ); /* list of (type) names */ }
| NAME ',' TLIST { $$ = mktlist ( $1, $3 ); }
;
TLIST1: '(' TLIST ')' { $$ = $2; /* TLIST in brackets */ }
;
TYPE : TSTD
| TNAME
| TSET { $$ = $1; /* type, simple or complex */ }
;
TSTD : KINT { $$ = mktstd ( $1 ); /* predefined type: INTEGER */ }
| KNUM { $$ = mktstd ( $1 ); /* predefined type: NUMBER */ }
| KDBL { $$ = mktstd ( $1 ); /* predefined type: REAL */ }
| KSTR { $$ = mktstd ( $1 ); /* predefined type: STRING */ }
| KLOG { $$ = mktstd ( $1 ); /* predefined type: LOGICAL */ }
| KBOOL { $$ = mktstd ( $1 ); /* predefined type: BOOLEAN */ }
;
TNAME : NAME { $$ = mktname ( $1 ); /* named type */ }
;
TSET : KLIST '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE { $$ = mktset ( $1, $3, $5, $9 ); /* complex type: LIST */ }
| KARR '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE { $$ = mktset ( $1, $3, $5, $9 ); /* complex type: ARRAY */ }
| KSET '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE { $$ = mktset ( $1, $3, $5, $9 ); /* complex type: SET */ }
| KBAG '[' INDEX ':' INDEX ']' KOF OPTUNI TYPE { $$ = mktset ( $1, $3, $5, $9 ); /* complex type: BAG */ }
;
INDEX : NUMBER { $$ = $1; /* index for array, set, bag, list range */ }
| '?' { $$ = -1; /* undefined */ }
| NAME '(' NAME ')' {$$ = -1; printf ( "Warning at line %d: index function %s(%s) ignored\n", ec_curline(), $1, $3 ); /* some function.. */ }
;
OPTUNI: /* empty */ { $$ = 0; /* UNIQUE keyword for complex type definition */ }
| KUNIQ { $$ = 1; }
;
SUBT : /* empty */ { $$ = NULL; /* no subtype clause */ }
| KSUBT KOF TLIST1 { $$ = $3; /* subtype clause */ }
;
SUPERT: /* empty */ { $$ = 0; /* no supertype clause */ }
| KSPRT { $$ = 0; /* supertype clause (ignored) */ }
| KSPRT KOF SUPLST { $$ = 0; /* supertype clause (ignored) */ }
;
SUPLST: NAME { $$ = 0; /* simple list of supertypes */ }
| '(' SUPLST ')' { $$ = 0; /* allow bracketing */ }
| NAME ',' SUPLST { $$ = 0; /* ... */ }
| K1OF SUPLST { $$ = 0; /* ONEOF construct */ }
| SUPLST KANDOR SUPLST { $$ = 0; /* ANDOR construct */ }
;
FLIST : FIELD { $$ = mkflist ( $1, 0 ); /* list of fields of ENTITY item */ }
| FIELD FLIST { $$ = mkflist ( $1, $2 ); }
| REDEF { $$ = 0; /* redefinition of inherited field, just skip */ }
| REDEF FLIST { $$ = $2; /* ignore redefinition of inherited field, take trailing list */ }
;
FLIST1: /* empty */ { $$ = NULL; /* empty list of fields */ }
| FLIST { $$ = $1; /* or not empty.. just to fix reduce/reduce conflict */ }
;
FIELD : NAME ':' OPTNL TYPE ';' { $$ = mkfield ( $1, $4, $3 ); }
;
REDEF : KSELF '\\' SPECIF ':' TYPE ';' { $$ = 0; printf ( "Warning at line %d: field redefinition ignored\n", ec_curline() ); /* redefinition of inherited field */ }
;
SPECIF: NAME { $$ = mktlist ( $1, 0 ); /* inherited field specification */ }
| NAME '.' SPECIF { $$ = mktlist ( $1, $3 ); }
;
OPTNL : /* empty */ { $$ = 0; }
| KOPT { $$ = 1; }
;
UNIQIT: NAME ':' TLIST ';' { $$ = $3; /* UNIQUE statement */ }
| NAME ':' SPCLST ';' { $$ = NULL; /* UNIQUE statement */ }
;
UNIQLS: UNIQIT { $$ = NULL; /* list of 1 UNIQUE statements */ }
| UNIQIT UNIQLS { $$ = mktlists ( $1, $2 );/* list of UNIQUE statements */ }
;
UNIQUE: /* empty */ { $$ = NULL; /* no UNIQUE clause in ENTITY */ }
| KUNIQ UNIQLS { $$ = $2; /* UNIQUE clause in ENTITY */ }
;
SPCLST: KSELF '\\' SPECIF { $$ = 0; /* list of specifications */ }
| KSELF '\\' SPECIF ',' SPCLST { $$ = 0; }
| NAME ',' SPCLST { $$ = 0; }
;
%%
/************************************************/
/* FUNCTIONS FOR CREATING SCHEMA REPRESENTATION */
static Express_Schema *mkschema ( char *name, Express_HSequenceOfItem *ilist )
{
Express_Schema *sch = new Express_Schema ( name, ilist );
Express::Schema() = sch;
return sch;
}
static Express_HSequenceOfItem *mkilist ( Express_Item *item, Express_HSequenceOfItem *seq )
{
if ( ! seq ) {
seq = new Express_HSequenceOfItem;
seq->Append ( item );
}
else seq->Prepend ( item );
return seq;
}
static Express_Item *mkenum ( char *name, TColStd_HSequenceOfHAsciiString *tlist )
{
return new Express_Enum ( name, tlist );
}
static Express_Item *mkselect ( char *name, TColStd_HSequenceOfHAsciiString *tlist )
{
return new Express_Select ( name, tlist );
}
static Express_Item *mkalias ( char *name, Express_Type *type )
{
return new Express_Alias ( name, type );
}
static Express_Item *mkentity ( char *name, TColStd_HSequenceOfHAsciiString *inherit,
Express_HSequenceOfField *field, int isabstract )
{
Express_Entity *ent = new Express_Entity ( name, inherit, field );
if ( isabstract ) ent->SetAbstractFlag ( Standard_True );
return ent;
}
static Express_Reference *mkrefs ( char *name, TColStd_HSequenceOfHAsciiString *items)
{
return new Express_Reference ( name, items );
}
static TColStd_HSequenceOfHAsciiString *mktlist ( char *name, TColStd_HSequenceOfHAsciiString *tlist )
{
Handle(TCollection_HAsciiString) str = new TCollection_HAsciiString ( name );
if ( tlist ) tlist->Prepend ( str );
else {
tlist = new TColStd_HSequenceOfHAsciiString;
tlist->Append ( str );
}
return tlist;
}
static TColStd_HSequenceOfHAsciiString *mktlists ( TColStd_HSequenceOfHAsciiString *tlist1,
TColStd_HSequenceOfHAsciiString *tlist2 )
{
if ( ! tlist1 ) return tlist2;
if ( ! tlist2 ) return tlist1;
for ( int i=1; i <= tlist2->Length(); i++ )
tlist1->Append ( tlist2->Value(i) );
return tlist1;
}
static Express_Type *mktstd ( int keyword )
{
switch ( keyword ) {
case exptocas::parser::token::KINT : return new Express_Integer;
case exptocas::parser::token::KNUM : return new Express_Number;
case exptocas::parser::token::KDBL : return new Express_Real;
case exptocas::parser::token::KSTR : return new Express_String;
case exptocas::parser::token::KBOOL: return new Express_Boolean;
case exptocas::parser::token::KLOG : return new Express_Logical;
default : ec_error ( "Predefined type not treated!", "" );
return NULL;
}
}
static Express_Type *mktname ( char *name )
{
return new Express_NamedType ( name );
}
static Express_Type *mktset ( int keyword, int ilow, int ihigh, Express_Type *of )
{
switch ( keyword ) {
case exptocas::parser::token::KLIST: return new Express_List ( ilow, ihigh, of );
case exptocas::parser::token::KARR : return new Express_Array ( ilow, ihigh, of );
case exptocas::parser::token::KBAG : return new Express_Bag ( ilow, ihigh, of );
case exptocas::parser::token::KSET : return new Express_Set ( ilow, ihigh, of );
default : ec_error ( "Complex type not treated!", "" );
return NULL;
}
}
static Express_Field *mkfield ( char *name, Express_Type *type, int optional )
{
return new Express_Field ( name, type, optional );
}
static Express_HSequenceOfField *mkflist ( Express_Field *field, Express_HSequenceOfField *seq )
{
if ( seq ) seq->Prepend ( field );
else {
seq = new Express_HSequenceOfField;
seq->Append ( field );
}
return seq;
}
/*******************************************************************/
/* MAIN & co */
/*
void tlistfree ( struct tlist *list )
{
if ( ! list ) return;
tlistfree ( list->next );
list->next = 0;
free ( list->str );
list->str = 0;
}
* /
int printtlist ( struct ec_tlist *tl )
{
int num=0;
while ( tl ) {
num++;
printf ( "%s\n", tl->name );
tl = tl->next;
}
return num;
}
int main ( void )
{
int num = 0;
yyparse();
printf ( "\nFinished\n" );
if ( schema ) {
struct ec_item *it;
it = schema->items;
printf ( "\nSchema %s", schema->name );
printf ( "\nItems:" );
while ( it ) {
num++;
printf ( "\n%s", it->name );
it = it->next;
}
// num = printtlist ( res );
printf ( "\nTotal %d", num );
}
// tlistfree ( yylval.tlist );
return num;
}
*/
void exptocas::parser::error(const std::string& s)
{
printf("\nParse error at line %d: %s\n", scanner->lineno(), s.c_str());
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,942 +0,0 @@
# Last update 27.10.2021
#===============================================
# package StepAP203
#===============================================
ApprovedItem StepAP203
CcDesignApproval StepAP203
CcDesignCertification StepAP203
CcDesignContract StepAP203
CcDesignDateAndTimeAssignment StepAP203
CcDesignPersonAndOrganizationAssignment StepAP203
CcDesignSecurityClassification StepAP203
CcDesignSpecificationReference StepAP203
CertifiedItem StepAP203
Change StepAP203
ChangeRequest StepAP203
ChangeRequestItem StepAP203
ClassifiedItem StepAP203
ContractedItem StepAP203
DateTimeItem StepAP203
PersonOrganizationItem StepAP203
SpecifiedItem StepAP203
StartRequest StepAP203
StartRequestItem StepAP203
StartWork StepAP203
WorkItem StepAP203
#===============================================
# package StepAP214
#===============================================
AppliedApprovalAssignment StepAP214
AppliedDateAndTimeAssignment StepAP214
AppliedDateAssignment StepAP214
AppliedDocumentReference StepAP214
AppliedExternalIdentificationAssignment StepAP214
AppliedGroupAssignment StepAP214
AppliedOrganizationAssignment StepAP214
AppliedPersonAndOrganizationAssignment StepAP214
AppliedPresentedItem StepAP214
AppliedSecurityClassificationAssignment StepAP214
ApprovalItem StepAP214
AutoDesignActualDateAndTimeAssignment StepAP214
AutoDesignActualDateAssignment StepAP214
AutoDesignApprovalAssignment StepAP214
AutoDesignDateAndPersonAssignment StepAP214
AutoDesignDateAndPersonItem StepAP214
AutoDesignDateAndTimeItem StepAP214
AutoDesignDatedItem StepAP214
AutoDesignDocumentReference StepAP214
AutoDesignGeneralOrgItem StepAP214
AutoDesignGroupAssignment StepAP214
AutoDesignGroupedItem StepAP214
AutoDesignNominalDateAndTimeAssignment StepAP214
AutoDesignNominalDateAssignment StepAP214
AutoDesignOrganizationAssignment StepAP214
AutoDesignOrganizationItem StepAP214
AutoDesignPersonAndOrganizationAssignment StepAP214
AutoDesignPresentedItem StepAP214
AutoDesignPresentedItemSelect StepAP214
AutoDesignReferencingItem StepAP214
AutoDesignSecurityClassificationAssignment StepAP214
Class StepAP214
DateAndTimeItem StepAP214
DateItem StepAP214
DocumentReferenceItem StepAP214
ExternalIdentificationItem StepAP214
ExternallyDefinedClass StepAP214
ExternallyDefinedGeneralProperty StepAP214
GroupItem StepAP214
OrganizationItem StepAP214
PersonAndOrganizationItem StepAP214
PresentedItemSelect StepAP214
Protocol StepAP214
RepItemGroup StepAP214
SecurityClassificationItem StepAP214
#===============================================
# package StepAP242
#===============================================
DraughtingModelItemAssociation StepAP242
GeometricItemSpecificUsage StepAP242
IdAttribute StepAP242
IdAttributeSelect StepAP242
ItemIdentifiedRepresentationUsage StepAP242
ItemIdentifiedRepresentationUsageDefinition StepAP242
#===============================================
# package StepBasic
#===============================================
Action StepBasic
ActionAssignment StepBasic
ActionMethod StepBasic
ActionRequestAssignment StepBasic
ActionRequestSolution StepBasic
Address StepBasic
AheadOrBehind StepBasic
ApplicationContext StepBasic
ApplicationContextElement StepBasic
ApplicationProtocolDefinition StepBasic
Approval StepBasic
ApprovalAssignment StepBasic
ApprovalDateTime StepBasic
ApprovalPersonOrganization StepBasic
ApprovalRelationship StepBasic
ApprovalRole StepBasic
ApprovalStatus StepBasic
AreaUnit StepBasic
CalendarDate StepBasic
Certification StepBasic
CertificationAssignment StepBasic
CertificationType StepBasic
CharacterizedObject StepBasic
Contract StepBasic
ContractAssignment StepBasic
ContractType StepBasic
ConversionBasedUnit StepBasic
ConversionBasedUnitAndAreaUnit StepBasic
ConversionBasedUnitAndLengthUnit StepBasic
ConversionBasedUnitAndMassUnit StepBasic
ConversionBasedUnitAndPlaneAngleUnit StepBasic
ConversionBasedUnitAndRatioUnit StepBasic
ConversionBasedUnitAndSolidAngleUnit StepBasic
ConversionBasedUnitAndTimeUnit StepBasic
ConversionBasedUnitAndVolumeUnit StepBasic
CoordinatedUniversalTimeOffset StepBasic
Date StepBasic
DateAndTime StepBasic
DateAndTimeAssignment StepBasic
DateAssignment StepBasic
DateRole StepBasic
DateTimeRole StepBasic
DateTimeSelect StepBasic
DerivedUnit StepBasic
DerivedUnitElement StepBasic
DesignContext StepBasic
DigitalDocument StepBasic
DimensionalExponents StepBasic
Document StepBasic
DocumentFile StepBasic
DocumentProductAssociation StepBasic
DocumentProductEquivalence StepBasic
DocumentReference StepBasic
DocumentRelationship StepBasic
DocumentRepresentationType StepBasic
DocumentType StepBasic
DocumentUsageConstraint StepBasic
Effectivity StepBasic
EffectivityAssignment StepBasic
EulerAngles StepBasic
ExternalIdentificationAssignment StepBasic
ExternallyDefinedItem StepBasic
ExternalSource StepBasic
GeneralProperty StepBasic
Group StepBasic
GroupAssignment StepBasic
GroupRelationship StepBasic
IdentificationAssignment StepBasic
IdentificationRole StepBasic
LengthMeasureWithUnit StepBasic
LengthUnit StepBasic
LocalTime StepBasic
MassMeasureWithUnit StepBasic
MassUnit StepBasic
MeasureValueMember StepBasic
MeasureWithUnit StepBasic
MechanicalContext StepBasic
NameAssignment StepBasic
NamedUnit StepBasic
ObjectRole StepBasic
OrdinalDate StepBasic
Organization StepBasic
OrganizationalAddress StepBasic
OrganizationAssignment StepBasic
OrganizationRole StepBasic
Person StepBasic
PersonalAddress StepBasic
PersonAndOrganization StepBasic
PersonAndOrganizationAssignment StepBasic
PersonAndOrganizationRole StepBasic
PersonOrganizationSelect StepBasic
PhysicallyModeledProductDefinition StepBasic
PlaneAngleMeasureWithUnit StepBasic
PlaneAngleUnit StepBasic
Product StepBasic
ProductCategory StepBasic
ProductCategoryRelationship StepBasic
ProductConceptContext StepBasic
ProductContext StepBasic
ProductDefinition StepBasic
ProductDefinitionContext StepBasic
ProductDefinitionEffectivity StepBasic
ProductDefinitionFormation StepBasic
ProductDefinitionFormationRelationship StepBasic
ProductDefinitionFormationWithSpecifiedSource StepBasic
ProductDefinitionOrReference StepBasic
ProductDefinitionReference StepBasic
ProductDefinitionReferenceWithLocalRepresentation StepBasic
ProductDefinitionRelationship StepBasic
ProductDefinitionWithAssociatedDocuments StepBasic
ProductOrFormationOrDefinition StepBasic
ProductRelatedProductCategory StepBasic
ProductType StepBasic
RatioMeasureWithUnit StepBasic
RatioUnit StepBasic
RoleAssociation StepBasic
RoleSelect StepBasic
SecurityClassification StepBasic
SecurityClassificationAssignment StepBasic
SecurityClassificationLevel StepBasic
SiPrefix StepBasic
SiUnit StepBasic
SiUnitAndAreaUnit StepBasic
SiUnitAndLengthUnit StepBasic
SiUnitAndMassUnit StepBasic
SiUnitAndPlaneAngleUnit StepBasic
SiUnitAndRatioUnit StepBasic
SiUnitAndSolidAngleUnit StepBasic
SiUnitAndThermodynamicTemperatureUnit StepBasic
SiUnitAndTimeUnit StepBasic
SiUnitAndVolumeUnit StepBasic
SiUnitName StepBasic
SizeMember StepBasic
SizeSelect StepBasic
SolidAngleMeasureWithUnit StepBasic
SolidAngleUnit StepBasic
Source StepBasic
SourceItem StepBasic
ThermodynamicTemperatureUnit StepBasic
TimeMeasureWithUnit StepBasic
TimeUnit StepBasic
UncertaintyMeasureWithUnit StepBasic
Unit StepBasic
VersionedActionRequest StepBasic
VolumeUnit StepBasic
WeekOfYearAndDayDate StepBasic
#===============================================
# package StepDimTol
#===============================================
AngularityTolerance StepDimTol
AreaUnitType StepDimTol
CircularRunoutTolerance StepDimTol
CoaxialityTolerance StepDimTol
CommonDatum StepDimTol
ConcentricityTolerance StepDimTol
CylindricityTolerance StepDimTol
Datum StepDimTol
DatumFeature StepDimTol
DatumOrCommonDatum StepDimTol
DatumReference StepDimTol
DatumReferenceCompartment StepDimTol
DatumReferenceElement StepDimTol
DatumReferenceModifier StepDimTol
DatumReferenceModifierType StepDimTol
DatumReferenceModifierWithValue StepDimTol
DatumSystem StepDimTol
DatumSystemOrReference StepDimTol
DatumTarget StepDimTol
FlatnessTolerance StepDimTol
GeneralDatumReference StepDimTol
GeometricTolerance StepDimTol
GeometricToleranceModifier StepDimTol
GeometricToleranceRelationship StepDimTol
GeometricToleranceTarget StepDimTol
GeometricToleranceType StepDimTol
GeometricToleranceWithDatumReference StepDimTol
GeometricToleranceWithDefinedAreaUnit StepDimTol
GeometricToleranceWithDefinedUnit StepDimTol
GeometricToleranceWithMaximumTolerance StepDimTol
GeometricToleranceWithModifiers StepDimTol
GeoTolAndGeoTolWthDatRef StepDimTol
GeoTolAndGeoTolWthDatRefAndGeoTolWthMaxTol StepDimTol
GeoTolAndGeoTolWthDatRefAndGeoTolWthMod StepDimTol
GeoTolAndGeoTolWthDatRefAndModGeoTolAndPosTol StepDimTol
GeoTolAndGeoTolWthDatRefAndUneqDisGeoTol StepDimTol
GeoTolAndGeoTolWthMaxTol StepDimTol
GeoTolAndGeoTolWthMod StepDimTol
LimitCondition StepDimTol
LineProfileTolerance StepDimTol
ModifiedGeometricTolerance StepDimTol
NonUniformZoneDefinition StepDimTol
ParallelismTolerance StepDimTol
PerpendicularityTolerance StepDimTol
PlacedDatumTargetFeature StepDimTol
PositionTolerance StepDimTol
ProjectedZoneDefinition StepDimTol
RoundnessTolerance StepDimTol
RunoutZoneDefinition StepDimTol
RunoutZoneOrientation StepDimTol
ShapeToleranceSelect StepDimTol
SimpleDatumReferenceModifier StepDimTol
SimpleDatumReferenceModifierMember StepDimTol
StraightnessTolerance StepDimTol
SurfaceProfileTolerance StepDimTol
SymmetryTolerance StepDimTol
ToleranceZone StepDimTol
ToleranceZoneDefinition StepDimTol
ToleranceZoneForm StepDimTol
ToleranceZoneTarget StepDimTol
TotalRunoutTolerance StepDimTol
UnequallyDisposedGeometricTolerance StepDimTol
#===============================================
# package StepElement
#===============================================
AnalysisItemWithinRepresentation StepElement
Curve3dElementDescriptor StepElement
CurveEdge StepElement
CurveElementEndReleasePacket StepElement
CurveElementFreedom StepElement
CurveElementFreedomMember StepElement
CurveElementPurpose StepElement
CurveElementPurposeMember StepElement
CurveElementSectionDefinition StepElement
CurveElementSectionDerivedDefinitions StepElement
Element2dShape StepElement
ElementAspect StepElement
ElementAspectMember StepElement
ElementDescriptor StepElement
ElementMaterial StepElement
ElementOrder StepElement
ElementVolume StepElement
EnumeratedCurveElementFreedom StepElement
EnumeratedCurveElementPurpose StepElement
EnumeratedSurfaceElementPurpose StepElement
EnumeratedVolumeElementPurpose StepElement
MeasureOrUnspecifiedValue StepElement
MeasureOrUnspecifiedValueMember StepElement
Surface3dElementDescriptor StepElement
SurfaceElementProperty StepElement
SurfaceElementPurpose StepElement
SurfaceElementPurposeMember StepElement
SurfaceSection StepElement
SurfaceSectionField StepElement
SurfaceSectionFieldConstant StepElement
SurfaceSectionFieldVarying StepElement
UniformSurfaceSection StepElement
UnspecifiedValue StepElement
Volume3dElementDescriptor StepElement
Volume3dElementShape StepElement
VolumeElementPurpose StepElement
VolumeElementPurposeMember StepElement
#===============================================
# package StepFEA
#===============================================
AlignedCurve3dElementCoordinateSystem StepFEA
AlignedSurface3dElementCoordinateSystem StepFEA
ArbitraryVolume3dElementCoordinateSystem StepFEA
ConstantSurface3dElementCoordinateSystem StepFEA
CoordinateSystemType StepFEA
Curve3dElementProperty StepFEA
Curve3dElementRepresentation StepFEA
CurveEdge StepFEA
CurveElementEndCoordinateSystem StepFEA
CurveElementEndOffset StepFEA
CurveElementEndRelease StepFEA
CurveElementInterval StepFEA
CurveElementIntervalConstant StepFEA
CurveElementIntervalLinearlyVarying StepFEA
CurveElementLocation StepFEA
DegreeOfFreedom StepFEA
DegreeOfFreedomMember StepFEA
DummyNode StepFEA
ElementGeometricRelationship StepFEA
ElementGroup StepFEA
ElementOrElementGroup StepFEA
ElementRepresentation StepFEA
ElementVolume StepFEA
EnumeratedDegreeOfFreedom StepFEA
FeaAreaDensity StepFEA
FeaAxis2Placement3d StepFEA
FeaCurveSectionGeometricRelationship StepFEA
FeaGroup StepFEA
FeaLinearElasticity StepFEA
FeaMassDensity StepFEA
FeaMaterialPropertyRepresentation StepFEA
FeaMaterialPropertyRepresentationItem StepFEA
FeaModel StepFEA
FeaModel3d StepFEA
FeaModelDefinition StepFEA
FeaMoistureAbsorption StepFEA
FeaParametricPoint StepFEA
FeaRepresentationItem StepFEA
FeaSecantCoefficientOfLinearThermalExpansion StepFEA
FeaShellBendingStiffness StepFEA
FeaShellMembraneBendingCouplingStiffness StepFEA
FeaShellMembraneStiffness StepFEA
FeaShellShearStiffness StepFEA
FeaSurfaceSectionGeometricRelationship StepFEA
FeaTangentialCoefficientOfLinearThermalExpansion StepFEA
FreedomAndCoefficient StepFEA
FreedomsList StepFEA
GeometricNode StepFEA
Node StepFEA
NodeDefinition StepFEA
NodeGroup StepFEA
NodeRepresentation StepFEA
NodeSet StepFEA
NodeWithSolutionCoordinateSystem StepFEA
NodeWithVector StepFEA
ParametricCurve3dElementCoordinateDirection StepFEA
ParametricCurve3dElementCoordinateSystem StepFEA
ParametricSurface3dElementCoordinateSystem StepFEA
Surface3dElementRepresentation StepFEA
SymmetricTensor22d StepFEA
SymmetricTensor23d StepFEA
SymmetricTensor23dMember StepFEA
SymmetricTensor42d StepFEA
SymmetricTensor43d StepFEA
SymmetricTensor43dMember StepFEA
UnspecifiedValue StepFEA
Volume3dElementRepresentation StepFEA
#===============================================
# package StepGeom
#===============================================
Axis1Placement StepGeom
Axis2Placement StepGeom
Axis2Placement2d StepGeom
Axis2Placement3d StepGeom
BezierCurve StepGeom
BezierCurveAndRationalBSplineCurve StepGeom
BezierSurface StepGeom
BezierSurfaceAndRationalBSplineSurface StepGeom
BoundaryCurve StepGeom
BoundedCurve StepGeom
BoundedSurface StepGeom
BSplineCurve StepGeom
BSplineCurveForm StepGeom
BSplineCurveWithKnots StepGeom
BSplineCurveWithKnotsAndRationalBSplineCurve StepGeom
BSplineSurface StepGeom
BSplineSurfaceForm StepGeom
BSplineSurfaceWithKnots StepGeom
BSplineSurfaceWithKnotsAndRationalBSplineSurface StepGeom
CartesianPoint StepGeom
CartesianTransformationOperator StepGeom
CartesianTransformationOperator2d StepGeom
CartesianTransformationOperator3d StepGeom
Circle StepGeom
CompositeCurve StepGeom
CompositeCurveOnSurface StepGeom
CompositeCurveSegment StepGeom
Conic StepGeom
ConicalSurface StepGeom
Curve StepGeom
CurveBoundedSurface StepGeom
CurveOnSurface StepGeom
CurveReplica StepGeom
CylindricalSurface StepGeom
DegeneratePcurve StepGeom
DegenerateToroidalSurface StepGeom
Direction StepGeom
ElementarySurface StepGeom
Ellipse StepGeom
EvaluatedDegeneratePcurve StepGeom
GeometricRepresentationContext StepGeom
GeometricRepresentationContextAndGlobalUnitAssignedContext StepGeom
GeometricRepresentationContextAndParametricRepresentationContext StepGeom
GeometricRepresentationItem StepGeom
GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx StepGeom
Hyperbola StepGeom
IntersectionCurve StepGeom
KnotType StepGeom
Line StepGeom
OffsetCurve3d StepGeom
OffsetSurface StepGeom
OrientedSurface StepGeom
OuterBoundaryCurve StepGeom
Parabola StepGeom
Pcurve StepGeom
PcurveOrSurface StepGeom
Placement StepGeom
Plane StepGeom
Point StepGeom
PointOnCurve StepGeom
PointOnSurface StepGeom
PointReplica StepGeom
Polyline StepGeom
PreferredSurfaceCurveRepresentation StepGeom
QuasiUniformCurve StepGeom
QuasiUniformCurveAndRationalBSplineCurve StepGeom
QuasiUniformSurface StepGeom
QuasiUniformSurfaceAndRationalBSplineSurface StepGeom
RationalBSplineCurve StepGeom
RationalBSplineSurface StepGeom
RectangularCompositeSurface StepGeom
RectangularTrimmedSurface StepGeom
ReparametrisedCompositeCurveSegment StepGeom
SeamCurve StepGeom
SphericalSurface StepGeom
SuParameters StepGeom
Surface StepGeom
SurfaceBoundary StepGeom
SurfaceCurve StepGeom
SurfaceCurveAndBoundedCurve StepGeom
SurfaceOfLinearExtrusion StepGeom
SurfaceOfRevolution StepGeom
SurfacePatch StepGeom
SurfaceReplica StepGeom
SweptSurface StepGeom
ToroidalSurface StepGeom
TransitionCode StepGeom
TrimmedCurve StepGeom
TrimmingMember StepGeom
TrimmingPreference StepGeom
TrimmingSelect StepGeom
UniformCurve StepGeom
UniformCurveAndRationalBSplineCurve StepGeom
UniformSurface StepGeom
UniformSurfaceAndRationalBSplineSurface StepGeom
Vector StepGeom
VectorOrDirection StepGeom
#===============================================
# package StepKinematics
#===============================================
ActuatedDirection StepKinematics
ActuatedKinematicPair StepKinematics
ActuatedKinPairAndOrderKinPair StepKinematics
ContextDependentKinematicLinkRepresentation StepKinematics
CylindricalPair StepKinematics
CylindricalPairValue StepKinematics
CylindricalPairWithRange StepKinematics
FullyConstrainedPair StepKinematics
GearPair StepKinematics
GearPairValue StepKinematics
GearPairWithRange StepKinematics
HighOrderKinematicPair StepKinematics
HomokineticPair StepKinematics
KinematicJoint StepKinematics
KinematicLink StepKinematics
KinematicLinkRepresentation StepKinematics
KinematicLinkRepresentationAssociation StepKinematics
KinematicPair StepKinematics
KinematicPropertyDefinitionRepresentation StepKinematics
KinematicPropertyMechanismRepresentation StepKinematics
KinematicTopologyDirectedStructure StepKinematics
KinematicTopologyNetworkStructure StepKinematics
KinematicTopologyRepresentationSelect StepKinematics
KinematicTopologyStructure StepKinematics
LinearFlexibleAndPinionPair StepKinematics
LinearFlexibleAndPlanarCurvePair StepKinematics
LinearFlexibleLinkRepresentation StepKinematics
LowOrderKinematicPair StepKinematics
LowOrderKinematicPairValue StepKinematics
LowOrderKinematicPairWithMotionCoupling StepKinematics
LowOrderKinematicPairWithRange StepKinematics
MechanismRepresentation StepKinematics
MechanismStateRepresentation StepKinematics
OrientedJoint StepKinematics
PairRepresentationRelationship StepKinematics
PairValue StepKinematics
PlanarCurvePair StepKinematics
PlanarCurvePairRange StepKinematics
PlanarPair StepKinematics
PlanarPairValue StepKinematics
PlanarPairWithRange StepKinematics
PointOnPlanarCurvePair StepKinematics
PointOnPlanarCurvePairValue StepKinematics
PointOnPlanarCurvePairWithRange StepKinematics
PointOnSurfacePair StepKinematics
PointOnSurfacePairValue StepKinematics
PointOnSurfacePairWithRange StepKinematics
PrismaticPair StepKinematics
PrismaticPairValue StepKinematics
PrismaticPairWithRange StepKinematics
ProductDefinitionKinematics StepKinematics
ProductDefinitionRelationshipKinematics StepKinematics
RackAndPinionPair StepKinematics
RackAndPinionPairValue StepKinematics
RackAndPinionPairWithRange StepKinematics
RevolutePair StepKinematics
RevolutePairValue StepKinematics
RevolutePairWithRange StepKinematics
RigidLinkRepresentation StepKinematics
RigidPlacement StepKinematics
RollingCurvePair StepKinematics
RollingCurvePairValue StepKinematics
RollingSurfacePair StepKinematics
RollingSurfacePairValue StepKinematics
RotationAboutDirection StepKinematics
ScrewPair StepKinematics
ScrewPairValue StepKinematics
ScrewPairWithRange StepKinematics
SlidingCurvePair StepKinematics
SlidingCurvePairValue StepKinematics
SlidingSurfacePair StepKinematics
SlidingSurfacePairValue StepKinematics
SpatialRotation StepKinematics
SphericalPair StepKinematics
SphericalPairSelect StepKinematics
SphericalPairValue StepKinematics
SphericalPairWithPin StepKinematics
SphericalPairWithPinAndRange StepKinematics
SphericalPairWithRange StepKinematics
SurfacePair StepKinematics
SurfacePairWithRange StepKinematics
UnconstrainedPair StepKinematics
UnconstrainedPairValue StepKinematics
UniversalPair StepKinematics
UniversalPairValue StepKinematics
UniversalPairWithRange StepKinematics
#===============================================
# package StepRepr
#===============================================
AllAroundShapeAspect StepRepr
Apex StepRepr
AssemblyComponentUsage StepRepr
AssemblyComponentUsageSubstitute StepRepr
BetweenShapeAspect StepRepr
CentreOfSymmetry StepRepr
CharacterizedDefinition StepRepr
CharacterizedRepresentation StepRepr
CompGroupShAspAndCompShAspAndDatumFeatAndShAsp StepRepr
CompositeGroupShapeAspect StepRepr
CompositeShapeAspect StepRepr
CompoundRepresentationItem StepRepr
CompShAspAndDatumFeatAndShAsp StepRepr
ConfigurationDesign StepRepr
ConfigurationDesignItem StepRepr
ConfigurationEffectivity StepRepr
ConfigurationItem StepRepr
ConstructiveGeometryRepresentation StepRepr
ConstructiveGeometryRepresentationRelationship StepRepr
ContinuosShapeAspect StepRepr
DataEnvironment StepRepr
DefinitionalRepresentation StepRepr
DerivedShapeAspect StepRepr
DescriptiveRepresentationItem StepRepr
Extension StepRepr
ExternallyDefinedRepresentation StepRepr
FeatureForDatumTargetRelationship StepRepr
FunctionallyDefinedTransformation StepRepr
GeometricAlignment StepRepr
GlobalUncertaintyAssignedContext StepRepr
GlobalUnitAssignedContext StepRepr
IntegerRepresentationItem StepRepr
ItemDefinedTransformation StepRepr
MakeFromUsageOption StepRepr
MappedItem StepRepr
MaterialDesignation StepRepr
MaterialProperty StepRepr
MaterialPropertyRepresentation StepRepr
MeasureRepresentationItem StepRepr
NextAssemblyUsageOccurrence StepRepr
ParallelOffset StepRepr
ParametricRepresentationContext StepRepr
PerpendicularTo StepRepr
ProductConcept StepRepr
ProductDefinitionShape StepRepr
ProductDefinitionUsage StepRepr
PromissoryUsageOccurrence StepRepr
PropertyDefinition StepRepr
PropertyDefinitionRelationship StepRepr
PropertyDefinitionRepresentation StepRepr
QuantifiedAssemblyComponentUsage StepRepr
Representation StepRepr
RepresentationContext StepRepr
RepresentationContextReference StepRepr
RepresentationItem StepRepr
RepresentationMap StepRepr
RepresentationOrRepresentationReference StepRepr
RepresentationReference StepRepr
RepresentationRelationship StepRepr
RepresentationRelationshipWithTransformation StepRepr
RepresentedDefinition StepRepr
ReprItemAndLengthMeasureWithUnit StepRepr
ReprItemAndLengthMeasureWithUnitAndQRI StepRepr
ReprItemAndMeasureWithUnit StepRepr
ReprItemAndMeasureWithUnitAndQRI StepRepr
ReprItemAndPlaneAngleMeasureWithUnit StepRepr
ReprItemAndPlaneAngleMeasureWithUnitAndQRI StepRepr
ShapeAspect StepRepr
ShapeAspectDerivingRelationship StepRepr
ShapeAspectRelationship StepRepr
ShapeAspectTransition StepRepr
ShapeDefinition StepRepr
ShapeRepresentationRelationship StepRepr
ShapeRepresentationRelationshipWithTransformation StepRepr
SpecifiedHigherUsageOccurrence StepRepr
StructuralResponseProperty StepRepr
StructuralResponsePropertyDefinitionRepresentation StepRepr
SuppliedPartRelationship StepRepr
Tangent StepRepr
Transformation StepRepr
ValueRange StepRepr
ValueRepresentationItem StepRepr
#===============================================
# package StepShape
#===============================================
AdvancedBrepShapeRepresentation StepShape
AdvancedFace StepShape
AngleRelator StepShape
AngularLocation StepShape
AngularSize StepShape
Block StepShape
BooleanOperand StepShape
BooleanOperator StepShape
BooleanResult StepShape
BoxDomain StepShape
BoxedHalfSpace StepShape
BrepWithVoids StepShape
ClosedShell StepShape
CompoundShapeRepresentation StepShape
ConnectedEdgeSet StepShape
ConnectedFaceSet StepShape
ConnectedFaceShapeRepresentation StepShape
ConnectedFaceSubSet StepShape
ContextDependentShapeRepresentation StepShape
CsgPrimitive StepShape
CsgSelect StepShape
CsgShapeRepresentation StepShape
CsgSolid StepShape
DefinitionalRepresentationAndShapeRepresentation StepShape
DimensionalCharacteristic StepShape
DimensionalCharacteristicRepresentation StepShape
DimensionalLocation StepShape
DimensionalLocationWithPath StepShape
DimensionalSize StepShape
DimensionalSizeWithPath StepShape
DirectedDimensionalLocation StepShape
Edge StepShape
EdgeBasedWireframeModel StepShape
EdgeBasedWireframeShapeRepresentation StepShape
EdgeCurve StepShape
EdgeLoop StepShape
ExtrudedAreaSolid StepShape
ExtrudedFaceSolid StepShape
Face StepShape
FaceBasedSurfaceModel StepShape
FaceBound StepShape
FaceOuterBound StepShape
FaceSurface StepShape
FacetedBrep StepShape
FacetedBrepAndBrepWithVoids StepShape
FacetedBrepShapeRepresentation StepShape
GeometricallyBoundedSurfaceShapeRepresentation StepShape
GeometricallyBoundedWireframeShapeRepresentation StepShape
GeometricCurveSet StepShape
GeometricSet StepShape
GeometricSetSelect StepShape
HalfSpaceSolid StepShape
LimitsAndFits StepShape
Loop StepShape
LoopAndPath StepShape
ManifoldSolidBrep StepShape
ManifoldSurfaceShapeRepresentation StepShape
MeasureQualification StepShape
MeasureRepresentationItemAndQualifiedRepresentationItem StepShape
NonManifoldSurfaceShapeRepresentation StepShape
OpenShell StepShape
OrientedClosedShell StepShape
OrientedEdge StepShape
OrientedFace StepShape
OrientedOpenShell StepShape
OrientedPath StepShape
Path StepShape
PlusMinusTolerance StepShape
PointRepresentation StepShape
PolyLoop StepShape
PrecisionQualifier StepShape
QualifiedRepresentationItem StepShape
ReversibleTopologyItem StepShape
RevolvedAreaSolid StepShape
RevolvedFaceSolid StepShape
RightAngularWedge StepShape
RightCircularCone StepShape
RightCircularCylinder StepShape
SeamEdge StepShape
ShapeDefinitionRepresentation StepShape
ShapeDimensionRepresentation StepShape
ShapeDimensionRepresentationItem StepShape
ShapeRepresentation StepShape
ShapeRepresentationWithParameters StepShape
Shell StepShape
ShellBasedSurfaceModel StepShape
SolidModel StepShape
SolidReplica StepShape
Sphere StepShape
Subedge StepShape
Subface StepShape
SurfaceModel StepShape
SweptAreaSolid StepShape
SweptFaceSolid StepShape
ToleranceMethodDefinition StepShape
ToleranceValue StepShape
TopologicalRepresentationItem StepShape
Torus StepShape
TransitionalShapeRepresentation StepShape
TypeQualifier StepShape
ValueFormatTypeQualifier StepShape
ValueQualifier StepShape
Vertex StepShape
VertexLoop StepShape
VertexPoint StepShape
#===============================================
# package StepVisual
#===============================================
AnnotationCurveOccurrence StepVisual
AnnotationCurveOccurrenceAndGeomReprItem StepVisual
AnnotationFillArea StepVisual
AnnotationFillAreaOccurrence StepVisual
AnnotationOccurrence StepVisual
AnnotationPlane StepVisual
AnnotationPlaneElement StepVisual
AnnotationText StepVisual
AnnotationTextOccurrence StepVisual
AreaInSet StepVisual
AreaOrView StepVisual
BackgroundColour StepVisual
BoxCharacteristicSelect StepVisual
CameraImage StepVisual
CameraImage2dWithScale StepVisual
CameraImage3dWithScale StepVisual
CameraModel StepVisual
CameraModelD2 StepVisual
CameraModelD3 StepVisual
CameraModelD3MultiClipping StepVisual
CameraModelD3MultiClippingInterectionSelect StepVisual
CameraModelD3MultiClippingIntersection StepVisual
CameraModelD3MultiClippingUnion StepVisual
CameraModelD3MultiClippingUnionSelect StepVisual
CameraUsage StepVisual
CentralOrParallel StepVisual
CharacterizedObjAndRepresentationAndDraughtingModel StepVisual
Colour StepVisual
ColourRgb StepVisual
ColourSpecification StepVisual
ComplexTriangulatedFace StepVisual
ComplexTriangulatedSurfaceSet StepVisual
CompositeText StepVisual
CompositeTextWithExtent StepVisual
ContextDependentInvisibility StepVisual
ContextDependentOverRidingStyledItem StepVisual
CoordinatesList StepVisual
CubicBezierTessellatedEdge StepVisual
CubicBezierTriangulatedFace StepVisual
CurveStyle StepVisual
CurveStyleFont StepVisual
CurveStyleFontPattern StepVisual
CurveStyleFontSelect StepVisual
DirectionCountSelect StepVisual
DraughtingAnnotationOccurrence StepVisual
DraughtingCallout StepVisual
DraughtingCalloutElement StepVisual
DraughtingModel StepVisual
DraughtingPreDefinedColour StepVisual
DraughtingPreDefinedCurveFont StepVisual
EdgeOrCurve StepVisual
ExternallyDefinedCurveFont StepVisual
ExternallyDefinedTextFont StepVisual
FaceOrSurface StepVisual
FillAreaStyle StepVisual
FillAreaStyleColour StepVisual
FillStyleSelect StepVisual
FontSelect StepVisual
Invisibility StepVisual
InvisibilityContext StepVisual
InvisibleItem StepVisual
LayeredItem StepVisual
MarkerMember StepVisual
MarkerSelect StepVisual
MarkerType StepVisual
MechanicalDesignGeometricPresentationArea StepVisual
MechanicalDesignGeometricPresentationRepresentation StepVisual
NullStyle StepVisual
NullStyleMember StepVisual
OverRidingStyledItem StepVisual
PathOrCompositeCurve StepVisual
PlanarBox StepVisual
PlanarExtent StepVisual
PointStyle StepVisual
PreDefinedColour StepVisual
PreDefinedCurveFont StepVisual
PreDefinedItem StepVisual
PreDefinedTextFont StepVisual
PresentationArea StepVisual
PresentationLayerAssignment StepVisual
PresentationLayerUsage StepVisual
PresentationRepresentation StepVisual
PresentationRepresentationSelect StepVisual
PresentationSet StepVisual
PresentationSize StepVisual
PresentationSizeAssignmentSelect StepVisual
PresentationStyleAssignment StepVisual
PresentationStyleByContext StepVisual
PresentationStyleSelect StepVisual
PresentationView StepVisual
PresentedItem StepVisual
PresentedItemRepresentation StepVisual
RenderingPropertiesSelect StepVisual
RepositionedTessellatedGeometricSet StepVisual
RepositionedTessellatedItem StepVisual
ShadingSurfaceMethod StepVisual
StyleContextSelect StepVisual
StyledItem StepVisual
StyledItemTarget StepVisual
SurfaceSide StepVisual
SurfaceSideStyle StepVisual
SurfaceStyleBoundary StepVisual
SurfaceStyleControlGrid StepVisual
SurfaceStyleElementSelect StepVisual
SurfaceStyleFillArea StepVisual
SurfaceStyleParameterLine StepVisual
SurfaceStyleReflectanceAmbient StepVisual
SurfaceStyleRendering StepVisual
SurfaceStyleRenderingWithProperties StepVisual
SurfaceStyleSegmentationCurve StepVisual
SurfaceStyleSilhouette StepVisual
SurfaceStyleTransparent StepVisual
SurfaceStyleUsage StepVisual
Template StepVisual
TemplateInstance StepVisual
TessellatedAnnotationOccurrence StepVisual
TessellatedConnectingEdge StepVisual
TessellatedCurveSet StepVisual
TessellatedEdge StepVisual
TessellatedEdgeOrVertex StepVisual
TessellatedFace StepVisual
TessellatedGeometricSet StepVisual
TessellatedItem StepVisual
TessellatedPointSet StepVisual
TessellatedShapeRepresentation StepVisual
TessellatedShapeRepresentationWithAccuracyParameters StepVisual
TessellatedShell StepVisual
TessellatedSolid StepVisual
TessellatedStructuredItem StepVisual
TessellatedSurfaceSet StepVisual
TessellatedVertex StepVisual
TessellatedWire StepVisual
TextLiteral StepVisual
TextOrCharacter StepVisual
TextPath StepVisual
TextStyle StepVisual
TextStyleForDefinedFont StepVisual
TextStyleWithBoxCharacteristics StepVisual
TriangulatedFace StepVisual
ViewVolume StepVisual

View File

@@ -1,129 +0,0 @@
// Created: Wed Nov 3 14:39:28 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <Express.hxx>
#include <Express_Schema.hxx>
#include <OSD_Process.hxx>
#include <OSD_Environment.hxx>
#include <Quantity_Date.hxx>
#include <TCollection_AsciiString.hxx>
//=======================================================================
// function : Schema
// purpose :
//=======================================================================
Handle(Express_Schema)& Express::Schema()
{
static Handle(Express_Schema) aSchema;
return aSchema;
}
//=======================================================================
// function : WriteFileStamp
// purpose : Write header of HXX or CXX file
//=======================================================================
void Express::WriteFileStamp (Standard_OStream& theOS)
{
static const char* EC_VERSION = "2.0";
OSD_Process aProcess;
Quantity_Date aCurTime = aProcess.SystemDate();
OSD_Environment anEnv ("EXPTOCAS_TIME");
TCollection_AsciiString aTimeString = anEnv.Value();
if (aTimeString.IsEmpty())
{
aTimeString += aCurTime.Year();
aTimeString += "-";
aTimeString += aCurTime.Month();
aTimeString += "-";
aTimeString += aCurTime.Day();
}
theOS << "// Created on : " << aTimeString << "\n"
"// Created by: " << aProcess.UserName() << "\n"
"// Generator: ExpToCasExe (EXPRESS -> CASCADE/XSTEP Translator) V" << EC_VERSION << "\n"
"// Copyright (c) Open CASCADE " << aCurTime.Year() << "\n"
"//\n"
"// This file is part of Open CASCADE Technology software library.\n"
"//\n"
"// This library is free software; you can redistribute it and/or modify it under\n"
"// the terms of the GNU Lesser General Public License version 2.1 as published\n"
"// by the Free Software Foundation, with special exception defined in the file\n"
"// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT\n"
"// distribution for complete text of the license and disclaimer of any warranty.\n"
"//\n"
"// Alternatively, this file may be used under the terms of Open CASCADE\n"
"// commercial license or contractual agreement.\n"
"\n";
}
//=======================================================================
// function : WriteMethodStamp
// purpose :
//=======================================================================
void Express::WriteMethodStamp (Standard_OStream& theOS, const TCollection_AsciiString& theName)
{
theOS << "\n"
"//=======================================================================\n"
"// function : " << theName << "\n"
"// purpose :\n"
"//=======================================================================\n"
"\n";
}
//=======================================================================
// function : ToStepName
// purpose :
//=======================================================================
TCollection_AsciiString Express::ToStepName (const TCollection_AsciiString& theName)
{
TCollection_AsciiString aStepName(theName);
for (Standard_Integer i = 2; i <= aStepName.Length(); i++)
{
if (isupper (aStepName.Value (i)))
{
aStepName.Insert (i++, '_');
}
}
aStepName.LowerCase();
return aStepName;
}
//=======================================================================
// function : GetPrefixEnum
// purpose :
//=======================================================================
TCollection_AsciiString Express::EnumPrefix (const TCollection_AsciiString& theName)
{
TCollection_AsciiString aStepName;
for (Standard_Integer i = 1; i <= theName.Length(); i++)
{
if (isupper (theName.Value (i)))
{
aStepName += theName.Value (i);
}
}
aStepName.LowerCase();
return aStepName;
}

View File

@@ -1,52 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_HeaderFile
#define _Express_HeaderFile
#include <Standard_Boolean.hxx>
#include <Standard_Type.hxx>
#include <Standard_OStream.hxx>
class Express_Schema;
class TCollection_AsciiString;
//! Provides data structures for representation of EXPRESS schema
//! (items, types, entities etc.)
//! and tools for generating XSTEP classes (HXX and CXX) from
//! items of the schema
class Express
{
public:
DEFINE_STANDARD_ALLOC
//! Returns (modifiable) handle to static schema object
Standard_EXPORT static Handle(Express_Schema)& Schema();
//! Writes standard copyright stamp (creation date/time, user, etc.)
Standard_EXPORT static void WriteFileStamp (Standard_OStream& theOS);
//! Writes standard comment for method in CXX file
Standard_EXPORT static void WriteMethodStamp (Standard_OStream& theOS, const TCollection_AsciiString& theName);
//! Converts item name from CASCADE to STEP style
//! e.g. BoundedCurve -> bounded_curve
Standard_EXPORT static TCollection_AsciiString ToStepName (const TCollection_AsciiString& theName);
//! Converts item name from CASCADE to STEP style
//! e.g. BoundedCurve -> bounded_curve
Standard_EXPORT static TCollection_AsciiString EnumPrefix (const TCollection_AsciiString& theName);
};
#endif // _Express_HeaderFile

View File

@@ -1,71 +0,0 @@
// Created: Tue Nov 2 14:40:06 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <Express_Alias.hxx>
#include <Message.hxx>
#include <TCollection_AsciiString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Express_Alias, Express_Item)
//=======================================================================
// function : Express_Alias
// purpose :
//=======================================================================
Express_Alias::Express_Alias (const Standard_CString theName, const Handle(Express_Type)& theType)
: Express_Item (theName), myType (theType)
{
}
//=======================================================================
// function : Type
// purpose :
//=======================================================================
const Handle(Express_Type)& Express_Alias::Type() const
{
return myType;
}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
const TCollection_AsciiString Express_Alias::CPPName() const
{
return myType->CPPName();
}
//=======================================================================
// function : GenerateClass
// purpose :
//=======================================================================
Standard_Boolean Express_Alias::GenerateClass() const
{
Message::SendInfo() << "ALIAS " << Name() << " = " << Type()->CPPName() << " used; no generation is needed";
return Standard_False;
}
//=======================================================================
// function : PropagateUse
// purpose :
//=======================================================================
void Express_Alias::PropagateUse() const
{
}

View File

@@ -1,55 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_Alias_HeaderFile
#define _Express_Alias_HeaderFile
#include <Express_Item.hxx>
#include <Express_Type.hxx>
#include <Standard_Type.hxx>
class TCollection_AsciiString;
//! Implements TYPE = type (alias) item of the EXPRESS
//! schema, with interface for deferred Item class.
class Express_Alias : public Express_Item
{
public:
//! Create ALIAS item and initialize it
Standard_EXPORT Express_Alias (const Standard_CString theName, const Handle(Express_Type)& theType);
//! Returns aliased type
Standard_EXPORT const Handle(Express_Type)& Type() const;
//! Returns name of aliased type
Standard_EXPORT virtual const TCollection_AsciiString CPPName() const Standard_OVERRIDE;
//! Create HXX/CXX files from item
Standard_EXPORT virtual Standard_Boolean GenerateClass() const Standard_OVERRIDE;
//! Propagates the calls of Use function
Standard_EXPORT virtual void PropagateUse() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Express_Alias, Express_Item)
protected:
private:
Handle(Express_Type) myType;
};
#endif // _Express_Alias_HeaderFile

View File

@@ -1,21 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_Array_HeaderFile
#define _Express_Array_HeaderFile
#include <Express_ComplexType.hxx>
typedef Express_ComplexType Express_Array;
#endif // _Express_Array_HeaderFile

View File

@@ -1,21 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_Bag_HeaderFile
#define _Express_Bag_HeaderFile
#include <Express_ComplexType.hxx>
typedef Express_ComplexType Express_Bag;
#endif // _Express_Bag_HeaderFile

View File

@@ -1,39 +0,0 @@
// Created: Tue Nov 2 15:27:26 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <Express_Boolean.hxx>
#include <TCollection_AsciiString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Express_Boolean, Express_PredefinedType)
//=======================================================================
// function : Express_Boolean
// purpose :
//=======================================================================
Express_Boolean::Express_Boolean()
{
}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
const TCollection_AsciiString Express_Boolean::CPPName() const
{
return "Standard_Boolean";
}

View File

@@ -1,42 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_Boolean_HeaderFile
#define _Express_Boolean_HeaderFile
#include <Express_PredefinedType.hxx>
#include <Standard_Type.hxx>
class TCollection_AsciiString;
//! Implements EXPRESS type 'BOOLEAN'
class Express_Boolean : public Express_PredefinedType
{
public:
//! Empty constructor
Standard_EXPORT Express_Boolean();
//! Returns "Standard_Boolean"
Standard_EXPORT virtual const TCollection_AsciiString CPPName() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Express_Boolean, Express_PredefinedType)
protected:
private:
};
#endif // _Express_Boolean_HeaderFile

View File

@@ -1,114 +0,0 @@
// Created: Tue Nov 2 15:13:31 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <Express_ComplexType.hxx>
#include <TCollection_AsciiString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Express_ComplexType, Express_Type)
//=======================================================================
// function : Express_ComplexType
// purpose :
//=======================================================================
Express_ComplexType::Express_ComplexType (const Standard_Integer theImin,
const Standard_Integer theImax,
const Handle(Express_Type)& theType)
{
myMin = theImin;
myMax = theImax;
myType = theType;
}
//=======================================================================
// function : Type
// purpose :
//=======================================================================
const Handle(Express_Type)& Express_ComplexType::Type() const
{
return myType;
}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
const TCollection_AsciiString Express_ComplexType::CPPName() const
{
// check if array 2
Handle(Express_Type) aType = myType;
if (aType->IsKind (STANDARD_TYPE(Express_ComplexType)))
{
Handle(Express_ComplexType) aType2 = Handle(Express_ComplexType)::DownCast (aType);
aType = aType2->Type();
}
// parse name of array argument
TCollection_AsciiString aName = aType->CPPName();
Standard_Integer aSplitIdx = aName.Location (1, '_', 1, aName.Length());
TCollection_AsciiString aClassName;
if (aSplitIdx)
{
aClassName = aName.Split (aSplitIdx);
}
else
{
aClassName = aName;
}
Standard_Integer anIdx = aName.Location ("TCollection", 1, aName.Length());
if (anIdx)
{
aName = "Interface_";
}
// generate name
if (aType->IsStandard() || !aSplitIdx)
{
aName = "TColStd_";
}
if (aType == myType)
{
aName += "HArray1Of";
}
else
{
aName += "HArray2Of";
}
aName += aClassName;
return aName;
}
//=======================================================================
// function : Use
// purpose :
//=======================================================================
Standard_Boolean Express_ComplexType::Use() const
{
return myType->Use();
}
//=======================================================================
// function : Use2
// purpose :
//=======================================================================
void Express_ComplexType::Use2 (const TCollection_AsciiString& theRefName, const TCollection_AsciiString& theRefPack) const
{
myType->Use2 (theRefName, theRefPack);
}

View File

@@ -1,61 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_ComplexType_HeaderFile
#define _Express_ComplexType_HeaderFile
#include <Express_Type.hxx>
#include <Standard_Type.hxx>
class TCollection_AsciiString;
//! Base class for complex types (ARRAY, LIST, BAG, SET)
//! in EXPRESS schema
//! Stores type of elements and
class Express_ComplexType : public Express_Type
{
public:
//! Creates an object and initializes fields
Standard_EXPORT Express_ComplexType (const Standard_Integer theImin,
const Standard_Integer theImax,
const Handle(Express_Type)& theType);
//! Returns type of complex type items
Standard_EXPORT const Handle(Express_Type)& Type() const;
//! Returns CPP-style name of the type
Standard_EXPORT virtual const TCollection_AsciiString CPPName() const Standard_OVERRIDE;
//! Declares type as used by some item being generated.
//! Calls Use() for type of elements
Standard_EXPORT virtual Standard_Boolean Use() const Standard_OVERRIDE;
//! Declares type as used by some item being generated.
//! Calls Use() for type of elements
Standard_EXPORT virtual void Use2 (const TCollection_AsciiString& theRefName, const TCollection_AsciiString& theRefPack) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Express_ComplexType, Express_Type)
protected:
private:
Standard_Integer myMin;
Standard_Integer myMax;
Handle(Express_Type) myType;
};
#endif // _Express_ComplexType_HeaderFile

View File

@@ -1,24 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef Express_DataMapOfAsciiStringItem_HeaderFile
#define Express_DataMapOfAsciiStringItem_HeaderFile
#include <Express_Item.hxx>
#include <NCollection_DataMap.hxx>
#include <TCollection_AsciiString.hxx>
typedef NCollection_DataMap<TCollection_AsciiString, Handle(Express_Item),
TCollection_AsciiString> Express_DataMapOfAsciiStringItem;
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,114 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_Entity_HeaderFile
#define _Express_Entity_HeaderFile
#include <Express_Item.hxx>
#include <Standard_OStream.hxx>
#include <Standard_Type.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx>
#include <NCollection_DataMap.hxx>
class Express_HSequenceOfEntity;
class Express_HSequenceOfField;
class Dico_DictionaryOfInteger;
//! Implements ENTITY item of the EXPRESS
//! schema, with interface for deferred Item class.
class Express_Entity : public Express_Item
{
public:
//! Create ENTITY item and initialize it
//! flags hasCheck and hasFillShared mark if generated class has
//! methods Check and FillShared correspondingly.
Standard_EXPORT Express_Entity (const Standard_CString theName,
const Handle(TColStd_HSequenceOfHAsciiString)& theInherit,
const Handle(Express_HSequenceOfField)& theFields);
//! Returns sequence of inherited classes (names)
Standard_EXPORT const Handle(TColStd_HSequenceOfHAsciiString)& SuperTypes() const;
//! Returns sequence of inherited items
Standard_EXPORT const Handle(Express_HSequenceOfEntity)& Inherit() const;
//! Returns sequence of fields
Standard_EXPORT const Handle(Express_HSequenceOfField)& Fields() const;
//! Returns number of fields (only own fields if inherited is False
//! and including fields of all supertypes if it is True)
Standard_EXPORT Standard_Integer NbFields (const Standard_Boolean theInherited = Standard_False) const;
//! Sets abstruct flag for entity;
Standard_EXPORT void SetAbstractFlag (const Standard_Boolean theIsAbstract);
//! Returns abstract flag.
Standard_EXPORT inline Standard_Boolean AbstractFlag() const;
DEFINE_STANDARD_RTTIEXT(Express_Entity, Express_Item)
protected:
private:
typedef NCollection_DataMap<TCollection_AsciiString, Standard_Integer, TCollection_AsciiString> DataMapOfStringInteger;
//! Create HXX/CXX files from item
Standard_EXPORT virtual Standard_Boolean GenerateClass() const Standard_OVERRIDE;
//! Propagates the calls of Use function
Standard_EXPORT virtual void PropagateUse() const Standard_OVERRIDE;
//! Writes includes section of HXX
Standard_EXPORT Standard_Boolean writeIncludes (Standard_OStream& theOS) const;
//! Writes code for reading all fields
Standard_EXPORT Standard_Integer writeRWReadCode (Standard_OStream& theOS,
const Standard_Integer theStart,
const Standard_Integer theOwn) const;
//! Writes code for writing all fields
Standard_EXPORT Standard_Integer writeRWWriteCode (Standard_OStream& theOS,
const Standard_Integer theStart,
const Standard_Integer theOwn) const;
//! Writes code for adding shared entities to the graph
Standard_EXPORT Standard_Integer writeRWShareCode (Standard_OStream& theOS,
const Standard_Integer theStart,
const Standard_Integer theOwn) const;
//! Writes arguments and code for method Init()
//! Mode identifies what code is being written:
//! 0 - HXX declaration
//! 1 - CXX declaration
//! 2 - call (argument list)
//! 3 - implementation
//! 4 - call (argument list for RW)
Standard_EXPORT Standard_Integer makeInit (Standard_OStream& theOS,
const Standard_Integer theShift,
const Standard_Integer theOwn,
const Standard_Integer theMode) const;
private:
Handle(TColStd_HSequenceOfHAsciiString) mySupers;
Handle(Express_HSequenceOfEntity) myInherit;
Handle(Express_HSequenceOfField) myFields;
Standard_Boolean myIsAbstract;
};
#endif // _Express_Entity_HeaderFile

View File

@@ -1,107 +0,0 @@
// Created: Tue Nov 2 14:40:06 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <Express_Enum.hxx>
#include <Express.hxx>
#include <Message.hxx>
#include <OSD_Directory.hxx>
#include <OSD_FileSystem.hxx>
#include <OSD_Path.hxx>
#include <OSD_Protection.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Express_Enum, Express_Item)
//=======================================================================
// function : Express_Enum
// purpose :
//=======================================================================
Express_Enum::Express_Enum (const Standard_CString theName, const Handle(TColStd_HSequenceOfHAsciiString)& theNames)
: Express_Item (theName), myNames (theNames)
{
}
//=======================================================================
// function : Names
// purpose :
//=======================================================================
const Handle(TColStd_HSequenceOfHAsciiString)& Express_Enum::Names() const
{
return myNames;
}
//=======================================================================
// function : GenerateClass
// purpose :
//=======================================================================
Standard_Boolean Express_Enum::GenerateClass() const
{
const TCollection_AsciiString aCPPName = CPPName();
Message::SendInfo() << "Generating ENUMERATION " << aCPPName;
// create a package directory (if not yet exist)
OSD_Protection aProt (OSD_RWXD, OSD_RWXD, OSD_RX, OSD_RX);
TCollection_AsciiString aPack = GetPackageName();
OSD_Path aPath (aPack);
OSD_Directory aDir (aPath);
aDir.Build (aProt);
aPack += "/";
aPack += aCPPName;
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
// Open HXX file
std::shared_ptr<std::ostream> aStreamPtr = aFileSystem->OpenOStream (aPack.Cat (".hxx"), std::ios::out | std::ios::ate);
Standard_OStream& anOS = *aStreamPtr;
// write header
Express::WriteFileStamp (anOS);
// write defines
anOS << "#ifndef _" << aCPPName << "_HeaderFile\n"
"#define _" << aCPPName << "_HeaderFile\n"
"\n"
"enum " << aCPPName << "\n"
"{\n";
TCollection_AsciiString aPrefix = Express::EnumPrefix (Name());
for (Standard_Integer i = 1; i <= myNames->Length(); i++)
{
if (i > 1)
{
anOS << ",\n";
}
anOS << " " << GetPackageName() << "_" << aPrefix << myNames->Value (i)->String();
}
anOS << "\n"
"};\n"
"\n"
"#endif // _" << aCPPName << "_HeaderFile\n";
aStreamPtr.reset();
return Standard_False;
}
//=======================================================================
// function : PropagateUse
// purpose :
//=======================================================================
void Express_Enum::PropagateUse() const
{
}

View File

@@ -1,50 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_Enum_HeaderFile
#define _Express_Enum_HeaderFile
#include <Express_Item.hxx>
#include <Standard_Type.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx>
//! Implements TYPE ENUMERATION item of the EXPRESS
//! schema, with interface for deferred Item class.
class Express_Enum : public Express_Item
{
public:
//! Create ENUM item and initialize it
Standard_EXPORT Express_Enum (const Standard_CString theName, const Handle(TColStd_HSequenceOfHAsciiString)& theNames);
//! Returns names of enumeration variants
Standard_EXPORT const Handle(TColStd_HSequenceOfHAsciiString)& Names() const;
//! Create HXX/CXX files from item
Standard_EXPORT virtual Standard_Boolean GenerateClass() const Standard_OVERRIDE;
//! Propagates the calls of Use function
Standard_EXPORT virtual void PropagateUse() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Express_Enum, Express_Item)
protected:
private:
Handle(TColStd_HSequenceOfHAsciiString) myNames;
};
#endif // _Express_Enum_HeaderFile

View File

@@ -1,89 +0,0 @@
// Created: Tue Nov 2 16:40:51 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <Express_Field.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_HAsciiString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Express_Field, Standard_Transient)
//=======================================================================
// function : Express_Field
// purpose :
//=======================================================================
Express_Field::Express_Field (const Standard_CString theName,
const Handle(Express_Type)& theType,
const Standard_Boolean theOpt)
{
myName = new TCollection_HAsciiString (theName);
myType = theType;
myOpt = theOpt;
}
//=======================================================================
// function : Express_Field
// purpose :
//=======================================================================
Express_Field::Express_Field (const Handle(TCollection_HAsciiString)& theName,
const Handle(Express_Type)& theType,
const Standard_Boolean theOpt)
{
myName = theName;
myType = theType;
myOpt = theOpt;
}
//=======================================================================
// function : Name
// purpose :
//=======================================================================
const TCollection_AsciiString& Express_Field::Name() const
{
return myName->String();
}
//=======================================================================
// function : HName
// purpose :
//=======================================================================
Handle(TCollection_HAsciiString) Express_Field::HName() const
{
return myName;
}
//=======================================================================
// function : Type
// purpose :
//=======================================================================
const Handle(Express_Type)& Express_Field::Type() const
{
return myType;
}
//=======================================================================
// function : IsOptional
// purpose :
//=======================================================================
Standard_Boolean Express_Field::IsOptional() const
{
return myOpt;
}

View File

@@ -1,63 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_Field_HeaderFile
#define _Express_Field_HeaderFile
#include <Standard_Type.hxx>
class Express_Type;
class TCollection_HAsciiString;
class TCollection_AsciiString;
//! Represents field of the ENTITY item in the EXPRESS schema
class Express_Field : public Standard_Transient
{
public:
//! Create object and initialize it
Standard_EXPORT Express_Field (const Standard_CString theName,
const Handle(Express_Type)& theType,
const Standard_Boolean theOpt);
//! Create object and initialize it
Standard_EXPORT Express_Field (const Handle(TCollection_HAsciiString)& theName,
const Handle(Express_Type)& theType,
const Standard_Boolean theOpt);
//! Returns field name
Standard_EXPORT const TCollection_AsciiString& Name() const;
//! Returns a pointer to the field name to modify it
Standard_EXPORT Handle(TCollection_HAsciiString) HName() const;
//! Returns field type
Standard_EXPORT const Handle(Express_Type)& Type() const;
//! Returns True if field is optional
Standard_EXPORT Standard_Boolean IsOptional() const;
DEFINE_STANDARD_RTTIEXT(Express_Field, Standard_Transient)
protected:
private:
Handle(TCollection_HAsciiString) myName;
Handle(Express_Type) myType;
Standard_Boolean myOpt;
};
#endif // _Express_Field_HeaderFile

View File

@@ -1,22 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef Express_HSequenceOfEntity_HeaderFile
#define Express_HSequenceOfEntity_HeaderFile
#include <Express_SequenceOfEntity.hxx>
#include <NCollection_DefineHSequence.hxx>
DEFINE_HSEQUENCE(Express_HSequenceOfEntity, Express_SequenceOfEntity)
#endif

View File

@@ -1,22 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef Express_HSequenceOfField_HeaderFile
#define Express_HSequenceOfField_HeaderFile
#include <Express_SequenceOfField.hxx>
#include <NCollection_DefineHSequence.hxx>
DEFINE_HSEQUENCE(Express_HSequenceOfField, Express_SequenceOfField)
#endif

View File

@@ -1,22 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef Express_HSequenceOfItem_HeaderFile
#define Express_HSequenceOfItem_HeaderFile
#include <Express_SequenceOfItem.hxx>
#include <NCollection_DefineHSequence.hxx>
DEFINE_HSEQUENCE(Express_HSequenceOfItem, Express_SequenceOfItem)
#endif

View File

@@ -1,39 +0,0 @@
// Created: Tue Nov 2 15:27:26 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <Express_Integer.hxx>
#include <TCollection_AsciiString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Express_Integer, Express_PredefinedType)
//=======================================================================
// function : Express_Integer
// purpose :
//=======================================================================
Express_Integer::Express_Integer()
{
}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
const TCollection_AsciiString Express_Integer::CPPName() const
{
return "Standard_Integer";
}

View File

@@ -1,42 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_Integer_HeaderFile
#define _Express_Integer_HeaderFile
#include <Express_PredefinedType.hxx>
#include <Standard_Type.hxx>
class TCollection_AsciiString;
//! Implements EXPRESS type 'INTEGER'
class Express_Integer : public Express_PredefinedType
{
public:
//! Empty constructor
Standard_EXPORT Express_Integer();
//! Returns "Standard_Integer"
Standard_EXPORT virtual const TCollection_AsciiString CPPName() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Express_Integer, Express_PredefinedType)
protected:
private:
};
#endif // _Express_Integer_HeaderFile

View File

@@ -1,335 +0,0 @@
// Created: Tue Nov 2 13:14:31 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <Express_Item.hxx>
#include <Message.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_HAsciiString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Express_Item, Standard_Transient)
Standard_Integer Express_Item::myIndex = -1;
//=======================================================================
// function : Express_Item
// purpose :
//=======================================================================
Express_Item::Express_Item (const Standard_CString theName)
{
myName = new TCollection_HAsciiString (theName);
myGenMode = GM_Undefined;
myShortName = new TCollection_HAsciiString;
myCategory = new TCollection_HAsciiString;
myhasCheck = Standard_False;
myhasFillShared = Standard_False;
myLoopFlag = Standard_False;
}
//=======================================================================
// function : Express_Item
// purpose :
//=======================================================================
Express_Item::Express_Item (const Handle(TCollection_HAsciiString)& theName)
{
myName = theName;
myGenMode = GM_Undefined;
myShortName = new TCollection_HAsciiString;
myCategory = new TCollection_HAsciiString;
myhasCheck = Standard_False;
myhasFillShared = Standard_False;
myLoopFlag = Standard_False;
}
//=======================================================================
// function : Name
// purpose :
//=======================================================================
const TCollection_AsciiString& Express_Item::Name() const
{
return myName->String();
}
//=======================================================================
// function : HName
// purpose :
//=======================================================================
Handle(TCollection_HAsciiString) Express_Item::HName() const
{
return myName;
}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
const TCollection_AsciiString Express_Item::CPPName() const
{
TCollection_AsciiString aName = GetPackageName();
aName += "_";
aName += Name();
return aName;
}
//=======================================================================
// function : SetPackageName
// purpose :
//=======================================================================
void Express_Item::SetPackageName (const TCollection_AsciiString& thePack)
{
myPack = new TCollection_HAsciiString(thePack);
}
//=======================================================================
// function : GetPackageName
// purpose :
//=======================================================================
const TCollection_AsciiString& Express_Item::GetPackageName() const
{
if (myPack.IsNull())
{
Message::SendWarning() << "Warning: item " << Name() << " still has no package assigned, used " << GetUnknownPackageName();
return GetUnknownPackageName();
}
return myPack->String();
}
//=======================================================================
// function : IsPackageNameSet
// purpose :
//=======================================================================
Standard_Boolean Express_Item::IsPackageNameSet() const
{
return !myPack.IsNull();
}
//=======================================================================
// function : GetUnknownPackageName
// purpose :
//=======================================================================
TCollection_AsciiString& Express_Item::GetUnknownPackageName()
{
static TCollection_AsciiString aUnknownPackageName = "StepStep";
return aUnknownPackageName;
}
//=======================================================================
// function : GetGenMode
// purpose :
//=======================================================================
Express_Item::GenMode Express_Item::GetGenMode() const
{
return myGenMode;
}
//=======================================================================
// function : SetGenMode
// purpose :
//=======================================================================
void Express_Item::SetGenMode (const Express_Item::GenMode theGenMode)
{
myGenMode = theGenMode;
}
//=======================================================================
// function : ResetLoopFlag
// purpose :
//=======================================================================
void Express_Item::ResetLoopFlag()
{
myLoopFlag = Standard_False;
}
//=======================================================================
// function : Generate
// purpose :
//=======================================================================
Standard_Boolean Express_Item::Generate()
{
// skip items without "generate" mark
GenMode aMode = GetGenMode();
if (!(aMode == GM_GenByUser || aMode == GM_GenByAlgo))
{
return Standard_False;
}
// manage indent for cout in order to mark structure of calls
static Standard_Integer aShift = -1;
aShift++;
for (Standard_Integer i = 0; i < aShift; i++)
{
std::cout << " ";
}
// sets the mode to generated before "GenerateClass" function to avoid looping
SetGenMode (GM_Generated);
Standard_Boolean aRes = GenerateClass();
aShift--;
return aRes;
}
//=======================================================================
// function : Use
// purpose :
//=======================================================================
Standard_Boolean Express_Item::Use()
{
// if Item is not mentioned by the user but is used, then it is necessary to generate
if (GetGenMode() != GM_Undefined)
{
return Standard_False;
}
SetGenMode (GM_GenByAlgo);
return Generate();
}
//=======================================================================
// function : Use2
// purpose :
//=======================================================================
void Express_Item::Use2 (const TCollection_AsciiString& theRefName, const TCollection_AsciiString& theRefPack)
{
if (myLoopFlag)
{
return;
}
else
{
myLoopFlag = Standard_True;
}
// issue a warning message if item does not have package assigned
if (!IsPackageNameSet())
{
Message::SendWarning() << "Warning: item " << Name() << " has no package assigned but used by " << theRefName << ", setting " << theRefPack;
SetPackageName (theRefPack);
}
PropagateUse();
}
//=======================================================================
// function : SetCategory
// purpose :
//=======================================================================
void Express_Item::SetCategory (const Handle(TCollection_HAsciiString)& theCateg)
{
myCategory = theCateg;
}
//=======================================================================
// function : Cartegory
// purpose :
//=======================================================================
const TCollection_AsciiString& Express_Item::Category() const
{
return myCategory->String();
}
//=======================================================================
// function : SetShortName
// purpose :
//=======================================================================
void Express_Item::SetShortName (const Handle(TCollection_HAsciiString)& theShName)
{
myShortName = theShName;
}
//=======================================================================
// function : ShortName
// purpose :
//=======================================================================
Handle(TCollection_HAsciiString) Express_Item::ShortName() const
{
return myShortName;
}
//=======================================================================
// function : SetCheckFlag
// purpose :
//=======================================================================
void Express_Item::SetCheckFlag (const Standard_Boolean theCheckFlag)
{
myhasCheck = theCheckFlag;
}
//=======================================================================
// function : CheckFlag
// purpose :
//=======================================================================
Standard_Boolean Express_Item::CheckFlag() const
{
return myhasCheck;
}
//=======================================================================
// function : SetFillSharedFlag
// purpose :
//=======================================================================
void Express_Item::SetFillSharedFlag (const Standard_Boolean theFillSharedFlag)
{
myhasFillShared = theFillSharedFlag;
}
//=======================================================================
// function : FillSharedFlag
// purpose :
//=======================================================================
Standard_Boolean Express_Item::FillSharedFlag() const
{
return myhasFillShared;
}
//=======================================================================
// function : SetIndex
// purpose :
//=======================================================================
void Express_Item::SetIndex (const Standard_Integer theIndex)
{
myIndex = theIndex;
}
//=======================================================================
// function : Index
// purpose :
//=======================================================================
Standard_Integer Express_Item::Index()
{
return myIndex;
}

View File

@@ -1,150 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_Item_HeaderFile
#define _Express_Item_HeaderFile
#include <Standard.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>
#include <Standard_DefineHandle.hxx>
#include <Standard_Transient.hxx>
class TCollection_AsciiString;
class TCollection_HAsciiString;
//! Base class for items of the schema. Stores a name of the class,
//! package name and flag used to mark items for generation.
//! Provides interface for writing generated class definitions to HXX
//! and CXX files.
class Express_Item : public Standard_Transient
{
public:
enum GenMode
{
GM_NoGen, // Item in existed list - no need to generate
GM_GenByUser, // Item in new list - need to generate
GM_GenByAlgo, // Item isn't in any list but is used by needed item
GM_Undefined, // Item isn't in any list
GM_Generated // Item has been generated
};
//! Returns item name
Standard_EXPORT const TCollection_AsciiString& Name() const;
//! Returns a pointer to the item name to modify it
Standard_EXPORT Handle(TCollection_HAsciiString) HName() const;
//! Returns (generated) name for the item in CXX-style (Package_Class)
Standard_EXPORT virtual const TCollection_AsciiString CPPName() const;
//! Returns package name
//! If not defined, returns unknown package name: "StepStep"
Standard_EXPORT const TCollection_AsciiString& GetPackageName() const;
//! Returns whether the package name is set.
Standard_EXPORT Standard_Boolean IsPackageNameSet() const;
//! Returns unknown package name: "StepStep"
Standard_EXPORT static TCollection_AsciiString& GetUnknownPackageName();
//! Sets package name
Standard_EXPORT void SetPackageName (const TCollection_AsciiString& thePack);
//! Returns item generation mode
Standard_EXPORT GenMode GetGenMode() const;
//! Change generation mode for item
Standard_EXPORT void SetGenMode (const GenMode theGenMode);
//! Reset loop flag
Standard_EXPORT void ResetLoopFlag();
//! General interface for creating HXX/CXX files from item
Standard_EXPORT virtual Standard_Boolean GenerateClass() const = 0;
//! Propagates the calls of Use function
Standard_EXPORT virtual void PropagateUse() const = 0;
//! Checks that item is marked for generation and if yes,
//! generate it by calling GenerateClass. But firstly define
//! PackageName to "StepStep" if not yet defined and drop Mark flag.
Standard_EXPORT Standard_Boolean Generate();
//! Declares item as used by other item being generated
//! If Item is not mentioned by the user (as new or existed) but is used,
//! then it sets GenMode to GM_GenByAlgo and Calls Generate().
Standard_EXPORT Standard_Boolean Use();
//! Mark Item as visited in PropagateUse flow and defined the package name if not set.
Standard_EXPORT void Use2 (const TCollection_AsciiString& theRefName, const TCollection_AsciiString& theRefPack);
//! Set category for item
Standard_EXPORT void SetCategory (const Handle(TCollection_HAsciiString)& theCateg);
//! Get item category
Standard_EXPORT const TCollection_AsciiString& Category() const;
//! Set short name for item
Standard_EXPORT void SetShortName (const Handle(TCollection_HAsciiString)& theShName);
//! Get item short name
Standard_EXPORT Handle(TCollection_HAsciiString) ShortName() const;
//! Set flag for presence of method Check in the class
Standard_EXPORT void SetCheckFlag (const Standard_Boolean theCheckFlag);
//! Get flag resposible for presence of method Check in the class
Standard_EXPORT Standard_Boolean CheckFlag() const;
//! Set flag for presence of method FillShared in the class
Standard_EXPORT void SetFillSharedFlag (const Standard_Boolean theFillSharedFlag);
//! Get flag resposible for presence of method FillShared in the class
Standard_EXPORT Standard_Boolean FillSharedFlag() const;
//! Set start entity index
Standard_EXPORT static void SetIndex (const Standard_Integer theIndex);
//! Get current entity index
Standard_EXPORT static Standard_Integer Index();
DEFINE_STANDARD_RTTIEXT(Express_Item, Standard_Transient)
protected:
//! Creates object and initializes fields PackageName and
//! CreateFlag by 0
Standard_EXPORT Express_Item (const Standard_CString theName);
//! Creates object and initializes fields PackageName and
//! CreateFlag by 0
Standard_EXPORT Express_Item (const Handle(TCollection_HAsciiString)& theName);
private:
Handle(TCollection_HAsciiString) myName;
Handle(TCollection_HAsciiString) myPack;
// "Generate" mark. If is TRUE a class will be generated for the item
GenMode myGenMode;
// Flag to avoid looping
Standard_Boolean myLoopFlag;
Handle(TCollection_HAsciiString) myShortName;
Handle(TCollection_HAsciiString) myCategory;
Standard_Boolean myhasCheck;
Standard_Boolean myhasFillShared;
static Standard_Integer myIndex;
};
#endif // _Express_Item_HeaderFile

View File

@@ -1,21 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_List_HeaderFile
#define _Express_List_HeaderFile
#include <Express_ComplexType.hxx>
typedef Express_ComplexType Express_List;
#endif // _Express_List_HeaderFile

View File

@@ -1,70 +0,0 @@
// Created: Tue Nov 2 15:27:26 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <Express_Logical.hxx>
#include <TCollection_AsciiString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Express_Logical, Express_PredefinedType)
//=======================================================================
// function : Express_Logical
// purpose :
//=======================================================================
Express_Logical::Express_Logical()
{
}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
const TCollection_AsciiString Express_Logical::CPPName() const
{
return "StepData_Logical";
}
//=======================================================================
// function : IsStandard
// purpose :
//=======================================================================
Standard_Boolean Express_Logical::IsStandard() const
{
return Standard_False;
}
//=======================================================================
// function : IsSimple
// purpose :
//=======================================================================
Standard_Boolean Express_Logical::IsSimple() const
{
return Standard_True;
}
//=======================================================================
// function : IsHandle
// purpose :
//=======================================================================
Standard_Boolean Express_Logical::IsHandle() const
{
return Standard_False;
}

View File

@@ -1,51 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_Logical_HeaderFile
#define _Express_Logical_HeaderFile
#include <Express_PredefinedType.hxx>
#include <Standard_Type.hxx>
class TCollection_AsciiString;
//! Implements EXPRESS type 'LOGICAL'
class Express_Logical : public Express_PredefinedType
{
public:
//! Empty constructor
Standard_EXPORT Express_Logical();
//! Returns "StepData_Logical"
Standard_EXPORT virtual const TCollection_AsciiString CPPName() const Standard_OVERRIDE;
//! Return False
Standard_EXPORT virtual Standard_Boolean IsStandard() const Standard_OVERRIDE;
//! Return False
Standard_EXPORT virtual Standard_Boolean IsSimple() const Standard_OVERRIDE;
//! Return False
Standard_EXPORT virtual Standard_Boolean IsHandle() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Express_Logical, Express_PredefinedType)
protected:
private:
};
#endif // _Express_Logical_HeaderFile

View File

@@ -1,167 +0,0 @@
// Created: Tue Nov 2 15:13:31 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <Express_NamedType.hxx>
#include <Express_Alias.hxx>
#include <Express_Entity.hxx>
#include <Express_Enum.hxx>
#include <Express_Item.hxx>
#include <TCollection_AsciiString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Express_NamedType, Express_Type)
//=======================================================================
// function : Express_NamedType
// purpose :
//=======================================================================
Express_NamedType::Express_NamedType (const Standard_CString theName)
{
myName = new TCollection_HAsciiString (theName);
}
//=======================================================================
// function : Express_NamedType
// purpose :
//=======================================================================
Express_NamedType::Express_NamedType (const Handle(TCollection_HAsciiString)& theName)
{
myName = theName;
}
//=======================================================================
// function : Name
// purpose :
//=======================================================================
const TCollection_AsciiString& Express_NamedType::Name() const
{
return myName->String();
}
//=======================================================================
// function : HName
// purpose :
//=======================================================================
Handle(TCollection_HAsciiString) Express_NamedType::HName() const
{
return myName;
}
//=======================================================================
// function : Item
// purpose :
//=======================================================================
const Handle(Express_Item)& Express_NamedType::Item() const
{
return myItem;
}
//=======================================================================
// function : SetItem
// purpose :
//=======================================================================
void Express_NamedType::SetItem (const Handle(Express_Item)& theItem)
{
myItem = theItem;
}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
const TCollection_AsciiString Express_NamedType::CPPName() const
{
return myItem->CPPName();
}
//=======================================================================
// function : IsStandard
// purpose :
//=======================================================================
Standard_Boolean Express_NamedType::IsStandard() const
{
if (myItem->IsKind (STANDARD_TYPE(Express_Alias)))
{
Handle(Express_Alias) anAlias = Handle(Express_Alias)::DownCast (myItem);
return anAlias->Type()->IsStandard();
}
return Standard_False;
}
//=======================================================================
// function : IsSimple
// purpose :
//=======================================================================
Standard_Boolean Express_NamedType::IsSimple() const
{
if (myItem->IsKind (STANDARD_TYPE(Express_Alias)))
{
Handle(Express_Alias) anAlias = Handle(Express_Alias)::DownCast (myItem);
return anAlias->Type()->IsSimple();
}
if (myItem->IsKind (STANDARD_TYPE(Express_Enum)))
{
return Standard_True;
}
return Standard_False; // SELECT & ENTITY
}
//=======================================================================
// function : IsHandle
// purpose :
//=======================================================================
Standard_Boolean Express_NamedType::IsHandle() const
{
if (myItem->IsKind (STANDARD_TYPE(Express_Alias)))
{
Handle(Express_Alias) alias = Handle(Express_Alias)::DownCast (myItem);
return alias->Type()->IsHandle();
}
if (myItem->IsKind (STANDARD_TYPE(Express_Entity)))
{
return Standard_True;
}
return Standard_False; // SELECT & ENUMERATION
}
//=======================================================================
// function : Use
// purpose :
//=======================================================================
Standard_Boolean Express_NamedType::Use() const
{
return myItem->Use();
}
//=======================================================================
// function : Use2
// purpose :
//=======================================================================
void Express_NamedType::Use2 (const TCollection_AsciiString& theRefName, const TCollection_AsciiString& theRefPack) const
{
myItem->Use2 (theRefName, theRefPack);
}

View File

@@ -1,81 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_NamedType_HeaderFile
#define _Express_NamedType_HeaderFile
#include <Express_Type.hxx>
#include <Standard_Type.hxx>
class Express_Item;
class TCollection_AsciiString;
class TCollection_HAsciiString;
//! Base class for complex types (ARRAY, LIST, BAG, SET)
//! in EXPRESS schema
//! Stores type of elements and
class Express_NamedType : public Express_Type
{
public:
//! Creates an object and initializes by name
Standard_EXPORT Express_NamedType (const Standard_CString theName);
//! Creates an object and initializes by name
Standard_EXPORT Express_NamedType (const Handle(TCollection_HAsciiString)& theName);
//! Returns name of type (item in schema)
Standard_EXPORT const TCollection_AsciiString& Name() const;
//! Returns a pointer to the type name to modify it
Standard_EXPORT Handle(TCollection_HAsciiString) HName() const;
//! Returns handle to referred item in schema
Standard_EXPORT const Handle(Express_Item)& Item() const;
//! Sets handle to referred item in schema
Standard_EXPORT void SetItem (const Handle(Express_Item)& theItem);
//! Returns CPP-style name of the type
Standard_EXPORT virtual const TCollection_AsciiString CPPName() const Standard_OVERRIDE;
//! Return True if type is defined in package Standard
Standard_EXPORT virtual Standard_Boolean IsStandard() const Standard_OVERRIDE;
//! Return True if type is simple (not a class)
Standard_EXPORT virtual Standard_Boolean IsSimple() const Standard_OVERRIDE;
//! Return True if type is inherited from Transient
Standard_EXPORT virtual Standard_Boolean IsHandle() const Standard_OVERRIDE;
//! Declares type as used by some item being generated.
//! Calls Use() for referred item (found by name).
Standard_EXPORT virtual Standard_Boolean Use() const Standard_OVERRIDE;
//! Declares type as used by some item being generated.
//! Calls Use() for referred item (found by name).
Standard_EXPORT virtual void Use2 (const TCollection_AsciiString& theRefName, const TCollection_AsciiString& theRefPack) const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Express_NamedType, Express_Type)
protected:
private:
Handle(TCollection_HAsciiString) myName;
Handle(Express_Item) myItem;
};
#endif // _Express_NamedType_HeaderFile

View File

@@ -1,21 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_Number_HeaderFile
#define _Express_Number_HeaderFile
#include <Express_Integer.hxx>
typedef Express_Integer Express_Number;
#endif // _Express_Number_HeaderFile

View File

@@ -1,38 +0,0 @@
// Created: Tue Nov 2 15:13:31 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <Express_PredefinedType.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Express_PredefinedType, Express_Type)
//=======================================================================
// function : Express_PredefinedType
// purpose :
//=======================================================================
Express_PredefinedType::Express_PredefinedType()
{
}
//=======================================================================
// function : IsStandard
// purpose :
//=======================================================================
Standard_Boolean Express_PredefinedType::IsStandard() const
{
return Standard_True;
}

View File

@@ -1,41 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_PredefinedType_HeaderFile
#define _Express_PredefinedType_HeaderFile
#include <Standard_Type.hxx>
#include <Express_Type.hxx>
//! Base class for predefined types (like NUMBER or STRING)
//! in EXPRESS schema
class Express_PredefinedType : public Express_Type
{
public:
//! Returns True
Standard_EXPORT virtual Standard_Boolean IsStandard() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Express_PredefinedType, Express_Type)
protected:
//! Empty constructor
Standard_EXPORT Express_PredefinedType();
private:
};
#endif // _Express_PredefinedType_HeaderFile

View File

@@ -1,39 +0,0 @@
// Created: Tue Nov 2 15:27:26 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <Express_Real.hxx>
#include <TCollection_AsciiString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Express_Real,Express_PredefinedType)
//=======================================================================
// function : Express_Real
// purpose :
//=======================================================================
Express_Real::Express_Real()
{
}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
const TCollection_AsciiString Express_Real::CPPName() const
{
return "Standard_Real";
}

View File

@@ -1,42 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_Real_HeaderFile
#define _Express_Real_HeaderFile
#include <Express_PredefinedType.hxx>
#include <Standard_Type.hxx>
class TCollection_AsciiString;
//! Implements EXPRESS type 'REAL'
class Express_Real : public Express_PredefinedType
{
public:
//! Empty constructor
Standard_EXPORT Express_Real();
//! Returns "Standard_Real"
Standard_EXPORT virtual const TCollection_AsciiString CPPName() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Express_Real, Express_PredefinedType)
protected:
private:
};
#endif // _Express_Real_HeaderFile

View File

@@ -1,49 +0,0 @@
// Created: Fri Nov 22 13:32:26 2002
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <Express_Reference.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Express_Reference, Express_Item)
//=======================================================================
// function : Express_Reference
// purpose :
//=======================================================================
Express_Reference::Express_Reference (const Standard_CString theName,
const Handle(TColStd_HSequenceOfHAsciiString)& theTypes)
: Express_Item (theName)
{
myTypes = theTypes;
}
//=======================================================================
// function : GenerateClass
// purpose : dummy method
//=======================================================================
Standard_Boolean Express_Reference::GenerateClass() const
{
return Standard_False;
}
//=======================================================================
// function : PropagateUse
// purpose : dummy method
//=======================================================================
void Express_Reference::PropagateUse() const
{
}

View File

@@ -1,65 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_Reference_HeaderFile
#define _Express_Reference_HeaderFile
#include <Express_Item.hxx>
#include <Standard_Type.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx>
class Express_HSequenceOfItem;
//! Implements REFERENCE FROM (list of types used from other schema)
//! item of the EXPRESS schema, with interface for Item class.
class Express_Reference : public Express_Item
{
public:
//! Create Reference item and initialize it
Standard_EXPORT Express_Reference (const Standard_CString theName,
const Handle(TColStd_HSequenceOfHAsciiString)& theTypes);
//! Returns list of types referenced
const Handle(TColStd_HSequenceOfHAsciiString)& Types() const
{
return myTypes;
}
//! Returns handle to sequence of items corresponding to
//! listed types
const Handle(Express_HSequenceOfItem)& Items() const
{
return myItems;
}
//! Redefined to empty (in order to be able to instantiate)
//! Return False
Standard_EXPORT virtual Standard_Boolean GenerateClass() const Standard_OVERRIDE;
//! Propagates the calls of Use function
Standard_EXPORT virtual void PropagateUse() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Express_Reference, Express_Item)
protected:
private:
Handle(TColStd_HSequenceOfHAsciiString) myTypes;
Handle(Express_HSequenceOfItem) myItems;
};
#endif // _Express_Reference_HeaderFile

View File

@@ -1,330 +0,0 @@
// Created: Tue Nov 2 12:29:06 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <Express_Schema.hxx>
#include <Express_Alias.hxx>
#include <Express_ComplexType.hxx>
#include <Express_Entity.hxx>
#include <Express_Enum.hxx>
#include <Express_HSequenceOfEntity.hxx>
#include <Express_HSequenceOfField.hxx>
#include <Express_NamedType.hxx>
#include <Express_Select.hxx>
#include <Express_Type.hxx>
#include <Message.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Express_Schema, Standard_Transient)
//=======================================================================
// function : Express_Schema
// purpose :
//=======================================================================
Express_Schema::Express_Schema (const Standard_CString theName,
const Handle(Express_HSequenceOfItem)& theItems)
{
myName = new TCollection_HAsciiString (theName);
myItems = theItems;
Prepare();
}
//=======================================================================
// function : Express_Schema
// purpose :
//=======================================================================
Express_Schema::Express_Schema (const Handle(TCollection_HAsciiString)& theName,
const Handle(Express_HSequenceOfItem)& theItems)
{
myName = theName;
myItems = theItems;
Prepare();
}
//=======================================================================
// function : Name
// purpose :
//=======================================================================
const Handle(TCollection_HAsciiString)& Express_Schema::Name() const
{
return myName;
}
//=======================================================================
// function : Items
// purpose :
//=======================================================================
const Handle(Express_HSequenceOfItem)& Express_Schema::Items() const
{
return myItems;
}
//=======================================================================
// function : NbItems
// purpose :
//=======================================================================
Standard_Integer Express_Schema::NbItems() const
{
return myItems->Length();
}
//=======================================================================
// function : Item
// purpose :
//=======================================================================
Handle(Express_Item) Express_Schema::Item (const Standard_Integer theNum) const
{
return myItems->Value (theNum);
}
//=======================================================================
// function : Item
// purpose :
//=======================================================================
Handle(Express_Item) Express_Schema::Item (const Standard_CString theName,
const Standard_Boolean theSilent) const
{
if (!myDict.IsBound (theName))
{
if (!theSilent)
{
Message::SendFail() << "Error: attempt to access unknown item by name " << theName;
}
return {};
}
return myDict.Find (theName);
}
//=======================================================================
// function : Item
// purpose :
//=======================================================================
Handle(Express_Item) Express_Schema::Item (const TCollection_AsciiString& theName) const
{
return Item (theName.ToCString());
}
//=======================================================================
// function : Item
// purpose :
//=======================================================================
Handle(Express_Item) Express_Schema::Item (const Handle(TCollection_HAsciiString)& theName) const
{
return Item (theName->ToCString());
}
//=======================================================================
// function : nameToCasCade
// purpose : auxilary for Prepare()
// Convert STEP-style name (lowercase, with underscores)
// to CASCADE-style name (each word starts with uppercase, no intervals)
//=======================================================================
static void nameToCasCade (const Handle(TCollection_HAsciiString)& theName)
{
if (theName.IsNull())
{
return;
}
for (Standard_Integer i = 1; i <= theName->Length(); i++)
{
if (theName->Value (i) == '_')
{
theName->Remove (i);
}
else if (i > 1)
{
continue;
}
theName->SetValue (i, UpperCase (theName->Value (i)));
}
}
//=======================================================================
// function : nameToCasCade
// purpose : auxilary for Prepare()
// Convert names for Type object
//=======================================================================
static void nameToCasCade (const Handle(Express_Type)& theType)
{
if (theType->IsKind (STANDARD_TYPE(Express_NamedType)))
{
const Handle(Express_NamedType) aNamedType = Handle(Express_NamedType)::DownCast (theType);
nameToCasCade (aNamedType->HName());
}
else if (theType->IsKind (STANDARD_TYPE(Express_ComplexType)))
{
const Handle(Express_ComplexType) aComplexType = Handle(Express_ComplexType)::DownCast (theType);
nameToCasCade (aComplexType->Type());
}
}
//=======================================================================
// function : Prepare
// purpose : Prepare data: convert names to CasCade, fill dictionary of typenames
// and set handles to items where they are referenced by names
//=======================================================================
void Express_Schema::Prepare()
{
myDict.Clear();
if (myItems.IsNull())
{
return;
}
Standard_Integer aNbItems = NbItems();
// convert names and fill dictionary
for (Standard_Integer aNum = 1; aNum <= aNbItems; aNum++)
{
// get item
const Handle(Express_Item) anItem = Item (aNum);
// change item name
nameToCasCade (anItem->HName());
// change names of referred types and other names
if (anItem->IsKind (STANDARD_TYPE(Express_Alias)))
{
const Handle(Express_Alias) anAlias = Handle(Express_Alias)::DownCast (anItem);
nameToCasCade (anAlias->Type());
}
else if (anItem->IsKind (STANDARD_TYPE(Express_Select)))
{
const Handle(Express_Select) aSelect = Handle(Express_Select)::DownCast (anItem);
for (Standard_Integer i = 1; i <= aSelect->Names()->Length(); i++)
{
nameToCasCade (aSelect->Names()->Value (i));
}
}
else if (anItem->IsKind (STANDARD_TYPE(Express_Enum)))
{
const Handle(Express_Enum) anEnum = Handle(Express_Enum)::DownCast (anItem);
for (Standard_Integer i = 1; i <= anEnum->Names()->Length(); i++)
{
nameToCasCade (anEnum->Names()->Value (i));
}
}
else if (anItem->IsKind (STANDARD_TYPE(Express_Entity)))
{
const Handle(Express_Entity) anEntity = Handle(Express_Entity)::DownCast (anItem);
for (Standard_Integer i = 1; i <= anEntity->SuperTypes()->Length(); i++)
{
nameToCasCade (anEntity->SuperTypes()->Value (i));
}
const Handle(Express_HSequenceOfField) aFields = anEntity->Fields();
for (Standard_Integer i = 1; i <= aFields->Length(); i++)
{
nameToCasCade (aFields->Value (i)->HName());
nameToCasCade (aFields->Value (i)->Type());
}
}
// add to dictionary
myDict.Bind (anItem->Name(), anItem);
}
// set references to items from other items and types
for (Standard_Integer aNum = 1; aNum <= aNbItems; aNum++)
{
const Handle(Express_Item) anItem = Item (aNum);
if (anItem->IsKind (STANDARD_TYPE(Express_Alias)))
{
const Handle(Express_Alias) anAlias = Handle(Express_Alias)::DownCast (anItem);
PrepareType (anAlias->Type());
// for aliases, define package to avoid warnings
anAlias->SetPackageName ("Standard");
continue;
}
else if (anItem->IsKind (STANDARD_TYPE(Express_Select)))
{
const Handle(Express_Select) aSelect = Handle(Express_Select)::DownCast (anItem);
Handle(TColStd_HSequenceOfHAsciiString) aNames = aSelect->Names();
Handle(Express_HSequenceOfItem) anItems = aSelect->Items();
for (Standard_Integer i = 1; i <= aNames->Length(); i++)
{
Handle(Express_Item) aSubItem = Item (aNames->Value (i));
// if select refers to another select, expand it
if (aSubItem->IsKind (STANDARD_TYPE(Express_Select)))
{
Message::SendInfo() << "Info: SELECT " << anItem->Name() << " refers to another SELECT " << aSubItem->Name() << "; expanded";
const Handle(Express_Select) aSubSelect = Handle(Express_Select)::DownCast (aSubItem);
Standard_Integer j = 1;
for (; j <= aSubSelect->Names()->Length(); j++)
{
aNames->InsertBefore (i + j - 1, aSubSelect->Names()->Value (j));
}
aNames->Remove (i + j - 1);
i--;
continue;
}
anItems->Append (aSubItem);
}
}
else if (anItem->IsKind (STANDARD_TYPE(Express_Entity)))
{
const Handle(Express_Entity) anEntity = Handle(Express_Entity)::DownCast (anItem);
Handle(TColStd_HSequenceOfHAsciiString) aNames = anEntity->SuperTypes();
Handle(Express_HSequenceOfEntity) anInhItems = anEntity->Inherit();
for (Standard_Integer i = 1; i <= aNames->Length(); i++)
{
Handle(Express_Entity) aSubEntity = Handle(Express_Entity)::DownCast (Item (aNames->Value (i)));
if (!aSubEntity.IsNull())
{
anInhItems->Append (aSubEntity);
}
else
{
Message::SendFail() << "Error in " << anItem->Name() << ": supertype " << aNames->Value (i)->String() << " is not an ENTITY; ignored";
}
}
const Handle(Express_HSequenceOfField) aFields = anEntity->Fields();
for (Standard_Integer i = 1; i <= aFields->Length(); i++)
{
PrepareType (aFields->Value (i)->Type());
}
}
}
}
//=======================================================================
// function : PrepareType
// purpose :
//=======================================================================
void Express_Schema::PrepareType (const Handle(Express_Type)& theType) const
{
if (theType->IsKind (STANDARD_TYPE(Express_NamedType)))
{
Handle(Express_NamedType) aNamedType = Handle(Express_NamedType)::DownCast (theType);
aNamedType->SetItem (Item (aNamedType->Name()));
}
else if (theType->IsKind (STANDARD_TYPE(Express_ComplexType)))
{
Handle(Express_ComplexType) aComplexType = Handle(Express_ComplexType)::DownCast (theType);
PrepareType (aComplexType->Type());
}
}

View File

@@ -1,92 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_Schema_HeaderFile
#define _Express_Schema_HeaderFile
#include <Express_DataMapOfAsciiStringItem.hxx>
#include <Express_HSequenceOfItem.hxx>
#include <Standard_Type.hxx>
class TCollection_HAsciiString;
class Express_HSequenceOfItem;
class Express_Item;
class TCollection_AsciiString;
class Express_Type;
//! Represents a schema as a list of items and provides general
//! tools for generating HXX/CXX files (including dictionary of
//! item names)
class Express_Schema : public Standard_Transient
{
public:
//! Creates a schema with given name and given set of items
//! and calls Prepare()
Standard_EXPORT Express_Schema (const Standard_CString theName,
const Handle(Express_HSequenceOfItem)& theItems);
//! Creates a schema with given name and given set of items
//! and calls Prepare()
Standard_EXPORT Express_Schema (const Handle(TCollection_HAsciiString)& theName,
const Handle(Express_HSequenceOfItem)& theItems);
//! Returns schema name
Standard_EXPORT const Handle(TCollection_HAsciiString)& Name() const;
//! Returns sequence of items
Standard_EXPORT const Handle(Express_HSequenceOfItem)& Items() const;
//! Returns number of items
Standard_EXPORT Standard_Integer NbItems() const;
//! Returns item by index
Standard_EXPORT Handle(Express_Item) Item (const Standard_Integer theNum) const;
//! Returns item by name
Standard_EXPORT Handle(Express_Item) Item (const Standard_CString theName,
const Standard_Boolean theSilent = Standard_False) const;
//! Returns item by name
Standard_EXPORT Handle(Express_Item) Item (const TCollection_AsciiString& theName) const;
//! Returns item by name
Standard_EXPORT Handle(Express_Item) Item (const Handle(TCollection_HAsciiString)& theName) const;
DEFINE_STANDARD_RTTIEXT(Express_Schema, Standard_Transient)
protected:
private:
//! Prepares data for further work. Converts all item names
//! from EXPRESS style (aaa_bb) to CASCADE style (AaaBb).
//! Then, makes a dictionary of item names and sets handles
//! to all items referred initially by name
Standard_EXPORT void Prepare();
//! Prepares type for work by setting its handle to item in the
//! schema according to dictionary (for types which refer items
//! by name)
Standard_EXPORT void PrepareType (const Handle(Express_Type)& theType) const;
private:
Handle(TCollection_HAsciiString) myName;
Handle(Express_HSequenceOfItem) myItems;
Express_DataMapOfAsciiStringItem myDict;
};
#endif // _Express_Schema_HeaderFile

View File

@@ -1,650 +0,0 @@
// Created: Tue Nov 2 14:40:06 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <Express_Select.hxx>
#include <Express.hxx>
#include <Express_Alias.hxx>
#include <Express_ComplexType.hxx>
#include <Express_Entity.hxx>
#include <Express_Enum.hxx>
#include <Express_HSequenceOfItem.hxx>
#include <Express_Type.hxx>
#include <Message.hxx>
#include <OSD_Directory.hxx>
#include <OSD_FileSystem.hxx>
#include <OSD_Path.hxx>
#include <OSD_Protection.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Express_Select, Express_Item)
//=======================================================================
// function : Express_Select
// purpose :
//=======================================================================
Express_Select::Express_Select ( const Standard_CString theName,
const Handle(TColStd_HSequenceOfHAsciiString)& theNames)
: Express_Item (theName), myNames (theNames)
{
myItems = new Express_HSequenceOfItem;
}
//=======================================================================
// function : Names
// purpose :
//=======================================================================
const Handle(TColStd_HSequenceOfHAsciiString)& Express_Select::Names() const
{
return myNames;
}
//=======================================================================
// function : Items
// purpose :
//=======================================================================
const Handle(Express_HSequenceOfItem)& Express_Select::Items() const
{
return myItems;
}
//=======================================================================
// function : GenerateClass
// purpose :
//=======================================================================
Standard_Boolean Express_Select::GenerateClass() const
{
const TCollection_AsciiString aCPPName = CPPName();
Handle(TColStd_HSequenceOfInteger) aSeqMember = new TColStd_HSequenceOfInteger;
Handle(TColStd_HSequenceOfInteger) aSeqEntities = new TColStd_HSequenceOfInteger;
for (Standard_Integer i = 1; i <= myItems->Length(); i++)
{
Handle(Express_Item) anItem = myItems->Value (i);
if (anItem->IsKind (STANDARD_TYPE(Express_Entity)) || anItem->IsKind (STANDARD_TYPE(Express_Select))
|| anItem->IsKind (STANDARD_TYPE(Express_Alias)) || anItem->IsKind (STANDARD_TYPE(Express_ComplexType)))
{
aSeqEntities->Append (i);
}
else
{
aSeqMember->Append (i);
}
}
Message::SendInfo() << "Generating SELECT " << aCPPName;
if (!aSeqMember->IsEmpty())
{
Message::SendInfo() << "Generating SELECTMember " << aCPPName << "Member";
generateSelectMember (aSeqMember);
}
// create a package directory (if not yet exist)
OSD_Protection aProt (OSD_RWXD, OSD_RWXD, OSD_RX, OSD_RX);
TCollection_AsciiString aPack = GetPackageName();
OSD_Path aPath (aPack);
OSD_Directory aDir (aPath);
aDir.Build (aProt);
aPack += "/";
aPack += aCPPName;
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
//===============================
// Step 1: generating HXX
{
// Open HXX file
std::shared_ptr<std::ostream> aStreamPtr = aFileSystem->OpenOStream (aPack.Cat (".hxx"), std::ios::out | std::ios::binary);
Standard_OStream& anOS = *aStreamPtr;
// write header
Express::WriteFileStamp (anOS);
// write start define
anOS << "#ifndef _" << aCPPName << "_HeaderFile\n"
"#define _" << aCPPName << "_HeaderFile\n"
"\n";
// write common includes
anOS << "#include <Standard.hxx>\n"
"#include <Standard_DefineAlloc.hxx>\n"
"#include <Standard_Handle.hxx>\n"
"#include <StepData_SelectType.hxx>\n"
"#include <Standard_Integer.hxx>\n"
"\n";
anOS << "class Standard_Transient;\n";
if (!aSeqMember->IsEmpty())
anOS << "class StepData_SelectMember;\n";
Standard_Integer jj = 1;
for (Standard_Integer i = 1; i <= myItems->Length(); i++)
{
Handle(Express_Item) anItem = myItems->Value (i);
anItem->Use();
if (anItem->IsKind (STANDARD_TYPE(Express_Alias)))
{
Handle(Express_Type) aType = Handle(Express_Alias)::DownCast (anItem)->Type();
if (aType->IsStandard())
{
continue;
}
}
anOS << "class " << anItem->CPPName() << ";\n";
jj++;
}
anOS << "\n";
// class declaration
anOS << "//! Representation of STEP SELECT type " << Name() << "\n"
"class " << aCPPName << " : public StepData_SelectType\n"
"{\n"
"\n"
"public:\n"
"\n"
" DEFINE_STANDARD_ALLOC\n"
"\n";
// default constructor
anOS << " //! Empty constructor\n"
" Standard_EXPORT " << aCPPName << "();\n"
"\n";
// write common methods section
anOS << " //! Recognizes a kind of " << Name() << " select type\n";
for (Standard_Integer i = 1; i <= aSeqEntities->Length(); i++)
{
Standard_Integer anIdx = aSeqEntities->Value (i);
anOS << " //! -- " << i << " -> " << myNames->Value (anIdx)->String() << "\n";
}
anOS << " Standard_EXPORT Standard_Integer CaseNum (const Handle(Standard_Transient)& theEnt) const Standard_OVERRIDE;\n"
"\n";
if (!aSeqMember->IsEmpty())
{
anOS << " //! Recognizes items of select member " << Name() << "Member\n";
for (Standard_Integer i = 1; i <= aSeqMember->Length(); i++)
{
Standard_Integer anIdx = aSeqMember->Value (i);
anOS << " //! -- " << i << " -> " << myNames->Value (anIdx)->String() << "\n";
}
anOS << " //! -- 0 else\n"
" Standard_EXPORT virtual Standard_Integer CaseMem (const Handle(StepData_SelectMember)& theEnt) const Standard_OVERRIDE;\n"
"\n"
" //! Returns a new select member the type " << Name() << "Member\n"
" Standard_EXPORT virtual Handle(StepData_SelectMember) NewMember() const Standard_OVERRIDE;\n"
"\n";
}
// write methods get for entities
for (Standard_Integer i = 1; i <= aSeqEntities->Length(); i++)
{
Standard_Integer anIdx = aSeqEntities->Value (i);
Handle(Express_Item) anItem = myItems->Value (anIdx);
const TCollection_AsciiString& aName = anItem->Name();
anOS << " //! Returns Value as " << aName << " (or Null if another type)\n"
" Standard_EXPORT Handle(" << anItem->CPPName() << ") " << aName << "() const;\n"
"\n";
}
// writes method set and get for enum , integer, real and string.
for (Standard_Integer i = 1; i <= aSeqMember->Length(); i++)
{
Standard_Integer anIdx = aSeqMember->Value (i);
Handle(Express_Item) anItem = myItems->Value (anIdx);
const TCollection_AsciiString& aName = anItem->Name();
const TCollection_AsciiString& anItemCPPName = anItem->CPPName();
anOS << " //! Set Value for " << aName << "\n"
" Standard_EXPORT void Set" << aName << " (const " << anItemCPPName << " theVal);\n"
"\n"
" //! Returns Value as " << aName << " (or Null if another type)\n"
" " << anItemCPPName << " " << aName << "() const;\n"
"\n";
}
// write end
anOS << "};\n"
"#endif // _" << aCPPName << "_HeaderFile\n";
aStreamPtr.reset();
}
//===============================
// Step 2: generating CXX
{
// Open CXX file
std::shared_ptr<std::ostream> aStreamPtr = aFileSystem->OpenOStream (aPack.Cat (".cxx"), std::ios::out | std::ios::binary);
Standard_OStream& anOS = *aStreamPtr;
// write header
Express::WriteFileStamp (anOS);
// write include section
anOS << "#include <" << aCPPName << ".hxx>\n";
if (!aSeqMember->IsEmpty())
{
anOS << "#include <" << aCPPName << "Member.hxx>\n"
"#include <TCollection_HAsciiString.hxx>\n";
}
for (Standard_Integer i = 1; i <= aSeqEntities->Length(); i++)
{
Standard_Integer anIdx = aSeqEntities->Value (i);
anOS << "#include <" << myItems->Value (anIdx)->CPPName() << ".hxx>\n";
}
// write constructor
Express::WriteMethodStamp (anOS, aCPPName);
anOS << aCPPName << "::" << aCPPName << "()\n"
"{\n"
"}\n";
// write CaseNum method
Express::WriteMethodStamp (anOS, "CaseNum");
anOS << "Standard_Integer " << aCPPName << "::CaseNum (const Handle(Standard_Transient)& theEnt) const\n"
"{\n";
if (!aSeqEntities->IsEmpty())
{
anOS << " if (theEnt.IsNull()) return 0;\n";
for (Standard_Integer i = 1; i <= aSeqEntities->Length(); i++)
{
Standard_Integer anIdx = aSeqEntities->Value (i);
anOS << " if (theEnt->IsKind (STANDARD_TYPE(" << myItems->Value (anIdx)->CPPName() << "))) return " << i << ";\n";
}
anOS << " return 0;\n"
"}\n";
}
else
{
anOS << " return 0;\n"
"}\n";
}
if (!aSeqMember->IsEmpty())
{
// write CaseMem method
Express::WriteMethodStamp (anOS, "CaseMem");
anOS << "Standard_Integer " << aCPPName << "::CaseMem (const Handle(StepData_SelectMember)& theEnt) const\n"
"{\n"
" if (theEnt.IsNull()) return 0;\n";
for (int j = 1; j <= aSeqMember->Length(); j++)
{
Standard_Integer anIdx = aSeqMember->Value (j);
if (j == 1)
{
anOS << " if (theEnt->Matches (\"" << myNames->Value (anIdx)->String() << "\")) return " << j << ";\n";
}
else
{
anOS << " else if (theEnt->Matches (\"" << myNames->Value (anIdx)->String() << "\")) return " << j << ";\n";
}
}
anOS << " else return 0;\n"
"}\n";
// write NewMember method
Express::WriteMethodStamp (anOS, "NewMember");
anOS << "Handle(StepData_SelectMember) " << aCPPName << "::NewMember() const\n"
"{\n"
" return new " << aCPPName << "Member;\n"
"}\n";
}
// write methods Get for entities.
for (Standard_Integer i = 1; i <= aSeqEntities->Length(); i++)
{
Standard_Integer anIdx = aSeqEntities->Value (i);
Handle(Express_Item) anItem = myItems->Value (anIdx);
const TCollection_AsciiString& aName = anItem->Name();
const TCollection_AsciiString& anItemCPPName = anItem->CPPName();
Express::WriteMethodStamp (anOS, aName);
anOS << "Handle(" << anItemCPPName << ") " << aCPPName << "::" << aName << "() const\n"
"{\n"
" return Handle(" << anItemCPPName << ")::DownCast(Value());\n"
"}\n";
}
// write methods Set and Get for Integer, Real, String and Enum
for (Standard_Integer i = 1; i <= aSeqMember->Length(); i++)
{
Standard_Integer anIdx = aSeqMember->Value (i);
Handle(Express_Item) anItem = myItems->Value (anIdx);
const TCollection_AsciiString& aName = anItem->Name();
const TCollection_AsciiString& anItemCPPName = anItem->CPPName();
TCollection_AsciiString aStamp = "Set";
aStamp += aName;
Express::WriteMethodStamp (anOS, aStamp);
Standard_Boolean isString = (anItemCPPName.Location ("HAsciiString", 1, anItemCPPName.Length()) > 0);
TCollection_AsciiString aNameFunc;
TCollection_AsciiString aFunc;
Standard_Boolean isEnum = anItem->IsKind (STANDARD_TYPE(Express_Enum));
if (!isEnum)
{
if (isString)
{
aFunc += "String";
}
else
{
aNameFunc += anItemCPPName;
aFunc = aNameFunc;
Standard_Integer aSplitInd = aNameFunc.Location ("_", 1, anItemCPPName.Length());
if (aSplitInd)
{
aFunc = aNameFunc.Split (aSplitInd);
}
}
}
// write method set
if (isString)
{
anOS << "void " << aCPPName << "::Set" << aName << " (const Handle(" << anItemCPPName << ") &theVal)\n";
}
else
{
anOS << "void " << aCPPName << "::Set" << aName << " (const " << anItemCPPName << " theVal)\n";
}
anOS << "{\n"
" Handle(" << aCPPName << "Member) SelMem = Handle(" << aCPPName << "Member)::DownCast(Value());\n"
" if (SelMem.IsNull()) return;\n"
" Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString(\"" << aName << "\");\n"
" SelMem->SetName (aName->ToCString());\n";
if (isEnum)
{
anOS << " SelMem->SetEnum ((Standard_Integer)theVal);\n";
}
else if (isString)
{
anOS << " SelMem->Set" << aFunc << " (theVal->ToCString());\n";
}
else
{
anOS << " SelMem->Set" << aFunc << " (theVal);\n";
}
anOS << "}\n";
// write method get
Express::WriteMethodStamp (anOS, aName);
if (isString)
{
anOS << "Handle(" << anItemCPPName << ") " << aCPPName << "::" << aName << "() const\n";
}
else
{
anOS << anItemCPPName << " " << aCPPName << "::" << aName << "() const\n";
}
anOS << "{\n"
" Handle(" << aCPPName << "Member) SelMem = Handle(" << aCPPName << "Member)::DownCast (Value());\n"
" if (SelMem.IsNull()) return 0;\n"
" Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString;\n"
" aName->AssignCat (SelMem->Name());\n"
" Handle(TCollection_HAsciiString) aNameItem = new TCollection_HAsciiString(\"" << aName << "\");\n"
" if (aName->IsDifferent (aNameItem)) return 0;\n";
if (isEnum)
{
anOS << " Standard_Integer aNumIt = SelMem->Enum();\n"
" " << anItemCPPName << " aVal;\n"
" switch (aNumIt)\n"
" {\n";
Handle(Express_Enum) anEnum = Handle(Express_Enum)::DownCast (anItem);
Handle(TColStd_HSequenceOfHAsciiString) anEnItems = anEnum->Names();
TCollection_AsciiString aPrefix = Express::EnumPrefix (aName);
for (Standard_Integer k = 1; k <= anEnItems->Length(); k++)
{
anOS << " case " << k << " : aVal = " << aName << "_" << aPrefix << anEnItems->Value (k)->String() << "; break;\n";
}
anOS << " default : return 0; break;\n"
" }\n";
}
else if (isString)
{
anOS << " Handle(TCollection_HAsciiString) aVal = new TCollection_HAsciiString;\n"
" aVal->AssignCat (SelMem->String());\n";
}
else
{
anOS << " " << anItemCPPName << " aVal = SelMem->" << aFunc << "();\n";
}
anOS << " return aVal;\n"
"}\n";
}
aStreamPtr.reset();
}
return Standard_True;
}
//=======================================================================
// function : PropagateUse
// purpose :
//=======================================================================
void Express_Select::PropagateUse() const
{
const TCollection_AsciiString& aPack = GetPackageName();
const TCollection_AsciiString& aName = Name();
for (Standard_Integer i = 1; i <= myItems->Length(); i++)
{
Handle(Express_Item) anItem = myItems->Value (i);
anItem->Use2 (aName, aPack);
}
}
//=======================================================================
// function : GenerateSelectMember
// purpose :
//=======================================================================
Standard_Boolean Express_Select::generateSelectMember (const Handle(TColStd_HSequenceOfInteger)& theSeqMember) const
{
TCollection_AsciiString aCPPname = CPPName();
aCPPname += "Member";
// create a package directory (if not yet exist)
OSD_Protection aProt (OSD_RWXD, OSD_RWXD, OSD_RX, OSD_RX);
TCollection_AsciiString aPack = GetPackageName();
OSD_Path aPath (aPack);
OSD_Directory aDir (aPath);
aDir.Build (aProt);
aPack += "/";
aPack += aCPPname;
const Handle(OSD_FileSystem)& aFileSystem = OSD_FileSystem::DefaultFileSystem();
// Step 1: generating HXX
{
// Open HXX file
std::shared_ptr<std::ostream> aStreamPtr = aFileSystem->OpenOStream (aPack.Cat (".hxx"), std::ios::out | std::ios::binary);
Standard_OStream& anOS = *aStreamPtr;
// write header
Express::WriteFileStamp (anOS);
// write start define
anOS << "#ifndef _" << aCPPname << "_HeaderFile\n"
"#define _" << aCPPname << "_HeaderFile\n"
"\n";
// includes
anOS << "#include <Standard.hxx>\n"
"#include <Standard_Type.hxx>\n"
"#include <Standard_Boolean.hxx>\n"
"#include <Standard_CString.hxx>\n"
"#include <Standard_Integer.hxx>\n"
"#include <StepData_SelectNamed.hxx>\n"
"\n"
"DEFINE_STANDARD_HANDLE(" << aCPPname << ", StepData_SelectNamed)\n"
"\n";
// write start of declaration (inheritance)
anOS << " //! Representation of member for STEP SELECT type " << Name() << "\n"
"class " << aCPPname << " : public StepData_SelectNamed\n"
"{\n"
"public:\n";
// write methods
anOS << " //! Empty constructor\n"
" Standard_EXPORT " << aCPPname << "();\n"
"\n"
" //! Returns True if has name\n"
" Standard_EXPORT virtual Standard_Boolean HasName() const Standard_OVERRIDE;\n"
"\n"
" //! Returns name\n"
" Standard_EXPORT virtual Standard_CString Name() const Standard_OVERRIDE;\n"
"\n"
" //! Set name\n"
" Standard_EXPORT virtual Standard_Boolean SetName(const Standard_CString name) Standard_OVERRIDE;\n"
"\n"
" //! Tells if the name of a SelectMember matches a given one;\n"
" Standard_EXPORT virtual Standard_Boolean Matches (const Standard_CString name) const Standard_OVERRIDE;\n"
"\n";
// write fields
anOS << "private:\n"
" Standard_Integer myCase;\n"
"\n";
// write end
anOS << "};\n"
"#endif // _" << aCPPname << "_HeaderFile\n";
aStreamPtr.reset();
}
//===============================
// Step 2: generating CXX
{
// Open CXX file
std::shared_ptr<std::ostream> aStreamPtr = aFileSystem->OpenOStream (aPack.Cat (".cxx"), std::ios::out | std::ios::binary);
Standard_OStream& anOS = *aStreamPtr;
// write header
Express::WriteFileStamp (anOS);
// write include section
anOS << "#include <" << aCPPname << ".hxx>\n"
"#include <TCollection_HAsciiString.hxx>\n";
// write constructor
Express::WriteMethodStamp (anOS, aCPPname);
anOS << aCPPname << "::" << aCPPname << "() : myCase(0) \n"
"{\n"
"}\n";
// write method HasName
Express::WriteMethodStamp (anOS, "HasName");
anOS << "Standard_Boolean " << aCPPname << "::HasName() const\n"
"{\n"
" return myCase > 0;\n"
"}\n";
Standard_Boolean hasEnum = Standard_False;
// write method Name
Express::WriteMethodStamp (anOS, "Name");
anOS << "Standard_CString " << aCPPname << "::Name() const\n"
"{\n"
" Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString;\n"
" switch (myCase)"
" {\n";
for (Standard_Integer i = 1; i <= theSeqMember->Length(); i++)
{
Standard_Integer anIdx = theSeqMember->Value (i);
Handle(Express_Item) anItem = myItems->Value (anIdx);
if (anItem->IsKind (STANDARD_TYPE(Express_Enum)))
{
hasEnum = Standard_True;
}
anOS << " case " << i << " : aName->AssignCat (\"" << myNames->Value (anIdx)->String() << "\"); break;\n";
}
anOS << " default : break;\n"
" }\n"
" return aName->String();\n"
"}\n";
// write static method for compare name
Express::WriteMethodStamp (anOS, "CompareNames");
anOS << "static Standard_Integer CompareNames (const Standard_CString theName";
if (hasEnum)
{
anOS << ", Standard_Integer &theNumEn)\n";
}
else
{
anOS << ")\n";
}
anOS << "{\n"
" Standard_Integer aCase = 0;\n"
" if (!theName || theName[0] == \'/0\') aCase = 0;\n";
for (Standard_Integer i = 1; i <= theSeqMember->Length(); i++)
{
Standard_Integer anIdx = theSeqMember->Value (i);
Handle(Express_Item) anItem = myItems->Value (anIdx);
if (anItem->IsKind (STANDARD_TYPE(Express_Enum)))
{
Handle(Express_Enum) en = Handle(Express_Enum)::DownCast (anItem);
for (Standard_Integer k = 1; k <= en->Names()->Length(); k++)
{
anOS << " else if (!strcmp (theName, \"" << en->Names()->Value (k)->String() << "\"))\n"
" {\n"
" aCase = " << i << ";\n"
" theNumEn = " << k << ";\n"
" }\n";
}
}
else
{
anOS << " else if (!strcmp (theName, \"" << myNames->Value (anIdx)->String() << "\")) aCase = " << i << ";\n";
}
}
anOS << " return aCase;\n"
"}\n";
// write method SetName
Express::WriteMethodStamp (anOS, "SetName");
anOS << "Standard_Boolean " << aCPPname << "::SetName (const Standard_CString theName) \n"
"{\n";
if (hasEnum)
{
anOS << " Standard_Integer aNumIt = 0;\n"
" myCase = CompareNames (theName, aNumIt);\n"
" if (aNumIt) SetInteger (aNumIt);\n";
}
else
{
anOS << " myCase = CompareNames (theName);\n";
}
anOS << " return (myCase > 0);\n"
"}\n";
// write method Matches
Express::WriteMethodStamp (anOS, "Matches");
anOS << "Standard_Boolean " << aCPPname << "::Matches (const Standard_CString theName) const\n"
"{\n";
if (hasEnum)
{
anOS << " Standard_Integer aNumIt = 0;\n"
" Standard_Integer aCase = CompareNames (theName, aNumIt);\n";
}
else
{
anOS << " Standard_Integer aCase = CompareNames (theName);\n";
}
anOS << " return (aCase > 0);\n"
"}\n";
aStreamPtr.reset();
}
return Standard_True;
}

View File

@@ -1,63 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_Select_HeaderFile
#define _Express_Select_HeaderFile
#include <Standard_Type.hxx>
#include <Express_Item.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_CString.hxx>
#include <TColStd_HSequenceOfHAsciiString.hxx>
#include <TColStd_HSequenceOfInteger.hxx>
class Express_HSequenceOfItem;
//! Implements TYPE SELECT item of the EXPRESS
//! schema, with interface for deferred Item class.
class Express_Select : public Express_Item
{
public:
//! Create SELECT item and initialize it
Standard_EXPORT Express_Select (const Standard_CString theName,
const Handle(TColStd_HSequenceOfHAsciiString)& theNames);
//! Returns names of types included in this SELECT
Standard_EXPORT const Handle(TColStd_HSequenceOfHAsciiString)& Names() const;
//! Returns sequence of items corresponding to typenames
Standard_EXPORT const Handle(Express_HSequenceOfItem)& Items() const;
//! Create HXX/CXX files from item
Standard_EXPORT virtual Standard_Boolean GenerateClass() const Standard_OVERRIDE;
//! Propagates the calls of Use function
Standard_EXPORT virtual void PropagateUse() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Express_Select, Express_Item)
protected:
private:
Standard_EXPORT Standard_Boolean generateSelectMember (const Handle(TColStd_HSequenceOfInteger)& theSeqMember) const;
Handle(TColStd_HSequenceOfHAsciiString) myNames;
Handle(Express_HSequenceOfItem) myItems;
};
#endif // _Express_Select_HeaderFile

View File

@@ -1,22 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef Express_SequenceOfEntity_HeaderFile
#define Express_SequenceOfEntity_HeaderFile
#include <Express_Entity.hxx>
#include <NCollection_Sequence.hxx>
typedef NCollection_Sequence<Handle(Express_Entity)> Express_SequenceOfEntity;
#endif

View File

@@ -1,22 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef Express_SequenceOfField_HeaderFile
#define Express_SequenceOfField_HeaderFile
#include <Express_Field.hxx>
#include <NCollection_Sequence.hxx>
typedef NCollection_Sequence<Handle(Express_Field)> Express_SequenceOfField;
#endif

View File

@@ -1,22 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef Express_SequenceOfItem_HeaderFile
#define Express_SequenceOfItem_HeaderFile
#include <Express_Item.hxx>
#include <NCollection_Sequence.hxx>
typedef NCollection_Sequence<Handle(Express_Item)> Express_SequenceOfItem;
#endif

View File

@@ -1,21 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_Set_HeaderFile
#define _Express_Set_HeaderFile
#include <Express_ComplexType.hxx>
typedef Express_ComplexType Express_Set;
#endif // _Express_Set_HeaderFile

View File

@@ -1,49 +0,0 @@
// Created: Tue Nov 2 15:27:26 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <Express_String.hxx>
#include <TCollection_AsciiString.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Express_String, Express_PredefinedType)
//=======================================================================
// function : Express_String
// purpose :
//=======================================================================
Express_String::Express_String()
{
}
//=======================================================================
// function : CPPName
// purpose :
//=======================================================================
const TCollection_AsciiString Express_String::CPPName() const
{
return "TCollection_HAsciiString";
}
//=======================================================================
// function : IsStandard
// purpose :
//=======================================================================
Standard_Boolean Express_String::IsStandard() const
{
return Standard_False;
}

View File

@@ -1,45 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_String_HeaderFile
#define _Express_String_HeaderFile
#include <Express_PredefinedType.hxx>
#include <Standard_Type.hxx>
class TCollection_AsciiString;
//! Implements EXPRESS type 'STRING'
class Express_String : public Express_PredefinedType
{
public:
//! Empty constructor
Standard_EXPORT Express_String();
//! Returns "TCollection_HAsciiString"
Standard_EXPORT virtual const TCollection_AsciiString CPPName() const Standard_OVERRIDE;
//! Returns False
Standard_EXPORT virtual Standard_Boolean IsStandard() const Standard_OVERRIDE;
DEFINE_STANDARD_RTTIEXT(Express_String, Express_PredefinedType)
protected:
private:
};
#endif // _Express_String_HeaderFile

View File

@@ -1,76 +0,0 @@
// Created: Tue Nov 2 15:11:36 1999
// Author: Andrey BETENEV
// Copyright (c) 1999-2020 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 <Express_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Express_Type, Standard_Transient)
//=======================================================================
// function : Express_Type
// purpose :
//=======================================================================
Express_Type::Express_Type()
{
}
//=======================================================================
// function : IsStandard
// purpose :
//=======================================================================
Standard_Boolean Express_Type::IsStandard() const
{
return Standard_False;
}
//=======================================================================
// function : IsSimple
// purpose :
//=======================================================================
Standard_Boolean Express_Type::IsSimple() const
{
return IsStandard();
}
//=======================================================================
// function : IsHandle
// purpose :
//=======================================================================
Standard_Boolean Express_Type::IsHandle() const
{
return !IsSimple();
}
//=======================================================================
// function : Use
// purpose :
//=======================================================================
Standard_Boolean Express_Type::Use() const
{
return Standard_False;
}
//=======================================================================
// function : Use2
// purpose :
//=======================================================================
void Express_Type::Use2 (const TCollection_AsciiString&, const TCollection_AsciiString&) const
{
}

View File

@@ -1,63 +0,0 @@
// Copyright (c) 1999-2020 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.
#ifndef _Express_Type_HeaderFile
#define _Express_Type_HeaderFile
#include <Standard_Type.hxx>
class TCollection_AsciiString;
//! Provides basis for identification (reference) to some type
//! in express schema
class Express_Type : public Standard_Transient
{
public:
//! Returns CPP-style name of the type
Standard_EXPORT virtual const TCollection_AsciiString CPPName() const = 0;
//! Return True if type is defined in package Standard (False by default)
Standard_EXPORT virtual Standard_Boolean IsStandard() const;
//! Return True if type is simple (not a class)
//! (by default returns IsStandard())
Standard_EXPORT virtual Standard_Boolean IsSimple() const;
//! Return True if type is Transient
//! (by default returns ! IsSimple())
Standard_EXPORT virtual Standard_Boolean IsHandle() const;
//! Declares type as used by some item being generated.
//! Calls Use() for all referred types and schema items.
//! Default instantiation does nothing
Standard_EXPORT virtual Standard_Boolean Use() const;
//! Declares type as used by some item being generated.
//! Calls Use() for all referred types and schema items.
//! Default instantiation does nothing
Standard_EXPORT virtual void Use2 (const TCollection_AsciiString& theRefName, const TCollection_AsciiString& theRefPack) const;
DEFINE_STANDARD_RTTIEXT(Express_Type, Standard_Transient)
protected:
//! Empty constructor
Standard_EXPORT Express_Type();
private:
};
#endif // _Express_Type_HeaderFile

View File

@@ -1,48 +0,0 @@
Express.cxx
Express.hxx
Express_Alias.cxx
Express_Alias.hxx
Express_Array.hxx
Express_Bag.hxx
Express_Boolean.cxx
Express_Boolean.hxx
Express_ComplexType.cxx
Express_ComplexType.hxx
Express_DataMapOfAsciiStringItem.hxx
Express_Entity.cxx
Express_Entity.hxx
Express_Enum.cxx
Express_Enum.hxx
Express_Field.cxx
Express_Field.hxx
Express_HSequenceOfEntity.hxx
Express_HSequenceOfField.hxx
Express_HSequenceOfItem.hxx
Express_Integer.cxx
Express_Integer.hxx
Express_Item.cxx
Express_Item.hxx
Express_List.hxx
Express_Logical.cxx
Express_Logical.hxx
Express_NamedType.cxx
Express_NamedType.hxx
Express_Number.hxx
Express_PredefinedType.cxx
Express_PredefinedType.hxx
Express_Real.cxx
Express_Real.hxx
Express_Reference.cxx
Express_Reference.hxx
Express_Schema.cxx
Express_Schema.hxx
Express_Select.cxx
Express_Select.hxx
Express_SequenceOfEntity.hxx
Express_SequenceOfField.hxx
Express_SequenceOfItem.hxx
Express_Set.hxx
Express_String.cxx
Express_String.hxx
Express_Type.cxx
Express_Type.hxx

View File

@@ -1,7 +1,5 @@
Geom2dConvert.cxx
Geom2dConvert.hxx
Geom2dConvert_ApproxArcsSegments.cxx
Geom2dConvert_ApproxArcsSegments.hxx
Geom2dConvert_ApproxCurve.cxx
Geom2dConvert_ApproxCurve.hxx
Geom2dConvert_BSplineCurveKnotSplitting.cxx
@@ -10,6 +8,3 @@ Geom2dConvert_BSplineCurveToBezierCurve.cxx
Geom2dConvert_BSplineCurveToBezierCurve.hxx
Geom2dConvert_CompCurveToBSplineCurve.cxx
Geom2dConvert_CompCurveToBSplineCurve.hxx
Geom2dConvert_PPoint.cxx
Geom2dConvert_PPoint.hxx
Geom2dConvert_SequenceOfPPoint.hxx

View File

@@ -1,911 +0,0 @@
// Created: 2009-01-21
//
// Copyright (c) 2009-2013 OPEN CASCADE SAS
//
// This file is part of commercial software by OPEN CASCADE SAS,
// furnished in accordance with the terms and conditions of the contract
// and with the inclusion of this copyright notice.
// This file or any part thereof may not be provided or otherwise
// made available to any third party.
//
// No ownership title to the software is transferred hereby.
//
// OPEN CASCADE SAS makes no representation or warranties with respect to the
// performance of this software, and specifically disclaims any responsibility
// for any damages, special or consequential, connected with its use.
#include <Geom2dConvert_ApproxArcsSegments.hxx>
#include <Adaptor2d_Curve2d.hxx>
#include <ElCLib.hxx>
#include <GCE2d_MakeArcOfCircle.hxx>
#include <GCE2d_MakeSegment.hxx>
#include <GCPnts_QuasiUniformDeflection.hxx>
#include <Geom2d_Circle.hxx>
#include <Geom2d_Line.hxx>
#include <Geom2d_TrimmedCurve.hxx>
#include <NCollection_IncAllocator.hxx>
#include <Precision.hxx>
#include <Standard_Version.hxx>
#include <gp.hxx>
#include <gp_Ax2d.hxx>
#include <gp_Lin2d.hxx>
static const Standard_Integer MAXPOINTS = 100;
static const Standard_Real MyCurvatureTolerance = 0.0001;
static Standard_Boolean checkContinuity (const Handle(Geom2d_Curve)& theCurve1,
const Handle(Geom2d_Curve)& theCurve2,
const Standard_Real theAnglTol);
static Geom2dConvert_PPoint getParameter (const gp_XY& theXY1,
const Standard_Real theFirstPar,
const Standard_Real theLastPar,
const Adaptor2d_Curve2d& theCurve);
static Standard_Boolean isInflectionPoint (const Standard_Real theParam,
const Adaptor2d_Curve2d& theCurve);
static Standard_Boolean isInflectionPoint (const Standard_Real theParam,
const Geom2dConvert_PPoint& theFirstInf,
const Adaptor2d_Curve2d& theCurve,
const Standard_Real theAnglTol);
//=======================================================================
//function : Geom2dConvert_ApproxArcsSegments()
//purpose : Constructor
//=======================================================================
Geom2dConvert_ApproxArcsSegments::Geom2dConvert_ApproxArcsSegments
(const Adaptor2d_Curve2d& theCurve,
const Standard_Real theTolerance,
const Standard_Real theAngleTol)
: myCurve (theCurve),
myAlloc (new NCollection_IncAllocator(4000)),
myTolerance (theTolerance),
myAngleTolerance (theAngleTol),
mySeqParams (myAlloc),
myStatus (StatusNotDone)
{
myExt[0] = Geom2dConvert_PPoint(myCurve.FirstParameter(), myCurve);
myExt[1] = Geom2dConvert_PPoint(myCurve.LastParameter(), myCurve);
switch (myCurve.GetType())
{
case GeomAbs_Line:
{
// Create a single line segment.
const Standard_Real aDist = myExt[0].Dist(myExt[1]);
if (aDist > Precision::Confusion()) {
const gp_Ax2d anAx2d(myExt[0].Point(), gp_Vec2d(myExt[0].Point(),
myExt[1].Point()));
const Handle(Geom2d_Line) aLine = new Geom2d_Line(anAx2d);
mySeqCurves.Append(new Geom2d_TrimmedCurve(aLine, 0., aDist));
myStatus = StatusOK;
}
}
break;
case GeomAbs_Circle:
{
// Create a couple of arcs of equal size.
const Geom2dConvert_PPoint aPP(.5 *(myExt[0].Parameter() +
myExt[1].Parameter()), myCurve);
Handle(Geom2d_Curve) aCurve = makeCircle (myExt[0], aPP);
if (aCurve.IsNull() == Standard_False) {
mySeqCurves.Append(aCurve);
aCurve = makeCircle (aPP, myExt[1]);
if (aCurve.IsNull() == Standard_False)
mySeqCurves.Append(aCurve);
}
}
break;
default:
makeFreeform();
}
// Check status of the calculation
if (myStatus == StatusNotDone) {
if (mySeqCurves.IsEmpty() == Standard_False)
myStatus = StatusOK;
else {
//std::cout << "GeomConv2d_Approx: no geometry converted." << std::endl;
myStatus = StatusError;
}
}
}
//=======================================================================
//function : makeCircle
//purpose : method for creation of circle
//=======================================================================
Handle(Geom2d_Curve) Geom2dConvert_ApproxArcsSegments::makeCircle
(const Geom2dConvert_PPoint& theFirst,
const Geom2dConvert_PPoint& theLast) const
{
Handle(Geom2d_Curve) aResult;
gp_Pnt2d aPointM (0.0,0.0);
const Standard_Real aParaM = (theFirst.Parameter() + theLast.Parameter()) *.5;
myCurve.D0(aParaM, aPointM);
GCE2d_MakeArcOfCircle aMakeArc1(theFirst.Point(), aPointM, theLast.Point());
if (aMakeArc1.IsDone())
aResult = aMakeArc1.Value();
//else
//std::cout << "makeCircle(): Circle not built" << std::endl;
return aResult;
}
//=======================================================================
//function : makeArc
//purpose : creation arcs by two points and derivative in the first point
/// : parameter isFirst specified direction of the arc.
//=======================================================================
Standard_Boolean Geom2dConvert_ApproxArcsSegments::makeArc
(const Geom2dConvert_PPoint& theParam1,
Geom2dConvert_PPoint& theParam2,
const Standard_Boolean isFirst,
Handle(Geom2d_TrimmedCurve)& theCurve) const
{
const gp_XY aP1 (theParam1.Point());
const gp_XY aP2 (theParam2.Point());
const gp_XY aVec (isFirst? theParam1.D1() : -theParam1.D1());
// Detect the sense (CCW means positive)
const gp_XY aDelta = aP2 - aP1;
Standard_Real aSense = aVec ^ aDelta;
if (aSense > Precision::Angular())
aSense = 1.;
else if (aSense < -Precision::Angular())
aSense = -1.;
else {
//std::cout << "makeArc(): Arc Not Built" << std::endl;
return Standard_False;
}
// Find the centre of the circle
const gp_XY aMiddle = (aP2 + aP1) * 0.5;
const Standard_Real prodP1V = aP1 * aVec;
const Standard_Real prodDeM = aDelta * aMiddle;
const Standard_Real vprodVD = aVec ^ aDelta;
const Standard_Real aResolution = gp::Resolution();
if (vprodVD < -aResolution || vprodVD > aResolution) {
const gp_Pnt2d aCenter((prodP1V * aDelta.Y() - prodDeM * aVec.Y())/vprodVD,
(prodDeM * aVec.X() - prodP1V * aDelta.X())/vprodVD);
const Standard_Real aRad =
(aCenter.Distance(aP1) + aCenter.Distance(aP2)) * 0.5;
const gp_Ax22d ax22d (aCenter, gp_Dir2d(1., 0.), gp_Dir2d(0., 1.));
const gp_Circ2d aCir (ax22d, aRad);
const Handle(Geom2d_Circle) Circ = new Geom2d_Circle(aCir);
//calculation parameters first and last points of arc.
Standard_Real anAlpha1, anAlpha2;
if (isFirst) {
anAlpha1 = ElCLib::Parameter(aCir, aP1);
anAlpha2 = ElCLib::Parameter(aCir, aP2);
} else {
anAlpha1 = ElCLib::Parameter(aCir, aP2);
anAlpha2 = ElCLib::Parameter(aCir, aP1);
aSense = -aSense;
}
if (fabs (anAlpha1 - anAlpha2) < 1e-100)
// very small value, just to avoid exact match
return Standard_False;
// Reverse the circle if the sense is negative
if (aSense < 0.) {
anAlpha1 = Circ->ReversedParameter(anAlpha1);
anAlpha2 = Circ->ReversedParameter(anAlpha2);
Circ->Reverse();
}
theCurve = new Geom2d_TrimmedCurve(Circ, anAlpha1, anAlpha2);
// Correct the direction in the opposite point
const gp_XY aRadV = theParam2.Point() - aCenter.XY();
theParam2.SetD1(gp_XY(- aRadV.Y() * aSense, aRadV.X() * aSense));
return Standard_True;
}
// Algorithm failed, possibly because aVec is normal to the chorde
return Standard_False;
}
//=======================================================================
//function : makeLine
//purpose : method for creation of line
//=======================================================================
Handle(Geom2d_TrimmedCurve) Geom2dConvert_ApproxArcsSegments::makeLine
(Geom2dConvert_PPoint& theFirst,
Geom2dConvert_PPoint& theLast,
const Standard_Boolean isCheck) const
{
Handle(Geom2d_TrimmedCurve) aResult;
gp_XY aSlope = theLast.Point() - theFirst.Point();
if (fabs(aSlope.SquareModulus()) < gp::Resolution())
return aResult;
gp_Dir2d aDirLine(aSlope);
if (isCheck) {
if (theFirst.D1().SquareModulus() < gp::Resolution() ||
theLast.D1().SquareModulus() < gp::Resolution())
return aResult;
// Angular continuity (G1) is only checked when the end of the line is not
// on the extremity of the curve
Standard_Real absAngle[2] = { 0., 0. };
if (theFirst != myExt[0]) {
const Standard_Real anAng = aDirLine.Angle(theFirst.D1());
absAngle[0] = (anAng > 0. ? anAng : -anAng);
}
if (theLast != myExt[1]) {
const Standard_Real anAng = aDirLine.Angle(theLast.D1());
absAngle[1] = (anAng > 0. ? anAng : -anAng);
}
// if the derivatives in the end points differ from the derivative line
// more than value of the specified continuity tolerance
// then a biarc should be build instead of a line.
const Standard_Real aContTolerance = ::Max(myAngleTolerance, 0.01);
if (absAngle[0] > aContTolerance || absAngle[1] > aContTolerance) {
//std::cout << "makeLine(): Line not built" << std::endl;
return aResult;
}
} // end if (isCheck)
//bulding segment of line
GCE2d_MakeSegment aMakeSeg (theFirst.Point(), theLast.Point());
if (aMakeSeg.IsDone()) {
Handle(Geom2d_TrimmedCurve) aCurve = aMakeSeg.Value();
if (checkCurve (aCurve, theFirst.Parameter(), theLast.Parameter())) {
aResult = aCurve;
// correct the derivatives fields in both arguments
const gp_XY aNewD1 (theLast.Point() - theFirst.Point());
theFirst.SetD1(aNewD1);
theLast.SetD1(aNewD1);
}
}
//else
//std::cout << "makeLine(): Line not built" << std::endl;
return aResult;
}
//=======================================================================
//function : makeFreeform
//purpose : get a sequence of Geom curves from one curve
//=======================================================================
Standard_Boolean Geom2dConvert_ApproxArcsSegments::makeFreeform()
{
Geom2dConvert_SequenceOfPPoint seqParamPoints(myAlloc);
Geom2dConvert_PPoint* aPrevParam = &myExt[0];
//calculation of the inflection points.
getLinearParts(seqParamPoints);
const Standard_Boolean isNoInfPoints = seqParamPoints.IsEmpty();
TColGeom2d_SequenceOfCurve aSeqLinearParts;
Standard_Boolean isDone (Standard_True);
Standard_Integer i;
for (i = 1; i < seqParamPoints.Length(); i += 2)
{
Handle(Geom2d_Curve) aLineCurve;
Geom2dConvert_PPoint& aParam0 = seqParamPoints.ChangeValue(i);
Geom2dConvert_PPoint& aParam1 = seqParamPoints.ChangeValue(i+1);
if (aParam0 != aParam1)
//linear part of the curve lies between odd and even values of i.
//parameters from parameter's sequence.
aLineCurve = makeLine (aParam0, aParam1, Standard_False);
aSeqLinearParts.Append(aLineCurve);
}
for (i = 1; i < seqParamPoints.Length(); i += 2)
{
//approximation for non-linear part preceding the linear part
if (seqParamPoints(i) != * aPrevParam) {
const Standard_Integer aLastInd = mySeqCurves.Length();
isDone = makeApproximation (* aPrevParam, seqParamPoints(i));
if (isDone && aLastInd && mySeqCurves.Length() > aLastInd)
isDone = checkContinuity(mySeqCurves.Value(aLastInd),
mySeqCurves.Value(aLastInd+1),
myAngleTolerance);
if (!isDone) {
myStatus = StatusError;
break;
}
}
const Handle(Geom2d_Curve)& aCurve = aSeqLinearParts.Value((i+1)/2);
if (aCurve.IsNull() == Standard_False)
mySeqCurves.Append(aCurve);
else {
Geom2dConvert_PPoint& aParam0 = seqParamPoints.ChangeValue(i);
Geom2dConvert_PPoint& aParam1 = seqParamPoints.ChangeValue(i+1);
const Standard_Integer aLastInd = mySeqCurves.Length();
isDone = makeApproximation (aParam0, aParam1);
if (isDone && aLastInd && mySeqCurves.Length() > aLastInd)
isDone = checkContinuity(mySeqCurves.Value(aLastInd),
mySeqCurves.Value(aLastInd+1),
myAngleTolerance);
if (!isDone) {
myStatus = StatusError;
//std::cout << "makeOther: Line not built" << std::endl;
break;
}
}
aPrevParam = &seqParamPoints(i+1);
}
//approximation for non-linear part following the last linear part
if (isDone && (* aPrevParam != myExt[1]))
{
// Case of a closed edge like an ellipse
if (isNoInfPoints &&
(myExt[0].Point() - myExt[1].Point()).Modulus() < myTolerance)
{
Geom2dConvert_PPoint aPPoint(0.5 * (myExt[0].Parameter() +
myExt[1].Parameter()), myCurve);
isDone = makeApproximation (myExt[0], aPPoint);
if (isDone)
isDone = makeApproximation (aPPoint, myExt[1]);
} else {
isDone = makeApproximation (* aPrevParam, myExt[1]);
}
if (!isDone) {
myStatus = StatusError;
//std::cout << "makeOther: Line not built" << std::endl;
}
}
return (mySeqCurves.Length() && myStatus != StatusError);
}
//=======================================================================
//function : getLinearParts
//purpose : method for geting inflection points
//=======================================================================
void Geom2dConvert_ApproxArcsSegments::getLinearParts (Geom2dConvert_SequenceOfPPoint& theSeqPar)
{
Standard_Integer i;
// Fill the sequences with values along the curve
mySeqParams.Clear();
Adaptor2d_Curve2d& myCurveMut = const_cast<Adaptor2d_Curve2d&>(myCurve);
GCPnts_QuasiUniformDeflection aQUDefAlgo (myCurveMut, myTolerance * 0.5);
Standard_Boolean isUniformDone = aQUDefAlgo.IsDone();
gp_XY aLastPnt(myExt[0].Point());
if (isUniformDone) {
for (i = 1; i <= aQUDefAlgo.NbPoints(); i++) {
const Geom2dConvert_PPoint aPP (aQUDefAlgo.Parameter(i), myCurve);
mySeqParams.Append(aPP);
aLastPnt = aPP.Point();
}
} else {
const Standard_Real aParamStep =
(myExt[1].Parameter() - myExt[0].Parameter()) / MAXPOINTS;
for (i = 1; i <= MAXPOINTS; i++) {
const Standard_Real aParam = myExt[0].Parameter() + aParamStep * i;
const Geom2dConvert_PPoint aPP (aParam, myCurve);
mySeqParams.Append(aPP);
aLastPnt = aPP.Point();
}
}
//check if the curve may be linearised
gp_XY aDir = myExt[1].Point() - myExt[0].Point();
const Standard_Real aMod2 = aDir.SquareModulus();
if (aMod2 > Precision::Confusion())
{
Standard_Boolean isLinear = Standard_True;
aDir /= sqrt(aMod2);
for (i = 1; i <= mySeqParams.Length(); i++) {
// Distance from point "i" to the segment between two extremities
const Standard_Real aDist = aDir ^ (mySeqParams(i).Point() -
myExt[0].Point());
if (aDist > myTolerance * 0.5 || aDist < -myTolerance * 0.5) {
isLinear = Standard_False;
break;
}
}
if (isLinear) {
theSeqPar.Append(myExt[0]);
theSeqPar.Append(myExt[1]);
return;
}
}
//check if point for First Parameter is inflection point.
Standard_Integer indStartLinear (0);
Geom2dConvert_PPoint aLastInflParam = myExt[0];
Geom2dConvert_PPoint aFirstInflParam = myExt[0];
// Getting further inflection points with step by parameter.
// The point with index 1 is the same as myExt[0]
for (i = 1; i <= mySeqParams.Length(); i++)
{
const Geom2dConvert_PPoint& aCurParam = mySeqParams(i);
if (indStartLinear) {
Standard_Boolean isStillInflectionFirst =
isInflectionPoint (aFirstInflParam.Parameter(), aCurParam,
myCurve, myAngleTolerance);
if (isInflectionPoint (aCurParam.Parameter(), aFirstInflParam,
myCurve, myAngleTolerance))
{
aLastInflParam = mySeqParams(i);
while (isStillInflectionFirst == Standard_False) {
if (++indStartLinear >= i) {
indStartLinear = 0;
break;
}
aFirstInflParam = mySeqParams(indStartLinear);
isStillInflectionFirst =
isInflectionPoint (aFirstInflParam.Parameter(), aCurParam,
myCurve, myAngleTolerance);
}
} else {
// Add the interval in the output sequence
// The interval is added only if it is more than 10 times the tolerance
aLastInflParam = findInflection (aLastInflParam, aCurParam);
if (!isInflectionPoint (aFirstInflParam.Parameter(), aLastInflParam,
myCurve, myAngleTolerance))
{
aFirstInflParam = findInflection (aLastInflParam, aFirstInflParam);
}
const Standard_Real aDist((aFirstInflParam.Point() -
aLastInflParam.Point()).Modulus());
if (aFirstInflParam.Parameter() < aLastInflParam.Parameter() &&
aDist > 10 * myTolerance)
{
theSeqPar.Append(aFirstInflParam);
theSeqPar.Append(aLastInflParam);
}
indStartLinear = 0;
}
} else
if (isInflectionPoint (aCurParam.Parameter(), myCurve)) {
aLastInflParam = aCurParam;
if (i > 1)
aFirstInflParam = findInflection (aCurParam, mySeqParams(i-1));
indStartLinear = i;
}
}
const Standard_Real aDist((aFirstInflParam.Point() -
myExt[1].Point()).Modulus());
if (indStartLinear && aDist > 10 * myTolerance)
{
theSeqPar.Append(aFirstInflParam);
theSeqPar.Append(myExt[1]);
}
}
//=======================================================================
//function : findInflection
//purpose : Dichotomic search of the boundary of inflection interval, between
// two parameters on the Curve
//=======================================================================
Geom2dConvert_PPoint Geom2dConvert_ApproxArcsSegments::findInflection
(const Geom2dConvert_PPoint& theParamIsInfl,
const Geom2dConvert_PPoint& theParamNoInfl) const
{
Standard_Real aLower (theParamIsInfl.Parameter());
Standard_Real anUpper (theParamNoInfl.Parameter());
Standard_Real aTest(0.);
for (Standard_Integer i = 0; i < 3; i++) { // 3 iterations
aTest = (aLower + anUpper) * 0.5;
if (isInflectionPoint (aTest, theParamIsInfl, myCurve, myAngleTolerance))
aLower = aTest;
else
anUpper = aTest;
}
return Geom2dConvert_PPoint(aTest, myCurve);
}
//=======================================================================
//function : makeApproximation
//purpose : make approximation non-linear part of the other curve
//=======================================================================
Standard_Boolean Geom2dConvert_ApproxArcsSegments::makeApproximation
(Geom2dConvert_PPoint& theFirstParam,
Geom2dConvert_PPoint& theLastParam)
{
// if difference between parameters is less than Precision::PConfusion
//approximation was not made.
Standard_Boolean isDone = Standard_False;
if (theLastParam != theFirstParam) {
const Standard_Real aDistance =
(theFirstParam.Point() - theLastParam.Point()).Modulus();
if (aDistance < myTolerance)
{
const Handle(Geom2d_Curve) aCurve = makeLine(theFirstParam, theLastParam,
Standard_True);
isDone = !aCurve.IsNull();
if (isDone && mySeqCurves.Length())
isDone = checkContinuity(mySeqCurves.Last(), aCurve, myAngleTolerance);
if (isDone || aDistance < Precision::Confusion()) {
mySeqCurves.Append(aCurve);
return isDone;
}
}
//calculate biarc
isDone = calculateBiArcs (theFirstParam, theLastParam);
// if biarc was not calculated calculation is repeated on half the interval.
if (!isDone)
{
Geom2dConvert_PPoint aParaM
(theFirstParam.Parameter() +
(theLastParam.Parameter() - theFirstParam.Parameter()) * 0.55,
myCurve);
isDone = makeApproximation (theFirstParam, aParaM);
if (isDone)
isDone = makeApproximation (aParaM, theLastParam);
}
}
return isDone;
}
//=======================================================================
//function : calculateBiArcs
//purpose : method for calculation of the biarcs.
//=======================================================================
Standard_Boolean Geom2dConvert_ApproxArcsSegments::calculateBiArcs
(Geom2dConvert_PPoint& theFirstParam,
Geom2dConvert_PPoint& theLastParam)
{
const Standard_Real aResolution = gp::Resolution();
if (theFirstParam.D1().SquareModulus() < aResolution ||
theLastParam.D1().SquareModulus() < aResolution)
{
//std::cout << "calculateBiArcs(): bad initial data" << std::endl;
return Standard_False;
}
const gp_XY aPnt[2] = {
theFirstParam.Point(),
theLastParam.Point()
};
gp_Dir2d aDir[2] = {
theFirstParam.D1(),
theLastParam.D1()
};
// Try to approximate the curve by a single arc. The criterion for that is
// more rigid if the curve is the entire input curve
// (possible pb. connecting with other boundaries)
const gp_Vec2d aDelta (aPnt[1] - aPnt[0]);
Standard_Real anAngle1 = aDelta.Angle(gp_Vec2d(aDir[0]));
if (anAngle1 < 0.)
anAngle1 = -anAngle1;
Standard_Real anAngle2 = aDelta.Angle(gp_Vec2d(aDir[1]));
if (anAngle2 < 0.)
anAngle2 = -anAngle2;
//in the case when two angles are equal one arc can be built.
Standard_Real anAngleThreshold (Precision::Angular() * 10.);
if (theFirstParam != myExt[0] || theLastParam != myExt[1])
anAngleThreshold = myAngleTolerance * 0.1;
if (fabs(anAngle1 - anAngle2) < anAngleThreshold)
{
Handle(Geom2d_TrimmedCurve) aCurve;
// protect the theLastParam from modification of D1, when
// the created arc is rejected.
Geom2dConvert_PPoint aLastParam (theLastParam);
if (!makeArc (theFirstParam, aLastParam, Standard_True, aCurve))
return Standard_False;
if (checkCurve(aCurve, theFirstParam.Parameter(), aLastParam.Parameter()))
{
theLastParam = aLastParam;
mySeqCurves.Append(aCurve);
return Standard_True;
}
}
// if one arc was not built or for other cases biarc will be built
// method for building biarc was taken from article Ahmad H. Nasri et al.
// "A Recursive Subdivision Algorithm for Piecewise Circular Spline",
// Computer Graphics Forum, 2001.
// definition of point of intersection two tangent directions in the points
// corresponding FirstParameter and LastParameter.
aDir[1].Reverse();
// Direct calculation of intersection point, replaces a class call below
const Standard_Real aProd [3] = {
aPnt[0] ^ aDir[0].XY(),
aPnt[1] ^ aDir[1].XY(),
aDir[1] ^ aDir[0].XY()
};
gp_XY aIntPoint((aProd[0] * aDir[1].X() - aProd[1] * aDir[0].X()) / aProd[2],
(aProd[0] * aDir[1].Y() - aProd[1] * aDir[0].Y()) / aProd[2]);
const gp_XY aDiff[2] = {
aIntPoint - aPnt[0],
aIntPoint - aPnt[1]
};
if (aDiff[0] * aDir[0].XY() < 0. || aDiff[1] * aDir[1].XY() < 0.)
{
return Standard_False;
}
//calculation middle point for building biarc.
const Standard_Real ad1 = aDiff[0].Modulus();
const Standard_Real ad2 = aDiff[1].Modulus();
const Standard_Real ad12 = aDelta.Magnitude();
const Standard_Real aB1 = ad1 / (ad1 + ad2);
if (fabs(aB1 - 0.5) < 0.0001)
return Standard_False;
gp_XY aXY[2] = {
aPnt[0] + aDir[0].XY() * ad12 * ad1 / (ad12 + ad1 + ad2),
aPnt[1] + aDir[1].XY() * ad12 * ad2 / (ad12 + ad1 + ad2)
};
const gp_XY aXYmidArc (aXY[0] + aB1*(aXY[1] - aXY[0]));
Geom2dConvert_PPoint aParamMidArc =
getParameter (aXYmidArc, theFirstParam.Parameter(),
theLastParam.Parameter(), myCurve);
//building first arc from biarc.
Handle(Geom2d_TrimmedCurve) aCurve1, aCurve2;
if (!makeArc (theFirstParam, aParamMidArc, Standard_True, aCurve1))
return Standard_False;
if (!checkCurve (aCurve1, theFirstParam.Parameter(),
aParamMidArc.Parameter()))
return Standard_False;
//building second arc from biarc.
if (makeArc (theLastParam, aParamMidArc, Standard_False, aCurve2)) {
if (checkCurve (aCurve2, aParamMidArc.Parameter(),
theLastParam.Parameter())) {
mySeqCurves.Append(aCurve1);
mySeqCurves.Append(aCurve2);
return Standard_True;
}
}
return Standard_False;
}
//=======================================================================
//function : calculateLines
//purpose : method for calculation of the linear interpolation.
//=======================================================================
Standard_Boolean Geom2dConvert_ApproxArcsSegments::calculateLines
(Geom2dConvert_PPoint& theFirstParam,
Geom2dConvert_PPoint& theLastParam)
{
Geom2dConvert_PPoint* aPrevParam = &theFirstParam;
for (int i = 1; i <= mySeqParams.Length(); i++)
{
Geom2dConvert_PPoint& aCurParam = mySeqParams.ChangeValue(i);
if (aCurParam.Parameter() < (*aPrevParam).Parameter()) {
continue;
}
if (aCurParam.Parameter() > theLastParam.Parameter()) {
break;
}
// build line segment
if (aCurParam != *aPrevParam)
{
const Standard_Real aDistance =
(aCurParam.Point() - (*aPrevParam).Point()).Modulus();
if (aDistance > myTolerance)
{
const Handle(Geom2d_Curve) aCurve =
makeLine(*aPrevParam, aCurParam, Standard_False);
if (aCurve.IsNull()) {
return Standard_False;
}
mySeqCurves.Append(aCurve);
aPrevParam = &mySeqParams(i);
}
}
}
return Standard_True;
}
//=======================================================================
//function : checkCurve
//purpose : method for checking max deflection Geom curve from Adaptor Curve
//=======================================================================
Standard_Boolean Geom2dConvert_ApproxArcsSegments::checkCurve
(const Handle(Geom2d_Curve)& aCurve,
const Standard_Real theFirstParam,
const Standard_Real theLastParam) const
{
if (aCurve.IsNull())
return Standard_False; // check fails on empty input
Standard_Boolean isUniformDone = !mySeqParams.IsEmpty();
//calcualtion sequence of the parameters or step by parameter.
Standard_Integer aNbPnts = (isUniformDone ? mySeqParams.Length() :MAXPOINTS);
Standard_Real aParamStep = (theLastParam - theFirstParam)/MAXPOINTS;
Handle(Geom2d_Curve) aCurve1 = aCurve;
Handle(Geom2d_TrimmedCurve) aTrCurve =
Handle(Geom2d_TrimmedCurve)::DownCast(aCurve);
if (!aTrCurve.IsNull())
aCurve1 = aTrCurve->BasisCurve();
gp_Lin2d aLin2d;
gp_Circ2d aCirc2d;
Handle(Geom2d_Line) aGeomLine = Handle(Geom2d_Line)::DownCast(aCurve1);
Standard_Boolean isLine = (!aGeomLine.IsNull());
Standard_Boolean isCircle = (!isLine);
if (isLine)
aLin2d = aGeomLine->Lin2d();
else {
Handle(Geom2d_Circle) aGeomCircle =
Handle(Geom2d_Circle)::DownCast(aCurve1);
isCircle = (!aGeomCircle.IsNull());
if (isCircle)
aCirc2d = aGeomCircle->Circ2d();
else
return Standard_False;
}
//calculation of the max deflection points from CurveAdaptor from Geom curve.
Standard_Boolean isLess = Standard_True;
Standard_Integer i = 1;
for (; i <= aNbPnts && isLess; i++)
{
Standard_Real aParam = (isUniformDone ? mySeqParams.Value(i).Parameter() :
(theFirstParam + i*aParamStep));
if (aParam < (theFirstParam - Precision::PConfusion()) ||
aParam > (theLastParam + Precision::PConfusion())) continue;
//getting point from adaptor curve by specified parameter.
gp_Pnt2d aPointAdaptor(0., 0.);
gp_Pnt2d aProjPoint(0., 0.);
myCurve.D0(aParam, aPointAdaptor);
Standard_Real aParameterCurve = 0.0;
//getting point from geom curve by specified parameter.
if (isLine)
{
aParameterCurve = ElCLib::Parameter(aLin2d, aPointAdaptor);
aProjPoint = ElCLib::Value(aParameterCurve, aLin2d);
}
else if (isCircle)
{
aParameterCurve = ElCLib::Parameter(aCirc2d, aPointAdaptor);
aProjPoint = ElCLib::Value(aParameterCurve, aCirc2d);
}
else isLess = Standard_False;
isLess = (aProjPoint.Distance(aPointAdaptor) <
myTolerance + Precision::PConfusion());
}
return isLess;
}
//=======================================================================
//function : checkContinuity
//purpose : check continuty first derivative between two curves.
//=======================================================================
Standard_Boolean checkContinuity (const Handle(Geom2d_Curve)& theCurve1,
const Handle(Geom2d_Curve)& theCurve2,
const Standard_Real theAngleTol)
{
gp_Vec2d v11,v21;
gp_Pnt2d p1, p2;
theCurve1->D1(theCurve1->LastParameter(), p1, v11);
theCurve2->D1(theCurve2->FirstParameter(), p2, v21);
//check continuity with the specified tolerance.
return (v11.IsParallel(v21, theAngleTol));
}
//=======================================================================
//function : getParameter
//purpose : getting the nearest point on AdaptorCurve to the specified point.
//=======================================================================
Geom2dConvert_PPoint getParameter (const gp_XY& theXY1,
const Standard_Real theFirstParam,
const Standard_Real theLastParam,
const Adaptor2d_Curve2d& theCurve)
{
Geom2dConvert_PPoint aResult;
Standard_Real prevParam = theFirstParam;
Standard_Real af1 = theFirstParam;
Standard_Real af2 = theLastParam;
// for finding nearest point use method half division.
Standard_Real aMinDist = RealLast();
Standard_Integer i = 1;
for (; i <= MAXPOINTS; i++)
{
aResult = Geom2dConvert_PPoint(af1, theCurve);
Standard_Real adist1 = (theXY1 - aResult.Point()).Modulus();
if (adist1 < Precision::Confusion())
{
return aResult;
}
aResult = Geom2dConvert_PPoint(af2, theCurve);
Standard_Real adist2 = (theXY1 - aResult.Point()).Modulus();
if (adist2 < Precision::Confusion())
{
return aResult;
}
if (aMinDist <= adist2 -Precision::Confusion() &&
aMinDist <= adist1 -Precision::Confusion())
{
break;
}
if (adist1 < adist2 -Precision::Confusion())
{
prevParam = af1;
aMinDist = adist1;
af2 = (af1 + af2) * 0.5;
}
else
{
prevParam = af2;
aMinDist = adist2;
af1 = (af1 + af2) * 0.5;
}
}
aResult = Geom2dConvert_PPoint(prevParam, theCurve);
return aResult;
}
//=======================================================================
//function : isInflectionPoint
//purpose : method calculating that point specified by parameter
// is inflection point
//=======================================================================
Standard_Boolean isInflectionPoint (const Standard_Real theParam,
const Adaptor2d_Curve2d& theCurve)
{
gp_Pnt2d aP1;
gp_Vec2d aD1, aD2;
theCurve.D2(theParam, aP1, aD1, aD2);
const Standard_Real aSqMod = aD1.XY().SquareModulus();
const Standard_Real aCurvature =
fabs (aD1.XY() ^ aD2.XY()) / (aSqMod * sqrt(aSqMod));
return (aCurvature < MyCurvatureTolerance);
}
//=======================================================================
//function : isInflectionPoint
//purpose : method calculating that point specified by parameter
// is inflection point
//=======================================================================
Standard_Boolean isInflectionPoint (const Standard_Real theParam,
const Geom2dConvert_PPoint& theFirstInfl,
const Adaptor2d_Curve2d& theCurve,
const Standard_Real theAngleTol)
{
gp_Pnt2d aP1;
gp_Vec2d aD1, aD2;
theCurve.D2(theParam, aP1, aD1, aD2);
const Standard_Real aSqMod = aD1.XY().SquareModulus();
const Standard_Real aCurvature =
fabs (aD1.XY() ^ aD2.XY()) / (aSqMod * sqrt(aSqMod));
Standard_Real aContAngle =
fabs(gp_Vec2d(aP1.XY() - theFirstInfl.Point()).Angle(aD1));
aContAngle = ::Min(aContAngle, fabs(M_PI - aContAngle));
return (aCurvature < MyCurvatureTolerance && aContAngle < theAngleTol);
}

View File

@@ -1,113 +0,0 @@
// Created: 2009-01-20
//
// Copyright (c) 2009-2013 OPEN CASCADE SAS
//
// This file is part of commercial software by OPEN CASCADE SAS,
// furnished in accordance with the terms and conditions of the contract
// and with the inclusion of this copyright notice.
// This file or any part thereof may not be provided or otherwise
// made available to any third party.
//
// No ownership title to the software is transferred hereby.
//
// OPEN CASCADE SAS makes no representation or warranties with respect to the
// performance of this software, and specifically disclaims any responsibility
// for any damages, special or consequential, connected with its use.
#ifndef _Geom2dConvert_ApproxArcsSegments_HeaderFile
#define _Geom2dConvert_ApproxArcsSegments_HeaderFile
#include <TColGeom2d_SequenceOfCurve.hxx>
#include <Geom2dConvert_PPoint.hxx>
#include <Geom2dConvert_SequenceOfPPoint.hxx>
#include <Geom2d_TrimmedCurve.hxx>
//! Approximation of a free-form curve by a sequence of arcs+segments.
class Geom2dConvert_ApproxArcsSegments
{
public:
// ---------- PUBLIC METHODS ----------
enum Status {
StatusOK = 0,
StatusNotDone,
StatusError
};
//! Constructor.
Standard_EXPORT Geom2dConvert_ApproxArcsSegments (const Adaptor2d_Curve2d& theCurve,
const Standard_Real theTolerance,
const Standard_Real theAngleTol);
//! Get the result curve after approximation.
const TColGeom2d_SequenceOfCurve& GetResult() const
{ return mySeqCurves; }
private:
//! Create arc of circle by three points (knowing that myCurve is circle).
Handle(Geom2d_Curve)
makeCircle (const Geom2dConvert_PPoint& theFirst,
const Geom2dConvert_PPoint& theLast) const;
//! Create an arc of circle using 2 points and a derivative in the first point.
Standard_Boolean makeArc (const Geom2dConvert_PPoint& theParam1,
Geom2dConvert_PPoint& theParam2,
const Standard_Boolean isFirst,
Handle(Geom2d_TrimmedCurve)& theCurve) const;
//! Make a line from myCurve in the limits by parameter from theFirst to theLast
Handle(Geom2d_TrimmedCurve)
makeLine (Geom2dConvert_PPoint& theFirst,
Geom2dConvert_PPoint& theLast,
const Standard_Boolean isCheck) const;
//! Create a sequence of elementary curves from a free-form adaptor curve.
Standard_Boolean makeFreeform ();
//! Obtain the linear intervals on the curve using as criteria
//! curvature tolerance (indicating either linear part or inflection)
void getLinearParts (Geom2dConvert_SequenceOfPPoint& theSeqParam);
//! Dichotomic search of the boundary of inflection interval, between
//! two parameters on the Curve
Geom2dConvert_PPoint findInflection(const Geom2dConvert_PPoint& theParamIsIn,
const Geom2dConvert_PPoint& theParamNoIn) const;
//! Make approximation non-linear part of the other curve.
Standard_Boolean makeApproximation
(Geom2dConvert_PPoint& theFirstParam,
Geom2dConvert_PPoint& theLastParam);
//! Method for calculation of a biarc.
Standard_Boolean calculateBiArcs(Geom2dConvert_PPoint& theFirstParam,
Geom2dConvert_PPoint& theLastParam);
//! Method for calculation of a linear interpolation.
Standard_Boolean calculateLines(Geom2dConvert_PPoint& theFirstParam,
Geom2dConvert_PPoint& theLastParam);
//! Checking max deflection Geom curve from Adaptor Curve
Standard_Boolean checkCurve (const Handle(Geom2d_Curve)& aCurve,
const Standard_Real theFirstParam,
const Standard_Real theLastParam) const;
private:
// ---------- PRIVATE FIELDS ----------
const Adaptor2d_Curve2d& myCurve;
Geom2dConvert_PPoint myExt[2];
Handle(NCollection_BaseAllocator) myAlloc;
Standard_Real myTolerance;
Standard_Real myAngleTolerance;
Geom2dConvert_SequenceOfPPoint mySeqParams;
TColGeom2d_SequenceOfCurve mySeqCurves;
Status myStatus;
//! Protection against compiler warning
void operator= (const Geom2dConvert_ApproxArcsSegments&);
};
#endif

View File

@@ -1,54 +0,0 @@
// Created: 2009-02-02
//
// Copyright (c) 2009-2013 OPEN CASCADE SAS
//
// This file is part of commercial software by OPEN CASCADE SAS,
// furnished in accordance with the terms and conditions of the contract
// and with the inclusion of this copyright notice.
// This file or any part thereof may not be provided or otherwise
// made available to any third party.
//
// No ownership title to the software is transferred hereby.
//
// OPEN CASCADE SAS makes no representation or warranties with respect to the
// performance of this software, and specifically disclaims any responsibility
// for any damages, special or consequential, connected with its use.
#include <Geom2dConvert_PPoint.hxx>
#include <Adaptor2d_Curve2d.hxx>
#include <Precision.hxx>
//=======================================================================
//function : Geom2dConvert_PPoint
//purpose : Constructor
//=======================================================================
Geom2dConvert_PPoint::Geom2dConvert_PPoint (const Standard_Real theParameter,
const Adaptor2d_Curve2d& theAdaptor)
: myParameter (theParameter)
{
theAdaptor.D1(theParameter, myPoint, myD1);
}
//=======================================================================
//function : Geom2dConvert_PPoint::operator ==
//purpose : Compare two values of this type.
//=======================================================================
Standard_Boolean Geom2dConvert_PPoint::operator ==
(const Geom2dConvert_PPoint& theOther) const
{
return (fabs(myParameter - theOther.Parameter()) <= Precision::PConfusion());
}
//=======================================================================
//function : Geom2dConvert_PPoint::operator !=
//purpose : Compare two values of this type.
//=======================================================================
Standard_Boolean Geom2dConvert_PPoint::operator !=
(const Geom2dConvert_PPoint& theOther) const
{
return (fabs(myParameter - theOther.Parameter()) > Precision::PConfusion());
}

View File

@@ -1,76 +0,0 @@
// Created: 2009-01-21
//
// Copyright (c) 2009-2013 OPEN CASCADE SAS
//
// This file is part of commercial software by OPEN CASCADE SAS,
// furnished in accordance with the terms and conditions of the contract
// and with the inclusion of this copyright notice.
// This file or any part thereof may not be provided or otherwise
// made available to any third party.
//
// No ownership title to the software is transferred hereby.
//
// OPEN CASCADE SAS makes no representation or warranties with respect to the
// performance of this software, and specifically disclaims any responsibility
// for any damages, special or consequential, connected with its use.
#ifndef _Geom2dConvert_PPoint_HeaderFile
#define _Geom2dConvert_PPoint_HeaderFile
#include <gp_Pnt2d.hxx>
#include <gp_Vec2d.hxx>
class Adaptor2d_Curve2d;
//! Class representing a point on curve, with 2D coordinate and the tangent
class Geom2dConvert_PPoint
{
public:
//! Empty constructor.
Standard_EXPORT inline Geom2dConvert_PPoint ()
: myParameter (::RealLast()),
myPoint (0., 0.),
myD1 (0., 0.) {}
//! Constructor.
Standard_EXPORT inline Geom2dConvert_PPoint (const Standard_Real theParameter,
const gp_XY& thePoint,
const gp_XY& theD1)
: myParameter (theParameter),
myPoint (thePoint),
myD1 (theD1) {}
//! Constructor.
Standard_EXPORT Geom2dConvert_PPoint (const Standard_Real theParameter,
const Adaptor2d_Curve2d& theAdaptor);
//! Compute the distance betwwen two 2d points.
inline Standard_Real Dist (const Geom2dConvert_PPoint& theOth) const
{ return myPoint.Distance(theOth.myPoint); }
//! Query the parmeter value.
inline Standard_Real Parameter () const { return myParameter; }
//! Query the point location.
inline const gp_XY& Point () const { return myPoint.XY(); }
//! Query the first derivatives.
inline const gp_XY& D1 () const { return myD1.XY(); }
//! Change the value of the derivative at the point.
inline void SetD1 (const gp_XY& theD1)
{ myD1.SetXY (theD1); }
//! Compare two values of this type.
Standard_EXPORT Standard_Boolean operator == (const Geom2dConvert_PPoint&) const;
//! Compare two values of this type.
Standard_EXPORT Standard_Boolean operator != (const Geom2dConvert_PPoint&) const;
private:
Standard_Real myParameter; //! Parameter value
gp_Pnt2d myPoint; //! Point location
gp_Vec2d myD1; //! derivatives by parameter (components of the tangent).
};
#endif

View File

@@ -1,25 +0,0 @@
// Created: 2009-01-09
//
// Copyright (c) 2009-2013 OPEN CASCADE SAS
//
// This file is part of commercial software by OPEN CASCADE SAS,
// furnished in accordance with the terms and conditions of the contract
// and with the inclusion of this copyright notice.
// This file or any part thereof may not be provided or otherwise
// made available to any third party.
//
// No ownership title to the software is transferred hereby.
//
// OPEN CASCADE SAS makes no representation or warranties with respect to the
// performance of this software, and specifically disclaims any responsibility
// for any damages, special or consequential, connected with its use.
#ifndef _Geom2dConvert_SequenceOfPPoint_HeaderFile
#define _Geom2dConvert_SequenceOfPPoint_HeaderFile
#include <NCollection_Sequence.hxx>
class Geom2dConvert_PPoint;
typedef NCollection_Sequence<Geom2dConvert_PPoint> Geom2dConvert_SequenceOfPPoint;
#endif

Some files were not shown because too many files have changed in this diff Show More