└── libsofa
├── build
├── CMakeLists.txt
├── linux
│ ├── makefile
│ ├── makefile_json2sofa
│ ├── makefile_sofa2json
│ └── makefile_sofainfo
├── macos
│ ├── libsofa.common.xcconfig
│ ├── libsofa.debug.xcconfig
│ ├── libsofa.plist
│ ├── libsofa.release.xcconfig
│ ├── libsofa.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── tcarpent.mode1v3
│ │ ├── tcarpent.pbxuser
│ │ └── xcuserdata
│ │ │ └── tcarpent.xcuserdatad
│ │ │ ├── xcdebugger
│ │ │ └── Breakpoints.xcbkptlist
│ │ │ └── xcschemes
│ │ │ └── xcschememanagement.plist
│ ├── shelltools.debug.xcconfig
│ └── shelltools.release.xcconfig
└── win
│ ├── libsofa.sln
│ ├── libsofa.vcxproj
│ └── sofainfo.vcxproj
├── dependencies
├── bin
│ ├── linux
│ │ └── ncdump
│ └── macos
│ │ └── ncdump
├── include
│ ├── ncAtt.cpp
│ ├── ncAtt.h
│ ├── ncByte.cpp
│ ├── ncByte.h
│ ├── ncChar.cpp
│ ├── ncChar.h
│ ├── ncCheck.cpp
│ ├── ncCheck.h
│ ├── ncCompoundType.cpp
│ ├── ncCompoundType.h
│ ├── ncDim.cpp
│ ├── ncDim.h
│ ├── ncDouble.cpp
│ ├── ncDouble.h
│ ├── ncEnumType.cpp
│ ├── ncEnumType.h
│ ├── ncException.cpp
│ ├── ncException.h
│ ├── ncFile.cpp
│ ├── ncFile.h
│ ├── ncFloat.cpp
│ ├── ncFloat.h
│ ├── ncGroup.cpp
│ ├── ncGroup.h
│ ├── ncGroupAtt.cpp
│ ├── ncGroupAtt.h
│ ├── ncInt.cpp
│ ├── ncInt.h
│ ├── ncInt64.cpp
│ ├── ncInt64.h
│ ├── ncOpaqueType.cpp
│ ├── ncOpaqueType.h
│ ├── ncShort.cpp
│ ├── ncShort.h
│ ├── ncString.cpp
│ ├── ncString.h
│ ├── ncType.cpp
│ ├── ncType.h
│ ├── ncUbyte.cpp
│ ├── ncUbyte.h
│ ├── ncUint.cpp
│ ├── ncUint.h
│ ├── ncUint64.cpp
│ ├── ncUint64.h
│ ├── ncUshort.cpp
│ ├── ncUshort.h
│ ├── ncVar.cpp
│ ├── ncVar.h
│ ├── ncVarAtt.cpp
│ ├── ncVarAtt.h
│ ├── ncVlenType.cpp
│ ├── ncVlenType.h
│ ├── netcdf.h
│ ├── netcdf_mem.h
│ └── netcdf_meta.h
├── lib
│ ├── linux
│ │ ├── libcurl.a
│ │ ├── libhdf5.a
│ │ ├── libhdf5_hl.a
│ │ ├── libnetcdf.a
│ │ ├── libnetcdf_c++4.a
│ │ └── libz.a
│ ├── macos
│ │ ├── libcurl.a
│ │ ├── libhdf5.a
│ │ ├── libhdf5_hl.a
│ │ ├── libnetcdf.a
│ │ ├── libnetcdf_c++4.a
│ │ └── libz.a
│ └── win
│ │ ├── i386
│ │ ├── hdf5.dll
│ │ ├── hdf5_hl.dll
│ │ ├── libcurl.dll
│ │ ├── libnetcdf.settings
│ │ ├── netcdf.dll
│ │ └── zlib1.dll
│ │ ├── libcurl_imp.lib
│ │ ├── libcurl_imp_x64.lib
│ │ ├── libhdf5.lib
│ │ ├── libhdf5_hl.lib
│ │ ├── libhdf5_hl_x64.lib
│ │ ├── libhdf5_x64.lib
│ │ ├── netcdf.lib
│ │ ├── netcdf_x64.lib
│ │ ├── x64
│ │ ├── hdf5.dll
│ │ ├── hdf5_hl.dll
│ │ ├── libcurl.dll
│ │ ├── libnetcdf.settings
│ │ ├── netcdf.dll
│ │ └── zlib1.dll
│ │ ├── zlib.lib
│ │ └── zlib_x64.lib
├── sofa_build_dependencies_linux.sh
├── sofa_build_dependencies_linux_2016.sh
├── sofa_build_dependencies_osx.sh
└── sofa_build_dependencies_osx_2017.sh
├── doc
├── LICENCE.txt
├── README.md
├── README.txt
├── doxygen
│ └── sofa_api.doxyfile
└── libsofa.changelog.txt
├── lib
├── libsofa.a
├── sofaexamples
├── sofainfo
└── sofamisc
└── src
├── SOFA.h
├── SOFAAPI.cpp
├── SOFAAPI.h
├── SOFAAttributes.cpp
├── SOFAAttributes.h
├── SOFACoordinates.cpp
├── SOFACoordinates.h
├── SOFADate.cpp
├── SOFADate.h
├── SOFAEmitter.cpp
├── SOFAEmitter.h
├── SOFAExceptions.cpp
├── SOFAExceptions.h
├── SOFAFile.cpp
├── SOFAFile.h
├── SOFAGeneralFIR.cpp
├── SOFAGeneralFIR.h
├── SOFAGeneralFIRE.cpp
├── SOFAGeneralFIRE.h
├── SOFAGeneralTF.cpp
├── SOFAGeneralTF.h
├── SOFAHelper.cpp
├── SOFAHelper.h
├── SOFAHostArchitecture.h
├── SOFAListener.cpp
├── SOFAListener.h
├── SOFAMultiSpeakerBRIR.cpp
├── SOFAMultiSpeakerBRIR.h
├── SOFANcFile.cpp
├── SOFANcFile.h
├── SOFANcUtils.h
├── SOFAPlatform.h
├── SOFAPoint3.cpp
├── SOFAPoint3.h
├── SOFAPosition.cpp
├── SOFAPosition.h
├── SOFAReceiver.cpp
├── SOFAReceiver.h
├── SOFASimpleFreeFieldHRIR.cpp
├── SOFASimpleFreeFieldHRIR.h
├── SOFASimpleFreeFieldSOS.cpp
├── SOFASimpleFreeFieldSOS.h
├── SOFASimpleHeadphoneIR.cpp
├── SOFASimpleHeadphoneIR.h
├── SOFASingleRoomDRIR.cpp
├── SOFASingleRoomDRIR.h
├── SOFASource.cpp
├── SOFASource.h
├── SOFAString.cpp
├── SOFAString.h
├── SOFAUnits.cpp
├── SOFAUnits.h
├── SOFAUtils.h
├── SOFAVersion.h
├── json2sofa.cpp
├── sofa2json.cpp
├── sofaexamples.cpp
├── sofainfo.cpp
└── sofamisc.cpp
/libsofa/build/linux/makefile_json2sofa:
--------------------------------------------------------------------------------
1 | #************************************************************************************
2 | #
3 | # @file makefile
4 | # @brief make file for sofa2json
5 | # @author Thibaut Carpentier
6 | # @version 1.0.0
7 | # @date 18/07/2012
8 | #
9 | #************************************************************************************
10 |
11 | #************************************************************************************
12 | # source files.
13 | SRC = ../../src/sofa2json.cpp
14 |
15 | #************************************************************************************
16 | # where to build the .o files
17 | BUILDDIR = .
18 |
19 | #************************************************************************************
20 | # object files
21 | OBJ = $(SRC:.cpp=.o)
22 |
23 | #************************************************************************************
24 | # output library
25 | OUT = ../../lib/json2sofa
26 |
27 | #************************************************************************************
28 | # header search paths
29 | INCLUDES = -I/usr/include \
30 | -I../../src \
31 | -I../../dependencies/include
32 |
33 | #************************************************************************************
34 | # preprocessor macros
35 | LIBSOFA_MACROS = \
36 | -DLINUX=1 \
37 | -D__unix__=1 \
38 | -DHOST_ENDIAN_LITTLE=1
39 |
40 | #************************************************************************************
41 | # Warning levels
42 | WARNING_CFLAGS = -Wno-unknown-pragmas -Wno-reorder -Wno-unused-value -Wno-unused
43 |
44 | #************************************************************************************
45 | # C++ compiler flags (-g -O2 -Wall)
46 | CCFLAGS = $(LIBSOFA_MACROS) \
47 | -g \
48 | -O3 \
49 | $(WARNING_CFLAGS)
50 |
51 | #************************************************************************************
52 | # compiler
53 | CCC = g++
54 |
55 | #************************************************************************************
56 | # library search paths
57 | LDFLAGS = -L../../../libsofa/lib
58 |
59 | #************************************************************************************
60 | # linker flags
61 | LDLIBS = -lsofa -lstdc++ -ljson-c
62 |
63 |
64 | #************************************************************************************
65 |
66 | .PHONY: depend clean
67 |
68 | all: $(OUT)
69 | @echo " "
70 | @echo Build $(OUT) is OK !!
71 | @echo " "
72 |
73 | $(OUT): $(OBJ) makefile_sofa2json
74 | @echo "Linking $(OUT) ... "
75 | $(CCC) -O -o $(OUT) $(OBJ) $(LDFLAGS) $(LDLIBS)
76 |
77 | # this is a suffix replacement rule for building .o's from .c's
78 | # it uses automatic variables $<: the name of the prerequisite of
79 | # the rule(a .c file) and $@: the name of the target of the rule (a .o file)
80 | # (see the gnu make manual section about automatic variables)
81 | .cpp.o:
82 | @echo " "
83 | @echo " "
84 | @echo "Compiling $< ..."
85 | @echo " "
86 | $(CCC) $(CCFLAGS) $(INCLUDES) -c $< -o $@
87 | @echo " "
88 | @echo " "
89 |
90 | clean:
91 | @echo "Cleaning..."
92 | $(RM) $(OBJ) *~ $(OUT)
93 |
94 | depend: $(SRC)
95 | @echo "Generating dependencies for $^"
96 | makedepend $(INCLUDES) $^
97 |
98 | # DO NOT DELETE THIS LINE -- make depend needs it
99 |
100 |
--------------------------------------------------------------------------------
/libsofa/build/linux/makefile_sofa2json:
--------------------------------------------------------------------------------
1 | #************************************************************************************
2 | #
3 | # @file makefile
4 | # @brief make file for sofa2json
5 | # @author Thibaut Carpentier
6 | # @version 1.0.0
7 | # @date 18/07/2012
8 | #
9 | #************************************************************************************
10 |
11 | #************************************************************************************
12 | # source files.
13 | SRC = ../../src/sofa2json.cpp
14 |
15 | #************************************************************************************
16 | # where to build the .o files
17 | BUILDDIR = .
18 |
19 | #************************************************************************************
20 | # object files
21 | OBJ = $(SRC:.cpp=.o)
22 |
23 | #************************************************************************************
24 | # output library
25 | OUT = ../../lib/sofa2json
26 |
27 | #************************************************************************************
28 | # header search paths
29 | INCLUDES = -I/usr/include \
30 | -I../../src \
31 | -I../../dependencies/include
32 |
33 | #************************************************************************************
34 | # preprocessor macros
35 | LIBSOFA_MACROS = \
36 | -DLINUX=1 \
37 | -D__unix__=1 \
38 | -DHOST_ENDIAN_LITTLE=1
39 |
40 | #************************************************************************************
41 | # Warning levels
42 | WARNING_CFLAGS = -Wno-unknown-pragmas -Wno-reorder -Wno-unused-value -Wno-unused
43 |
44 | #************************************************************************************
45 | # C++ compiler flags (-g -O2 -Wall)
46 | CCFLAGS = $(LIBSOFA_MACROS) \
47 | -g \
48 | -O3 \
49 | $(WARNING_CFLAGS)
50 |
51 | #************************************************************************************
52 | # compiler
53 | CCC = g++
54 |
55 | #************************************************************************************
56 | # library search paths
57 | LDFLAGS = -L../../../libsofa/lib
58 |
59 | #************************************************************************************
60 | # linker flags
61 | LDLIBS = -l:libsofa.a -lstdc++ -l:libnetcdf.a -l:libhdf5_hl.a -l:libhdf5.a -l:libcurl.a -lm -lz -l:libdl.a -l:libnetcdf_c++4.so -ljson-c
62 |
63 |
64 | #************************************************************************************
65 |
66 | .PHONY: depend clean
67 |
68 | all: $(OUT)
69 | @echo " "
70 | @echo Build $(OUT) is OK !!
71 | @echo " "
72 |
73 | $(OUT): $(OBJ) makefile_sofa2json
74 | @echo "Linking $(OUT) ... "
75 | $(CCC) -O -o $(OUT) $(OBJ) $(LDFLAGS) $(LDLIBS)
76 |
77 | # this is a suffix replacement rule for building .o's from .c's
78 | # it uses automatic variables $<: the name of the prerequisite of
79 | # the rule(a .c file) and $@: the name of the target of the rule (a .o file)
80 | # (see the gnu make manual section about automatic variables)
81 | .cpp.o:
82 | @echo " "
83 | @echo " "
84 | @echo "Compiling $< ..."
85 | @echo " "
86 | $(CCC) $(CCFLAGS) $(INCLUDES) -c $< -o $@
87 | @echo " "
88 | @echo " "
89 |
90 | clean:
91 | @echo "Cleaning..."
92 | $(RM) $(OBJ) *~ $(OUT)
93 |
94 | depend: $(SRC)
95 | @echo "Generating dependencies for $^"
96 | makedepend $(INCLUDES) $^
97 |
98 | # DO NOT DELETE THIS LINE -- make depend needs it
99 |
100 |
--------------------------------------------------------------------------------
/libsofa/build/macos/libsofa.debug.xcconfig:
--------------------------------------------------------------------------------
1 | //==============================================================================
2 | //
3 | // @file libsofa.debug.xconfig
4 | // @brief Xcode Config file for Release configuration
5 | // @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
6 | // @date 10/05/2013
7 | //
8 | //==============================================================================
9 | #include "libsofa.common.xcconfig"
10 |
11 | PRODUCT_NAME = $(TARGET_NAME)_debug
12 |
13 | //==============================================================================
14 | // BUILD ARCHITECTURE
15 | //==============================================================================
16 | ARCHS = x86_64 i386
17 | ONLY_ACTIVE_ARCH = NO
18 |
19 | MACH_O_TYPE = staticlib
20 |
21 | //==============================================================================
22 | // PREPROCESSOR
23 | //==============================================================================
24 | GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1
25 |
26 |
27 | //==============================================================================
28 | // LINKED LIBRARIES
29 | //==============================================================================
30 | OTHER_LDFLAGS = $(DEPENDENCIES_LIB)
31 |
32 | //==============================================================================
33 | // OPTIONS SPECIFIC FOR DEBUG CONFIGURATION
34 | //==============================================================================
35 | GCC_ENABLE_FIX_AND_CONTINUE = YES
36 | GCC_OPTIMIZATION_LEVEL = 0
37 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES
38 | DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
39 | GCC_DEBUGGING_SYMBOLS = full
40 |
41 | //==============================================================================
42 | // WARNINGS
43 | //==============================================================================
44 | WARNING_CFLAGS = -Wall
45 |
46 |
47 |
--------------------------------------------------------------------------------
/libsofa/build/macos/libsofa.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleDocumentTypes
8 |
9 | CFBundleExecutable
10 | ${PRODUCT_NAME}
11 | CFBundleIdentifier
12 | org.ircam.libsofa
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleLongVersionString
16 | libsofa ${PRODUCT_VERSION}, ${COPYRIGHT_TAG} ${ORGANIZATION_NAME}
17 | CFBundleName
18 | libsofa
19 | CFBundlePackageType
20 | FMWK
21 | CFBundleShortVersionString
22 | ${PRODUCT_VERSION}
23 | CFBundleSignature
24 | ????
25 | CFBundleVersion
26 | ${PRODUCT_VERSION}
27 | NSHumanReadableCopyright
28 | ${COPYRIGHT_TAG} ${ORGANIZATION_NAME}
29 |
30 |
31 |
--------------------------------------------------------------------------------
/libsofa/build/macos/libsofa.release.xcconfig:
--------------------------------------------------------------------------------
1 | //==============================================================================
2 | //
3 | // @file libsofa.release.xconfig
4 | // @brief Xcode Config file for Release configuration
5 | // @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
6 | // @date 10/05/2013
7 | //
8 | //==============================================================================
9 | #include "libsofa.common.xcconfig"
10 |
11 | PRODUCT_NAME = $(TARGET_NAME)
12 |
13 | //==============================================================================
14 | // BUILD ARCHITECTURE
15 | //==============================================================================
16 | ARCHS = x86_64 i386
17 | ONLY_ACTIVE_ARCH = NO
18 |
19 | MACH_O_TYPE = staticlib
20 |
21 | //==============================================================================
22 | // PREPROCESSOR
23 | //==============================================================================
24 | GCC_PREPROCESSOR_DEFINITIONS = NDEBUG=1
25 |
26 |
27 | //==============================================================================
28 | // LINKED LIBRARIES
29 | //==============================================================================
30 | OTHER_LDFLAGS = $(DEPENDENCIES_LIB)
31 |
32 | //==============================================================================
33 | // OPTIONS SPECIFIC FOR RELEASE CONFIGURATION
34 | //==============================================================================
35 | LLVM_VECTORIZE_LOOPS = YES
36 | GCC_OPTIMIZATION_LEVEL = s
37 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO
38 | LLVM_LTO = NO
39 |
40 |
--------------------------------------------------------------------------------
/libsofa/build/macos/libsofa.xcodeproj/xcuserdata/tcarpent.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/libsofa/build/macos/libsofa.xcodeproj/xcuserdata/tcarpent.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | all.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 | libsofa.xcscheme
13 |
14 | orderHint
15 | 1
16 |
17 | sofaexamples.xcscheme
18 |
19 | orderHint
20 | 4
21 |
22 | sofainfo.xcscheme
23 |
24 | orderHint
25 | 2
26 |
27 | sofamisc.xcscheme
28 |
29 | orderHint
30 | 3
31 |
32 |
33 | SuppressBuildableAutocreation
34 |
35 | 458CEB480AEF80A90010981A
36 |
37 | primary
38 |
39 |
40 | D2AAC045055464E500DB518D
41 |
42 | primary
43 |
44 |
45 | F82191CE1320010E00C80FA1
46 |
47 | primary
48 |
49 |
50 | F82B2B1819EE76AC006A84FC
51 |
52 | primary
53 |
54 |
55 | F82C9A3F133CD28C00B5D162
56 |
57 | primary
58 |
59 |
60 | F82C9A97133CD45200B5D162
61 |
62 | primary
63 |
64 |
65 | F86B24AB13631D72005913E5
66 |
67 | primary
68 |
69 |
70 | F8ABC6DB173D2E8500F18AD2
71 |
72 | primary
73 |
74 |
75 | F8ABCC52173EAB2000F18AD2
76 |
77 | primary
78 |
79 |
80 | F8B4CABF1402B2F2007F0BB4
81 |
82 | primary
83 |
84 |
85 | F8F1119F13CCBB1A009E61B0
86 |
87 | primary
88 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/libsofa/build/macos/shelltools.debug.xcconfig:
--------------------------------------------------------------------------------
1 | //==============================================================================
2 | //
3 | // @file shelltools.debug.xconfig
4 | // @brief Xcode Config file for Debug configuration
5 | // @author Thibaut Carpentier
6 | // @date 28/05/2010
7 | //
8 | //==============================================================================
9 | #include "libsofa.common.xcconfig"
10 |
11 | PRODUCT_NAME = $(TARGET_NAME)_debug
12 |
13 | //==============================================================================
14 | // BUILD ARCHITECTURE
15 | //==============================================================================
16 | ARCHS = x86_64
17 | ONLY_ACTIVE_ARCH = NO
18 |
19 | MACH_O_TYPE = mh_execute
20 |
21 | //==============================================================================
22 | // LINKER
23 | //==============================================================================
24 | FRAMEWORK_LINKED =
25 | OTHER_LDFLAGS = $(SRCROOT)/../../lib/libsofa_debug.a $(DEPENDENCIES_LIB) $(FRAMEWORK_LINKED)
26 |
27 | //==============================================================================
28 | // PREPROCESSOR
29 | //==============================================================================
30 | GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1
31 |
32 | //==============================================================================
33 | // OPTIONS SPECIFIC FOR DEBUG CONFIGURATION
34 | //==============================================================================
35 | GCC_OPTIMIZATION_LEVEL = 0
36 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES
37 | DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
38 | GCC_DEBUGGING_SYMBOLS = full
39 | LLVM_LTO = NO
40 |
41 | //==============================================================================
42 | // WARNINGS
43 | //==============================================================================
44 | WARNING_CFLAGS = -Wall
45 |
--------------------------------------------------------------------------------
/libsofa/build/macos/shelltools.release.xcconfig:
--------------------------------------------------------------------------------
1 | //==============================================================================
2 | //
3 | // @file shelltools.release.xconfig
4 | // @brief Xcode Config file for Release configuration
5 | // @author Thibaut Carpentier
6 | // @date 28/05/2010
7 | //
8 | //==============================================================================
9 | #include "libsofa.common.xcconfig"
10 |
11 | PRODUCT_NAME = $(TARGET_NAME)
12 |
13 | //==============================================================================
14 | // BUILD ARCHITECTURE
15 | //==============================================================================
16 | ARCHS = i386 x86_64
17 | ONLY_ACTIVE_ARCH = NO
18 |
19 | MACH_O_TYPE = mh_execute
20 |
21 | //==============================================================================
22 | // LINKER
23 | //==============================================================================
24 | FRAMEWORK_LINKED =
25 | OTHER_LDFLAGS = $(SRCROOT)/../../lib/libsofa.a $(DEPENDENCIES_LIB) $(FRAMEWORK_LINKED)
26 |
27 | //==============================================================================
28 | // PREPROCESSOR
29 | //==============================================================================
30 | GCC_PREPROCESSOR_DEFINITIONS = NDEBUG=1
31 |
32 | //==============================================================================
33 | // OPTIONS SPECIFIC FOR RELEASE CONFIGURATION
34 | //==============================================================================
35 | LLVM_VECTORIZE_LOOPS = YES
36 | GCC_OPTIMIZATION_LEVEL = s
37 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO
38 | LLVM_LTO = NO
39 |
40 |
--------------------------------------------------------------------------------
/libsofa/build/win/libsofa.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25420.1
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsofa", "libsofa.vcxproj", "{BD65F1EB-AF1B-483F-8BF2-08C5AD7E9BC1}"
7 | EndProject
8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sofainfo", "sofainfo.vcxproj", "{82942D67-E40C-4659-AD32-775EE62E0500}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Win32 = Debug|Win32
13 | Debug|x64 = Debug|x64
14 | Release|Win32 = Release|Win32
15 | Release|x64 = Release|x64
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {BD65F1EB-AF1B-483F-8BF2-08C5AD7E9BC1}.Debug|Win32.ActiveCfg = Debug|Win32
19 | {BD65F1EB-AF1B-483F-8BF2-08C5AD7E9BC1}.Debug|Win32.Build.0 = Debug|Win32
20 | {BD65F1EB-AF1B-483F-8BF2-08C5AD7E9BC1}.Debug|x64.ActiveCfg = Debug|x64
21 | {BD65F1EB-AF1B-483F-8BF2-08C5AD7E9BC1}.Debug|x64.Build.0 = Debug|x64
22 | {BD65F1EB-AF1B-483F-8BF2-08C5AD7E9BC1}.Release|Win32.ActiveCfg = Release|Win32
23 | {BD65F1EB-AF1B-483F-8BF2-08C5AD7E9BC1}.Release|Win32.Build.0 = Release|Win32
24 | {BD65F1EB-AF1B-483F-8BF2-08C5AD7E9BC1}.Release|x64.ActiveCfg = Release|x64
25 | {BD65F1EB-AF1B-483F-8BF2-08C5AD7E9BC1}.Release|x64.Build.0 = Release|x64
26 | {82942D67-E40C-4659-AD32-775EE62E0500}.Debug|Win32.ActiveCfg = Debug|Win32
27 | {82942D67-E40C-4659-AD32-775EE62E0500}.Debug|Win32.Build.0 = Debug|Win32
28 | {82942D67-E40C-4659-AD32-775EE62E0500}.Debug|x64.ActiveCfg = Debug|x64
29 | {82942D67-E40C-4659-AD32-775EE62E0500}.Debug|x64.Build.0 = Debug|x64
30 | {82942D67-E40C-4659-AD32-775EE62E0500}.Release|Win32.ActiveCfg = Release|Win32
31 | {82942D67-E40C-4659-AD32-775EE62E0500}.Release|Win32.Build.0 = Release|Win32
32 | {82942D67-E40C-4659-AD32-775EE62E0500}.Release|x64.ActiveCfg = Release|x64
33 | {82942D67-E40C-4659-AD32-775EE62E0500}.Release|x64.Build.0 = Release|x64
34 | EndGlobalSection
35 | GlobalSection(SolutionProperties) = preSolution
36 | HideSolutionNode = FALSE
37 | EndGlobalSection
38 | EndGlobal
39 |
--------------------------------------------------------------------------------
/libsofa/dependencies/bin/linux/ncdump:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/bin/linux/ncdump
--------------------------------------------------------------------------------
/libsofa/dependencies/bin/macos/ncdump:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/bin/macos/ncdump
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncAtt.h:
--------------------------------------------------------------------------------
1 | #include "ncType.h"
2 | #include "ncException.h"
3 | #include
4 | #include
5 |
6 | #ifndef NcAttClass
7 | #define NcAttClass
8 |
9 | namespace netCDF
10 | {
11 |
12 | /*! Abstract base class represents inherited by ncVarAtt and ncGroupAtt. */
13 | class NcAtt
14 | {
15 | public:
16 |
17 | /*! destructor */
18 | virtual ~NcAtt()=0;
19 |
20 | /*! Constructor generates a \ref isNull "null object". */
21 | NcAtt ();
22 |
23 | /*! Constructor for non-null instances. */
24 | NcAtt(bool nullObject);
25 |
26 | /*! The copy constructor. */
27 | NcAtt(const NcAtt& rhs);
28 |
29 | /*! Get the attribute name. */
30 | std::string getName() const {return myName;}
31 |
32 | /*! Gets attribute length. */
33 | size_t getAttLength() const;
34 |
35 | /*! Returns the attribute type. */
36 | NcType getType() const;
37 |
38 | /*! Gets parent group. */
39 | NcGroup getParentGroup() const;
40 |
41 | /*! equivalence operator */
42 | bool operator== (const NcAtt& rhs) const;
43 |
44 | /*! != operator */
45 | bool operator!=(const NcAtt& rhs) const;
46 |
47 | /*! \overload
48 | */
49 | void getValues(char* dataValues) const;
50 | /*! \overload
51 | */
52 | void getValues(unsigned char* dataValues) const;
53 | /*! \overload
54 | */
55 | void getValues(signed char* dataValues) const;
56 | /*! \overload
57 | */
58 | void getValues(short* dataValues) const;
59 | /*! \overload
60 | */
61 | void getValues(int* dataValues) const;
62 | /*! \overload
63 | */
64 | void getValues(long* dataValues) const;
65 | /*! \overload
66 | */
67 | void getValues(float* dataValues) const;
68 | /*! \overload
69 | */
70 | void getValues(double* dataValues) const;
71 | /*! \overload
72 | */
73 | void getValues(unsigned short* dataValues) const;
74 | /*! \overload
75 | */
76 | void getValues(unsigned int* dataValues) const;
77 | /*! \overload
78 | */
79 | void getValues(long long* dataValues) const;
80 | /*! \overload
81 | */
82 | void getValues(unsigned long long* dataValues) const;
83 | /*! \overload
84 | */
85 | void getValues(char** dataValues) const;
86 |
87 | /*! \overload
88 | (The string variable does not need preallocating.)
89 | */
90 | void getValues(std::string& dataValues) const;
91 |
92 | /*!
93 | Gets a netCDF attribute.
94 | The user must ensure that the variable "dataValues" has sufficient space to hold the attribute.
95 | \param dataValues On return contains the value of the attribute.
96 | If the type of data values differs from the netCDF variable type, type conversion will occur.
97 | (However, no type conversion is carried out for variables using the user-defined data types:
98 | nc_Vlen, nc_Opaque, nc_Compound and nc_Enum.)
99 | */
100 | void getValues(void* dataValues) const;
101 |
102 | /*! Returns true if this object is null (i.e. it has no contents); otherwise returns false. */
103 | bool isNull() const {return nullObject;}
104 |
105 | protected:
106 | /*! assignment operator */
107 | NcAtt& operator= (const NcAtt& rhs);
108 |
109 | bool nullObject;
110 |
111 | std::string myName;
112 |
113 | int groupId;
114 |
115 | int varId;
116 |
117 | };
118 |
119 | }
120 |
121 | #endif
122 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncByte.cpp:
--------------------------------------------------------------------------------
1 | #include "ncByte.h"
2 | #include "netcdf.h"
3 | using namespace netCDF;
4 |
5 | // create an instance of NcByte called netCDF::ncByte
6 | namespace netCDF {
7 | NcByte ncByte;
8 | }
9 |
10 | // constructor
11 | NcByte::NcByte() : NcType(NC_BYTE){
12 | }
13 |
14 | NcByte::~NcByte() {
15 | }
16 |
17 | int NcByte::sizeoff(){char a;return sizeof(a);};
18 |
19 |
20 | // equivalence operator
21 | bool NcByte::operator==(const NcByte & rhs) {
22 | // simply check the netCDF id.
23 | return myId == rhs.myId;
24 | }
25 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncByte.h:
--------------------------------------------------------------------------------
1 | #include "ncType.h"
2 |
3 | #ifndef NcByteClass
4 | #define NcByteClass
5 |
6 | namespace netCDF
7 | {
8 |
9 | /*! Class represents a netCDF atomic Byte type. */
10 | class NcByte : public NcType
11 | {
12 | public:
13 |
14 | /*! equivalence operator */
15 | bool operator==(const NcByte & rhs);
16 |
17 | /*! storage size */
18 | int sizeoff();
19 |
20 | ~NcByte();
21 |
22 | /*! Constructor */
23 | NcByte();
24 | };
25 |
26 | /*! A global instance of the NcByte class within the netCDF namespace. */
27 | extern NcByte ncByte;
28 |
29 | }
30 | #endif
31 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncChar.cpp:
--------------------------------------------------------------------------------
1 | #include "ncChar.h"
2 | #include "netcdf.h"
3 | using namespace netCDF;
4 |
5 | // create an instance of NcChar called netCDF::ncChar
6 | namespace netCDF {
7 | NcChar ncChar;
8 | }
9 |
10 | // constructor
11 | NcChar::NcChar() : NcType(NC_CHAR){
12 | }
13 |
14 | NcChar::~NcChar() {
15 | }
16 |
17 |
18 | // equivalence operator
19 | bool NcChar::operator==(const NcChar & rhs) {
20 | // simply check the netCDF id.
21 | return myId == rhs.myId;
22 | }
23 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncChar.h:
--------------------------------------------------------------------------------
1 | #include "ncType.h"
2 |
3 | #ifndef NcCharClass
4 | #define NcCharClass
5 |
6 | namespace netCDF
7 | {
8 |
9 | /*! Class represents a netCDF atomic Char type. */
10 | class NcChar : public NcType
11 | {
12 | public:
13 |
14 | /*! equivalence operator */
15 | bool operator==(const NcChar & rhs);
16 |
17 | ~NcChar();
18 |
19 | /*! Constructor */
20 | NcChar();
21 | };
22 |
23 | /*! A global instance of the NcChar class within the netCDF namespace. */
24 | extern NcChar ncChar;
25 |
26 | }
27 | #endif
28 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncCheck.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "netcdf.h"
3 | #include
4 | using namespace std;
5 | using namespace netCDF::exceptions;
6 |
7 | // C++ API for netCDF4.
8 | namespace netCDF
9 | {
10 | // function checks error code and if necessary throws appropriate exception.
11 | void ncCheck(int retCode, const char* file, int line){
12 | if (retCode==NC_NOERR)
13 | return;
14 |
15 | const char* msg = 0;
16 | if (NC_ISSYSERR(retCode)){
17 | msg = std::strerror(retCode);
18 | msg = msg ? msg : "Unknown system error";
19 | }else{
20 | msg = nc_strerror(retCode);
21 | }
22 |
23 | switch(retCode) {
24 | case NC_EBADID : throw NcBadId(msg,file,line);
25 | case NC_ENFILE : throw NcNFile(msg,file,line);
26 | case NC_EEXIST : throw NcExist(msg,file,line);
27 | case NC_EINVAL : throw NcInvalidArg(msg,file,line);
28 | case NC_EPERM : throw NcInvalidWrite(msg,file,line);
29 | case NC_ENOTINDEFINE : throw NcNotInDefineMode(msg,file,line);
30 | case NC_EINDEFINE : throw NcInDefineMode(msg,file,line);
31 | case NC_EINVALCOORDS : throw NcInvalidCoords(msg,file,line);
32 | case NC_EMAXDIMS : throw NcMaxDims(msg,file,line);
33 | case NC_ENAMEINUSE : throw NcNameInUse(msg,file,line);
34 | case NC_ENOTATT : throw NcNotAtt(msg,file,line);
35 | case NC_EMAXATTS : throw NcMaxAtts(msg,file,line);
36 | case NC_EBADTYPE : throw NcBadType(msg,file,line);
37 | case NC_EBADDIM : throw NcBadDim(msg,file,line);
38 | case NC_EUNLIMPOS : throw NcUnlimPos(msg,file,line);
39 | case NC_EMAXVARS : throw NcMaxVars(msg,file,line);
40 | case NC_ENOTVAR : throw NcNotVar(msg,file,line);
41 | case NC_EGLOBAL : throw NcGlobal(msg,file,line);
42 | case NC_ENOTNC : throw NcNotNCF(msg,file,line);
43 | case NC_ESTS : throw NcSts(msg,file,line);
44 | case NC_EMAXNAME : throw NcMaxName(msg,file,line);
45 | case NC_EUNLIMIT : throw NcUnlimit(msg,file,line);
46 | case NC_ENORECVARS : throw NcNoRecVars(msg,file,line);
47 | case NC_ECHAR : throw NcChar(msg,file,line);
48 | case NC_EEDGE : throw NcEdge(msg,file,line);
49 | case NC_ESTRIDE : throw NcStride(msg,file,line);
50 | case NC_EBADNAME : throw NcBadName(msg,file,line);
51 | case NC_ERANGE : throw NcRange(msg,file,line);
52 | case NC_ENOMEM : throw NcNoMem(msg,file,line);
53 | case NC_EVARSIZE : throw NcVarSize(msg,file,line);
54 | case NC_EDIMSIZE : throw NcDimSize(msg,file,line);
55 | case NC_ETRUNC : throw NcTrunc(msg,file,line);
56 |
57 | // The following are specific netCDF4 errors.
58 | case NC_EHDFERR : throw NcHdfErr(msg,file,line);
59 | case NC_ECANTREAD : throw NcCantRead(msg,file,line);
60 | case NC_ECANTWRITE : throw NcCantWrite(msg,file,line);
61 | case NC_ECANTCREATE : throw NcCantCreate(msg,file,line);
62 | case NC_EFILEMETA : throw NcFileMeta(msg,file,line);
63 | case NC_EDIMMETA : throw NcDimMeta(msg,file,line);
64 | case NC_EATTMETA : throw NcAttMeta(msg,file,line);
65 | case NC_EVARMETA : throw NcVarMeta(msg,file,line);
66 | case NC_ENOCOMPOUND : throw NcNoCompound(msg,file,line);
67 | case NC_EATTEXISTS : throw NcAttExists(msg,file,line);
68 | case NC_ENOTNC4 : throw NcNotNc4(msg,file,line);
69 | case NC_ESTRICTNC3 : throw NcStrictNc3(msg,file,line);
70 | case NC_EBADGRPID : throw NcBadGroupId(msg,file,line);
71 | case NC_EBADTYPID : throw NcBadTypeId(msg,file,line); // netcdf.h file inconsistent with documentation!!
72 | case NC_EBADFIELD : throw NcBadFieldId(msg,file,line); // netcdf.h file inconsistent with documentation!!
73 | // case NC_EUNKNAME : throw NcUnkownName("Cannot find the field id.",file,line); // netcdf.h file inconsistent with documentation!!
74 |
75 | case NC_ENOGRP : throw NcEnoGrp(msg,file,line);
76 | case NC_ELATEDEF : throw NcElateDef(msg,file,line);
77 |
78 | default:
79 | throw NcException(retCode, msg, file, line);
80 | }
81 | }
82 |
83 | void ncCheckDefineMode(int ncid)
84 | {
85 | int status = nc_redef(ncid);
86 | if (status != NC_EINDEFINE) ncCheck(status, __FILE__, __LINE__);
87 | }
88 |
89 | void ncCheckDataMode(int ncid)
90 | {
91 | int status = nc_enddef(ncid);
92 | if (status != NC_ENOTINDEFINE) ncCheck(status, __FILE__, __LINE__);
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncCheck.h:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #ifndef NcCheckFunction
6 | #define NcCheckFunction
7 |
8 | namespace netCDF
9 | {
10 | /*!
11 | Function checks error code and if necessary throws an exception.
12 | \param retCode Integer value returned by %netCDF C-routines.
13 | \param file The name of the file from which this call originates.
14 | \param line The line number in the file from which this call originates.
15 | */
16 | void ncCheck(int retCode, const char* file, int line);
17 |
18 | /*!
19 | Function checks if the file (group) is in define mode.
20 | If not, it places it in the define mode.
21 | While this is automatically done by the underlying C API
22 | for netCDF-4 files, the netCDF-3 files still need this call.
23 | */
24 | void ncCheckDefineMode(int ncid);
25 |
26 | /*!
27 | Function checks if the file (group) is in data mode.
28 | If not, it places it in the data mode.
29 | While this is automatically done by the underlying C API
30 | for netCDF-4 files, the netCDF-3 files still need this call.
31 | */
32 | void ncCheckDataMode(int ncid);
33 |
34 | };
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncCompoundType.h:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "ncType.h"
4 | #include "netcdf.h"
5 |
6 | #ifndef NcCompoundTypeClass
7 | #define NcCompoundTypeClass
8 |
9 |
10 | namespace netCDF
11 | {
12 | class NcGroup; // forward declaration.
13 |
14 | /*!
15 | Class represents a netCDF compound type
16 | */
17 | class NcCompoundType : public NcType
18 | {
19 | public:
20 |
21 | /*! Constructor generates a \ref isNull "null object". */
22 | NcCompoundType();
23 |
24 | /*!
25 | Constructor.
26 | The compound Type must already exist in the netCDF file. New netCDF compound types can be
27 | added using NcGroup::addNcCompoundType();
28 | \param grp The parent group where this type is defined.
29 | \param name Name of new type.
30 | */
31 | NcCompoundType(const NcGroup& grp, const std::string& name);
32 |
33 | /*!
34 | Constructor.
35 | Constructs from the base type NcType object. Will throw an exception if the NcType is not the base of a Compound type.
36 | \param ncType A Nctype object.
37 | */
38 | NcCompoundType(const NcType& ncType);
39 |
40 | /*! assignment operator */
41 | NcCompoundType& operator=(const NcCompoundType& rhs);
42 |
43 | /*!
44 | Assignment operator.
45 | This assigns from the base type NcType object. Will throw an exception if the NcType is not the base of a Compound type.
46 | */
47 | NcCompoundType& operator=(const NcType& rhs);
48 |
49 | /*! The copy constructor. */
50 | NcCompoundType(const NcCompoundType& rhs);
51 |
52 | /*! equivalence operator */
53 | bool operator==(const NcCompoundType & rhs);
54 |
55 | /*! destructor */
56 | ~NcCompoundType(){;}
57 |
58 |
59 | /*!
60 | Adds a named field.
61 | \param memName Name of new field.
62 | \param newMemberType The type of the new member.
63 | \param offset Offset of this member in bytes, obtained by a call to offsetof. For example
64 | the offset of a member "mem4" in structure struct1 is: offsetof(struct1,mem4).
65 | */
66 | void addMember(const std::string& memName, const NcType& newMemberType,size_t offset);
67 |
68 | /*!
69 | Adds a named array field.
70 | \param memName Name of new field.
71 | \param newMemberType The type of the new member.
72 | \param offset Offset of this member in bytes, obtained by a call to offsetof. For example
73 | the offset of a member "mem4" in structure struct1 is: offsetof(struct1,mem4).
74 | \param shape The shape of the array field.
75 | */
76 | void addMember(const std::string& memName, const NcType& newMemberType, size_t offset, const std::vector& shape);
77 |
78 |
79 | /*! Returns number of members in this NcCompoundType object. */
80 | size_t getMemberCount() const;
81 |
82 | /*! Returns a NcType object for a single member. */
83 | NcType getMember(int memberIndex) const;
84 |
85 | /*! Returns name of member field. */
86 | std::string getMemberName(int memberIndex) const;
87 |
88 | /*! Returns index of named member field. */
89 | int getMemberIndex(const std::string& memberName) const;
90 |
91 | /*! Returns the offset of the member with given index. */
92 | size_t getMemberOffset(const int index) const;
93 |
94 | /*!
95 | Returns the number of dimensions of a member with the given index.
96 | \param Index of member (numbering starts at zero).
97 | \return The number of dimensions of the field. Non-array fields have 0 dimensions.
98 | */
99 | int getMemberDimCount(int memberIndex) const;
100 |
101 |
102 | /*!
103 | Returns the shape of a given member.
104 | \param Index of member (numbering starts at zero).
105 | \return The size of the dimensions of the field. Non-array fields have 0 dimensions.
106 | */
107 | std::vector getMemberShape(int memberIndex) const;
108 |
109 |
110 | private:
111 |
112 | int myOffset;
113 |
114 | };
115 |
116 | }
117 |
118 |
119 | #endif
120 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncDim.cpp:
--------------------------------------------------------------------------------
1 | #include "ncDim.h"
2 | #include "ncGroup.h"
3 | #include "ncCheck.h"
4 | #include
5 | using namespace std;
6 |
7 |
8 | namespace netCDF {
9 | // Global comparator operator ==============
10 | // comparator operator
11 | bool operator<(const NcDim& lhs,const NcDim& rhs)
12 | {
13 | return false;
14 | }
15 |
16 | // comparator operator
17 | bool operator>(const NcDim& lhs,const NcDim& rhs)
18 | {
19 | return true;
20 | }
21 | }
22 |
23 | using namespace netCDF;
24 |
25 | // assignment operator
26 | NcDim& NcDim::operator=(const NcDim & rhs)
27 | {
28 | nullObject = rhs.nullObject;
29 | myId = rhs.myId;
30 | groupId = rhs.groupId;
31 | return *this;
32 | }
33 |
34 | // The copy constructor.
35 | NcDim::NcDim(const NcDim& rhs):
36 | nullObject(rhs.nullObject),
37 | myId(rhs.myId),
38 | groupId(rhs.groupId)
39 | {}
40 |
41 |
42 | // equivalence operator
43 | bool NcDim::operator==(const NcDim& rhs) const
44 | {
45 | if(nullObject)
46 | return nullObject == rhs.nullObject;
47 | else
48 | return myId == rhs.myId && groupId == rhs.groupId;
49 | }
50 |
51 | // != operator
52 | bool NcDim::operator!=(const NcDim & rhs) const
53 | {
54 | return !(*this == rhs);
55 | }
56 |
57 |
58 | // Gets parent group.
59 | NcGroup NcDim::getParentGroup() const {
60 | return NcGroup(groupId);
61 | }
62 |
63 | // Constructor generates a null object.
64 | NcDim::NcDim() :
65 | nullObject(true)
66 | {}
67 |
68 | // Constructor for a dimension (must already exist in the netCDF file.)
69 | NcDim::NcDim(const NcGroup& grp, int dimId) :
70 | nullObject(false)
71 | {
72 | groupId = grp.getId();
73 | myId = dimId;
74 | }
75 |
76 | // gets the size of the dimension, for unlimited, this is the current number of records.
77 | size_t NcDim::getSize() const
78 | {
79 | size_t dimSize;
80 | ncCheck(nc_inq_dimlen(groupId, myId, &dimSize),__FILE__,__LINE__);
81 | return dimSize;
82 | }
83 |
84 |
85 | // returns true if this dimension is unlimited.
86 | bool NcDim::isUnlimited() const
87 | {
88 | int numlimdims;
89 | int* unlimdimidsp=NULL;
90 | // get the number of unlimited dimensions
91 | ncCheck(nc_inq_unlimdims(groupId,&numlimdims,unlimdimidsp),__FILE__,__LINE__);
92 | if (numlimdims){
93 | // get all the unlimited dimension ids in this group
94 | vector unlimdimid(numlimdims);
95 | ncCheck(nc_inq_unlimdims(groupId,&numlimdims,&unlimdimid[0]),__FILE__,__LINE__);
96 | vector::iterator it;
97 | // now look to see if this dimension is unlimited
98 | it = find(unlimdimid.begin(),unlimdimid.end(),myId);
99 | return it != unlimdimid.end();
100 | }
101 | return false;
102 | }
103 |
104 |
105 | // gets the name of the dimension.
106 | const string NcDim::getName() const
107 | {
108 | char dimName[NC_MAX_NAME+1];
109 | ncCheck(nc_inq_dimname(groupId, myId, dimName),__FILE__,__LINE__);
110 | return string(dimName);
111 | }
112 |
113 | // renames this dimension.
114 | void NcDim::rename(const string& name)
115 | {
116 | ncCheck(nc_rename_dim(groupId, myId, name.c_str()),__FILE__,__LINE__);
117 | }
118 |
119 |
120 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncDim.h:
--------------------------------------------------------------------------------
1 | #include
2 | #include "netcdf.h"
3 |
4 | #ifndef NcDimClass
5 | #define NcDimClass
6 |
7 |
8 | namespace netCDF
9 | {
10 | class NcGroup; // forward declaration.
11 |
12 | /*! Class represents a netCDF dimension */
13 | class NcDim {
14 |
15 | public:
16 |
17 | /*! destructor*/
18 | ~NcDim(){};
19 |
20 | /*! Constructor generates a \ref isNull "null object". */
21 | NcDim ();
22 |
23 | /*!
24 | Constructor for a dimension .
25 | The dimension must already exist in the netCDF file. New netCDF variables can be added using NcGroup::addNcDim();
26 | \param grp Parent NcGroup object.
27 | \param dimId Id of the NcDim object.
28 | */
29 | NcDim(const NcGroup& grp, int dimId);
30 |
31 | /*! assignment operator */
32 | NcDim& operator =(const NcDim &);
33 |
34 | /*! equivalence operator */
35 | bool operator==(const NcDim& rhs) const;
36 |
37 | /*! != operator */
38 | bool operator!=(const NcDim& rhs) const;
39 |
40 | /*! The copy constructor. */
41 | NcDim(const NcDim& ncDim);
42 |
43 | /*! The name of this dimension.*/
44 | const std::string getName() const;
45 |
46 | /*! The netCDF Id of this dimension. */
47 | const int getId() const {return myId;};
48 |
49 | /*! Gets a NcGroup object of the parent group. */
50 | NcGroup getParentGroup() const;
51 |
52 | /*! Returns true if this is an unlimited dimension */
53 | bool isUnlimited() const;
54 |
55 | /*! The size of the dimension; for unlimited, this is the number of records written so far. */
56 | size_t getSize() const;
57 |
58 | /*!renames the dimension */
59 | void rename( const std::string& newName);
60 |
61 | /*! Returns true if this object is null (i.e. it has no contents); otherwise returns false. */
62 | bool isNull() const {return nullObject;}
63 |
64 | /*! comparator operator */
65 | friend bool operator<(const NcDim& lhs,const NcDim& rhs);
66 |
67 | /*! comparator operator */
68 | friend bool operator>(const NcDim& lhs,const NcDim& rhs);
69 |
70 | private:
71 |
72 | bool nullObject;
73 |
74 | int myId;
75 |
76 | int groupId;
77 |
78 | };
79 |
80 | }
81 |
82 |
83 | #endif
84 |
85 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncDouble.cpp:
--------------------------------------------------------------------------------
1 | #include "ncDouble.h"
2 | #include "netcdf.h"
3 | using namespace netCDF;
4 |
5 | // create an instance of NcDouble called netCDF::ncDouble
6 | namespace netCDF {
7 | NcDouble ncDouble;
8 | }
9 |
10 | // constructor
11 | NcDouble::NcDouble() : NcType(NC_DOUBLE){
12 | }
13 |
14 | NcDouble::~NcDouble() {
15 | }
16 |
17 |
18 | // equivalence operator
19 | bool NcDouble::operator==(const NcDouble & rhs) {
20 | // simply check the netCDF id.
21 | return myId == rhs.myId;
22 | }
23 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncDouble.h:
--------------------------------------------------------------------------------
1 | #include "ncType.h"
2 |
3 | #ifndef NcDoubleClass
4 | #define NcDoubleClass
5 |
6 | namespace netCDF
7 | {
8 |
9 | /*! Class represents a netCDF atomic Double type. */
10 | class NcDouble : public NcType
11 | {
12 | public:
13 |
14 | /*! equivalence operator */
15 | bool operator==(const NcDouble & rhs);
16 |
17 | /*! destructor */
18 | ~NcDouble();
19 |
20 | /*! Constructor */
21 | NcDouble();
22 | };
23 |
24 | /*! A global instance of the NcDouble class within the netCDF namespace. */
25 | extern NcDouble ncDouble;
26 |
27 | }
28 | #endif
29 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncEnumType.cpp:
--------------------------------------------------------------------------------
1 | #include "ncEnumType.h"
2 | #include "ncGroup.h"
3 | #include "ncCheck.h"
4 | #include "ncByte.h"
5 | #include "ncUbyte.h"
6 | #include "ncChar.h"
7 | #include "ncShort.h"
8 | #include "ncUshort.h"
9 | #include "ncInt.h"
10 | #include "ncUint.h"
11 | #include "ncInt64.h"
12 | #include "ncUint64.h"
13 | #include "ncFloat.h"
14 | #include "ncDouble.h"
15 | #include "ncString.h"
16 | #include "ncException.h"
17 | using namespace std;
18 | using namespace netCDF;
19 | using namespace netCDF::exceptions;
20 |
21 | // Class represents a netCDF variable.
22 |
23 | // assignment operator
24 | NcEnumType& NcEnumType::operator=(const NcEnumType& rhs)
25 | {
26 | NcType::operator=(rhs); // assign base class parts
27 | return *this;
28 | }
29 |
30 | // assignment operator
31 | NcEnumType& NcEnumType::operator=(const NcType& rhs)
32 | {
33 | if (&rhs != this) {
34 | // check the rhs is the base of an Enum type
35 | if(getTypeClass() != NC_ENUM) throw NcException("The NcType object must be the base of an Enum type.",__FILE__,__LINE__);
36 | // assign base class parts
37 | NcType::operator=(rhs);
38 | }
39 | return *this;
40 | }
41 |
42 | // The copy constructor.
43 | NcEnumType::NcEnumType(const NcEnumType& rhs):
44 | NcType(rhs)
45 | {
46 | }
47 |
48 |
49 | // Constructor generates a null object.
50 | NcEnumType::NcEnumType() :
51 | NcType() // invoke base class constructor
52 | {}
53 |
54 | // constructor
55 | NcEnumType::NcEnumType(const NcGroup& grp, const string& name):
56 | NcType(grp,name)
57 | {}
58 |
59 |
60 | // constructor
61 | NcEnumType::NcEnumType(const NcType& ncType):
62 | NcType(ncType)
63 | {
64 | // check the nctype object is the base of an Enum type
65 | if(getTypeClass() != NC_ENUM) throw NcException("The NcType object must be the base of an Enum type.",__FILE__,__LINE__);
66 | }
67 |
68 | // Returns the base type.
69 | NcType NcEnumType::getBaseType() const
70 | {
71 | char charName[NC_MAX_NAME+1];
72 | nc_type base_nc_typep;
73 | size_t *base_sizep=NULL;
74 | size_t *num_membersp=NULL;
75 | ncCheck(nc_inq_enum(groupId,myId,charName,&base_nc_typep,base_sizep,num_membersp),__FILE__,__LINE__);
76 | switch (base_nc_typep) {
77 | case NC_BYTE : return ncByte;
78 | case NC_UBYTE : return ncUbyte;
79 | case NC_CHAR : return ncChar;
80 | case NC_SHORT : return ncShort;
81 | case NC_USHORT : return ncUshort;
82 | case NC_INT : return ncInt;
83 | case NC_UINT : return ncUint;
84 | case NC_INT64 : return ncInt64;
85 | case NC_UINT64 : return ncUint64;
86 | case NC_FLOAT : return ncFloat;
87 | case NC_DOUBLE : return ncDouble;
88 | case NC_STRING : return ncString;
89 | default:
90 | // this is a user defined type
91 | return NcType(getParentGroup(),base_nc_typep);
92 | }
93 | }
94 |
95 |
96 | // Returns number of members in this NcEnumType object.
97 | size_t NcEnumType::getMemberCount() const{
98 | char charName[NC_MAX_NAME+1];
99 | nc_type* base_nc_typep=NULL;
100 | size_t* base_sizep=NULL;
101 | size_t num_membersp;
102 | ncCheck(nc_inq_enum(groupId,myId,charName,base_nc_typep,base_sizep,&num_membersp),__FILE__,__LINE__);
103 | return num_membersp;
104 | };
105 |
106 | // Returns the member name for the given zero-based index.
107 | string NcEnumType::getMemberNameFromIndex(int index) const{
108 | void* value=NULL;
109 | char charName[NC_MAX_NAME+1];
110 | ncCheck(nc_inq_enum_member(groupId,myId,index,charName,value),__FILE__,__LINE__);
111 | return static_cast (charName);
112 | };
113 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncEnumType.h:
--------------------------------------------------------------------------------
1 | #include
2 | #include "ncType.h"
3 | #include "netcdf.h"
4 | #include "ncCheck.h"
5 |
6 | #ifndef NcEnumTypeClass
7 | #define NcEnumTypeClass
8 |
9 |
10 | namespace netCDF
11 | {
12 | class NcGroup; // forward declaration.
13 |
14 | /*! Class represents a netCDF enum type */
15 | class NcEnumType : public NcType
16 | {
17 | public:
18 |
19 | /*! List of NetCDF-4 Enumeration types.*/
20 | enum ncEnumType {
21 | nc_BYTE = NC_BYTE, //!< signed 1 byte integer
22 | nc_SHORT = NC_SHORT, //!< signed 2 byte integer
23 | nc_INT = NC_INT, //!< signed 4 byte integer
24 | nc_UBYTE = NC_UBYTE, //!< unsigned 1 byte int
25 | nc_USHORT = NC_USHORT, //!< unsigned 2-byte int
26 | nc_UINT = NC_UINT, //!< unsigned 4-byte int
27 | nc_INT64 = NC_INT64, //!< signed 8-byte int
28 | nc_UINT64 = NC_UINT64 //!< unsigned 8-byte int
29 | };
30 |
31 | /*! Constructor generates a \ref isNull "null object". */
32 | NcEnumType();
33 |
34 | /*!
35 | Constructor.
36 | The enum Type must already exist in the netCDF file. New netCDF enum types can
37 | be added using NcGroup::addNcEnumType();
38 | \param grp The parent group where this type is defined.
39 | \param name Name of new type.
40 | */
41 | NcEnumType(const NcGroup& grp, const std::string& name);
42 |
43 | /*!
44 | Constructor.
45 | Constructs from the base type NcType object. Will throw an exception if the NcType is not the base of an Enum type.
46 | \param ncType A Nctype object.
47 | */
48 | NcEnumType(const NcType& ncType);
49 |
50 | /*! assignment operator */
51 | NcEnumType& operator=(const NcEnumType& rhs);
52 |
53 | /*!
54 | Assignment operator.
55 | This assigns from the base type NcType object. Will throw an exception if the NcType is not the base of an Enum type.
56 | */
57 | NcEnumType& operator=(const NcType& rhs);
58 |
59 | /*! The copy constructor. */
60 | NcEnumType(const NcEnumType& rhs);
61 |
62 | /*! Destructor */
63 | ~NcEnumType(){}
64 |
65 |
66 | /*!
67 | Adds a new member to this NcEnumType type.
68 | \param name Name for this new Enum memebr.
69 | \param memberValue Member value, must be of the correct NcType.
70 | */
71 | template void addMember(const std::string& name, T memberValue)
72 | {
73 | ncCheck(nc_insert_enum(groupId, myId, name.c_str(), (void*) &memberValue),__FILE__,__LINE__);
74 | }
75 |
76 | /*! Returns number of members in this NcEnumType object. */
77 | size_t getMemberCount() const;
78 |
79 | /*! Returns the member name for the given zero-based index. */
80 | std::string getMemberNameFromIndex(int index) const;
81 |
82 | /*! Returns the member name for the given NcEnumType value. */
83 | template std::string getMemberNameFromValue(const T memberValue) const {
84 | char charName[NC_MAX_NAME+1];
85 | ncCheck(nc_inq_enum_ident(groupId,myId,static_cast(memberValue),charName),__FILE__,__LINE__);
86 | return std::string(charName);
87 | }
88 |
89 | /*!
90 | Returns the value of a member with the given zero-based index.
91 | \param name Name for this new Enum member.
92 | \param memberValue Member value, returned by this routine.
93 | */
94 | template void getMemberValue(int index, T& memberValue) const
95 | {
96 | char* charName=NULL;
97 | ncCheck(nc_inq_enum_member(groupId,myId,index,charName,&memberValue),__FILE__,__LINE__);
98 | }
99 |
100 | /*! Returns the base type. */
101 | NcType getBaseType() const;
102 |
103 | };
104 |
105 | }
106 |
107 | #endif
108 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncFile.cpp:
--------------------------------------------------------------------------------
1 | #include "ncFile.h"
2 | #include "ncCheck.h"
3 | #include "ncException.h"
4 | #include "ncByte.h"
5 | #include
6 | #include
7 | #include
8 | using namespace std;
9 | using namespace netCDF;
10 | using namespace netCDF::exceptions;
11 |
12 | int g_ncid = -1;
13 |
14 | // destructor
15 | NcFile::~NcFile()
16 | {
17 | // destructor may be called due to an exception being thrown
18 | // hence throwing an exception from within a destructor
19 | // causes undefined behaviour! so just printing a warning message
20 | try
21 | {
22 | close();
23 | }
24 | catch (NcException &e)
25 | {
26 | cerr << e.what() << endl;
27 | }
28 | }
29 |
30 | void NcFile::close()
31 | {
32 | if (!nullObject) {
33 | ncCheck(nc_close(myId),__FILE__,__LINE__);
34 | g_ncid = -1;
35 | }
36 |
37 | nullObject = true;
38 | }
39 |
40 | // Constructor generates a null object.
41 | NcFile::NcFile() :
42 | NcGroup() // invoke base class constructor
43 | {}
44 |
45 | // constructor
46 | NcFile::NcFile(const string& filePath, const FileMode fMode)
47 | {
48 | open(filePath, fMode);
49 | }
50 |
51 | // open a file from path and mode
52 | void NcFile::open(const string& filePath, const FileMode fMode)
53 | {
54 | if (!nullObject)
55 | close();
56 |
57 | switch (fMode)
58 | {
59 | case NcFile::write:
60 | ncCheck(nc_open(filePath.c_str(), NC_WRITE, &myId),__FILE__,__LINE__);
61 | break;
62 | case NcFile::read:
63 | ncCheck(nc_open(filePath.c_str(), NC_NOWRITE, &myId),__FILE__,__LINE__);
64 | break;
65 | case NcFile::newFile:
66 | ncCheck(nc_create(filePath.c_str(), NC_NETCDF4 | NC_NOCLOBBER, &myId),__FILE__,__LINE__);
67 | break;
68 | case NcFile::replace:
69 | ncCheck(nc_create(filePath.c_str(), NC_NETCDF4 | NC_CLOBBER, &myId),__FILE__,__LINE__);
70 | break;
71 | }
72 |
73 | g_ncid = myId;
74 |
75 | nullObject=false;
76 | }
77 |
78 | // constructor with file type specified
79 | NcFile::NcFile(const string& filePath, const FileMode fMode, const FileFormat fFormat )
80 | {
81 | open(filePath, fMode, fFormat);
82 | }
83 |
84 | void NcFile::open(const string& filePath, const FileMode fMode, const FileFormat fFormat )
85 | {
86 | if (!nullObject)
87 | close();
88 |
89 | int format;
90 | switch (fFormat)
91 | {
92 | case NcFile::classic:
93 | format = 0;
94 | break;
95 | case NcFile::classic64:
96 | format = NC_64BIT_OFFSET;
97 | break;
98 | case NcFile::nc4:
99 | format = NC_NETCDF4;
100 | break;
101 | case NcFile::nc4classic:
102 | format = NC_NETCDF4 | NC_CLASSIC_MODEL;
103 | break;
104 | }
105 | switch (fMode)
106 | {
107 | case NcFile::write:
108 | ncCheck(nc_open(filePath.c_str(), format | NC_WRITE, &myId),__FILE__,__LINE__);
109 | break;
110 | case NcFile::read:
111 | ncCheck(nc_open(filePath.c_str(), format | NC_NOWRITE, &myId),__FILE__,__LINE__);
112 | break;
113 | case NcFile::newFile:
114 | ncCheck(nc_create(filePath.c_str(), format | NC_NOCLOBBER, &myId),__FILE__,__LINE__);
115 | break;
116 | case NcFile::replace:
117 | ncCheck(nc_create(filePath.c_str(), format | NC_CLOBBER, &myId),__FILE__,__LINE__);
118 | break;
119 | }
120 |
121 | g_ncid = myId;
122 | nullObject=false;
123 | }
124 |
125 | // Synchronize an open netcdf dataset to disk
126 | void NcFile::sync(){
127 | ncCheck(nc_sync(myId),__FILE__,__LINE__);
128 | }
129 |
130 | // Leave define mode, used for classic model
131 | void NcFile::enddef() {
132 | ncCheck(nc_enddef(myId),__FILE__,__LINE__);
133 | }
134 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncFile.h:
--------------------------------------------------------------------------------
1 | #include
2 | #include "ncGroup.h"
3 | #include "netcdf.h"
4 |
5 | #ifndef NcFileClass
6 | #define NcFileClass
7 |
8 |
9 | //! C++ API for netCDF4.
10 | namespace netCDF
11 | {
12 |
13 | /*!
14 | Class represents a netCDF root group.
15 | The Ncfile class is the same as the NcGroup class with the additional functionality for opening
16 | and closing files.
17 | */
18 | class NcFile : public NcGroup
19 | {
20 | public:
21 |
22 | enum FileMode
23 | {
24 | read, //!< File exists, open read-only.
25 | write, //!< File exists, open for writing.
26 | replace, //!< Create new file, even if already exists.
27 | newFile //!< Create new file, fail if already exists.
28 | };
29 |
30 | enum FileFormat
31 | {
32 | classic, //!< Classic format, classic data model
33 | classic64, //!< 64-bit offset format, classic data model
34 | nc4, //!< (default) netCDF-4/HDF5 format, enhanced data model
35 | nc4classic //!< netCDF-4/HDF5 format, classic data model
36 | };
37 |
38 |
39 | /*! Constructor generates a \ref isNull "null object". */
40 | NcFile();
41 |
42 | /*!
43 | Opens a netCDF file.
44 | \param filePath Name of netCDF optional path.
45 | \param fMode The file mode:
46 | - 'read' File exists, open for read-only.
47 | - 'write' File exists, open for writing.
48 | - 'replace' Create new file, even it already exists.
49 | - 'newFile' Create new file, fail it exists already.
50 | */
51 | NcFile(const std::string& filePath, FileMode fMode);
52 | /*!
53 | Opens a netCDF file.
54 | \param filePath Name of netCDF optional path.
55 | \param fMode The file mode:
56 | - 'read' File exists, open for read-only.
57 | - 'write' File exists, open for writing.
58 | - 'replace' Create new file, even it already exists.
59 | - 'newFile' Create new file, fail it exists already.
60 | */
61 | void open(const std::string& filePath, FileMode fMode);
62 |
63 | /*!
64 | Creates a netCDF file of a specified format.
65 | \param filePath Name of netCDF optional path.
66 | \param fMode The file mode:
67 | - 'replace' Create new file, even it already exists.
68 | - 'newFile' Create new file, fail it exists already.
69 | */
70 | NcFile(const std::string& filePath, FileMode fMode, FileFormat fFormat);
71 | /*!
72 | Creates a netCDF file of a specified format.
73 | \param filePath Name of netCDF optional path.
74 | \param fMode The file mode:
75 | - 'replace' Create new file, even it already exists.
76 | - 'newFile' Create new file, fail it exists already.
77 | */
78 | void open(const std::string& filePath, FileMode fMode, FileFormat fFormat);
79 |
80 | //! Close a file before destructor call
81 | void close();
82 |
83 | /*! destructor */
84 | virtual ~NcFile(); //closes file and releases all resources
85 |
86 | //! Synchronize an open netcdf dataset to disk
87 | void sync();
88 |
89 | //! Leave define mode, used for classic model
90 | void enddef();
91 |
92 | private:
93 | /* Do not allow definition of NcFile involving copying any NcFile or NcGroup.
94 | Because the destructor closes the file and releases al resources such
95 | an action could leave NcFile objects in an invalid state */
96 | NcFile& operator =(const NcGroup & rhs);
97 | NcFile& operator =(const NcFile & rhs);
98 | NcFile(const NcGroup& rhs);
99 | NcFile(const NcFile& rhs);
100 | };
101 |
102 | }
103 |
104 |
105 | #endif
106 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncFloat.cpp:
--------------------------------------------------------------------------------
1 | #include "ncFloat.h"
2 | #include "netcdf.h"
3 | using namespace netCDF;
4 |
5 | // create an instance of NcFloat called netCDF::ncFloat
6 | namespace netCDF {
7 | NcFloat ncFloat;
8 | }
9 |
10 | // constructor
11 | NcFloat::NcFloat() : NcType(NC_FLOAT){
12 | }
13 |
14 | NcFloat::~NcFloat() {
15 | }
16 |
17 |
18 | // equivalence operator
19 | bool NcFloat::operator==(const NcFloat & rhs) {
20 | // simply check the netCDF id.
21 | return myId == rhs.myId;
22 | }
23 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncFloat.h:
--------------------------------------------------------------------------------
1 | #include "ncType.h"
2 |
3 | #ifndef NcFloatClass
4 | #define NcFloatClass
5 |
6 | namespace netCDF
7 | {
8 |
9 | /*! Class represents a netCDF atomic Float type. */
10 | class NcFloat : public NcType
11 | {
12 | public:
13 |
14 | /*! equivalence operator */
15 | bool operator==(const NcFloat & rhs);
16 |
17 | /*! destructor */
18 | ~NcFloat();
19 |
20 | /*! Constructor */
21 | NcFloat();
22 | };
23 |
24 | /*! A global instance of the NcFloat class within the netCDF namespace. */
25 | extern NcFloat ncFloat;
26 |
27 | }
28 | #endif
29 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncGroupAtt.cpp:
--------------------------------------------------------------------------------
1 | #include "ncGroupAtt.h"
2 | #include "ncGroup.h"
3 | #include "ncCheck.h"
4 | #include
5 | using namespace std;
6 |
7 |
8 | namespace netCDF {
9 | // Global comparator operator ==============
10 | // comparator operator
11 | bool operator<(const NcGroupAtt& lhs,const NcGroupAtt& rhs)
12 | {
13 | return false;
14 | }
15 |
16 | // comparator operator
17 | bool operator>(const NcGroupAtt& lhs,const NcGroupAtt& rhs)
18 | {
19 | return true;
20 | }
21 | }
22 |
23 |
24 | using namespace netCDF;
25 |
26 | // assignment operator
27 | NcGroupAtt& NcGroupAtt::operator=(const NcGroupAtt & rhs)
28 | {
29 | NcAtt::operator=(rhs); // assign base class parts
30 | return *this;
31 | }
32 |
33 | //! The copy constructor.
34 | NcGroupAtt::NcGroupAtt(const NcGroupAtt& rhs):
35 | NcAtt(rhs) // invoke base class copy constructor
36 | {}
37 |
38 |
39 | // Constructor generates a null object.
40 | NcGroupAtt::NcGroupAtt() :
41 | NcAtt() // invoke base class constructor
42 | {}
43 |
44 | // equivalence operator (doesn't bother compaing varid's of each object).
45 | bool NcGroupAtt::operator==(const NcGroupAtt & rhs)
46 | {
47 | if(nullObject)
48 | return nullObject == rhs.isNull();
49 | else
50 | return myName == rhs.myName && groupId == rhs.groupId;
51 | }
52 |
53 | // Constructor for an existing global attribute.
54 | NcGroupAtt::NcGroupAtt(const NcGroup& grp, const int index):
55 | NcAtt(false)
56 | {
57 | groupId = grp.getId();
58 | varId = NC_GLOBAL;
59 | // get the name of this attribute
60 | char attName[NC_MAX_NAME+1];
61 | ncCheck(nc_inq_attname(groupId,varId, index, attName),__FILE__,__LINE__);
62 | ncCheck(nc_inq_attname(groupId,varId,index,attName),__FILE__,__LINE__);
63 | myName = attName;
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncGroupAtt.h:
--------------------------------------------------------------------------------
1 | #include "ncAtt.h"
2 | #include "netcdf.h"
3 |
4 | #ifndef NcGroupAttClass
5 | #define NcGroupAttClass
6 |
7 | namespace netCDF
8 | {
9 | class NcGroup; // forward declaration.
10 |
11 | /*! Class represents a netCDF group attribute */
12 | class NcGroupAtt : public NcAtt
13 | {
14 | public:
15 |
16 | /*! assignment operator */
17 | NcGroupAtt& operator= (const NcGroupAtt& rhs);
18 |
19 | /*! Constructor generates a \ref isNull "null object". */
20 | NcGroupAtt ();
21 |
22 | /*! The copy constructor. */
23 | NcGroupAtt(const NcGroupAtt& rhs) ;
24 |
25 | /*!
26 | Constructor for an existing global attribute.
27 | \param grp Parent Group object.
28 | \param index The index (id) of the attribute.
29 | */
30 | NcGroupAtt(const NcGroup& grp, const int index);
31 |
32 | /*! equivalence operator */
33 | bool operator== (const NcGroupAtt& rhs);
34 |
35 | /*! comparator operator */
36 | friend bool operator<(const NcGroupAtt& lhs,const NcGroupAtt& rhs);
37 |
38 | /*! comparator operator */
39 | friend bool operator>(const NcGroupAtt& lhs,const NcGroupAtt& rhs);
40 |
41 | };
42 |
43 | }
44 |
45 | #endif
46 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncInt.cpp:
--------------------------------------------------------------------------------
1 | #include "ncInt.h"
2 | #include "netcdf.h"
3 | using namespace netCDF;
4 |
5 | // create an instance of NcInt called netCDF::ncInt
6 | namespace netCDF {
7 | NcInt ncInt;
8 | }
9 |
10 | // constructor
11 | NcInt::NcInt() : NcType(NC_INT){
12 | }
13 |
14 | NcInt::~NcInt() {
15 | }
16 |
17 |
18 | // equivalence operator
19 | bool NcInt::operator==(const NcInt & rhs) {
20 | // simply check the netCDF id.
21 | return myId == rhs.myId;
22 | }
23 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncInt.h:
--------------------------------------------------------------------------------
1 | #include "ncType.h"
2 |
3 | #ifndef NcIntClass
4 | #define NcIntClass
5 |
6 | namespace netCDF
7 | {
8 |
9 | /*! Class represents a netCDF atomic Int type. */
10 | class NcInt : public NcType
11 | {
12 | public:
13 |
14 | /*! equivalence operator */
15 | bool operator==(const NcInt & rhs);
16 |
17 | /*! destructor */
18 | ~NcInt();
19 |
20 | /*! Constructor */
21 | NcInt();
22 | };
23 |
24 | /*! A global instance of the NcInt class within the netCDF namespace. */
25 | extern NcInt ncInt;
26 |
27 | }
28 | #endif
29 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncInt64.cpp:
--------------------------------------------------------------------------------
1 | #include "ncInt64.h"
2 | #include "netcdf.h"
3 | using namespace netCDF;
4 |
5 | // create an instance of NcInt64 called netCDF::ncInt64
6 | namespace netCDF {
7 | NcInt64 ncInt64;
8 | }
9 |
10 | // constructor
11 | NcInt64::NcInt64() : NcType(NC_INT64){
12 | }
13 |
14 | NcInt64::~NcInt64() {
15 | }
16 |
17 |
18 | // equivalence operator
19 | bool NcInt64::operator==(const NcInt64 & rhs) {
20 | // simply check the netCDF id.
21 | return myId == rhs.myId;
22 | }
23 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncInt64.h:
--------------------------------------------------------------------------------
1 | #include "ncType.h"
2 |
3 | #ifndef NcInt64Class
4 | #define NcInt64Class
5 |
6 | namespace netCDF
7 | {
8 |
9 | /*! Class represents a netCDF atomic Int64 type. */
10 | class NcInt64 : public NcType
11 | {
12 | public:
13 |
14 | /*! equivalence operator */
15 | bool operator==(const NcInt64 & rhs);
16 |
17 | /*! destructor */
18 | ~NcInt64();
19 |
20 | /*! Constructor */
21 | NcInt64();
22 | };
23 |
24 | /*! A global instance of the NcInt64 class within the netCDF namespace. */
25 | extern NcInt64 ncInt64;
26 |
27 | }
28 | #endif
29 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncOpaqueType.cpp:
--------------------------------------------------------------------------------
1 | #include "ncOpaqueType.h"
2 | #include "ncGroup.h"
3 | #include "ncCheck.h"
4 | #include "ncException.h"
5 | #include
6 | using namespace std;
7 | using namespace netCDF;
8 | using namespace netCDF::exceptions;
9 |
10 | // Class represents a netCDF variable.
11 | using namespace netCDF;
12 |
13 | // assignment operator
14 | NcOpaqueType& NcOpaqueType::operator=(const NcOpaqueType& rhs)
15 | {
16 | // assign base class parts
17 | NcType::operator=(rhs);
18 | return *this;
19 | }
20 |
21 | // assignment operator
22 | NcOpaqueType& NcOpaqueType::operator=(const NcType& rhs)
23 | {
24 | if (&rhs != this) {
25 | // check the rhs is the base of an Opaque type
26 | if(getTypeClass() != NC_OPAQUE) throw NcException("The NcType object must be the base of an Opaque type.",__FILE__,__LINE__);
27 | // assign base class parts
28 | NcType::operator=(rhs);
29 | }
30 | return *this;
31 | }
32 |
33 | // The copy constructor.
34 | NcOpaqueType::NcOpaqueType(const NcOpaqueType& rhs):
35 | NcType(rhs)
36 | {
37 | }
38 |
39 |
40 | // Constructor generates a null object.
41 | NcOpaqueType::NcOpaqueType() :
42 | NcType() // invoke base class constructor
43 | {}
44 |
45 |
46 | // constructor
47 | NcOpaqueType::NcOpaqueType(const NcGroup& grp, const string& name) :
48 | NcType(grp,name)
49 | {}
50 |
51 |
52 | // constructor
53 | NcOpaqueType::NcOpaqueType(const NcType& ncType) :
54 | NcType(ncType)
55 | {
56 | // check the nctype object is the base of a Opaque type
57 | if(getTypeClass() != NC_OPAQUE) throw NcException("The NcType object must be the base of an Opaque type.",__FILE__,__LINE__);
58 | }
59 |
60 | // Returns the size of the opaque type in bytes.
61 | size_t NcOpaqueType::getTypeSize() const
62 | {
63 | char* charName;
64 | charName=NULL;
65 | size_t sizep;
66 | ncCheck(nc_inq_opaque(groupId,myId,charName,&sizep),__FILE__,__LINE__);
67 | return sizep;
68 | }
69 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncOpaqueType.h:
--------------------------------------------------------------------------------
1 | #include
2 | #include "ncType.h"
3 | #include "netcdf.h"
4 |
5 | #ifndef NcOpaqueTypeClass
6 | #define NcOpaqueTypeClass
7 |
8 |
9 | namespace netCDF
10 | {
11 | class NcGroup; // forward declaration.
12 |
13 | /*! Class represents a netCDF opaque type */
14 | class NcOpaqueType : public NcType
15 | {
16 | public:
17 |
18 | /*! Constructor generates a \ref isNull "null object". */
19 | NcOpaqueType();
20 |
21 | /*!
22 | Constructor.
23 | The opaque Type must already exist in the netCDF file. New netCDF opaque types #
24 | can be added using NcGroup::addNcOpaqueType();
25 | \param grp The parent group where this type is defined.
26 | \param name Name of new type.
27 | */
28 | NcOpaqueType(const NcGroup& grp, const std::string& name);
29 |
30 | /*!
31 | Constructor.
32 | Constructs from the base type NcType object. Will throw an exception if the NcType is not the base of a Opaque type.
33 | \param ncType A Nctype object.
34 | */
35 | NcOpaqueType(const NcType& ncType);
36 |
37 | /*! assignment operator */
38 | NcOpaqueType& operator=(const NcOpaqueType& rhs);
39 |
40 | /*!
41 | Assignment operator.
42 | This assigns from the base type NcType object. Will throw an exception if the NcType is not the base of an Opaque type.
43 | */
44 | NcOpaqueType& operator=(const NcType& rhs);
45 |
46 | /*! The copy constructor.*/
47 | NcOpaqueType(const NcOpaqueType& rhs);
48 |
49 | /*! destructor */
50 | ~NcOpaqueType(){;}
51 |
52 | /*! Returns the size of the opaque type in bytes. */
53 | size_t getTypeSize() const;
54 |
55 | };
56 |
57 | }
58 |
59 | #endif
60 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncShort.cpp:
--------------------------------------------------------------------------------
1 | #include "ncShort.h"
2 | #include "netcdf.h"
3 | using namespace netCDF;
4 |
5 | // create an instance of NcShort called netCDF::ncShort
6 | namespace netCDF {
7 | NcShort ncShort;
8 | }
9 |
10 | // constructor
11 | NcShort::NcShort() : NcType(NC_SHORT){
12 | }
13 |
14 | NcShort::~NcShort() {
15 | }
16 |
17 |
18 | // equivalence operator
19 | bool NcShort::operator==(const NcShort & rhs) {
20 | // simply check the netCDF id.
21 | return myId == rhs.myId;
22 | }
23 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncShort.h:
--------------------------------------------------------------------------------
1 | #include "ncType.h"
2 |
3 | #ifndef NcShortClass
4 | #define NcShortClass
5 |
6 | namespace netCDF
7 | {
8 |
9 | /*! Class represents a netCDF atomic Short type. */
10 | class NcShort : public NcType
11 | {
12 | public:
13 |
14 | /*! equivalence operator */
15 | bool operator==(const NcShort & rhs);
16 |
17 | /*! destructor */
18 | ~NcShort();
19 |
20 | /*! Constructor */
21 | NcShort();
22 | };
23 |
24 | /*! A global instance of the NcShort class within the netCDF namespace. */
25 | extern NcShort ncShort;
26 |
27 | }
28 | #endif
29 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncString.cpp:
--------------------------------------------------------------------------------
1 | #include "ncString.h"
2 | #include "netcdf.h"
3 | using namespace netCDF;
4 |
5 | // create an instance of NcString called netCDF::ncString
6 | namespace netCDF {
7 | NcString ncString;
8 | }
9 |
10 | // constructor
11 | NcString::NcString() : NcType(NC_STRING){
12 | }
13 |
14 | NcString::~NcString() {
15 | }
16 |
17 |
18 | // equivalence operator
19 | bool NcString::operator==(const NcString & rhs) {
20 | // simply check the netCDF id.
21 | return myId == rhs.myId;
22 | }
23 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncString.h:
--------------------------------------------------------------------------------
1 | #include "ncType.h"
2 |
3 | #ifndef NcStringClass
4 | #define NcStringClass
5 |
6 | namespace netCDF
7 | {
8 |
9 | /*! Class represents a netCDF atomic String type. */
10 | class NcString : public NcType
11 | {
12 | public:
13 |
14 | /*! equivalence operator */
15 | bool operator==(const NcString & rhs);
16 |
17 | /*! destructor */
18 | ~NcString();
19 |
20 | /*! Constructor */
21 | NcString();
22 | };
23 |
24 | /*! A global instance of the NcString class within the netCDF namespace. */
25 | extern NcString ncString;
26 |
27 | }
28 | #endif
29 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncUbyte.cpp:
--------------------------------------------------------------------------------
1 | #include "ncUbyte.h"
2 | #include "netcdf.h"
3 | using namespace netCDF;
4 |
5 | // create an instance of NcUbyte called netCDF::ncUbyte
6 | namespace netCDF {
7 | NcUbyte ncUbyte;
8 | }
9 |
10 | // constructor
11 | NcUbyte::NcUbyte() : NcType(NC_UBYTE){
12 | }
13 |
14 | NcUbyte::~NcUbyte() {
15 | }
16 |
17 |
18 | // equivalence operator
19 | bool NcUbyte::operator==(const NcUbyte & rhs) {
20 | // simply check the netCDF id.
21 | return myId == rhs.myId;
22 | }
23 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncUbyte.h:
--------------------------------------------------------------------------------
1 | #include "ncType.h"
2 |
3 | #ifndef NcUbyteClass
4 | #define NcUbyteClass
5 |
6 | namespace netCDF
7 | {
8 |
9 | /*! Class represents a netCDF atomic Ubyte type. */
10 | class NcUbyte : public NcType
11 | {
12 | public:
13 |
14 | /*! equivalence operator */
15 | bool operator==(const NcUbyte & rhs);
16 |
17 | /*! destructor */
18 | ~NcUbyte();
19 |
20 | /*! Constructor */
21 | NcUbyte();
22 | };
23 |
24 | /*! A global instance of the NcUbyte class within the netCDF namespace. */
25 | extern NcUbyte ncUbyte;
26 |
27 | }
28 | #endif
29 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncUint.cpp:
--------------------------------------------------------------------------------
1 | #include "ncUint.h"
2 | #include "netcdf.h"
3 | using namespace netCDF;
4 |
5 | // create an instance of NcUint called netCDF::ncUint
6 | namespace netCDF {
7 | NcUint ncUint;
8 | }
9 |
10 | // constructor
11 | NcUint::NcUint() : NcType(NC_UINT){
12 | }
13 |
14 | NcUint::~NcUint() {
15 | }
16 |
17 |
18 | // equivalence operator
19 | bool NcUint::operator==(const NcUint & rhs) {
20 | // simply check the netCDF id.
21 | return myId == rhs.myId;
22 | }
23 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncUint.h:
--------------------------------------------------------------------------------
1 | #include "ncType.h"
2 |
3 | #ifndef NcUintClass
4 | #define NcUintClass
5 |
6 | namespace netCDF
7 | {
8 |
9 | /*! Class represents a netCDF atomic Uint type. */
10 | class NcUint : public NcType
11 | {
12 | public:
13 |
14 | /*! equivalence operator */
15 | bool operator==(const NcUint & rhs);
16 |
17 | /*! destructor */
18 | ~NcUint();
19 |
20 | /*! Constructor */
21 | NcUint();
22 | };
23 |
24 | /*! A global instance of the NcUint class within the netCDF namespace. */
25 | extern NcUint ncUint;
26 |
27 | }
28 | #endif
29 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncUint64.cpp:
--------------------------------------------------------------------------------
1 | #include "ncUint64.h"
2 | #include "netcdf.h"
3 | using namespace netCDF;
4 |
5 | // create an instance of NcUint64 called netCDF::ncUint64
6 | namespace netCDF {
7 | NcUint64 ncUint64;
8 | }
9 |
10 | // constructor
11 | NcUint64::NcUint64() : NcType(NC_UINT64){
12 | }
13 |
14 | NcUint64::~NcUint64() {
15 | }
16 |
17 |
18 | // equivalence operator
19 | bool NcUint64::operator==(const NcUint64 & rhs) {
20 | // simply check the netCDF id.
21 | return myId == rhs.myId;
22 | }
23 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncUint64.h:
--------------------------------------------------------------------------------
1 | #include "ncType.h"
2 |
3 | #ifndef NcUint64Class
4 | #define NcUint64Class
5 |
6 | namespace netCDF
7 | {
8 |
9 | /*! Class represents a netCDF atomic Uint64 type.*/
10 | class NcUint64 : public NcType
11 | {
12 | public:
13 |
14 | /*! equivalence operator */
15 | bool operator==(const NcUint64 & rhs);
16 |
17 | /*! destructor */
18 | ~NcUint64();
19 |
20 | /*! Constructor */
21 | NcUint64();
22 | };
23 |
24 | /*! A global instance of the NcUint64 class within the netCDF namespace. */
25 | extern NcUint64 ncUint64;
26 |
27 | }
28 | #endif
29 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncUshort.cpp:
--------------------------------------------------------------------------------
1 | #include "ncUshort.h"
2 | #include "netcdf.h"
3 | using namespace netCDF;
4 |
5 | // create an instance of NcUshort called netCDF::ncUshort
6 | namespace netCDF {
7 | NcUshort ncUshort;
8 | }
9 |
10 | // constructor
11 | NcUshort::NcUshort() : NcType(NC_USHORT){
12 | }
13 |
14 | NcUshort::~NcUshort() {
15 | }
16 |
17 |
18 | // equivalence operator
19 | bool NcUshort::operator==(const NcUshort & rhs) {
20 | // simply check the netCDF id.
21 | return myId == rhs.myId;
22 | }
23 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncUshort.h:
--------------------------------------------------------------------------------
1 | #include "ncType.h"
2 |
3 | #ifndef NcUshortClass
4 | #define NcUshortClass
5 |
6 | namespace netCDF
7 | {
8 |
9 | /*! Class represents a netCDF atomic Ushort type. */
10 | class NcUshort : public NcType
11 | {
12 | public:
13 |
14 | /*! equivalence operator */
15 | bool operator==(const NcUshort & rhs);
16 |
17 | /*! destructor */
18 | ~NcUshort();
19 |
20 | /*! Constructor */
21 | NcUshort();
22 | };
23 |
24 | // declare that the class instance ncUshort is known by all....
25 | extern NcUshort ncUshort;
26 |
27 | }
28 | #endif
29 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncVarAtt.cpp:
--------------------------------------------------------------------------------
1 | #include "ncVar.h"
2 | #include "ncVarAtt.h"
3 | #include "ncGroup.h"
4 | #include "ncCheck.h"
5 | #include
6 | using namespace std;
7 |
8 |
9 | namespace netCDF {
10 | // Global comparator operator ==============
11 | // comparator operator
12 | bool operator<(const NcVarAtt& lhs,const NcVarAtt& rhs)
13 | {
14 | return false;
15 | }
16 |
17 | // comparator operator
18 | bool operator>(const NcVarAtt& lhs,const NcVarAtt& rhs)
19 | {
20 | return true;
21 | }
22 | }
23 |
24 |
25 | using namespace netCDF;
26 |
27 |
28 | // assignment operator
29 | NcVarAtt& NcVarAtt::operator=(const NcVarAtt & rhs)
30 | {
31 | NcAtt::operator=(rhs); // assign base class parts
32 | return *this;
33 | }
34 |
35 | //! The copy constructor.
36 | NcVarAtt::NcVarAtt(const NcVarAtt& rhs):
37 | NcAtt(rhs) // invoke base class copy constructor
38 | {}
39 |
40 |
41 | // Constructor generates a null object.
42 | NcVarAtt::NcVarAtt() :
43 | NcAtt() // invoke base class constructor
44 | {}
45 |
46 |
47 | // Constructor for an existing local attribute.
48 | NcVarAtt::NcVarAtt(const NcGroup& grp, const NcVar& ncVar, const int index):
49 | NcAtt(false)
50 | {
51 | groupId = grp.getId();
52 | varId = ncVar.getId();
53 | // get the name of this attribute
54 | char attName[NC_MAX_NAME+1];
55 | ncCheck(nc_inq_attname(groupId,varId, index, attName),__FILE__,__LINE__);
56 | ncCheck(nc_inq_attname(groupId,varId,index,attName),__FILE__,__LINE__);
57 | myName = attName;
58 | }
59 |
60 | // Returns the NcVar parent object.
61 | NcVar NcVarAtt::getParentVar() const {
62 | return NcVar(groupId,varId);
63 | }
64 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncVarAtt.h:
--------------------------------------------------------------------------------
1 | #include "ncAtt.h"
2 | #include "netcdf.h"
3 |
4 | #ifndef NcVarAttClass
5 | #define NcVarAttClass
6 |
7 | namespace netCDF
8 | {
9 | class NcGroup; // forward declaration.
10 | class NcVar; // forward declaration.
11 |
12 | /*! Class represents a netCDF attribute local to a netCDF variable. */
13 | class NcVarAtt : public NcAtt
14 | {
15 | public:
16 |
17 | /*! assignment operator */
18 | NcVarAtt& operator= (const NcVarAtt& rhs);
19 |
20 | /*! Constructor generates a \ref isNull "null object". */
21 | NcVarAtt ();
22 |
23 | /*! The copy constructor. */
24 | NcVarAtt(const NcVarAtt& rhs) ;
25 |
26 | /*!
27 | Constructor for an existing local attribute.
28 | \param grp Parent Group object.
29 | \param NcVar Parent NcVar object.
30 | \param index The index (id) of the attribute.
31 | */
32 | NcVarAtt(const NcGroup& grp, const NcVar& ncVar, const int index);
33 |
34 | /*! Returns the NcVar parent object. */
35 | NcVar getParentVar() const;
36 |
37 | /*! comparator operator */
38 | friend bool operator<(const NcVarAtt& lhs,const NcVarAtt& rhs);
39 |
40 | /*! comparator operator */
41 | friend bool operator>(const NcVarAtt& lhs,const NcVarAtt& rhs);
42 |
43 | };
44 |
45 | }
46 |
47 | #endif
48 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncVlenType.cpp:
--------------------------------------------------------------------------------
1 | #include "ncVlenType.h"
2 | #include "ncGroup.h"
3 | #include "ncCheck.h"
4 | #include "ncException.h"
5 | #include "ncByte.h"
6 | #include "ncUbyte.h"
7 | #include "ncChar.h"
8 | #include "ncShort.h"
9 | #include "ncUshort.h"
10 | #include "ncInt.h"
11 | #include "ncUint.h"
12 | #include "ncInt64.h"
13 | #include "ncUint64.h"
14 | #include "ncFloat.h"
15 | #include "ncDouble.h"
16 | #include "ncString.h"
17 | #include
18 | using namespace std;
19 | using namespace netCDF;
20 | using namespace netCDF::exceptions;
21 |
22 | // Class represents a netCDF variable.
23 | using namespace netCDF;
24 |
25 | // assignment operator
26 | NcVlenType& NcVlenType::operator=(const NcVlenType& rhs)
27 | {
28 | NcType::operator=(rhs); // assign base class parts
29 | return *this;
30 | }
31 |
32 | // assignment operator
33 | NcVlenType& NcVlenType::operator=(const NcType& rhs)
34 | {
35 | if (&rhs != this) {
36 | // check the rhs is the base of an Opaque type
37 | if(getTypeClass() != NC_VLEN) throw NcException("The NcType object must be the base of an Vlen type.",__FILE__,__LINE__);
38 | // assign base class parts
39 | NcType::operator=(rhs);
40 | }
41 | return *this;
42 | }
43 |
44 | // The copy constructor.
45 | NcVlenType::NcVlenType(const NcVlenType& rhs):
46 | NcType(rhs)
47 | {
48 | }
49 |
50 |
51 | // Constructor generates a null object.
52 | NcVlenType::NcVlenType() :
53 | NcType() // invoke base class constructor
54 | {}
55 |
56 | // constructor
57 | NcVlenType::NcVlenType(const NcGroup& grp, const string& name) :
58 | NcType(grp,name)
59 | {}
60 |
61 | // constructor
62 | NcVlenType::NcVlenType(const NcType& ncType):
63 | NcType(ncType)
64 | {
65 | // check the nctype object is the base of a Vlen type
66 | if(getTypeClass() != NC_VLEN) throw NcException("The NcType object must be the base of a Vlen type.",__FILE__,__LINE__);
67 | }
68 |
69 | // Returns the base type.
70 | NcType NcVlenType::getBaseType() const
71 | {
72 | char charName[NC_MAX_NAME+1];
73 | nc_type base_nc_typep;
74 | size_t datum_sizep;
75 | ncCheck(nc_inq_vlen(groupId,myId,charName,&datum_sizep,&base_nc_typep),__FILE__,__LINE__);
76 | switch (base_nc_typep) {
77 | case NC_BYTE : return ncByte;
78 | case NC_UBYTE : return ncUbyte;
79 | case NC_CHAR : return ncChar;
80 | case NC_SHORT : return ncShort;
81 | case NC_USHORT : return ncUshort;
82 | case NC_INT : return ncInt;
83 | case NC_UINT : return ncUint;
84 | case NC_INT64 : return ncInt64;
85 | case NC_UINT64 : return ncUint64;
86 | case NC_FLOAT : return ncFloat;
87 | case NC_DOUBLE : return ncDouble;
88 | case NC_STRING : return ncString;
89 | default:
90 | // this is a user defined type
91 | return NcType(getParentGroup(),base_nc_typep);
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/ncVlenType.h:
--------------------------------------------------------------------------------
1 | #include
2 | #include "ncType.h"
3 | #include "netcdf.h"
4 |
5 | #ifndef NcVlenTypeClass
6 | #define NcVlenTypeClass
7 |
8 |
9 | namespace netCDF
10 | {
11 | class NcGroup; // forward declaration.
12 |
13 | /*! Class represents a netCDF VLEN type */
14 | class NcVlenType : public NcType
15 | {
16 | public:
17 |
18 | /*! Constructor generates a \ref isNull "null object". */
19 | NcVlenType();
20 |
21 | /*!
22 | Constructor.
23 | The vlen Type must already exist in the netCDF file. New netCDF vlen types can be added
24 | using NcGroup::addNcVlenType();
25 | \param grp The parent group where this type is defined.
26 | \param name Name of new type.
27 | */
28 | NcVlenType(const NcGroup& grp, const std::string& name);
29 |
30 | /*!
31 | Constructor.
32 | Constructs from the base type NcType object. Will throw an exception if the NcType is not the base of a Vlen type.
33 | \param ncType A Nctype object.
34 | */
35 | NcVlenType(const NcType& ncType);
36 |
37 | /*! assignment operator */
38 | NcVlenType& operator=(const NcVlenType& rhs);
39 |
40 | /*!
41 | Assignment operator.
42 | This assigns from the base type NcType object. Will throw an exception if the NcType is not the base of a Vlen type.
43 | */
44 | NcVlenType& operator=(const NcType& rhs);
45 |
46 | /*! The copy constructor. */
47 | NcVlenType(const NcVlenType& rhs);
48 |
49 | ~NcVlenType(){;}
50 |
51 | /*! Returns the base type. */
52 | NcType getBaseType() const;
53 |
54 | };
55 |
56 | }
57 |
58 | #endif
59 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/netcdf_mem.h:
--------------------------------------------------------------------------------
1 | /*! \file netcdf_mem.h
2 | *
3 | * Main header file for in-memory (diskless) functionality.
4 | *
5 | * Copyright 2010 University Corporation for Atmospheric
6 | * Research/Unidata. See COPYRIGHT file for more info.
7 | *
8 | * See \ref copyright file for more info.
9 | *
10 | */
11 |
12 | #ifndef NETCDF_MEM_H
13 | #define NETCDF_MEM_H 1
14 |
15 | #if defined(__cplusplus)
16 | extern "C" {
17 | #endif
18 |
19 | /* Declaration modifiers for DLL support (MSC et al) */
20 | #if defined(DLL_NETCDF) /* define when library is a DLL */
21 | # if defined(DLL_EXPORT) /* define when building the library */
22 | # define MSC_EXTRA __declspec(dllexport)
23 | # else
24 | # define MSC_EXTRA __declspec(dllimport)
25 | # endif
26 | #include
27 | #else
28 | #define MSC_EXTRA
29 | #endif /* defined(DLL_NETCDF) */
30 |
31 | # define EXTERNL MSC_EXTRA extern
32 |
33 | EXTERNL int nc_open_mem(const char* path, int mode, size_t size, void* memory, int* ncidp);
34 |
35 | #if defined(__cplusplus)
36 | }
37 | #endif
38 |
39 | #endif /* NETCDF_MEM_H */
40 |
--------------------------------------------------------------------------------
/libsofa/dependencies/include/netcdf_meta.h:
--------------------------------------------------------------------------------
1 | /*! \file netcdf_meta.h
2 | *
3 | * Meta information for libnetcdf which can be used by other packages which
4 | * depend on libnetcdf.
5 | *
6 | * This file is automatically generated by the build system
7 | * at configure time, and contains information related to
8 | * how libnetcdf was built. It will not be required to
9 | * include this file unless you want to probe the capabilities
10 | * of libnetcdf. This should ideally only happen when configuring
11 | * a project which depends on libnetcdf. At configure time,
12 | * the dependant project can set its own macros which can be used
13 | * in conditionals.
14 | *
15 | * Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
16 | * 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014
17 | * University Corporation for Atmospheric Research/Unidata.
18 | * See \ref copyright file for more info.
19 | */
20 |
21 | #ifndef NETCDF_META_H
22 | #define NETCDF_META_H
23 |
24 | #define NC_VERSION_MAJOR 4 /*!< netcdf-c major version. */
25 | #define NC_VERSION_MINOR 4 /*!< netcdf-c minor version. */
26 | #define NC_VERSION_PATCH 1 /*!< netcdf-c patch version. */
27 | #define NC_VERSION_NOTE "" /*!< netcdf-c note. May be blank. */
28 |
29 | /*! netcdf-c version string.
30 | *
31 | * The format of the netcdf-c version string is as follows:
32 | * \code
33 | * NC_VERSION_MAJOR.NC_VERSION_MINOR.NC_VERSION_PATCH.NC_VERSION_NOTE
34 | * \endcode
35 | * Note that the trailing NC_VERSION_NOTE may be empty. It serves for
36 | * identifiers such as '-rc1', etc.
37 | */
38 | #define NC_VERSION "4.4.1"
39 |
40 | #define NC_HAS_NC2 1 /*!< API version 2 support. */
41 | #define NC_HAS_NC4 1 /*!< API version 4 support. */
42 | #define NC_HAS_HDF4 0 /*!< hdf4 support. */
43 | #define NC_HAS_HDF5 1 /*!< hdf5 support. */
44 | #define NC_HAS_SZIP 0 /*!< szip support (hdf5 only) */
45 | #define NC_HAS_DAP 1 /*!< DAP support. */
46 | #define NC_HAS_DISKLESS 1 /*!< diskless support. */
47 | #define NC_HAS_MMAP 0 /*!< mmap support. */
48 | #define NC_HAS_JNA 0 /*!< jna support. */
49 | #define NC_HAS_PNETCDF 0 /*!< pnetcdf support. */
50 | #define NC_HAS_PARALLEL 0 /*!< parallel IO support via hdf5 and/or pnetcdf. */
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/linux/libcurl.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/linux/libcurl.a
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/linux/libhdf5.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/linux/libhdf5.a
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/linux/libhdf5_hl.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/linux/libhdf5_hl.a
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/linux/libnetcdf.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/linux/libnetcdf.a
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/linux/libnetcdf_c++4.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/linux/libnetcdf_c++4.a
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/linux/libz.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/linux/libz.a
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/macos/libcurl.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/macos/libcurl.a
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/macos/libhdf5.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/macos/libhdf5.a
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/macos/libhdf5_hl.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/macos/libhdf5_hl.a
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/macos/libnetcdf.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/macos/libnetcdf.a
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/macos/libnetcdf_c++4.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/macos/libnetcdf_c++4.a
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/macos/libz.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/macos/libz.a
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/i386/hdf5.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/i386/hdf5.dll
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/i386/hdf5_hl.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/i386/hdf5_hl.dll
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/i386/libcurl.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/i386/libcurl.dll
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/i386/libnetcdf.settings:
--------------------------------------------------------------------------------
1 | # NetCDF C Configuration Summary
2 | ==============================
3 |
4 | # General
5 | -------
6 | NetCDF Version: 4.4.1
7 | Configured On: Tue Jun 28 14:36:31 MDT 2016
8 | Host System: i686-MINGW32_NT-6.2-1.0.18(0.48/3/2)
9 | Build Directory: G:/netcdf-c/all_builds/build_4.4.1-NC4-DAP-32
10 | Install Prefix: C:/Program Files (x86)/netCDF
11 |
12 | # Compiling Options
13 | -----------------
14 | C Compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe
15 | CFLAGS: /DWIN32 /D_WINDOWS /W3 /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
16 | CPPFLAGS:
17 | LDFLAGS: /machine:X86 /LARGEADDRESSAWARE /STACK:40000000 /debug /INCREMENTAL
18 | AM_CFLAGS:
19 | AM_CPPFLAGS:
20 | AM_LDFLAGS:
21 | Shared Library: yes
22 | Static Library: no
23 | Extra libraries: -lhdf5-shared -lhdf5_hl-shared -lzlib -lcurl_imp
24 |
25 | # Features
26 | --------
27 | NetCDF-2 API: yes
28 | HDF4 Support: no
29 | NetCDF-4 API: yes
30 | NC-4 Parallel Support: no
31 | PNetCDF Support: no
32 | DAP Support: yes
33 | Diskless Support: yes
34 | MMap Support: no
35 | JNA Support: no
36 |
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/i386/netcdf.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/i386/netcdf.dll
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/i386/zlib1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/i386/zlib1.dll
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/libcurl_imp.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/libcurl_imp.lib
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/libcurl_imp_x64.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/libcurl_imp_x64.lib
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/libhdf5.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/libhdf5.lib
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/libhdf5_hl.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/libhdf5_hl.lib
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/libhdf5_hl_x64.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/libhdf5_hl_x64.lib
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/libhdf5_x64.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/libhdf5_x64.lib
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/netcdf.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/netcdf.lib
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/netcdf_x64.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/netcdf_x64.lib
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/x64/hdf5.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/x64/hdf5.dll
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/x64/hdf5_hl.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/x64/hdf5_hl.dll
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/x64/libcurl.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/x64/libcurl.dll
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/x64/libnetcdf.settings:
--------------------------------------------------------------------------------
1 | # NetCDF C Configuration Summary
2 | ==============================
3 |
4 | # General
5 | -------
6 | NetCDF Version: 4.4.1
7 | Configured On: Tue Jun 28 14:36:38 MDT 2016
8 | Host System: i686-MINGW32_NT-6.2-1.0.18(0.48/3/2)
9 | Build Directory: G:/netcdf-c/all_builds/build_4.4.1-NC4-DAP-64
10 | Install Prefix: C:/Program Files/netCDF
11 |
12 | # Compiling Options
13 | -----------------
14 | C Compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe
15 | CFLAGS: /DWIN32 /D_WINDOWS /W3 /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1
16 | CPPFLAGS:
17 | LDFLAGS: /machine:x64 /LARGEADDRESSAWARE /STACK:40000000 /debug /INCREMENTAL
18 | AM_CFLAGS:
19 | AM_CPPFLAGS:
20 | AM_LDFLAGS:
21 | Shared Library: yes
22 | Static Library: no
23 | Extra libraries: -lhdf5-shared -lhdf5_hl-shared -lzlib -lcurl_imp
24 |
25 | # Features
26 | --------
27 | NetCDF-2 API: yes
28 | HDF4 Support: no
29 | NetCDF-4 API: yes
30 | NC-4 Parallel Support: no
31 | PNetCDF Support: no
32 | DAP Support: yes
33 | Diskless Support: yes
34 | MMap Support: no
35 | JNA Support: no
36 |
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/x64/netcdf.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/x64/netcdf.dll
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/x64/zlib1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/x64/zlib1.dll
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/zlib.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/zlib.lib
--------------------------------------------------------------------------------
/libsofa/dependencies/lib/win/zlib_x64.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/dependencies/lib/win/zlib_x64.lib
--------------------------------------------------------------------------------
/libsofa/dependencies/sofa_build_dependencies_linux.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ####################################################################
4 | # @brief This script build the dependencies libs for SOFA
5 | # namely this builds zlib, curl, hdf5, netcdf and netcdf-c++
6 | # @author Thibaut Carpentier, Ircam-Centre Pompidou-CNRS
7 | #
8 | # @details Tested on Linux gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-54)
9 | #
10 |
11 | # the folder where the build occurs
12 | DEP_BUILD_FOLDER=$HOME/src/sofa_netcdf/build
13 |
14 | # the destination folder
15 | DEP_INSTALLATION_FOLDER=$HOME/src/sofa_netcdf/destination
16 |
17 | #
18 | ZLIB_LIB=zlib-1.2.8
19 | CURL_LIB=curl-7.37.1
20 | HDF5_LIB=hdf5-1.8.13
21 | NETCDF_LIB=netcdf-4.3.2
22 | NETCDF_CXX_LIB=netcdf-cxx4-4.2
23 |
24 | # standard library
25 | #STD_LIB=libstdc++
26 |
27 | # build options
28 | BUILD_OPT="-fPIC "
29 |
30 | ############################################################
31 | # Building zlib with i386 and x86_64 arch
32 | echo "Building: ${ZLIB_LIB}"
33 | cd $DEP_BUILD_FOLDER
34 | tar zxf $ZLIB_LIB.tar.gz
35 | cd $ZLIB_LIB
36 | CFLAGS="-O3 $BUILD_OPT " ./configure --prefix=$DEP_INSTALLATION_FOLDER --static
37 | make install
38 |
39 | ############################################################
40 | # echo "Building: ${CURL_LIB}"
41 | cd $DEP_BUILD_FOLDER
42 | rm -Rf curl-universal
43 | mkdir curl-universal
44 | #mkdir curl-universal/x86_64
45 |
46 | # Building curl with x86_64 arch
47 | cd $DEP_BUILD_FOLDER
48 | tar zxf $CURL_LIB.tar.gz
49 | mv $CURL_LIB curl-universal/x86_64
50 | cd curl-universal/x86_64
51 | CFLAGS="-O3 $BUILD_OPT " ./configure --prefix=$DEP_INSTALLATION_FOLDER --without-ssl --disable-ldap --with-zlib=$DEP_INSTALLATION_FOLDER --disable-shared --with-pic
52 | make install
53 |
54 | mv $DEP_INSTALLATION_FOLDER/include/curl/* $DEP_INSTALLATION_FOLDER/include
55 |
56 | ############################################################
57 | cd $DEP_BUILD_FOLDER
58 | rm -Rf hdf5-universal
59 | mkdir hdf5-universal
60 | mkdir hdf5-universal/x86_64
61 |
62 | # Building hdf5 with x86_64 arch
63 | cd $DEP_BUILD_FOLDER
64 | tar zxf $HDF5_LIB.tar.gz
65 | mv $HDF5_LIB hdf5-universal/x86_64
66 | cd hdf5-universal/x86_64/$HDF5_LIB
67 | CFLAGS="$BUILD_OPT " CPPFLAGS="$BUILD_OPT " ./configure --with-zlib=$DEP_INSTALLATION_FOLDER --prefix=$DEP_INSTALLATION_FOLDER --disable-shared --with-pic --disable-debug --enable-static-exec
68 | make install
69 |
70 |
71 | ############################################################
72 | NETCDF_OPTS="--enable-netcdf-4 --disable-shared --enable-dap --with-pic --disable-examples"
73 |
74 | cd $DEP_BUILD_FOLDER
75 | rm -Rf netcdf-universal
76 | mkdir netcdf-universal
77 |
78 | # Building netcdf with x86_64 arch
79 | cd $DEP_BUILD_FOLDER
80 | tar zxf $NETCDF_LIB.tar.gz
81 | mv $NETCDF_LIB netcdf-universal/x86_64
82 | cd netcdf-universal/x86_64
83 | ./configure CPPFLAGS="-I$DEP_INSTALLATION_FOLDER/include $BUILD_OPT" LDFLAGS="-L$DEP_INSTALLATION_FOLDER/lib" LIBS="-lz -lhdf5 -lhdf5_hl -lcurl -ldl" --prefix=$DEP_INSTALLATION_FOLDER $NETCDF_OPTS
84 | make install
85 |
86 | ############################################################
87 | #NETCDF_CXX_OPTS="--disable-shared --disable-dap"
88 | NETCDF_CXX_OPTS="--disable-shared --with-pic"
89 |
90 | # Building netcdf-cxx with i386 arch
91 | cd $DEP_BUILD_FOLDER
92 | rm -Rf netcdf-cxx-universal
93 | mkdir netcdf-cxx-universal
94 |
95 |
96 | cd $DEP_BUILD_FOLDER
97 | tar zxf $NETCDF_CXX_LIB.tar.gz
98 | mv $NETCDF_CXX_LIB netcdf-cxx-universal/x86_64
99 | cd netcdf-cxx-universal/x86_64
100 |
101 | CPPFLAGS="$BUILD_OPT -I$DEP_INSTALLATION_FOLDER/include" LDFLAGS=" -L$DEP_INSTALLATION_FOLDER/lib" LIBS="-lz -lhdf5 -lhdf5_hl -lnetcdf -lcurl -ldl" ./configure --prefix=$DEP_INSTALLATION_FOLDER $NETCDF_CXX_OPTS
102 | make install
103 |
104 |
--------------------------------------------------------------------------------
/libsofa/dependencies/sofa_build_dependencies_linux_2016.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ####################################################################
4 | # @brief This script build the dependencies libs for SOFA
5 | # namely this builds zlib, curl, hdf5, netcdf and netcdf-c++
6 | # @author Thibaut Carpentier, Ircam-Centre Pompidou-CNRS
7 | #
8 | # @details Tested on Linux gcc (Debian 4.9.2-10) 4.9.2
9 | #
10 |
11 | # the folder where the build occurs
12 | DEP_BUILD_FOLDER=$HOME/forge/sofa_netcdf/build
13 |
14 | # the destination folder
15 | DEP_INSTALLATION_FOLDER=$HOME/forge/sofa_netcdf/destination
16 |
17 | # these files must be downloaded and unzip prior to running this script
18 | # place all these files in the DEP_BUILD_FOLDER folder
19 |
20 | ZLIB_LIB=zlib-1.2.11
21 | CURL_LIB=curl-7.52.1
22 | HDF5_LIB=hdf5-1.10.0-patch1
23 | NETCDF_LIB=netcdf-c-4.4.1.1
24 | NETCDF_CXX_LIB=netcdf-cxx4-4.2
25 |
26 | #ZLIB_LIB=zlib-1.2.8
27 | #CURL_LIB=curl-7.50.3
28 | #HDF5_LIB=hdf5-1.10.0-patch1
29 | #NETCDF_LIB=netcdf-c-4.4.1
30 | #NETCDF_CXX_LIB=netcdf-cxx4-4.3.0
31 |
32 | # standard library
33 | #STD_LIB=libstdc++
34 |
35 | # build options
36 | BUILD_OPT="-fPIC "
37 |
38 | ############################################################
39 | # Building zlib with i386 and x86_64 arch
40 | echo "Building: ${ZLIB_LIB}"
41 | cd $DEP_BUILD_FOLDER
42 | cd $ZLIB_LIB
43 | make clean
44 | chmod +x configure
45 | CFLAGS="-O3 $BUILD_OPT " ./configure --prefix=$DEP_INSTALLATION_FOLDER --static
46 | make install
47 |
48 | ############################################################
49 | # echo "Building: ${CURL_LIB}"
50 | # Building curl with x86_64 arch
51 | cd $DEP_BUILD_FOLDER
52 | cd $CURL_LIB
53 | chmod +x configure
54 | make clean
55 | CFLAGS="-O3 $BUILD_OPT " ./configure --prefix=$DEP_INSTALLATION_FOLDER --without-ssl --disable-ldap --with-zlib=$DEP_INSTALLATION_FOLDER --disable-shared --with-pic
56 | make install
57 |
58 | mv $DEP_INSTALLATION_FOLDER/include/curl/* $DEP_INSTALLATION_FOLDER/include
59 |
60 | ############################################################
61 | # Building hdf5 with x86_64 arch
62 | cd $DEP_BUILD_FOLDER
63 | cd $HDF5_LIB
64 | chmod +x configure
65 | make clean
66 | CFLAGS="$BUILD_OPT " CPPFLAGS="$BUILD_OPT " ./configure --with-zlib=$DEP_INSTALLATION_FOLDER --prefix=$DEP_INSTALLATION_FOLDER --disable-shared --with-pic --enable-static-exec --enable-build-mode=production
67 | make install
68 |
69 |
70 | ############################################################
71 | NETCDF_OPTS="--enable-netcdf-4 --disable-shared --enable-dap --with-pic --disable-examples"
72 |
73 | # Building netcdf with x86_64 arch
74 | cd $DEP_BUILD_FOLDER
75 | cd $NETCDF_LIB
76 | chmod +x configure
77 | make clean
78 | ./configure CFLAGS="-I$DEP_INSTALLATION_FOLDER/include $BUILD_OPT" LDFLAGS="-L$DEP_INSTALLATION_FOLDER/lib" LIBS="-lz -lhdf5 -lhdf5_hl -lcurl -ldl" --prefix=$DEP_INSTALLATION_FOLDER $NETCDF_OPTS
79 | make install
80 |
81 | ############################################################
82 | NETCDF_CXX_OPTS="--disable-shared --with-pic"
83 |
84 | cd $DEP_BUILD_FOLDER
85 | cd $NETCDF_CXX_LIB
86 | chmod +x configure
87 | make clean
88 | CPPFLAGS="$BUILD_OPT -I$DEP_INSTALLATION_FOLDER/include" LDFLAGS=" -L$DEP_INSTALLATION_FOLDER/lib" LIBS="-lz -lhdf5 -lhdf5_hl -lnetcdf -lcurl -ldl" ./configure --prefix=$DEP_INSTALLATION_FOLDER $NETCDF_CXX_OPTS
89 | make install
90 |
91 |
--------------------------------------------------------------------------------
/libsofa/doc/LICENCE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2013-2014, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 | * Redistributions of source code must retain the above copyright
7 | notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | * Neither the name of the nor the
12 | names of its contributors may be used to endorse or promote products
13 | derived from this software without specific prior written permission.
14 |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 |
26 |
27 |
28 | Spatial acoustic data file format - AES X212 standard
29 | http://www.aes.org
30 |
31 | SOFA (Spatially Oriented Format for Acoustics)
32 | http://www.sofaconventions.org
33 |
34 |
--------------------------------------------------------------------------------
/libsofa/doc/README.md:
--------------------------------------------------------------------------------
1 | [S]patially [O]riented [F]ormat for [A]coustics, C++ library.
2 | ==============================
3 |
4 | Library for reading and writing the standartized .sofa file format (AES69-2015).
5 |
6 | Changes to libSOFA-master:
7 | ------------
8 |
9 | Added cmake build file and included static windows libraries (compiled with minGW on a x86 machine for both 32 and 64 bit targets). That means it should be possible to build libSOFA with this fork on windows 32/64Bit (running on x86 architecture) on-the-fly. Cmake and the minGW-w64 (both available for i686 [32Bit] and x64 [64Bit]) compiler is required.
10 |
11 | Instructions to build dependencies from source:
12 | ------------
13 |
14 | Ref.: This is a build instruction based on MSYS2 with the minGW compiler on windows. It can help you on other systems too, but there you wouldn't work with the MSYS2 console and the minGW compiler. There, you have to find the suitable command line instructions. Additionally, This is no general solution to serve all possible system situations. I'd like to see it more like a hint to get things work properly. We need curl, zlib, hdf5 and netcdf (c and c++).
15 |
16 | Ok, here we go:
17 |
18 | - Install MSYS2 from https://sourceforge.net/projects/msys2/ . Afterwards, an update is recommended. Open the MSYS2 console and type:
19 |
20 | ``pacman-syu`` >>>restart MSYS2 console<<< ``pacman -Su``
21 |
22 | - We need a compiler. ``pacman -S mingw-w64-i686`` for 32 bit or ``pacman -S mingw-w64-x86_64`` for 64 bit minGW.
23 |
24 | - Close the MSYS2 console and start the convenient mingw32 or mingw64 console (bash scripts in MSYS2 directory), pending on the compiler installation before (32 or 64 bit).
25 |
26 | - You have to install several libraries and linux-like library wrappers: make, dlfcn, hdf5, netcdf, curl. ``pacman -Ss [fill on your own]`` plus a name hint will inform you about avilable up-to-date packages for each compiler, try ``pacman -Ss dlfcn`` and you'll see what I mean. Zlib is shipped with MinGW, so you don't need to install it.
27 |
28 | - Unfortunalety, netcdf-c++4 is not available yet with pacman (maybe it is at the time when you read this? Try it with the command above). We need to build it from source. Download the netcdf_c++ unix-style source code (google will help you to find it) and navigate inside the mingw shell to the directory and configure the build with ``./configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32`` with the 64 bit compiler version, or ``./configure --host=i686-w64-mingw32 --build=i686-w64-mingw32`` with the 32Bit compiler version. then ``make`` and ``make install`` will compile static libraries and place them in the mingw lib folder.
29 |
30 | Congratulations, now you have all the required libraries in your MSYS/minGW library folder. Link to them when building libSOFA (easiest and dirtiest is to copy them into your source directory) and everything should work fine.
31 |
--------------------------------------------------------------------------------
/libsofa/doc/README.txt:
--------------------------------------------------------------------------------
1 | This is a readme file for the SOFA C++ API.
2 |
3 | Contact : Thibaut Carpentier
4 | first name dot last name at ircam dot fr
5 |
6 |
7 | The SOFA API depends on the following libraries:
8 | - zlib
9 | - curl
10 | - hdf5
11 | - netcdf
12 | - netcdf C++
13 |
14 | The 'dependencies' folder contains pre-compiled static libraries for OSX and linux.
15 | I used the following versions:
16 | zlib-1.2.8
17 | curl-7.37.1
18 | hdf5-1.8.13
19 | netcdf-4.3.2
20 | netcdf-cxx4-4.2
21 |
22 | The OSX pre-compiled libraries are built for i386 and x86_64 architectures,
23 | for OSX 10.6 or higher.
24 | They were built and tested on OSX 10.9.4 with Xcode 5.1.1, using libstdc++ as the standard library.
25 |
26 | The Linux pre-compiled libraries are built for x86_64 architecture.
27 | They were built and tested on Red Hat 4.1.2-54 (kernel version 2.6.18-371.1.2.el5).
28 | gcc version 4.1.2
29 |
30 | Besides the main SOFA library, there is also 'sofainfo' which is a command line utility
31 | that prints informations about sofa files.
32 | The 'sofainfo.cpp' is thus a basic example on how to use the API, especially for
33 | a SimpleFreeFieldHRIR file.
34 |
35 |
36 | The repository also includes additional contributions from Hagen Jaeger and Christian Hoene.
37 | This includes:
38 | - a sofa/json converter based on the json-c library
39 | - cmake file for Win32 / 64 MinGW build
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/libsofa/doc/libsofa.changelog.txt:
--------------------------------------------------------------------------------
1 | /************************************************************************************/
2 | /*!
3 | * @file libsofa.changelog.txt
4 | * @brief Changelog for libsofa library
5 | * @author Thibaut Carpentier
6 | * @date 15/07/2013
7 | *
8 | /************************************************************************************/
9 |
10 | ****************************************************************
11 | @version 1.1.4
12 | @author Thibaut Carpentier
13 | @date 04/2017
14 |
15 | * lots of code cleanup and cosmetic improvements
16 | * added GeneralFIRE convention
17 | * added MultiSpeakerBRIR convention
18 | * added SingleRoomDRIR convention
19 | * added Windows projects + precompiled dependencies for Windows (32/64 bits)
20 | * added pull requests from Christian Hoene (sofa/json converter) and Hagen Jaeger (cmake file for Win32 / 64 MinGW build)
21 |
22 | ****************************************************************
23 | @version 1.0.4
24 | @author Thibaut Carpentier
25 | @date 03/2015
26 |
27 | * added SimpleFreeFieldSOS convention
28 | * added SimpleHeadphoneIR convention
29 | * added GeneralFIR convention
30 | * added GeneralTF convention
31 | * according to AES69-2015, Data.SamplingRate can be [I] or [M], unlike previous versions
32 | of this library. The code is updated accordingly.
33 |
34 | ****************************************************************
35 | @version 1.0.3
36 | @author Thibaut Carpentier
37 | @date 01/2015
38 |
39 | * added new Units aliases, according to latest changes in AES standard
40 | * Mac OS :
41 | - use libc++ instead of libstdc++
42 | - use SDK OSX 10.10
43 | - Min deployment target is now OSX >= 10.7
44 | (dependency libraries are re-built accordingly)
45 |
46 | ****************************************************************
47 | @version 1.0.2
48 | @author Thibaut Carpentier
49 | @date 10/2014
50 |
51 | * sofa::File::GetDataSamples moved to sofa::SimpleFreeFieldHRIR::GetDataIR for consistency
52 | * added sofa::SimpleFreeFieldHRIR::GetDataDelay
53 | * removed SOFAConfig.h (the DEBUG or _DEBUG macro was problematic)
54 | * added helper functions :
55 | sofa::IsValidNetCDFFile, sofa::IsValidSOFAFile, sofa::IsValidSimpleFreeFieldHRIRFile
56 | * added sofa::NetCDFFile::GetValues(std::vector< double > &values, const std::string &variableName)
57 | and other similar methods
58 | * added misc examples in sofaexamples.cpp
59 | * cosmetic changes all over the place
60 | * sofa::SimpleFreeFieldHRIR::IsValidSimpleFreeFieldHRIRFile renamed sofa::SimpleFreeFieldHRIR::IsValid for consistency
61 | * sofa::File::IsValidSOFAFile renamed sofa::File::IsValid for consistency
62 |
63 | ****************************************************************
64 | @version 1.0.1
65 | @author Thibaut Carpentier
66 | @date 10/2014
67 |
68 | * adding a few functions in the NetCDFFile class (NetCDFFile::GetAllCharAttributes, etc.)
69 | * fixing mac os linker flags (thanks to Harald)
70 |
71 | ****************************************************************
72 | @version 1.0.0
73 | @author Thibaut Carpentier
74 | @date 09/2014
75 |
76 | * first release on sourceforge
77 |
78 | ****************************************************************
79 | @version 0.2.0
80 | @author Thibaut Carpentier
81 | @date 01/2014
82 |
83 | * updating according to the latest AES X-212 draft
84 |
85 | ****************************************************************
86 | @version 0.0.2
87 | @author Thibaut Carpentier
88 | @date 07/2013
89 |
90 | * Using C++ exceptions rather than error code, whenever it's possible.
91 |
--------------------------------------------------------------------------------
/libsofa/lib/libsofa.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/lib/libsofa.a
--------------------------------------------------------------------------------
/libsofa/lib/sofaexamples:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/lib/sofaexamples
--------------------------------------------------------------------------------
/libsofa/lib/sofainfo:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/lib/sofainfo
--------------------------------------------------------------------------------
/libsofa/lib/sofamisc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sofacoustics/API_Cpp/2c5c3e269f66f5d6854bb9941937d43f8578fd04/libsofa/lib/sofamisc
--------------------------------------------------------------------------------
/libsofa/src/SOFA.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFA.h
42 | * @brief Spatially Oriented Format for Acoustics
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | *
48 | * @see "Spatially Oriented Format for Acoustics:
49 | * A Data Exchange Format Representing Head-Related Transfer Functions"
50 | *
51 | * Piotr Majdak, Yukio Iwaya, Thibaut Carpentier, Rozenn Nicol, Matthieu Parmentier,
52 | * Agnieszka Roginska, Yôiti Suzuki, Kanji Watanabe, Hagen Wierstorf, Harald Ziegelwanger, and Markus Noisternig
53 | *
54 | * Presented at the 134th Audio Engineering Society Convention,
55 | * 2013 May 4–7 Rome, Italy
56 | */
57 | /************************************************************************************/
58 | #ifndef _SOFA_H__
59 | #define _SOFA_H__
60 |
61 | //==============================================================================
62 | /// public API
63 | //==============================================================================
64 | #include "../src/SOFAAPI.h"
65 | #include "../src/SOFAAttributes.h"
66 | #include "../src/SOFACoordinates.h"
67 | #include "../src/SOFAFile.h"
68 | #include "../src/SOFANcFile.h"
69 | #include "../src/SOFAPlatform.h"
70 | #include "../src/SOFASimpleFreeFieldHRIR.h"
71 | #include "../src/SOFASimpleFreeFieldSOS.h"
72 | #include "../src/SOFASimpleHeadphoneIR.h"
73 | #include "../src/SOFAMultiSpeakerBRIR.h"
74 | #include "../src/SOFAGeneralFIR.h"
75 | #include "../src/SOFAGeneralFIRE.h"
76 | #include "../src/SOFAGeneralTF.h"
77 | #include "../src/SOFASingleRoomDRIR.h"
78 | #include "../src/SOFAUnits.h"
79 | #include "../src/SOFAVersion.h"
80 | #include "../src/SOFAHelper.h"
81 |
82 | //==============================================================================
83 | /// private files
84 | //==============================================================================
85 | //#include "../src/SOFAHostArchitecture.h"
86 | //#include "../src/SOFAExceptions.h"
87 | //#include "../src/SOFAString.h"
88 | //#include "../src/SOFADate.h"
89 | //#include "../src/SOFAEmitter.h"
90 | //#include "../src/SOFAListener.h"
91 | //#include "../src/SOFANcUtils.h"
92 | //#include "../src/SOFAPosition.h"
93 | //#include "../src/SOFAReceiver.h"
94 | //#include "../src/SOFASource.h"
95 | //#include "../src/SOFAUtils.h"
96 |
97 | #endif /* _SOFA_H__ */
98 |
99 |
--------------------------------------------------------------------------------
/libsofa/src/SOFACoordinates.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFACoordinates.h
42 | * @brief SOFA Coordinates systems
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_COORDINATES_H__
50 | #define _SOFA_COORDINATES_H__
51 |
52 | #include "../src/SOFAPlatform.h"
53 | #include "netcdf.h"
54 | #include "ncFile.h"
55 |
56 | namespace sofa
57 | {
58 |
59 | /************************************************************************************/
60 | /*!
61 | * @class Coordinates
62 | * @brief Static class to represent information about SOFA coordinates
63 | *
64 | * @details So far, SOFA specifications consider two coordinates system: cartesian and spherical
65 | */
66 | /************************************************************************************/
67 | class SOFA_API Coordinates
68 | {
69 | public:
70 |
71 | enum Type
72 | {
73 | kCartesian = 0, ///< cartesian
74 | kSpherical = 1, ///< spherical
75 | kNumCoordinatesTypes = 2
76 | };
77 |
78 | public:
79 | static std::string GetName(const sofa::Coordinates::Type &type_);
80 | static sofa::Coordinates::Type GetType(const std::string &name);
81 |
82 | static bool IsValid(const std::string &name);
83 |
84 | static bool IsValid(const netCDF::NcAtt & attr);
85 |
86 | private:
87 | Coordinates() SOFA_DELETED_FUNCTION;
88 | };
89 |
90 | }
91 |
92 | #endif /* _SOFA_COORDINATES_H__ */
93 |
--------------------------------------------------------------------------------
/libsofa/src/SOFADate.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFADate.h
42 | * @brief Useful methods to represent and manipulate date and time
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_DATE_H__
50 | #define _SOFA_DATE_H__
51 |
52 | #include "../src/SOFAPlatform.h"
53 |
54 | namespace sofa
55 | {
56 |
57 | /************************************************************************************/
58 | /*!
59 | * @class Date
60 | * @brief Useful methods to represent and manipulate date and time
61 | *
62 | * @details When saved as attributes string in ISO 8601 format “yyyy-mm-dd HH:MM:SS” is used.
63 | */
64 | /************************************************************************************/
65 | class SOFA_API Date
66 | {
67 | public:
68 | static Date GetCurrentDate();
69 |
70 | static long long GetCurrentSystemTime();
71 |
72 | static bool IsValid(const std::string &iso8601);
73 |
74 | public:
75 | Date();
76 | ~Date() {};
77 |
78 | Date(const std::string &iso8601);
79 |
80 | Date(const Date &other);
81 | Date & operator= (const Date &other);
82 |
83 | Date( const unsigned int year,
84 | const unsigned int month_,
85 | const unsigned int day,
86 | const unsigned int hours,
87 | const unsigned int minutes,
88 | const unsigned int seconds = 0,
89 | const unsigned int milliseconds = 0);
90 |
91 | explicit Date(const long long millisecondsSinceEpoch);
92 |
93 | long long GetMillisecondsSinceEpoch() const;
94 |
95 | //==============================================================================
96 | unsigned int GetYear() const;
97 | unsigned int GetMonth() const;
98 | unsigned int GetDay() const;
99 | unsigned int GetHours() const;
100 | unsigned int GetMinutes() const;
101 | unsigned int GetSeconds() const;
102 | unsigned int GetMilliSeconds() const;
103 |
104 | std::string ToISO8601() const;
105 |
106 | bool IsValid() const;
107 |
108 | private:
109 | static unsigned long long getMillisecondsSinceStartup();
110 |
111 | private:
112 | long long millisSinceEpoch;
113 | };
114 |
115 | }
116 |
117 | #endif /* _SOFA_DATE_H__ */
118 |
119 |
--------------------------------------------------------------------------------
/libsofa/src/SOFAExceptions.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFAExceptions.h
42 | * @brief Exception handling
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_EXCEPTIONS_H__
50 | #define _SOFA_EXCEPTIONS_H__
51 |
52 | #include "../src/SOFAPlatform.h"
53 | #include
54 |
55 | namespace sofa
56 | {
57 |
58 | /************************************************************************************/
59 | /*!
60 | * @class Exception
61 | * @brief Exception handling
62 | *
63 | */
64 | /************************************************************************************/
65 | class SOFA_API Exception : public std::exception
66 | {
67 | public:
68 | static void LogToCerr(const bool value);
69 | static bool IsLoggedToCerr();
70 |
71 | public:
72 | Exception(const std::string &text = "unknown exception",
73 | const std::string &file = "",
74 | const unsigned long line_ = 0,
75 | const bool exitAfterException = false);
76 |
77 | virtual ~Exception() SOFA_NOEXCEPT {};
78 | virtual const char* what() const SOFA_NOEXCEPT SOFA_OVERRIDE;
79 |
80 | const std::string & GetFile() const;
81 | unsigned long GetLine() const;
82 |
83 | private:
84 | static std::string getFileName(const std::string & fullfilename);
85 |
86 | static bool logToCerr;
87 |
88 | private:
89 | const std::string filename; ///< name of the file where the exception occured
90 | const std::string description; ///< description of the exception
91 | const unsigned long line; ///< line number where the exception ocurred
92 | };
93 |
94 | /**
95 | @brief Handy macro to throw a SOFA exception
96 | */
97 | #define SOFA_THROW( message )\
98 | {\
99 | throw sofa::Exception( message, __FILE__ , __LINE__ );\
100 | }
101 |
102 | }
103 |
104 | #endif /* _SOFA_EXCEPTIONS_H__ */
105 |
106 |
--------------------------------------------------------------------------------
/libsofa/src/SOFAGeneralFIR.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFAGeneralFIR.h
42 | * @brief Class for SOFA files with GeneralFIR convention
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_GENERAL_FIR_H__
50 | #define _SOFA_GENERAL_FIR_H__
51 |
52 | #include "../src/SOFAFile.h"
53 |
54 | namespace sofa
55 | {
56 |
57 | /************************************************************************************/
58 | /*!
59 | * @class GeneralFIR
60 | * @brief Class for SOFA files with GeneralFIR convention
61 | *
62 | * @details Provides methods specific to SOFA files with GeneralFIR convention
63 | */
64 | /************************************************************************************/
65 | class SOFA_API GeneralFIR : public sofa::File
66 | {
67 | public:
68 | static const unsigned int ConventionVersionMajor;
69 | static const unsigned int ConventionVersionMinor;
70 | static std::string GetConventionVersion();
71 |
72 | public:
73 | GeneralFIR(const std::string &path,
74 | const netCDF::NcFile::FileMode &mode = netCDF::NcFile::read);
75 |
76 | virtual ~GeneralFIR() {};
77 |
78 | virtual bool IsValid() const SOFA_OVERRIDE;
79 |
80 | bool GetSamplingRate(double &value) const;
81 | bool GetSamplingRateUnits(sofa::Units::Type &units) const;
82 |
83 | //==============================================================================
84 | bool GetDataIR(std::vector< double > &values) const;
85 | bool GetDataIR(double *values, const unsigned long dim1, const unsigned long dim2, const unsigned long dim3) const;
86 |
87 | //==============================================================================
88 | bool GetDataDelay(double *values, const unsigned long dim1, const unsigned long dim2) const;
89 | bool GetDataDelay(std::vector< double > &values) const;
90 |
91 | private:
92 | //==============================================================================
93 | bool checkGlobalAttributes() const;
94 |
95 | private:
96 | /// avoid shallow and copy constructor
97 | SOFA_AVOID_COPY_CONSTRUCTOR( GeneralFIR );
98 | };
99 |
100 | }
101 |
102 | #endif /* _SOFA_GENERAL_FIR_H__ */
103 |
104 |
--------------------------------------------------------------------------------
/libsofa/src/SOFAGeneralFIRE.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFAGeneralFIRE.h
42 | * @brief Class for SOFA files with GeneralFIRE convention
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 14/04/2017
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_GENERAL_FIRE_H__
50 | #define _SOFA_GENERAL_FIRE_H__
51 |
52 | #include "../src/SOFAFile.h"
53 |
54 | namespace sofa
55 | {
56 |
57 | /************************************************************************************/
58 | /*!
59 | * @class GeneralFIRE
60 | * @brief Class for SOFA files with GeneralFIRE convention
61 | *
62 | * @details Provides methods specific to SOFA files with GeneralFIRE convention
63 | */
64 | /************************************************************************************/
65 | class SOFA_API GeneralFIRE : public sofa::File
66 | {
67 | public:
68 | static const unsigned int ConventionVersionMajor;
69 | static const unsigned int ConventionVersionMinor;
70 | static std::string GetConventionVersion();
71 |
72 | public:
73 | GeneralFIRE(const std::string &path,
74 | const netCDF::NcFile::FileMode &mode = netCDF::NcFile::read);
75 |
76 | virtual ~GeneralFIRE() {};
77 |
78 | virtual bool IsValid() const SOFA_OVERRIDE;
79 |
80 | bool GetSamplingRate(double &value) const;
81 | bool GetSamplingRateUnits(sofa::Units::Type &units) const;
82 |
83 | //==============================================================================
84 | bool GetDataIR(std::vector< double > &values) const;
85 | bool GetDataIR(double *values, const unsigned long dim1, const unsigned long dim2, const unsigned long dim3, const unsigned long dim4) const;
86 |
87 | //==============================================================================
88 | bool GetDataDelay(double *values, const unsigned long dim1, const unsigned long dim2, const unsigned long dim3) const;
89 |
90 | private:
91 | //==============================================================================
92 | bool checkGlobalAttributes() const;
93 |
94 | private:
95 | /// avoid shallow and copy constructor
96 | SOFA_AVOID_COPY_CONSTRUCTOR( GeneralFIRE );
97 | };
98 |
99 | }
100 |
101 | #endif /* _SOFA_GENERAL_FIRE_H__ */
102 |
103 |
--------------------------------------------------------------------------------
/libsofa/src/SOFAGeneralTF.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFAGeneralTF.cpp
42 | * @brief Class for SOFA files with GeneralTF convention
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #include "../src/SOFAGeneralTF.h"
50 | #include "../src/SOFAExceptions.h"
51 | #include "../src/SOFAUtils.h"
52 | #include "../src/SOFANcUtils.h"
53 | #include "../src/SOFAString.h"
54 | #include "../src/SOFAListener.h"
55 |
56 | using namespace sofa;
57 |
58 | const unsigned int GeneralTF::ConventionVersionMajor = 1;
59 | const unsigned int GeneralTF::ConventionVersionMinor = 0;
60 |
61 | std::string GeneralTF::GetConventionVersion()
62 | {
63 | return sofa::String::Int2String( GeneralTF::ConventionVersionMajor ) + std::string(".") + sofa::String::Int2String( GeneralTF::ConventionVersionMinor );
64 | }
65 |
66 | /************************************************************************************/
67 | /*!
68 | * @brief Class constructor
69 | * @param[in] path : the file path
70 | * @param[in] mode : opening mode
71 | *
72 | */
73 | /************************************************************************************/
74 | GeneralTF::GeneralTF(const std::string &path,
75 | const netCDF::NcFile::FileMode &mode)
76 | : sofa::File( path, mode )
77 | {
78 | }
79 |
80 | bool GeneralTF::checkGlobalAttributes() const
81 | {
82 | sofa::Attributes attributes;
83 | GetGlobalAttributes( attributes );
84 |
85 | sofa::File::ensureSOFAConvention( "GeneralTF" );
86 | sofa::File::ensureDataType( "TF" );
87 |
88 | return true;
89 | }
90 |
91 | /************************************************************************************/
92 | /*!
93 | * @brief Returns true if this is a valid SOFA file with GeneralTF convention
94 | *
95 | */
96 | /************************************************************************************/
97 | bool GeneralTF::IsValid() const
98 | {
99 | if( sofa::File::IsValid() == false )
100 | {
101 | return false;
102 | }
103 |
104 | if( IsTFDataType() == false )
105 | {
106 | SOFA_THROW( "'DataType' shall be TF" );
107 | return false;
108 | }
109 |
110 | if( checkGlobalAttributes() == false )
111 | {
112 | return false;
113 | }
114 |
115 | SOFA_ASSERT( GetDimension( "I" ) == 1 );
116 | SOFA_ASSERT( GetDimension( "C" ) == 3 );
117 |
118 | return true;
119 | }
120 |
121 |
--------------------------------------------------------------------------------
/libsofa/src/SOFAGeneralTF.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFAGeneralTF.h
42 | * @brief Class for SOFA files with GeneralTF convention
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_GENERAL_TF_H__
50 | #define _SOFA_GENERAL_TF_H__
51 |
52 | #include "../src/SOFAFile.h"
53 |
54 | namespace sofa
55 | {
56 |
57 | /************************************************************************************/
58 | /*!
59 | * @class GeneralTF
60 | * @brief Class for SOFA files with GeneralTF convention
61 | *
62 | * @details Provides methods specific to SOFA files with GeneralTF convention
63 | */
64 | /************************************************************************************/
65 | class SOFA_API GeneralTF : public sofa::File
66 | {
67 | public:
68 | static const unsigned int ConventionVersionMajor;
69 | static const unsigned int ConventionVersionMinor;
70 | static std::string GetConventionVersion();
71 |
72 | public:
73 | GeneralTF(const std::string &path,
74 | const netCDF::NcFile::FileMode &mode = netCDF::NcFile::read);
75 |
76 | virtual ~GeneralTF() {};
77 |
78 | virtual bool IsValid() const SOFA_OVERRIDE;
79 |
80 | private:
81 | //==============================================================================
82 | bool checkGlobalAttributes() const;
83 |
84 | private:
85 | /// avoid shallow and copy constructor
86 | SOFA_AVOID_COPY_CONSTRUCTOR( GeneralTF );
87 | };
88 |
89 | }
90 |
91 | #endif /* _SOFA_GENERAL_TF_H__ */
92 |
93 |
--------------------------------------------------------------------------------
/libsofa/src/SOFAHostArchitecture.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFAHostArchitecture.h
42 | * @brief
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_HOST_ARCHITECTURE_H__
50 | #define _SOFA_HOST_ARCHITECTURE_H__
51 |
52 | #if ( defined(unix) || defined(__unix) || defined(__unix__) || defined(__linux__) )
53 |
54 | //==============================================================================
55 | /// UNIX
56 | //==============================================================================
57 | #define SOFA_UNIX 1
58 | #undef SOFA_MAC
59 | #undef SOFA_WINDOWS
60 |
61 | #elif ( defined(macintosh) || defined(__MACH__) || defined(__APPLE__) || defined (__APPLE_CPP__) || defined(__APPLE_CC__) )
62 |
63 | //==============================================================================
64 | /// MAC OS
65 | //==============================================================================
66 | #define SOFA_MAC 1
67 | #undef SOFA_WINDOWS
68 | #undef SOFA_UNIX
69 |
70 | #elif ( defined(_WIN32) || defined (_WIN64)) || (defined (WIN32) || defined(__DOS__) || defined(_MSC_VER) )
71 |
72 | //==============================================================================
73 | /// WINDOWS
74 | //==============================================================================
75 | #define SOFA_WINDOWS 1
76 | #undef SOFA_MAC
77 | #undef SOFA_UNIX
78 |
79 | #else
80 |
81 | #error "Unknown host architecture"
82 |
83 | #endif
84 |
85 | #endif /* _SOFA_HOST_ARCHITECTURE_H__ */
86 |
--------------------------------------------------------------------------------
/libsofa/src/SOFAListener.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFAListener.h
42 | * @brief Represents a sofa listener
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_LISTENER_H__
50 | #define _SOFA_LISTENER_H__
51 |
52 | #include "../src/SOFAPosition.h"
53 |
54 | namespace sofa
55 | {
56 |
57 | /************************************************************************************/
58 | /*!
59 | * @class Listener
60 | * @brief Represents a sofa listener
61 | *
62 | * @details Source and listener are defined in the coordinate system of the room, called global coordinate system.
63 | */
64 | /************************************************************************************/
65 | class SOFA_API Listener
66 | {
67 | public:
68 | Listener(const netCDF::NcVar &varListenerPosition,
69 | const netCDF::NcVar &varListenerUp,
70 | const netCDF::NcVar &varListenerView);
71 |
72 | ~Listener() {};
73 |
74 | bool IsValid() const;
75 |
76 | bool HasListenerUp() const;
77 | bool HasListenerView() const;
78 |
79 | bool ListenerPositionHasDimensions(const unsigned long dim1, const unsigned long dim2) const;
80 | bool ListenerUpHasDimensions(const unsigned long dim1, const unsigned long dim2) const;
81 | bool ListenerViewHasDimensions(const unsigned long dim1, const unsigned long dim2) const;
82 |
83 | private:
84 | const sofa::PositionVariable ListenerPosition;
85 | const sofa::PositionVariable ListenerUp;
86 | const sofa::PositionVariable ListenerView;
87 |
88 | const bool hasVarListenerUp; ///< flag to check if a NcVar was provided for ListenerUp
89 | const bool hasVarListenerView; ///< flag to check if a NcVar was provided for ListenerView
90 |
91 | private:
92 | //==============================================================================
93 | /// avoid shallow and copy constructor
94 | SOFA_AVOID_COPY_CONSTRUCTOR( Listener );
95 | };
96 |
97 | }
98 |
99 | #endif /* _SOFA_LISTENER_H__ */
100 |
101 |
--------------------------------------------------------------------------------
/libsofa/src/SOFAMultiSpeakerBRIR.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFAMultiSpeakerBRIR.h
42 | * @brief Class for SOFA files with MultiSpeakerBRIR convention
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 14/04/2017
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_MULTI_SPEAKER_BRIR_H__
50 | #define _SOFA_MULTI_SPEAKER_BRIR_H__
51 |
52 | #include "../src/SOFAFile.h"
53 |
54 | namespace sofa
55 | {
56 |
57 | /************************************************************************************/
58 | /*!
59 | * @class MultiSpeakerBRIR
60 | * @brief Class for SOFA files with MultiSpeakerBRIR convention
61 | *
62 | * @details Provides methods specific to SOFA files with MultiSpeakerBRIR convention
63 | */
64 | /************************************************************************************/
65 | class SOFA_API MultiSpeakerBRIR : public sofa::File
66 | {
67 | public:
68 | static const unsigned int ConventionVersionMajor;
69 | static const unsigned int ConventionVersionMinor;
70 | static std::string GetConventionVersion();
71 |
72 | public:
73 | MultiSpeakerBRIR(const std::string &path,
74 | const netCDF::NcFile::FileMode &mode = netCDF::NcFile::read);
75 |
76 | virtual ~MultiSpeakerBRIR() {};
77 |
78 | virtual bool IsValid() const SOFA_OVERRIDE;
79 |
80 | bool GetSamplingRate(double &value) const;
81 | bool GetSamplingRateUnits(sofa::Units::Type &units) const;
82 |
83 | //==============================================================================
84 | bool GetDataIR(std::vector< double > &values) const;
85 | bool GetDataIR(double *values, const unsigned long dim1, const unsigned long dim2, const unsigned long dim3, const unsigned long dim4) const;
86 | bool GetDataDelay(double *values, const unsigned long dim1, const unsigned long dim2, const unsigned long dim3) const;
87 |
88 | private:
89 | //==============================================================================
90 | bool checkGlobalAttributes() const;
91 | bool checkListenerVariables() const;
92 |
93 | private:
94 | /// avoid shallow and copy constructor
95 | SOFA_AVOID_COPY_CONSTRUCTOR( MultiSpeakerBRIR );
96 | };
97 |
98 | }
99 |
100 | #endif /* _SOFA_MULTI_SPEAKER_BRIR_H__ */
101 |
102 |
--------------------------------------------------------------------------------
/libsofa/src/SOFAPoint3.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFAPoint3.h
42 | * @brief Represents one point in 3D
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_POINT3_H__
50 | #define _SOFA_POINT3_H__
51 |
52 | #include "../src/SOFACoordinates.h"
53 | #include "../src/SOFAUnits.h"
54 |
55 | namespace sofa
56 | {
57 |
58 | /************************************************************************************/
59 | /*!
60 | * @class Point3
61 | * @brief Represents one point in 3D with a unit and a coordinate system,
62 | * and allows for conversion between coordinate systems
63 | *
64 | */
65 | /************************************************************************************/
66 | class SOFA_API Point3
67 | {
68 | public:
69 | Point3();
70 | ~Point3() {};
71 |
72 | Point3( const Point3 &other );
73 | const Point3 & operator= ( const Point3 &other );
74 |
75 | double operator[](const unsigned int index) const;
76 |
77 | sofa::Units::Type GetUnits() const;
78 | sofa::Coordinates::Type GetCoordinates() const;
79 |
80 | void Set(const sofa::Units::Type &type_);
81 | void Set(const sofa::Coordinates::Type &type_);
82 | void Set(const double data_[3]);
83 |
84 | /*
85 | void ConvertTo(const sofa::Units::Type &newUnit);
86 | void ConvertTo(const sofa::Coordinates::Type &newCoordinate);
87 | void ConvertTo(const sofa::Coordinates::Type &newCoordinate, const sofa::Units::Type &newUnit);
88 | */
89 |
90 | public:
91 | //==============================================================================
92 | /// data members kept public for convenience
93 | double data[3];
94 | sofa::Units::Type units;
95 | sofa::Coordinates::Type coordinates;
96 | };
97 |
98 | bool GetPoint3(sofa::Point3 &point3, const netCDF::NcVar & variable);
99 |
100 | }
101 |
102 | #endif /* _SOFA_POINT3_H__ */
103 |
104 |
--------------------------------------------------------------------------------
/libsofa/src/SOFAPosition.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFAPosition.h
42 | * @brief Represents a sofa position variable
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_POSITION_H__
50 | #define _SOFA_POSITION_H__
51 |
52 | #include "../src/SOFACoordinates.h"
53 | #include "../src/SOFAUnits.h"
54 | #include "ncVar.h"
55 |
56 | namespace sofa
57 | {
58 |
59 | /************************************************************************************/
60 | /*!
61 | * @class PositionVariable
62 | * @brief Represents a sofa position variable
63 | *
64 | * @details Within SOFA, Position variables are represented by a variable (2 or 3 dimensions)
65 | * which has two attributes : coordinate type and unit
66 | */
67 | /************************************************************************************/
68 | class SOFA_API PositionVariable
69 | {
70 | public:
71 | PositionVariable(const netCDF::NcVar & variable);
72 | ~PositionVariable();
73 |
74 | bool IsValid(const bool shouldHaveTypeAndUnits = true) const;
75 |
76 | bool HasUnits() const;
77 | bool HasCoordinates() const;
78 |
79 | sofa::Units::Type GetUnits() const;
80 | sofa::Coordinates::Type GetCoordinates() const;
81 |
82 | unsigned int GetDimensionality() const;
83 |
84 | bool HasDimensions(const std::size_t dim1, const std::size_t dim2) const;
85 | bool HasDimensions(const std::size_t dim1, const std::size_t dim2, const std::size_t dim3) const;
86 |
87 | private:
88 | const netCDF::NcVar var; ///< the NcVar is not hold
89 |
90 | private:
91 | //==============================================================================
92 | /// avoid shallow and copy constructor
93 | SOFA_AVOID_COPY_CONSTRUCTOR( PositionVariable );
94 | };
95 |
96 | }
97 |
98 | #endif /* _SOFA_POSITION_H__ */
99 |
100 |
--------------------------------------------------------------------------------
/libsofa/src/SOFASimpleFreeFieldHRIR.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFASimpleFreeFieldHRIR.h
42 | * @brief Class for SOFA files with SimpleFreeFieldHRIR convention
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_SIMPLE_FREE_FIELD_HRIR_H__
50 | #define _SOFA_SIMPLE_FREE_FIELD_HRIR_H__
51 |
52 | #include "../src/SOFAFile.h"
53 |
54 | namespace sofa
55 | {
56 |
57 | /************************************************************************************/
58 | /*!
59 | * @class SimpleFreeFieldHRIR
60 | * @brief Class for SOFA files with SimpleFreeFieldHRIR convention
61 | *
62 | * @details Provides methods specific to SOFA files with SimpleFreeFieldHRIR convention
63 | */
64 | /************************************************************************************/
65 | class SOFA_API SimpleFreeFieldHRIR : public sofa::File
66 | {
67 | public:
68 | static const unsigned int ConventionVersionMajor;
69 | static const unsigned int ConventionVersionMinor;
70 | static std::string GetConventionVersion();
71 |
72 | public:
73 | SimpleFreeFieldHRIR(const std::string &path,
74 | const netCDF::NcFile::FileMode &mode = netCDF::NcFile::read);
75 |
76 | virtual ~SimpleFreeFieldHRIR() {};
77 |
78 | virtual bool IsValid() const SOFA_OVERRIDE;
79 |
80 | bool GetSamplingRate(double &value) const;
81 | bool GetSamplingRateUnits(sofa::Units::Type &units) const;
82 |
83 | //==============================================================================
84 | bool GetDataIR(std::vector< double > &values) const;
85 | bool GetDataIR(double *values, const unsigned long dim1, const unsigned long dim2, const unsigned long dim3) const;
86 |
87 | //==============================================================================
88 | bool GetDataDelay(double *values, const unsigned long dim1, const unsigned long dim2) const;
89 | bool GetDataDelay(std::vector< double > &values) const;
90 |
91 | private:
92 | //==============================================================================
93 | bool checkGlobalAttributes() const;
94 | bool checkListenerVariables() const;
95 |
96 | private:
97 | /// avoid shallow and copy constructor
98 | SOFA_AVOID_COPY_CONSTRUCTOR( SimpleFreeFieldHRIR );
99 | };
100 |
101 | }
102 |
103 | #endif /* _SOFA_SIMPLE_FREE_FIELD_HRIR_H__ */
104 |
105 |
--------------------------------------------------------------------------------
/libsofa/src/SOFASimpleFreeFieldSOS.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFASimpleFreeFieldSOS.h
42 | * @brief Class for SOFA files with SimpleFreeFieldSOS convention
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_SIMPLE_FREE_FIELD_SOS_H__
50 | #define _SOFA_SIMPLE_FREE_FIELD_SOS_H__
51 |
52 | #include "../src/SOFAFile.h"
53 |
54 | namespace sofa
55 | {
56 |
57 | /************************************************************************************/
58 | /*!
59 | * @class SimpleFreeFieldSOS
60 | * @brief Class for SOFA files with SimpleFreeFieldSOS convention
61 | *
62 | * @details Provides methods specific to SOFA files with SimpleFreeFieldSOS convention
63 | */
64 | /************************************************************************************/
65 | class SOFA_API SimpleFreeFieldSOS : public sofa::File
66 | {
67 | public:
68 | static const unsigned int ConventionVersionMajor;
69 | static const unsigned int ConventionVersionMinor;
70 | static std::string GetConventionVersion();
71 |
72 | public:
73 | SimpleFreeFieldSOS(const std::string &path,
74 | const netCDF::NcFile::FileMode &mode = netCDF::NcFile::read);
75 |
76 | virtual ~SimpleFreeFieldSOS() {};
77 |
78 | virtual bool IsValid() const SOFA_OVERRIDE;
79 |
80 | bool GetSamplingRate(double &value) const;
81 | bool GetSamplingRateUnits(sofa::Units::Type &units) const;
82 |
83 | //==============================================================================
84 | bool GetDataSOS(std::vector< double > &values) const;
85 | bool GetDataSOS(double *values, const unsigned long dim1, const unsigned long dim2, const unsigned long dim3) const;
86 |
87 | //==============================================================================
88 | bool GetDataDelay(double *values, const unsigned long dim1, const unsigned long dim2) const;
89 | bool GetDataDelay(std::vector< double > &values) const;
90 |
91 | private:
92 | //==============================================================================
93 | bool checkGlobalAttributes() const;
94 | bool checkListenerVariables() const;
95 |
96 | bool hasDatabaseName() const;
97 |
98 | private:
99 | /// avoid shallow and copy constructor
100 | SOFA_AVOID_COPY_CONSTRUCTOR( SimpleFreeFieldSOS );
101 | };
102 |
103 | }
104 |
105 | #endif /* _SOFA_SIMPLE_FREE_FIELD_SOS_H__ */
106 |
107 |
--------------------------------------------------------------------------------
/libsofa/src/SOFASimpleHeadphoneIR.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFASimpleHeadphoneIR.h
42 | * @brief Class for SOFA files with SimpleHeadphoneIR convention
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_SIMPLE_HEADPHONE_IR_H__
50 | #define _SOFA_SIMPLE_HEADPHONE_IR_H__
51 |
52 | #include "../src/SOFAFile.h"
53 |
54 | namespace sofa
55 | {
56 |
57 | /************************************************************************************/
58 | /*!
59 | * @class SimpleHeadphoneIR
60 | * @brief Class for SOFA files with SimpleHeadphoneIR convention
61 | *
62 | * @details Provides methods specific to SOFA files with SimpleHeadphoneIR convention
63 | */
64 | /************************************************************************************/
65 | class SOFA_API SimpleHeadphoneIR : public sofa::File
66 | {
67 | public:
68 | static const unsigned int ConventionVersionMajor;
69 | static const unsigned int ConventionVersionMinor;
70 | static std::string GetConventionVersion();
71 |
72 | public:
73 | SimpleHeadphoneIR(const std::string &path,
74 | const netCDF::NcFile::FileMode &mode = netCDF::NcFile::read);
75 |
76 | virtual ~SimpleHeadphoneIR() {};
77 |
78 | virtual bool IsValid() const SOFA_OVERRIDE;
79 |
80 | bool GetSamplingRate(double &value) const;
81 | bool GetSamplingRateUnits(sofa::Units::Type &units) const;
82 |
83 | //==============================================================================
84 | bool GetDataIR(std::vector< double > &values) const;
85 | bool GetDataIR(double *values, const unsigned long dim1, const unsigned long dim2, const unsigned long dim3) const;
86 |
87 | //==============================================================================
88 | bool GetDataDelay(double *values, const unsigned long dim1, const unsigned long dim2) const;
89 | bool GetDataDelay(std::vector< double > &values) const;
90 |
91 | private:
92 | //==============================================================================
93 | bool checkGlobalAttributes() const;
94 | bool checkListenerVariables() const;
95 |
96 | private:
97 | /// avoid shallow and copy constructor
98 | SOFA_AVOID_COPY_CONSTRUCTOR( SimpleHeadphoneIR );
99 | };
100 |
101 | }
102 |
103 | #endif /* _SOFA_SIMPLE_HEADPHONE_IR_H__ */
104 |
105 |
--------------------------------------------------------------------------------
/libsofa/src/SOFASingleRoomDRIR.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFASingleRoomDRIR.h
42 | * @brief Class for SOFA files with SingleRoomDRIR convention
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 14/04/2017
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_SINGLE_ROOM_DRIR_H__
50 | #define _SOFA_SINGLE_ROOM_DRIR_H__
51 |
52 | #include "../src/SOFAFile.h"
53 |
54 | namespace sofa
55 | {
56 |
57 | /************************************************************************************/
58 | /*!
59 | * @class SingleRoomDRIR
60 | * @brief Class for SOFA files with SingleRoomDRIR convention
61 | *
62 | * @details Provides methods specific to SOFA files with SingleRoomDRIR convention
63 | */
64 | /************************************************************************************/
65 | class SOFA_API SingleRoomDRIR : public sofa::File
66 | {
67 | public:
68 | static const unsigned int ConventionVersionMajor;
69 | static const unsigned int ConventionVersionMinor;
70 | static std::string GetConventionVersion();
71 |
72 | public:
73 | SingleRoomDRIR(const std::string &path,
74 | const netCDF::NcFile::FileMode &mode = netCDF::NcFile::read);
75 |
76 | virtual ~SingleRoomDRIR() {};
77 |
78 | virtual bool IsValid() const SOFA_OVERRIDE;
79 |
80 | bool GetSamplingRate(double &value) const;
81 | bool GetSamplingRateUnits(sofa::Units::Type &units) const;
82 |
83 | //==============================================================================
84 | bool GetDataIR(std::vector< double > &values) const;
85 | bool GetDataIR(double *values, const unsigned long dim1, const unsigned long dim2, const unsigned long dim3) const;
86 |
87 | //==============================================================================
88 | bool GetDataDelay(double *values, const unsigned long dim1, const unsigned long dim2) const;
89 | bool GetDataDelay(std::vector< double > &values) const;
90 |
91 | private:
92 | //==============================================================================
93 | bool checkGlobalAttributes() const;
94 | bool checkListenerVariables() const;
95 |
96 | private:
97 | /// avoid shallow and copy constructor
98 | SOFA_AVOID_COPY_CONSTRUCTOR( SingleRoomDRIR );
99 | };
100 |
101 | }
102 |
103 | #endif /* _SOFA_SINGLE_ROOM_DRIR_H__ */
104 |
105 |
--------------------------------------------------------------------------------
/libsofa/src/SOFASource.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFASource.h
42 | * @brief Represents a sofa source
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_SOURCE_H__
50 | #define _SOFA_SOURCE_H__
51 |
52 | #include "../src/SOFAPosition.h"
53 |
54 | namespace sofa
55 | {
56 |
57 | /************************************************************************************/
58 | /*!
59 | * @class Source
60 | * @brief Represents a sofa source
61 | *
62 | * @details Source and Listener are defined in the coordinate system of the room, called global coordinate system.
63 | */
64 | /************************************************************************************/
65 | class SOFA_API Source
66 | {
67 | public:
68 | Source(const netCDF::NcVar & varSourcePosition,
69 | const netCDF::NcVar & varSourceUp,
70 | const netCDF::NcVar & varSourceView);
71 |
72 | ~Source() {};
73 |
74 | bool IsValid() const;
75 |
76 | bool HasSourceUp() const;
77 | bool HasSourceView() const;
78 |
79 | bool SourcePositionHasDimensions(const unsigned long dim1, const unsigned long dim2) const;
80 | bool SourceUpHasDimensions(const unsigned long dim1, const unsigned long dim2) const;
81 | bool SourceViewHasDimensions(const unsigned long dim1, const unsigned long dim2) const;
82 |
83 | private:
84 | const sofa::PositionVariable SourcePosition;
85 | const sofa::PositionVariable SourceUp;
86 | const sofa::PositionVariable SourceView;
87 |
88 | const bool hasVarSourceUp; ///< flag to check if a NcVar was provided for SourceUp
89 | const bool hasVarSourceView; ///< flag to check if a NcVar was provided for SourceView
90 |
91 | private:
92 | //==============================================================================
93 | /// avoid shallow and copy constructor
94 | SOFA_AVOID_COPY_CONSTRUCTOR( Source );
95 | };
96 |
97 | }
98 |
99 | #endif /* _SOFA_SOURCE_H__ */
100 |
101 |
--------------------------------------------------------------------------------
/libsofa/src/SOFAString.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFAString.cpp
42 | * @brief Useful functions to manipulate strings
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #include "../src/SOFAString.h"
50 |
51 | using namespace sofa;
52 |
53 | /************************************************************************************/
54 | /*!
55 | * @brief Pad with character at the right of the original string
56 | * @param[in] src : the string to be padded
57 | * @param[in] totalLength : the total number of characters
58 | * @param[in] pad : the padding character
59 | * @return the string padded
60 | *
61 | */
62 | /************************************************************************************/
63 | std::string sofa::String::PadWith(const std::string &src,
64 | const std::size_t totalLength,
65 | const std::string &pad)
66 | {
67 | const std::size_t length = src.length();
68 | if( length > totalLength )
69 | {
70 | // the string is longer that expected...
71 | // let's return the original string
72 | return src;
73 | }
74 | else
75 | {
76 | const std::size_t paddingLength = pad.length();
77 |
78 | const std::size_t numPad = ( totalLength - length ) / paddingLength;
79 |
80 | std::string dest = src;
81 |
82 | for( std::size_t i = 0; i < numPad; i++ )
83 | {
84 | dest += pad;
85 | }
86 |
87 | return dest;
88 | }
89 | }
90 |
91 | void sofa::String::PrintSeparationLine(std::ostream & output)
92 | {
93 | const unsigned int padding = 30;
94 | const std::string verticalSeparator = " ";
95 | const std::string horizontalSeparator = "_";
96 |
97 | output << sofa::String::PadWith( horizontalSeparator, padding, horizontalSeparator );
98 | output << horizontalSeparator;
99 | output << sofa::String::PadWith( horizontalSeparator, padding, horizontalSeparator );
100 | output << horizontalSeparator ;
101 | output << sofa::String::PadWith( horizontalSeparator, padding, horizontalSeparator );
102 | output << horizontalSeparator ;
103 | output << sofa::String::PadWith( horizontalSeparator, padding, horizontalSeparator );
104 | output << std::endl;
105 | }
106 |
107 |
--------------------------------------------------------------------------------
/libsofa/src/SOFAString.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFAString.h
42 | * @brief Useful functions to manipulate strings
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_STRING_H__
50 | #define _SOFA_STRING_H__
51 |
52 | #include "../src/SOFAPlatform.h"
53 | #include
54 | #include
55 | #include
56 |
57 | namespace sofa
58 | {
59 |
60 | namespace String
61 | {
62 |
63 | inline int String2Int(const std::string &str)
64 | {
65 | return atoi( str.c_str() );
66 | }
67 |
68 | inline std::string ToLowerCase(const std::string &str)
69 | {
70 | std::string result = str;
71 | std::transform( result.begin(), result.end(), result.begin(), ::tolower);
72 |
73 | return result;
74 | }
75 |
76 | inline std::string Int2String(const int value)
77 | {
78 | std::ostringstream str;
79 | str << value;
80 | return str.str();
81 | }
82 |
83 | inline bool IsInt(const char c)
84 | {
85 | return ( c >= '0' && c <= '9' );
86 | }
87 |
88 | inline std::string bool2string(const bool value)
89 | {
90 | return ( value == true ) ? ("true") : ("false");
91 | }
92 |
93 | inline std::string bool2yesorno(const bool value)
94 | {
95 | return ( value == true ) ? ("yes") : ("no");
96 | }
97 |
98 | std::string PadWith(const std::string &src,
99 | const std::size_t totalLength = 30,
100 | const std::string &pad = " ");
101 |
102 | void PrintSeparationLine(std::ostream & output = std::cout);
103 | }
104 | }
105 |
106 | #endif /* _SOFA_STRING_H__ */
107 |
108 |
--------------------------------------------------------------------------------
/libsofa/src/SOFAUnits.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFAUnits.h
42 | * @brief SOFA units systems
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_UNITS_H__
50 | #define _SOFA_UNITS_H__
51 |
52 | #include "../src/SOFAPlatform.h"
53 | #include "netcdf.h"
54 | #include "ncFile.h"
55 |
56 | namespace sofa
57 | {
58 |
59 | /************************************************************************************/
60 | /*!
61 | * @class Units
62 | * @brief Static class to represent information about SOFA Units
63 | *
64 | */
65 | /************************************************************************************/
66 | class SOFA_API Units
67 | {
68 | public:
69 |
70 | enum Type
71 | {
72 | kMeter = 0,
73 | kCubicMeter = 1,
74 | kHertz = 2,
75 | kSamples = 3,
76 | kSphericalUnits = 4,
77 | kKelvin = 5,
78 | kNumUnitsTypes = 6
79 | };
80 |
81 | public:
82 | static std::string GetName(const sofa::Units::Type &type_);
83 | static sofa::Units::Type GetType(const std::string &name);
84 |
85 | static bool IsDistanceUnit(const sofa::Units::Type &type_);
86 | static bool IsFrequencyUnit(const sofa::Units::Type &type_);
87 | static bool IsTimeUnit(const sofa::Units::Type &type_);
88 |
89 | static bool IsDistanceUnit(const std::string &name);
90 | static bool IsFrequencyUnit(const std::string &name);
91 | static bool IsTimeUnit(const std::string &name);
92 |
93 | static bool IsValid(const std::string &name);
94 |
95 | static bool IsValid(const netCDF::NcAtt &attr);
96 |
97 | protected:
98 | Units() SOFA_DELETED_FUNCTION;
99 | };
100 |
101 | }
102 |
103 | #endif /* _SOFA_UNITS_H__ */
104 |
105 |
--------------------------------------------------------------------------------
/libsofa/src/SOFAUtils.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFAUtils.h
42 | * @brief Standard utility functions
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_UTILS_H__
50 | #define _SOFA_UTILS_H__
51 |
52 | #include "../src/SOFAPlatform.h"
53 | #include
54 |
55 | namespace sofa
56 | {
57 | /************************************************************************************/
58 | /*!
59 | * @brief Absolute value, single precision
60 | * @param[in] x
61 | * @return abs( x )
62 | *
63 | */
64 | /************************************************************************************/
65 | inline float FAbs(const float x) SOFA_NOEXCEPT
66 | {
67 | return fabsf(x);
68 | }
69 |
70 | /************************************************************************************/
71 | /*!
72 | * @brief Absolute value, double precision
73 | * @param[in] x
74 | * @return abs( x )
75 | *
76 | */
77 | /************************************************************************************/
78 | inline double FAbs(const double x) SOFA_NOEXCEPT
79 | {
80 | return fabs(x);
81 | }
82 |
83 | /************************************************************************************/
84 | /*!
85 | * @brief template binary minimum function
86 | * @param[in] a
87 | * @param[in] b
88 | * @return min of a and b
89 | *
90 | */
91 | /************************************************************************************/
92 | template< typename Type >
93 | Type smin(const Type &a, const Type &b) SOFA_NOEXCEPT
94 | {
95 | return ( a < b ) ? a : b;
96 | }
97 |
98 | /************************************************************************************/
99 | /*!
100 | * @brief template binary maximum function
101 | * @param[in] a
102 | * @param[in] b
103 | * @return max of a and b
104 | *
105 | */
106 | /************************************************************************************/
107 | template< typename Type >
108 | Type smax(const Type &a, const Type &b) SOFA_NOEXCEPT
109 | {
110 | return ( a > b ) ? a : b;
111 | }
112 |
113 | }
114 |
115 | #endif /* _SOFA_UTILS_H__ */
116 |
117 |
--------------------------------------------------------------------------------
/libsofa/src/SOFAVersion.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2013--2017, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 | * Redistributions of source code must retain the above copyright
8 | notice, this list of conditions and the following disclaimer.
9 | * Redistributions in binary form must reproduce the above copyright
10 | notice, this list of conditions and the following disclaimer in the
11 | documentation and/or other materials provided with the distribution.
12 | * Neither the name of the nor the
13 | names of its contributors may be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | /**
29 |
30 | Spatial acoustic data file format - AES69-2015 - Standard for File Exchange - Spatial Acoustic Data File Format
31 | http://www.aes.org
32 |
33 | SOFA (Spatially Oriented Format for Acoustics)
34 | http://www.sofaconventions.org
35 |
36 | */
37 |
38 |
39 | /************************************************************************************/
40 | /*!
41 | * @file SOFAVersion.h
42 | * @brief API Version
43 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
44 | *
45 | * @date 10/05/2013
46 | *
47 | */
48 | /************************************************************************************/
49 | #ifndef _SOFA_VERSION_H__
50 | #define _SOFA_VERSION_H__
51 |
52 | //==============================================================================
53 | /* major version of sofa library */
54 | #define SOFA_VERSION_MAJOR 1
55 |
56 | /* minor version of sofa library */
57 | #define SOFA_VERSION_MINOR 1
58 |
59 | /* release number of current version of sofa library */
60 | #define SOFA_VERSION_RELEASE 0
61 |
62 |
63 | //==============================================================================
64 | /* major version of the sofa specifications */
65 | #define SOFA_SPECIFICATIONS_MAJOR 1
66 |
67 | /* minor version of the sofa specifications */
68 | #define SOFA_SPECIFICATIONS_MINOR 0
69 |
70 |
71 |
72 | #endif /* _SOFA_VERSION_H__ */
73 |
--------------------------------------------------------------------------------
/libsofa/src/sofamisc.cpp:
--------------------------------------------------------------------------------
1 | /************************************************************************************/
2 | /*!
3 | * @file sofamisc.cpp
4 | * @brief Prints some informations about the current API and the related SOFA convention/specifications
5 | * @author Thibaut Carpentier, UMR STMS 9912 - Ircam-Centre Pompidou / CNRS / UPMC
6 | *
7 | * @date 10/05/2013
8 | *
9 | */
10 | /************************************************************************************/
11 | #include "../src/SOFA.h"
12 | #include "../src/SOFAString.h"
13 |
14 | static const std::string verticalSeparator = " ";
15 |
16 | /************************************************************************************/
17 | /*!
18 | * @brief Main entry point
19 | *
20 | */
21 | /************************************************************************************/
22 | int main(int argc, char *argv[])
23 | {
24 | std::ostream & output = std::cout;
25 |
26 | sofa::String::PrintSeparationLine( output );
27 | output << sofa::ApiInfos::GetAPICopyright();
28 | sofa::String::PrintSeparationLine( output );
29 |
30 | output << std::endl;
31 | output << std::endl;
32 | output << "SOFA Global attributes : " << std::endl;
33 |
34 | sofa::String::PrintSeparationLine( output );
35 |
36 | output << sofa::String::PadWith( "name " );
37 | output << verticalSeparator;
38 | output << sofa::String::PadWith( "required" );
39 | output << verticalSeparator ;
40 | output << sofa::String::PadWith( "read only" );
41 | output << verticalSeparator ;
42 | output << sofa::String::PadWith( "default" ) ;
43 | output << std::endl;
44 |
45 | sofa::String::PrintSeparationLine( output );
46 |
47 | for( unsigned int i = 0; i < sofa::Attributes::kNumAttributes; i++ )
48 | {
49 | const sofa::Attributes::Type type_ = static_cast< const sofa::Attributes::Type >( i );
50 | const std::string name = sofa::Attributes::GetName( type_ );
51 | const bool required = sofa::Attributes::IsRequired( type_ );
52 | const bool readonly = sofa::Attributes::IsReadOnly( type_ );
53 | //const bool hasDefault = sofa::Attributes::HasDefaultValue( type_ );
54 | const std::string def = sofa::Attributes::GetDefaultValue( type_ );
55 |
56 | output << sofa::String::PadWith( name );
57 | output << verticalSeparator;
58 | output << sofa::String::PadWith( sofa::String::bool2yesorno( required ) );
59 | output << verticalSeparator;
60 | output << sofa::String::PadWith( sofa::String::bool2yesorno( readonly ) );
61 | output << verticalSeparator;
62 | output << sofa::String::PadWith( def );
63 | output << std::endl;
64 | }
65 |
66 | sofa::String::PrintSeparationLine( output );
67 |
68 | return 0;
69 | }
70 |
71 |
--------------------------------------------------------------------------------