diff --git a/sources/cmake/commonSources.cmake b/sources/cmake/commonSources.cmake index a60d017..197ac09 100644 --- a/sources/cmake/commonSources.cmake +++ b/sources/cmake/commonSources.cmake @@ -2,7 +2,7 @@ # # List of common source files and directories. # -# Copyright (c) 2017 vcdMaker team +# Copyright (c) 2019 vcdMaker team # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -88,6 +88,7 @@ set(COMMON_HEADERS ${COMMON_HEADERS_DIR}/VCDTracer.h ${COMMON_HEADERS_DIR}/SafeUInt.h ${COMMON_HEADERS_DIR}/Timestamp.h + ${COMMON_HEADERS_DIR}/OutOfMemory.h ${VERSION_HEADER}) # 3rd party directories. diff --git a/sources/common/doc/manual.odt b/sources/common/doc/manual.odt index 425aa26..cc8536c 100644 Binary files a/sources/common/doc/manual.odt and b/sources/common/doc/manual.odt differ diff --git a/sources/common/doc/manual.pdf b/sources/common/doc/manual.pdf index 6e57f5d..05d72ec 100644 Binary files a/sources/common/doc/manual.pdf and b/sources/common/doc/manual.pdf differ diff --git a/sources/common/inc/OutOfMemory.h b/sources/common/inc/OutOfMemory.h new file mode 100644 index 0000000..5388b47 --- /dev/null +++ b/sources/common/inc/OutOfMemory.h @@ -0,0 +1,37 @@ +/// @file common/inc/OutOfMemory.h +/// +/// The common out of memory handler. +/// +/// @par Full Description +/// The common out of memory handler to be used by vcdMaker and vcdMerge. +/// +/// @ingroup Exception +/// +/// @par Copyright (c) 2019 vcdMaker team +/// +/// Permission is hereby granted, free of charge, to any person obtaining a +/// copy of this software and associated documentation files (the "Software"), +/// to deal in the Software without restriction, including without limitation +/// the rights to use, copy, modify, merge, publish, distribute, sublicense, +/// and/or sell copies of the Software, and to permit persons to whom the +/// Software is furnished to do so, subject to the following conditions: +/// +/// The above copyright notice and this permission notice shall be included +/// in all copies or substantial portions of the Software. +/// +/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +/// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +/// IN THE SOFTWARE. + +#pragma once + +#include "VcdException.h" + +inline void OutOfMemory() +{ + throw EXCEPTION::VcdException(EXCEPTION::Error::OUT_OF_MEMORY, "Out of memory."); +} diff --git a/sources/common/inc/VcdExceptionList.h b/sources/common/inc/VcdExceptionList.h index 67b1fe9..48c9d10 100644 --- a/sources/common/inc/VcdExceptionList.h +++ b/sources/common/inc/VcdExceptionList.h @@ -8,7 +8,7 @@ /// /// @ingroup Exception /// -/// @par Copyright (c) 2018 vcdMaker team +/// @par Copyright (c) 2019 vcdMaker team /// /// Permission is hereby granted, free of charge, to any person obtaining a /// copy of this software and associated documentation files (the "Software"), @@ -120,6 +120,9 @@ namespace EXCEPTION /// Vector size exceeded. const uint32_t VECTOR_SIZE_EXCEEDED = 21U; + /// Out of memory. + const uint32_t OUT_OF_MEMORY = 22U; + // Logic errors below shall never happen. // They are enumerated from 9000. diff --git a/sources/vcdMaker/src/vcdMaker.cpp b/sources/vcdMaker/src/vcdMaker.cpp index 18ebc16..4372f06 100644 --- a/sources/vcdMaker/src/vcdMaker.cpp +++ b/sources/vcdMaker/src/vcdMaker.cpp @@ -2,7 +2,7 @@ /// /// The main module of the vcdMaker application. /// -/// @par Copyright (c) 2018 vcdMaker team +/// @par Copyright (c) 2019 vcdMaker team /// /// Permission is hereby granted, free of charge, to any person obtaining a /// copy of this software and associated documentation files (the "Software"), @@ -33,6 +33,7 @@ #include "Logger.h" #include "XmlSignalFactory.h" #include "DefaultSignalFactory.h" +#include "OutOfMemory.h" /// The vcdMaker main function. /// @@ -44,6 +45,8 @@ int main(int argc, const char *argv[]) // The application execution status. int32_t executionStatus = EXECUTION::APP_OK; + std::set_new_handler(OutOfMemory); + try { // Parse input parameters diff --git a/sources/vcdMerge/src/vcdMerge.cpp b/sources/vcdMerge/src/vcdMerge.cpp index 2b3689b..f7a3d4b 100644 --- a/sources/vcdMerge/src/vcdMerge.cpp +++ b/sources/vcdMerge/src/vcdMerge.cpp @@ -2,7 +2,7 @@ /// /// The main module of the vcdMerge application. /// -/// @par Copyright (c) 2018 vcdMaker team +/// @par Copyright (c) 2019 vcdMaker team /// /// Permission is hereby granted, free of charge, to any person obtaining a /// copy of this software and associated documentation files (the "Software"), @@ -29,6 +29,7 @@ #include "SignalSource.h" #include "Merge.h" #include "Logger.h" +#include "OutOfMemory.h" /// The vcdMerge main function. /// @@ -40,6 +41,8 @@ int main(int argc, const char *argv[]) // The application execution status. int32_t executionStatus = EXECUTION::APP_OK; + std::set_new_handler(OutOfMemory); + try { // Parse input parameters diff --git a/windows/vcdMaker/vcdMakerCore/vcdMakerCore.vcxproj b/windows/vcdMaker/vcdMakerCore/vcdMakerCore.vcxproj index d96164d..c703aed 100644 --- a/windows/vcdMaker/vcdMakerCore/vcdMakerCore.vcxproj +++ b/windows/vcdMaker/vcdMakerCore/vcdMakerCore.vcxproj @@ -152,6 +152,7 @@ + diff --git a/windows/vcdMaker/vcdMakerCore/vcdMakerCore.vcxproj.filters b/windows/vcdMaker/vcdMakerCore/vcdMakerCore.vcxproj.filters index 266da69..60febbd 100644 --- a/windows/vcdMaker/vcdMakerCore/vcdMakerCore.vcxproj.filters +++ b/windows/vcdMaker/vcdMakerCore/vcdMakerCore.vcxproj.filters @@ -110,6 +110,9 @@ Header Files + + Header Files +