TSDuck v3.40-4163
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches

Cross-platforms portable base definitions for the TSDuck project. More...

Classes

class  ts::null_mutex
 A null_mutex class which can be used to replace std::mutex or std::recursive_mutex. More...
 
struct  ts::ThreadSafetyMutex< THS >
 Define the appropriate mutex class for a given level of thread-safety. More...
 

Namespaces

namespace  ts
 TSDuck namespace, containing all TSDuck classes and functions.
 

Macros

#define TS_ANDROID
 Defined when compiled for an Android target platform.
 
#define TS_ARM32
 Defined when the target processor architecture is 32-bit ARM.
 
#define TS_ARM64
 Defined when the target processor architecture is 64-bit ARM.
 
#define TS_ASM_ARM64
 Defined when the target processor architecture is 64-bit ARM and inline assembler is allowed.
 
#define TS_BSD
 Defined when compiled for a BSD target platform (FreeBSD, OpenBSD, NetBSD, DragonFlyBSD).
 
#define TS_CPLUSPLUS
 Level of C++ language, same as predefined __cplusplus, but safe with MSVC.
 
#define TS_CXX20
 Defined when the compiler is compliant with C++20.
 
#define TS_CXX23
 Defined when the compiler is compliant with C++23.
 
#define TS_CYGWIN
 Defined when compiled for a Cygwin target platform.
 
#define TS_DEFAULT_ASSIGMENTS(classname)
 A macro to declare the default assignment operators in the declaration of a class.
 
#define TS_DEFAULT_COPY_MOVE(classname)
 A macro to declare the default copy and move constructors and assignment operators in the declaration of a class.
 
#define TS_DEFINE_SINGLETON(fullclassname)
 Singleton class definition.
 
#define TS_DRAGONFLYBSD
 Defined when compiled for a DragonFlyBSD target platform.
 
#define TS_FREEBSD
 Defined when compiled for a FreeBSD target platform.
 
#define TS_FUNCTION
 Definition of the name of the current function.
 
#define TS_GCC
 Defined when the compiler is GCC, also known as "GNU C", or a GCC-compatible compiler.
 
#define TS_GCC_NOWARNING(name)
 Disable a warning with the GCC compiler (does nothing on other compilers).
 
#define TS_GCC_ONLY
 Defined when the compiler is exactly GCC, also known as "GNU C", not a GCC-compatible compiler.
 
#define TS_GCC_VERSION
 GCC version, encoded as an integer.
 
#define TS_I386
 Defined when the target processor architecture is Intel IA-32, also known as x86.
 
#define TS_INTERFACE(classname)
 A macro to declare the basic operators in the declaration of an interface class.
 
#define TS_LINUX
 Defined when compiled for a Linux target platform.
 
#define TS_LLVM
 Defined when the compiler is LLVM (clang).
 
#define TS_LLVM_NOWARNING(name)
 Disable a warning with the LLVM/clang compiler (does nothing on other compilers).
 
#define TS_MAC
 Defined when compiled for a macOS target platform.
 
#define TS_MIPS
 Defined when the target processor architecture is 32-bit MIPS architecture.
 
#define TS_MIPS64
 Defined when the target processor architecture is 64-bit MIPS architecture.
 
#define TS_MSC
 Defined when the compiler is Microsoft C/C++, the default compiler in the Microsoft Visual Studio environment.
 
#define TS_MSC_NOWARNING(num)
 Disable a warning with the Microsoft Visual C++ compiler (does nothing on other compilers).
 
#define TS_NETBSD
 Defined when compiled for a NetBSD target platform.
 
#define TS_NO_ARM_CRC32_INSTRUCTIONS
 Define TS_NO_ARM_CRC32_INSTRUCTIONS from the command line if you want to disable the usage of Arm64 CRC32 instructions.
 
#define TS_NO_DEFAULT_CONSTRUCTORS(classname)
 A macro to disable default constructors in the declaration of a class.
 
#define TS_NO_OPTIMIZE   platform_specific
 Attribute to explicitly disable optimization in a function.
 
#define TS_NOBUILD_NOCOPY(classname)
 A macro to disable default constructor and object copy in the declaration of a class.
 
#define TS_NOCOPY(classname)
 A macro to disable object copy in the declaration of a class.
 
#define TS_NOMOVE(classname)
 A macro to disable object move in the declaration of a class.
 
#define TS_OPENBSD
 Defined when compiled for an OpenBSD target platform.
 
#define TS_POP_WARNING()
 Restore the compiler's warnings reporting from a previous TS_PUSH_WARNING().
 
#define TS_POWERPC
 Defined when the target processor architecture is 32-bit Power PC.
 
#define TS_POWERPC64
 Defined when the target processor architecture is 64-bit Power PC.
 
#define TS_PRAGMA(directive)
 Helper macro for the C++11 keyword _Pragma.
 
#define TS_PUSH_WARNING()
 Save the compiler's warnings reporting.
 
#define TS_RISCV64
 Defined when the target processor architecture is 64-bit RISC-V.
 
#define TS_RULE_OF_FIVE(classname, dtor_attributes)
 A macro to apply the C++ "rule of five" in the declaration of a class.
 
#define TS_S390X
 Defined when the target processor architecture is S390X.
 
#define TS_SINGLETON(classname)
 Singleton class declaration.
 
#define TS_SLINE   TS_STRINGIFY(__LINE__)
 String version of LINE, the source code line number.
 
#define TS_SPARC
 Defined when the target processor architecture is Sun SPARC architecture.
 
#define TS_STATIC_MUTEX(mutex_class, function_name)
 Define a static mutex inside a translation unit.
 
#define TS_STATIC_REFERENCE(suffix, addr)
 This macro generates a reference to some address (string literal, external symbol, etc.) The reference is a unique static symbol which is otherwise unused.
 
#define TS_STRICT_MEMORY_ALIGN   1
 Defined when the CPU requires strict memory alignment (address must be a multiple of the data size).
 
#define TS_STRINGIFY(x)
 This macro transforms the value of a macro parameter into the equivalent string literal.
 
#define TS_UNIQUE_NAME(prefix)
 This macro generates a unique name based on the source line number.
 
#define TS_UNIX
 Defined when compiled for any flavor of UNIX target platforms.
 
#define TS_USTRINGIFY(x)
 This macro transforms the value of a macro parameter into the equivalent 16-bit Unicode string literal.
 
#define TS_WINDOWS
 Defined when compiled for a Microsoft Windows target platform.
 
#define TS_X86_64
 Defined when the target processor architecture is the 64-bit extension of the IA-32 architecture, also known as AMD-64 or Intel x86-64.
 
#define TSCOREDLL
 Attribute to declare a class or function from tscore.dll on Windows.
 
#define TSDUCK_STATIC
 User-defined macro to enable full static linking.
 
#define TSDUCK_STATIC_LIBRARY
 Applications which link against the TSDuck static library.
 
#define TSDUCK_STATIC_PLUGINS
 User-defined macro to enable static linking of plugins.
 
#define TSDUCKDLL
 Attribute to declare a class or function from tsduck.dll on Windows.
 

Typedefs

using ts::char_ptr = char *
 Pointer to char.
 
using ts::const_char_ptr = const char *
 Pointer to const char.
 
using ts::const_int16_ptr = const int16_t *
 Pointer to const int16_t.
 
using ts::const_int32_ptr = const int32_t *
 Pointer to const int32_t.
 
using ts::const_int64_ptr = const int64_t *
 Pointer to const int64_t.
 
using ts::const_int8_ptr = const int8_t *
 Pointer to const int8_t.
 
using ts::const_uint16_ptr = const uint16_t *
 Pointer to const uint16_t.
 
using ts::const_uint32_ptr = const uint32_t *
 Pointer to const uint32_t.
 
using ts::const_uint64_ptr = const uint64_t *
 Pointer to const uint64_t.
 
using ts::const_uint8_ptr = const uint8_t *
 Pointer to const uint8_t.
 
using ts::deciseconds = cn::duration< cn::milliseconds::rep, std::deci >
 A derivative of std::chrono::duration for deciseconds (1/10 of a second).
 
using ts::int16_ptr = int16_t *
 Pointer to int16_t.
 
using ts::int32_ptr = int32_t *
 Pointer to int32_t.
 
using ts::int64_ptr = int64_t *
 Pointer to int64_t.
 
using ts::int8_ptr = int8_t *
 Pointer to int8_t.
 
using ts::monotonic_time = cn::time_point< cn::steady_clock >
 Definition of a monotonic time.
 
using ts::uint16_ptr = uint16_t *
 Pointer to uint16_t.
 
using ts::uint32_ptr = uint32_t *
 Pointer to uint32_t.
 
using ts::uint64_ptr = uint64_t *
 Pointer to uint64_t.
 
using ts::uint8_ptr = uint8_t *
 Pointer to uint8_t.
 

Enumerations

enum class  ts::ShareMode {
  ts::ShareMode::COPY ,
  ts::ShareMode::SHARE
}
 Enumeration type used to indicate if the data referenced by a pointer shall be copied or shared. More...
 
enum class  ts::ThreadSafety {
  ts::ThreadSafety::Full ,
  ts::ThreadSafety::None
}
 Thread safety property of a class. More...
 
enum class  ts::Tristate {
  ts::Tristate::Maybe = -1 ,
  ts::Tristate::False = 0 ,
  ts::Tristate::True = 1
}
 Tristate boolean. More...
 

Functions

template<class T , class U >
void ts::set_default (std::optional< T > &opt, const U &value)
 Set a default value in a std::optional object, if there is none.
 
template<typename INT >
requires std::integral<INT>
Tristate ts::ToTristate (INT i)
 Normalize any integer value in the range of a Tristate value.
 

Variables

template<typename T >
constexpr bool ts::dependent_false = std::false_type::value
 A "false" expression which is built from a template type T.
 
constexpr std::uintmax_t ts::FS_ERROR = static_cast<std::uintmax_t>(-1)
 This error code is returned by some functions in std::filesystem.
 
constexpr size_t ts::NPOS = size_t(-1)
 Constant meaning "no size", "not found" or "do not resize".
 

Detailed Description

Cross-platforms portable base definitions for the TSDuck project.

This header file shall be included by all C++ compilation units in the TSDuck project. It provides common portable definitions. This file shall always be included first, before system headers and other TSDuck headers.

Important: This file shall be updated each time a new platform is used (processor, compiler, operating system). When recompiling this header on a new platform, many errors are generated (explicit #error directives). These errors will guide you on the required additions for the new platform.

Platform definitions

This header file conditionally defines several symbols (macros) which describe the platform (processor, compiler, operating system). These symbols can be used for conditional compilation.

The following environments are described:

Macro Definition Documentation

◆ TS_LLVM

#define TS_LLVM

Defined when the compiler is LLVM (clang).

In that case, TS_GCC is also defined since LLVM is reasonably compatible with GCC.