-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dan Smith
committed
Jan 17, 2022
1 parent
92632ef
commit 2863272
Showing
90 changed files
with
1,291 additions
and
733 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
set(MODULE_NAME coda_oss) | ||
|
||
coda_generate_module_config_header(${MODULE_NAME}) | ||
|
||
coda_add_module( | ||
${MODULE_NAME} | ||
VERSION 1.0 | ||
DEPS config-c++ gsl-c++) | ||
|
||
coda_add_tests( | ||
MODULE_NAME ${MODULE_NAME} | ||
DIRECTORY "unittests" | ||
UNITTEST) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
This is our implementation of various C++11/14/17/20 routines that work with the ancient compilers | ||
we sometimes still need to use. It's called `coda_oss` instead of `std_` only because some people | ||
won't like the name `coda_oss` (of course, it "can't" be `std`); `coda_oss` is far less likely | ||
to collide with other code (someone else could *also* be trying to do the same thing we are). | ||
|
||
By making this a very low-level module with very few other dependencies, it is easier to use | ||
in other code and avoid circular dependencies. For example, the `sys` and `mem` modules can't | ||
be used in `str`. | ||
|
66 changes: 66 additions & 0 deletions
66
externals/coda-oss/modules/c++/coda_oss/include/coda_oss/CPlusPlus.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* ========================================================================= | ||
* This file is part of coda_oss-c++ | ||
* ========================================================================= | ||
* | ||
* (C) Copyright 2021, 2022, Maxar Technologies, Inc. | ||
* | ||
* sys-c++ is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this program; If not, | ||
* see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#ifndef CODA_OSS_coda_oss_CPlusPlus_h_INCLUDED_ | ||
#define CODA_OSS_coda_oss_CPlusPlus_h_INCLUDED_ | ||
#pragma once | ||
|
||
#ifdef CODA_OSS_cplusplus | ||
#error "CODA_OSS_cplusplus already #define'd." | ||
#endif | ||
|
||
#ifndef __cplusplus | ||
#error "Only C++ compilation is supported." | ||
#endif | ||
#define CODA_OSS_cplusplus __cplusplus | ||
|
||
#if CODA_OSS_cplusplus < 201103L // We need at least C++11 | ||
#undef CODA_OSS_cplusplus // oops...try to fix | ||
|
||
// MSVC only sets __cplusplus >199711L with the /Zc:__cplusplus command-line option. | ||
// https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ | ||
#if defined(_MSVC_LANG) | ||
// https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-160 | ||
// "Defined as an integer literal that specifies the C++ language standard targeted by the compiler." | ||
#define CODA_OSS_cplusplus _MSVC_LANG | ||
#elif defined(_MSC_VER) | ||
#error "_MSVC_LANG should be #define'd." | ||
#endif // _MSVC_LANG | ||
|
||
#if defined(__GNUC__) | ||
// ... similar things needed for other compilers ... ? | ||
#endif // __GNUC__ | ||
|
||
#endif // CODA_OSS_cplusplus | ||
|
||
#if CODA_OSS_cplusplus < 201103L | ||
#error "Must compile with C++11 or greater." | ||
#endif | ||
|
||
// Define a few macros as that's less verbose than testing against a version number | ||
#define CODA_OSS_cpp11 (CODA_OSS_cplusplus >= 201103L) | ||
#define CODA_OSS_cpp14 (CODA_OSS_cplusplus >= 201402L) | ||
#define CODA_OSS_cpp17 (CODA_OSS_cplusplus >= 201703L) | ||
#define CODA_OSS_cpp20 (CODA_OSS_cplusplus >= 202002L) | ||
#define CODA_OSS_cpp23 0 | ||
|
||
#endif // CODA_OSS_coda_oss_CPlusPlus_h_INCLUDED_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
externals/coda-oss/modules/c++/coda_oss/include/coda_oss/memory.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* ========================================================================= | ||
* This file is part of coda_oss-c++ | ||
* ========================================================================= | ||
* | ||
* (C) Copyright 2004 - 2018, MDA Information Systems LLC | ||
* (C) Copyright 2022, Maxar Technologies, Inc. | ||
* | ||
* coda_oss-c++ is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this program; If not, | ||
* see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#ifndef CODA_OSS_coda_oss_memory_h_INCLUDED_ | ||
#define CODA_OSS_coda_oss_memory_h_INCLUDED_ | ||
#pragma once | ||
|
||
#include <memory> | ||
#include <type_traits> | ||
#include <utility> | ||
|
||
#include "config/compiler_extensions.h" | ||
|
||
#include "coda_oss/namespace_.h" | ||
namespace coda_oss | ||
{ | ||
// C++11 inadvertently ommitted make_unique; provide it here. (Swiped from <memory>.) | ||
template <typename T, typename... TArgs, typename std::enable_if<!std::is_array<T>::value, int>::type = 0> | ||
std::unique_ptr<T> make_unique(TArgs&&... args) | ||
{ | ||
CODA_OSS_disable_warning_push | ||
#if _MSC_VER | ||
#pragma warning(disable: 26409) // Avoid calling new and delete explicitly, use std::make_unique<T> instead (r .11). | ||
#endif | ||
return std::unique_ptr<T>(new T(std::forward<TArgs>(args)...)); | ||
CODA_OSS_disable_warning_pop | ||
} | ||
|
||
template <typename T, typename std::enable_if<std::is_array<T>::value && std::extent<T>::value == 0, int>::type = 0> | ||
std::unique_ptr<T> make_unique(size_t size) | ||
{ | ||
using element_t = typename std::remove_extent<T>::type; | ||
|
||
CODA_OSS_disable_warning_push | ||
#if _MSC_VER | ||
#pragma warning(disable: 26409) // Avoid calling new and delete explicitly, use std::make_unique<T> instead (r .11). | ||
#endif | ||
return std::unique_ptr<T>(new element_t[size]()); | ||
CODA_OSS_disable_warning_pop | ||
} | ||
|
||
template <typename T, typename... TArgs, typename std::enable_if<std::extent<T>::value != 0, int>::type = 0> | ||
void make_unique(TArgs&&...) = delete; | ||
|
||
#define CODA_OSS_coda_oss_make_unique 201304L // c.f., __cpp_lib_make_unique | ||
|
||
} // namespace coda_oss | ||
|
||
#endif // CODA_OSS_coda_oss_memory_h_INCLUDED_ |
29 changes: 29 additions & 0 deletions
29
externals/coda-oss/modules/c++/coda_oss/include/coda_oss/namespace_.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* ========================================================================= | ||
* This file is part of coda_oss-c++ | ||
* ========================================================================= | ||
* | ||
* (C) Copyright 2020, Maxar Technologies, Inc. | ||
* | ||
* sys-c++ is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this program; If not, http://www.gnu.org/licenses/. | ||
* | ||
*/ | ||
#ifndef CODA_OSS_coda_oss_namespace__h_INCLUDED_ | ||
#define CODA_OSS_coda_oss_namespace__h_INCLUDED_ | ||
#pragma once | ||
|
||
namespace coda_oss | ||
{ | ||
} | ||
|
||
#endif // CODA_OSS_coda_oss_namespace__h_INCLUDED_ |
Oops, something went wrong.