Browse Source

first commit

YinBin 1 year ago
commit
a9d738149f
100 changed files with 13750 additions and 0 deletions
  1. 47 0
      .gitmodules
  2. 92 0
      .travis.yml
  3. 286 0
      CMakeLists.txt
  4. 304 0
      Changelog.txt
  5. 23 0
      LICENSE_1_0.txt
  6. 108 0
      README.md
  7. 34 0
      apps/CMakeLists.txt
  8. 274 0
      apps/PothosUtil.cpp
  9. 34 0
      apps/PothosUtil.hpp
  10. 53 0
      apps/PothosUtilDeviceInfo.cpp
  11. 70 0
      apps/PothosUtilDocParse.cpp
  12. 42 0
      apps/PothosUtilGenerateSIMDDispatchers.cpp
  13. 66 0
      apps/PothosUtilListModules.cpp
  14. 105 0
      apps/PothosUtilListTypeConversions.cpp
  15. 27 0
      apps/PothosUtilLoadModule.cpp
  16. 63 0
      apps/PothosUtilModuleInfo.cpp
  17. 30 0
      apps/PothosUtilPluginTree.cpp
  18. 144 0
      apps/PothosUtilProxyEnvironmentInfo.cpp
  19. 145 0
      apps/PothosUtilProxyServer.cpp
  20. 112 0
      apps/PothosUtilRunTopology.cpp
  21. 17 0
      apps/PothosUtilSIMDFeatures.cpp
  22. 202 0
      apps/PothosUtilSelfTests.cpp
  23. 27 0
      apps/PothosUtilSystemInfo.cpp
  24. 73 0
      appveyor.yml
  25. 32 0
      cmake/Modules/CMakeLists.txt
  26. 144 0
      cmake/Modules/FindPkgMacros.cmake
  27. 110 0
      cmake/Modules/FindPoco.cmake
  28. 130 0
      cmake/Modules/GetGitRevisionDescription.cmake
  29. 38 0
      cmake/Modules/GetGitRevisionDescription.cmake.in
  30. 184 0
      cmake/Modules/PothosConfig.cmake
  31. 1333 0
      cmake/Modules/PothosConfigSIMD.cmake
  32. 12 0
      cmake/Modules/PothosConfigVersion.in.cmake
  33. 173 0
      cmake/Modules/PothosUtil.cmake
  34. 57 0
      cmake/Modules/SetupPoco.cmake
  35. 21 0
      cmake/cmake_uninstall.cmake.in
  36. 101 0
      debian/changelog
  37. 1 0
      debian/compat
  38. 54 0
      debian/control
  39. 32 0
      debian/copyright
  40. 1 0
      debian/docs
  41. 4 0
      debian/libpothos-dev.install
  42. 1 0
      debian/libpothos0.7.install
  43. 1 0
      debian/pothos-util.install
  44. 21 0
      debian/rules
  45. 1 0
      debian/source/format
  46. 43 0
      docs/CMakeLists.txt
  47. 2428 0
      docs/Doxyfile.in
  48. BIN
      docs/PothosGui.png
  49. 17 0
      include/CMakeLists.txt
  50. 26 0
      include/Pothos/Archive.hpp
  51. 110 0
      include/Pothos/Archive/ArchiveEntry.hpp
  52. 51 0
      include/Pothos/Archive/BinaryObject.hpp
  53. 42 0
      include/Pothos/Archive/Complex.hpp
  54. 22 0
      include/Pothos/Archive/Exception.hpp
  55. 39 0
      include/Pothos/Archive/Export.hpp
  56. 108 0
      include/Pothos/Archive/Invoke.hpp
  57. 52 0
      include/Pothos/Archive/Map.hpp
  58. 233 0
      include/Pothos/Archive/Numbers.hpp
  59. 25 0
      include/Pothos/Archive/Pair.hpp
  60. 48 0
      include/Pothos/Archive/Polymorphic.hpp
  61. 51 0
      include/Pothos/Archive/Set.hpp
  62. 44 0
      include/Pothos/Archive/Split.hpp
  63. 131 0
      include/Pothos/Archive/StreamArchiver.hpp
  64. 45 0
      include/Pothos/Archive/String.hpp
  65. 78 0
      include/Pothos/Archive/Vector.hpp
  66. 17 0
      include/Pothos/Callable.hpp
  67. 64 0
      include/Pothos/Callable/CallInterface.hpp
  68. 54 0
      include/Pothos/Callable/CallInterfaceImpl.hpp
  69. 49 0
      include/Pothos/Callable/CallRegistry.hpp
  70. 35 0
      include/Pothos/Callable/CallRegistryImpl.hpp
  71. 221 0
      include/Pothos/Callable/Callable.hpp
  72. 232 0
      include/Pothos/Callable/CallableImpl.hpp
  73. 32 0
      include/Pothos/Callable/Exception.hpp
  74. 101 0
      include/Pothos/Config.hpp
  75. 294 0
      include/Pothos/Exception.hpp
  76. 36 0
      include/Pothos/Framework.hpp
  77. 384 0
      include/Pothos/Framework/Block.hpp
  78. 82 0
      include/Pothos/Framework/BlockImpl.hpp
  79. 65 0
      include/Pothos/Framework/BlockRegistry.hpp
  80. 22 0
      include/Pothos/Framework/BlockRegistryImpl.hpp
  81. 109 0
      include/Pothos/Framework/BufferAccumulator.hpp
  82. 444 0
      include/Pothos/Framework/BufferChunk.hpp
  83. 203 0
      include/Pothos/Framework/BufferManager.hpp
  84. 48 0
      include/Pothos/Framework/BufferPool.hpp
  85. 105 0
      include/Pothos/Framework/Connectable.hpp
  86. 14 0
      include/Pothos/Framework/ConnectableImpl.hpp
  87. 215 0
      include/Pothos/Framework/DType.hpp
  88. 68 0
      include/Pothos/Framework/Exception.hpp
  89. 285 0
      include/Pothos/Framework/InputPort.hpp
  90. 190 0
      include/Pothos/Framework/InputPortImpl.hpp
  91. 199 0
      include/Pothos/Framework/Label.hpp
  92. 287 0
      include/Pothos/Framework/ManagedBuffer.hpp
  93. 287 0
      include/Pothos/Framework/OutputPort.hpp
  94. 172 0
      include/Pothos/Framework/OutputPortImpl.hpp
  95. 58 0
      include/Pothos/Framework/Packet.hpp
  96. 209 0
      include/Pothos/Framework/SharedBuffer.hpp
  97. 156 0
      include/Pothos/Framework/ThreadPool.hpp
  98. 395 0
      include/Pothos/Framework/Topology.hpp
  99. 127 0
      include/Pothos/Framework/TopologyImpl.hpp
  100. 69 0
      include/Pothos/Framework/WorkInfo.hpp

+ 47 - 0
.gitmodules

@@ -0,0 +1,47 @@
+[submodule "spuce"]
+	path = spuce
+	url = https://github.com/audiofilter/spuce.git
+	branch = master
+[submodule "muparserx"]
+	path = muparserx
+	url = https://github.com/beltoforion/muparserx.git
+	branch = master
+[submodule "poco"]
+	path = poco
+	url = https://github.com/pocoproject/poco.git
+	branch = poco-1.7.8
+[submodule "plotters"]
+	path = plotters
+	url = https://github.com/pothosware/PothosPlotters.git
+	branch = master
+[submodule "widgets"]
+	path = widgets
+	url = https://github.com/pothosware/PothosWidgets.git
+	branch = master
+[submodule "flow"]
+	path = flow
+	url = https://github.com/pothosware/PothosFlow.git
+	branch = master
+[submodule "soapy"]
+	path = soapy
+	url = https://github.com/pothosware/PothosSoapy.git
+	branch = master
+[submodule "blocks"]
+	path = blocks
+	url = https://github.com/pothosware/PothosBlocks.git
+	branch = master
+[submodule "python"]
+	path = python
+	url = https://github.com/pothosware/PothosPython.git
+	branch = master
+[submodule "audio"]
+	path = audio
+	url = https://github.com/pothosware/PothosAudio.git
+	branch = master
+[submodule "comms"]
+	path = comms
+	url = https://github.com/pothosware/PothosComms.git
+	branch = master
+[submodule "libsimdpp"]
+	path = libsimdpp
+	url = https://github.com/p12tic/libsimdpp

+ 92 - 0
.travis.yml

@@ -0,0 +1,92 @@
+########################################################################
+## Travis CI config for Pothos
+##
+## * not all components will be configured
+## * the matrix builds Release and Debug
+## * run the self tests after install
+########################################################################
+
+sudo: required
+dist: trusty
+
+language: cpp
+compiler: gcc
+
+env:
+  global:
+    - INSTALL_PREFIX=/usr/local
+    - SOAPY_SDR_BRANCH=master
+  matrix:
+    - BUILD_TYPE=Debug
+    - BUILD_TYPE=Release
+
+# whitelist
+branches:
+  only:
+    - master
+    - maint
+
+before_install:
+  # regular ubuntu packages
+  - sudo add-apt-repository main
+  - sudo add-apt-repository universe
+
+  # tool chain for gcc5
+  - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
+
+  # development files from ppa
+  - sudo add-apt-repository -y ppa:myriadrf/drivers
+  - sudo add-apt-repository -y ppa:pothosware/support
+  - sudo add-apt-repository -y ppa:pothosware/framework
+
+  # update after package changes
+  - sudo apt-get update -qq
+
+install:
+
+  # tool chain for gcc5
+  - sudo apt-get install -qq g++-5
+  - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 90
+
+  # install development dependencies
+  - sudo apt-get install -qq libnuma-dev cmake
+
+  # install development dependencies from drivers ppa
+  - sudo apt-get install -qq libspuce-dev libsoapysdr-dev
+
+  # install development dependencies from support ppa
+  - sudo apt-get install -qq libpoco-dev-min libmuparserx-dev
+
+  # install audio support dependencies
+  - sudo apt-get install -qq portaudio19-dev libjack-jackd2-dev
+
+  # install graphics support dependencies
+  - sudo apt-get install -qq qtbase5-dev libqt5svg5-dev libqwt-qt5-dev
+
+  # install python support dependencies
+  - sudo apt-get install -qq python-dev python-numpy
+
+  # install SoapySDR from source
+  - git clone https://github.com/pothosware/SoapySDR.git
+  - pushd SoapySDR
+  - git checkout ${SOAPY_SDR_BRANCH}
+  - mkdir build && cd build
+  - cmake ../ -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
+  - make && sudo make install
+  - popd
+
+script:
+  - mkdir build && cd build
+  - cmake ../ -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DPYTHON_EXECUTABLE=/usr/bin/python2 -DPython_ADDITIONAL_VERSIONS=2.7
+  - make -j2
+  - sudo make install
+
+  # setup environment paths
+  - export LD_LIBRARY_PATH=${INSTALL_PREFIX}/lib:${LD_LIBRARY_PATH}
+  - export PATH=${INSTALL_PREFIX}/bin:${PATH}
+  - export PYTHONPATH=/usr/lib/python2.7/dist-packages:${PYTHONPATH}
+  - export PYTHONPATH=${INSTALL_PREFIX}/lib/python2.7/dist-packages:${PYTHONPATH}
+
+  # basic test for command line utility
+  - PothosUtil --system-info
+  - PothosUtil --self-tests

+ 286 - 0
CMakeLists.txt

@@ -0,0 +1,286 @@
+########################################################################
+# Project setup
+########################################################################
+cmake_minimum_required(VERSION 3.1.0)
+project(Pothos)
+enable_language(CXX)
+enable_testing()
+
+########################################################################
+# gather version information
+# packagers may specify -DPOTHOS_EXTVER="foo" to replace the git hash
+########################################################################
+file(READ "${PROJECT_SOURCE_DIR}/Changelog.txt" changelog_txt)
+string(REGEX MATCH "Release ([0-9]+\\.[0-9]+\\.[0-9]+) \\(" CHANGELOG_MATCH "${changelog_txt}")
+if(NOT CHANGELOG_MATCH)
+    message(FATAL_ERROR "Failed to extract version number from Changelog.txt")
+endif(NOT CHANGELOG_MATCH)
+set(POTHOS_LIBVER "${CMAKE_MATCH_1}")
+
+if (NOT POTHOS_EXTVER)
+    include(${PROJECT_SOURCE_DIR}/cmake/Modules/GetGitRevisionDescription.cmake)
+    get_git_head_revision(GITREFSPEC GITHASH)
+    if (GITHASH)
+        string(SUBSTRING "${GITHASH}" 0 8 GITHASH)
+        set(POTHOS_EXTVER "g${GITHASH}")
+    else (GITHASH)
+        set(POTHOS_EXTVER "unknown")
+    endif (GITHASH)
+endif()
+
+set(POTHOS_VERSION "${POTHOS_LIBVER}-${POTHOS_EXTVER}")
+
+#set in-tree variables for PothosConfig.cmake
+set(Pothos_DIR ${PROJECT_SOURCE_DIR}/cmake/Modules)
+set(POTHOS_IN_TREE_SOURCE_DIR ${PROJECT_SOURCE_DIR})
+
+#POTHOS_ROOT is compiled into the library to locate the install base.
+#By default, the POTHOS_ROOT is set to the CMAKE_INSTALL_PREFIX.
+#However users may overload this by specifying -DPOTHOS_ROOT=<path>.
+set(POTHOS_ROOT "${CMAKE_INSTALL_PREFIX}" CACHE PATH
+    "Installation root for Pothos::System::getRootPath()")
+file(TO_CMAKE_PATH "${POTHOS_ROOT}" POTHOS_ROOT)
+
+#POTHOS_ROOT_ENV is the name of the environment variable
+#which tells Pothos where to find the root installation.
+#By default, the environment variable POTHOS_ROOT is used.
+#Example: set -DPOTHOS_ROOT_ENV=SNAP for snappy packages.
+set(POTHOS_ROOT_ENV "POTHOS_ROOT" CACHE STRING
+    "Environment variable for Pothos::System::getRootPath()")
+
+#APPDATA_ENV is the name of the environment variable
+#which tells Pothos where to find the user's data directory.
+#By default, the environment variable APPDATA is used.
+#Example: set -DAPPDATA_ENV=SNAP_USER_DATA for snappy packages.
+set(APPDATA_ENV "APPDATA" CACHE STRING
+    "Environment variable for Pothos::System::getUserDataPath()")
+
+include(FeatureSummary)
+include(CMakeDependentOption)
+
+########################################################################
+# rpath setup - http://www.cmake.org/Wiki/CMake_RPATH_handling
+########################################################################
+# use, i.e. don't skip the full RPATH for the build tree
+option(CMAKE_SKIP_BUILD_RPATH "skip rpath build" FALSE)
+
+# when building, don't use the install RPATH already
+# (but later on when installing)
+option(CMAKE_BUILD_WITH_INSTALL_RPATH "build with install rpath" FALSE)
+
+# the RPATH to be used when installing, but only if it's not a system directory
+option(CMAKE_AUTOSET_INSTALL_RPATH TRUE)
+if(CMAKE_AUTOSET_INSTALL_RPATH)
+LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" isSystemDir)
+IF("${isSystemDir}" STREQUAL "-1")
+    SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
+ENDIF("${isSystemDir}" STREQUAL "-1")
+endif(CMAKE_AUTOSET_INSTALL_RPATH)
+
+# add the automatically determined parts of the RPATH
+# which point to directories outside the build tree to the install RPATH
+option(CMAKE_INSTALL_RPATH_USE_LINK_PATH "build with automatic rpath" TRUE)
+
+if(APPLE)
+    set(CMAKE_MACOSX_RPATH ON)
+endif()
+
+########################################################################
+# POCO C++ utility libraries
+########################################################################
+if(NOT ENABLE_INTERNAL_POCO)
+include(${PROJECT_SOURCE_DIR}/cmake/Modules/SetupPoco.cmake)
+endif()
+cmake_dependent_option(ENABLE_INTERNAL_POCO "Enable Poco C++ utility libraries" ON "NOT Poco_FOUND" OFF)
+add_feature_info(Poco ENABLE_INTERNAL_POCO "Build internal Poco C++ utility libraries")
+
+set(POCO_DIR poco)
+if (ENABLE_INTERNAL_POCO)
+
+    message(STATUS "Poco >= 1.5.4 not found - using built-in Poco")
+
+    if (NOT EXISTS ${PROJECT_SOURCE_DIR}/${POCO_DIR}/CMakeLists.txt)
+        message(FATAL_ERROR "poco submodule not configured (git submodule update --init --recursive)")
+    endif ()
+
+    #mark that the in-tree poco build is used
+    #used by uninstall target and PothosConfig
+    set(POCO_IN_TREE TRUE)
+
+    #disable SetupPoco in PothosConfig module
+    set(INCLUDED_SETUP_POCO_CMAKE TRUE)
+
+    #when in-tree poco is selected, default to a minimum build
+    #users can specify -DPOCO_MIN_BUILD=TRUE to enable full poco
+    option(POCO_MIN_BUILD "Minimum build for in-tree Poco" TRUE)
+    if(POCO_MIN_BUILD)
+        set(ENABLE_MONGODB OFF CACHE INTERNAL "")
+        set(ENABLE_PDF OFF CACHE INTERNAL "")
+        set(ENABLE_NETSSL OFF CACHE INTERNAL "")
+        set(ENABLE_CRYPTO OFF CACHE INTERNAL "")
+        set(ENABLE_DATA OFF CACHE INTERNAL "")
+        set(ENABLE_SEVENZIP OFF CACHE INTERNAL "")
+        set(ENABLE_ZIP OFF CACHE INTERNAL "")
+        set(ENABLE_APACHECONNECTOR OFF CACHE INTERNAL "")
+    endif()
+
+    add_subdirectory(${POCO_DIR})
+    set(Poco_FOUND 1)
+
+    set(Poco_INCLUDE_DIRS
+        ${PROJECT_SOURCE_DIR}/${POCO_DIR}/Foundation/include
+        ${PROJECT_SOURCE_DIR}/${POCO_DIR}/Util/include
+        ${PROJECT_SOURCE_DIR}/${POCO_DIR}/XML/include
+        ${PROJECT_SOURCE_DIR}/${POCO_DIR}/Net/include
+    )
+
+    set(Poco_LIBRARIES
+        PocoFoundation
+        PocoUtil
+        PocoXML
+        PocoNet
+    )
+
+    #ensure that local headers get precedent over installed headers
+    include_directories(${Poco_INCLUDE_DIRS})
+
+endif(ENABLE_INTERNAL_POCO)
+
+########################################################################
+# Spuce filter design library
+########################################################################
+if(NOT ENABLE_INTERNAL_SPUCE)
+find_package(Spuce CONFIG)
+endif()
+cmake_dependent_option(ENABLE_INTERNAL_SPUCE "Enable Spuce filter design library" ON "NOT Spuce_FOUND" OFF)
+add_feature_info(Spuce ENABLE_INTERNAL_SPUCE "Build internal Spuce filter design library")
+
+if (ENABLE_INTERNAL_SPUCE)
+    message(STATUS "Spuce not found - using built-in Spuce")
+
+    if (EXISTS ${PROJECT_SOURCE_DIR}/spuce/CMakeLists.txt)
+        add_subdirectory(spuce)
+        set(SPUCE_IN_TREE TRUE)
+        set(Spuce_FOUND TRUE)
+        set(Spuce_VERSION "[submodule]")
+        set(Spuce_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/spuce)
+        set(Spuce_LIBRARIES spuce)
+    else ()
+        message(WARNING "spuce submodule not configured (git submodule update --init --recursive)")
+    endif ()
+
+endif(ENABLE_INTERNAL_SPUCE)
+
+########################################################################
+# muparserx expression parser
+########################################################################
+if(NOT ENABLE_INTERNAL_MUPARSERX)
+find_package(muparserx CONFIG)
+endif()
+cmake_dependent_option(ENABLE_INTERNAL_MUPARSERX "Enable MuparserX expression parser" ON "NOT muparserx_FOUND" OFF)
+add_feature_info(MuparserX ENABLE_INTERNAL_MUPARSERX "Build internal MuparserX expression parser")
+
+if (ENABLE_INTERNAL_MUPARSERX)
+    message(STATUS "muparserx not found - using built-in muparserx")
+
+    if (NOT EXISTS ${PROJECT_SOURCE_DIR}/muparserx/CMakeLists.txt)
+        message(FATAL_ERROR "muparserx submodule not configured (git submodule update --init --recursive)")
+    endif ()
+
+    add_subdirectory(muparserx)
+    set(MUPARSERX_IN_TREE TRUE)
+    set(muparserx_FOUND TRUE)
+    set(muparserx_VERSION "[submodule]")
+    set(muparserx_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/muparserx/parser)
+    set(muparserx_LIBRARIES muparserx)
+endif(ENABLE_INTERNAL_MUPARSERX)
+
+########################################################################
+# json.hpp header
+########################################################################
+find_path(JSON_HPP_INCLUDE_DIR NAMES json.hpp PATH_SUFFIXES nlohmann)
+
+#some of the libraries use this header for development
+#its a header only and its extremely easy to just download
+#but don't do this for package builds (/usr) the package
+#maintainer should do this manually to avoid downloading
+if (NOT JSON_HPP_INCLUDE_DIR AND NOT "${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr")
+    if (NOT EXISTS "${PROJECT_BINARY_DIR}/json.hpp")
+        file(DOWNLOAD "https://raw.githubusercontent.com/nlohmann/json/v2.1.1/src/json.hpp" "${PROJECT_BINARY_DIR}/json.hpp")
+    endif()
+    set(JSON_HPP_INCLUDE_DIR "${PROJECT_BINARY_DIR}")
+endif ()
+
+if ("${JSON_HPP_INCLUDE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
+    install(FILES "${PROJECT_BINARY_DIR}/json.hpp" DESTINATION include/nlohmann)
+endif()
+
+########################################################################
+# Build the framework library
+########################################################################
+cmake_dependent_option(ENABLE_LIBRARY "Enable Pothos Library component" ON "TRUE" OFF)
+add_feature_info(Library ENABLE_LIBRARY "The main library for all Pothos projects")
+
+#C++11 is a required language feature for this project
+set(CMAKE_CXX_STANDARD 11)
+
+if(ENABLE_LIBRARY)
+    find_package(Pothos CONFIG REQUIRED)
+    add_subdirectory(include)
+    add_subdirectory(lib)
+    add_subdirectory(cmake/Modules)
+    add_subdirectory(apps)
+    add_subdirectory(docs)
+endif(ENABLE_LIBRARY)
+
+########################################################################
+## Build submodule toolkits
+########################################################################
+cmake_dependent_option(ENABLE_TOOLKITS "Enable Pothos Toolkits components" ON "ENABLE_LIBRARY" OFF)
+add_feature_info(Toolkits ENABLE_TOOLKITS "Pothos data-flow software suite toolkits")
+
+if(ENABLE_TOOLKITS)
+    foreach(subdir blocks comms python soapy audio flow widgets plotters)
+        if (EXISTS ${PROJECT_SOURCE_DIR}/${subdir}/CMakeLists.txt)
+            add_subdirectory(${subdir})
+        else()
+            message(WARNING "ENABLE_TOOLKITS: submodule ${subdir} not configured, skipping...")
+        endif()
+    endforeach(subdir)
+endif(ENABLE_TOOLKITS)
+
+########################################################################
+# uninstall target
+########################################################################
+if (POCO_IN_TREE)
+    # use poco's uninstall target, but overwrite the script
+    configure_file(
+        "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
+        "${CMAKE_CURRENT_BINARY_DIR}/${POCO_DIR}/cmake_uninstall.cmake"
+        IMMEDIATE @ONLY)
+
+else (POCO_IN_TREE)
+    add_custom_target(uninstall
+        "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
+    configure_file(
+        "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
+        "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+        IMMEDIATE @ONLY)
+
+endif (POCO_IN_TREE)
+
+########################################################################
+# print features summary
+########################################################################
+message(STATUS "")
+message(STATUS "######################################################")
+message(STATUS "## Enabled features")
+message(STATUS "######################################################")
+feature_summary(WHAT ENABLED_FEATURES)
+message(STATUS "######################################################")
+message(STATUS "## Disabled features")
+message(STATUS "######################################################")
+feature_summary(WHAT DISABLED_FEATURES)
+message(STATUS "Pothos version: v${POTHOS_VERSION}")
+message(STATUS "ABI/so version: v${POTHOS_ABI_VERSION}")
+message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")

+ 304 - 0
Changelog.txt

@@ -0,0 +1,304 @@
+This this the changelog file for the Pothos C++ library.
+
+Release 0.8.0 (pending)
+==========================
+
+API changes:
+
+- BufferManager: added functionality to specify custom memory allocation
+
+Additions:
+
+- Added Pothos::ProxyVector <-> std::vector<Pothos::Label> conversions
+
+PothosUtil:
+
+- Added --proxy-environment-info option
+- Added option to print type conversions for a given type
+
+SIMD support:
+
+- Added SIMDDispatcherUtils
+- Buffer and vector conversions use SIMD conversion
+- Added utility header that adds SFINAE structs for XSIMD type support
+
+Build changes:
+
+- Update to CMake 3.0 style and project config generation
+- Increase the CMake build requirement to version 3.1.0
+
+Release 0.7.2 (pending)
+==========================
+
+Build Changes:
+
+- undefined linker flags are only used on module builds
+- create interface library to support modern cmake targets
+
+Release 0.7.1 (2021-01-24)
+==========================
+
+- TestDocUtils: fix GCC "unused result" warning
+- Fix std::vector<bool> emplace_back missing
+- Revert BufferAccumulator.cpp from #205
+
+Release 0.7.0 (2020-07-19)
+==========================
+
+Additions:
+
+- Added PothosUtil --num-trials option for tests
+- Added PothosUtil --list-modules
+- Octal support for muparserx expressions
+
+API Changes:
+
+- Added ExceptionForErrorCode exception class with error code
+- New test assert macros for comparisons
+- Added equality operator for Object class to other type
+- Added Block::prepare() API call to be called before work()
+- Callable API support for std::function
+- Added function to query Pothos module search paths
+- Added std::function support for Callable API
+- Added calls setOut/InputAlias() for Topology API
+- Update poco submodule to poco-1.9.0-release
+- OutputPort::getBuffer() returns the exact specified buffer length
+- Added OutputPort::getBuffer() with specified data type variant
+- Version reporting API and build support for loadable modules
+
+Fixes:
+
+- Move probe handlers into worker actor - fixes python overload
+- Fixes for circular buffer alias calculation
+
+Release 0.6.1 (2018-04-30)
+==========================
+
+- Fixed BufferPool::get() unique check from buffer refactor work
+- Remove arbitrary argument limit from Callable::opaqueCall()
+- Additional error handling when RemoteServer fails to launch process
+- Added support for PothosUtil to query information about loaded modules
+- Fix for potential overrun in Block Description if the line is empty.
+
+Release 0.6.0 (2017-12-25)
+==========================
+
+- Updated internal poco submodule to poco-1.8.0.1-release
+- Removed deprecated API call OutputPort::popBuffer()
+- Re-implement RingDeque container to use std::allocator
+- Removed previously unused ObjectM class (mutable object)
+- Added Pothos::Util::SpinLockRW for single write, multi-read
+- API changes to Object, Proxy, and Callable interface types
+  * Object supports implicit templated convert to target type
+  * Proxy supports implicit templated convert to target type
+  * Deprecated Callable interface's callVoid(), use call()
+  * Deprecated Callable interface's callObject(), use call()
+  * Deprecated Proxy interface's callVoid(), use call()
+  * Deprecated Proxy interface's callProxy(), use call()
+- Automatic slots for all void calls in Block::registerCallable:
+  Previously calls with 1 or more arguments became automatic slots.
+  The new rule checks for void return type and supports calls
+  without arguments. In addition registerSlot() will not throw
+  when registering slots that were created automatically.
+- Renamed the project repo from pothos to PothosCore
+- Updated toolkit/submodule URLs for repo rename
+  - Renamed pothos-gui toolkit to PothosFlow
+  - Renamed pothos-sdr toolkit to PothosSoapy
+- Alternative JSON C++ library to handle JSON parsing/emitting
+
+Release 0.5.1 (2017-08-16)
+==========================
+
+- Fixed buffer inlining corner case for amalgamated multi-buffers
+- Moved cmake modules into subdirectory to hide them from cmake's
+  default project search path when cloned in user's home directory
+- Fix for doc parser and getline for windows newlines
+- Added missing functional include for Remote/Server.cpp
+- Exception handling for EvalEnvironment::registerConstantObj()
+- Fixed memory leak in Util FileLock implementation
+
+Release 0.5.0 (2017-04-27)
+==========================
+
+- BlockEval API changes to support GUI evaluator
+- DocUtils API changes to support GUI docs query
+- Removed the pothos-serialization dependency and
+  replaced it with a much smaller in-library solution.
+  The serialization format has changed for this release.
+- Switch stdio to end of line flushing for logging
+- Added Plugin path API for concatenating two paths
+- Added API for parsing sources for block descriptions
+- Created configuration-file based loader for plugins:
+    - With built-in loader for JSON topologies
+    - With built-in loader for JIT compilation
+    - With built-in loader for block descriptions
+- Added PluginModule boolean operator for checking null
+- Reimplemented compiler support around file paths
+- Reimplemented QFormat for simplification and warnings
+
+Release 0.4.3 (2017-04-23)
+==========================
+
+- Fixed RemoteServer process arguments for some shells
+- Fix copy/paste typo in DeviceInfoUtils registration
+
+Release 0.4.2 (2017-01-26)
+==========================
+
+- Fix expression parser for nested parenthesized functions
+- Added missing ProxyEnvironment calls to managed registry
+- Added missing BufferChunk calls to managed registry
+- RemoteServer should wait() on process after terminate
+- Added missing Block::isActive to managed registry
+- Fixed typo in PothosConfig.cmake for include check
+- PothosUtil option argument for --proxy-server
+
+Release 0.4.1 (2016-09-26)
+==========================
+
+- Update internal poco submodule to track poco-1.7.5
+- Dynamic environment variables for snappy packages
+- Fixed output port reserve handling for empty managers
+- Fix warnings for doxygen generated documentation
+- Set _DEBUG define when not building under MSVC Debug
+- Bump activity indicator for slots and de/activate
+
+Release 0.4.0 (2016-08-02)
+==========================
+
+Deprecated Framework API calls:
+
+- Deprecated OutputPort::popBuffer, use popElements
+
+New Framework API calls:
+
+- Added OutputPort::setReserve function call
+- Added OutputPort::popElements function call
+- Added OutputPort::getBuffer function call
+- Added InputPort::peekMessage function call
+- Added BlockRegistry::make block proxy factory
+- Added Block::emitSignal to replace callVoid
+- Added DType::fromDType factory method
+- Added BufferChunk::convert into a specified buffer
+
+General additions and changes:
+
+- Added set, get, and function call operator to Proxy
+- Support global variables in JSON Topology description
+- BufferChunk management of multiple buffer references
+- Moved EvalEnvironment interface into public headers
+- Library fixes to support compilation on FreeBSD systems
+- Use default debug log level for plugin registry events
+- Allow for plugin module re-initialization after deinit()
+- Fixed weak storage of plugin's associated module object
+- Updated the internal Poco submodule to version 1.7.4
+
+Release 0.3.3 (2016-05-10)
+==========================
+
+- Added conversion for proxy vector to/from numeric matrix
+- Switch to getWildcardAddr() in logger for portability
+- Fix Poco in-tree build support, was missing Poco_FOUND
+- Updated muparserx submodule, contains various fixes
+- CMake POTHOS_SOVER variable cache fix use INTERNAL type
+- Proxy server sets unbuffered on descriptors for printf() users
+
+Release 0.3.2 (2016-03-06)
+==========================
+
+- Use current DLL path to determine the system install root
+- Fixes for POTHOS_MODULE_UTIL destination and install prefix
+- Added conversions between ObjectMap and ObjectKwargs
+- Added CMake ENABLE_* flags for internal dependencies
+
+Release 0.3.1 (2016-01-01)
+==========================
+
+- The reserve only prevents work when all ports fail
+- InputPort::setReserve() only bump for larger setting
+- Renamed BlockEval to fix symbol conflict with GUI
+- Restored pothos-all metapackage for convenience
+- Added pothos (runtime) to libpothos-dev Depends
+- Make spuce submodule optional as a dependency
+- CMakeLists.txt use newer git submodule syntax
+- spuce submodule set to 0.4.2 release tag
+
+Release 0.3.0 (2015-12-16)
+==========================
+
+- Absorbed the pothos-util toolkit into lib/Util
+- Replaced NamedMutex use with FileLock and std::mutex
+- Added templated Q-format/fixed-point conversions
+- Added POTHOS_TEST_CLOSE() for equality with tolerance
+- Support complex integer toString() and conversions
+- Added displayable port alias name to framework APIs
+- Support conditional preview mode in block description parser
+- Applications can cleanup before exit with deinit()
+- Detection logic in input port for queue overflows
+- Added network utils for IPv6 with fall-back support
+- Improved error reporting and formatting for self tests
+- Fixed text fixture symbol declaration for OSX
+- Set library SOVERSION using POTHOS_ABI_VERSION
+- Use requestTermination in server and fix destructor throw
+- RemoteProxyEnvironment reply cache check without blocking
+- Bumped API number to "0.3-0" for serialization changes
+- Re-implement RPC datagram format with embedded length
+- Switch to portable binary Object serialization from EOS
+
+Release 0.2.2 (2015-12-07)
+==========================
+
+- Fix Topology::dumpJSON undefined JSON Object behavior
+- Buffer accumulator pop all front-most consumed buffers
+- Fixed Buffer manager reuse on small consume logic
+- Fixed Pothos Util doc parse bug in use of seekg()
+
+Release 0.2.1 (2015-08-26)
+==========================
+
+- Fix buffer accumulator require circular optimization
+- Support custom multi-dest buffers when domain unspecified
+- JSON stats use block name from flattened hierarchy
+- Cache calls to get buffer manager implementations
+- Install buffer managers skips signal/slot ports
+- Default propagate labels now skips signal ports
+- Support alias paths in block description markup
+- Fixed workInfo element counts to exclude signals/slots
+- Fixed integer parser failure in named ports setup
+- Allow work() operation with unused output ports
+- Created new test suite macro for array equality
+- WorkerActor push downstream only when data available
+- Fix Topology::waitInactive() activity checker
+- Fix input port buffer accumulator total counter
+- Implement SoapySDRConfigVersion.cmake version check
+
+Release 0.2.0 (2015-06-17)
+==========================
+
+- Support /usr/local module installs when root is /usr
+- Support POTHOS_PLUGIN_PATH environment variable
+- Support using system installed version of Poco
+- Serialization switched to portable text archive
+- Topology waitInactive() support for infinite timeout
+- PothosUtil --print-tree renamed to --plugin-tree
+- PothosUtil --self-tests-at combined with --self-tests
+- Fixed automatic port deletion upon disconnection
+- Threading overhaul and performance improvements
+- Topology factory from JSON description
+- Topology supports pass-through flows
+
+Release 0.1.1 (2015-06-16)
+==========================
+
+- Fix temporary file cleanup for unix circular buffer
+- Support openSuSE for automatic LIB_SUFFIX detection logic
+- Pothos build utils set library paths in unix environment
+- Added serialization for built-in proxy container types
+- Fixed circular buffer push front condition when non-empty
+- Fixed Topology::waitInactive() false positive condition
+- Fixed usage of managed buffers for message back-pressure
+
+Release 0.1.0 (2014-12-21)
+==========================
+
+This is the first public release of the Pothos C++ library.

+ 23 - 0
LICENSE_1_0.txt

@@ -0,0 +1,23 @@
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.

+ 108 - 0
README.md

@@ -0,0 +1,108 @@
+# Pothos framework library and build environment
+
+This is the project for the Pothos framework library.
+It also contains submodules for various dependencies
+and Pothos toolkits to make it easy to install
+the entire Pothos software suite in one build.
+
+## Documentation
+
+* https://github.com/pothosware/PothosCore/wiki
+
+## Build Status
+
+- Travis: [![Travis Build Status](https://travis-ci.org/pothosware/PothosCore.svg?branch=master)](https://travis-ci.org/pothosware/PothosCore)
+- AppVeyor: [![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/7owo8qb9oldw8iq8)](https://ci.appveyor.com/project/guruofquality/pothos)
+
+## Dependencies
+
+The poco, muparserx, and spuce libraries are available
+as git submodules to simplify building this project from source.
+The user may install these dependencies separately prior to building,
+or the build will install them automatically from submodule if missing.
+
+* poco C++ utility library (framework+toolkit dependency)
+* muparserx expression parser (framework dependency)
+* spuce filter design library (toolkit dependency)
+
+## Toolkits
+
+Although all toolkits can be built as standalone cmake projects,
+user may wish to build these toolkits alongside the framework
+library to simplfy the effort involved building from source.
+The following toolkits are available as git submodules:
+
+* PothosAudio
+* PothosBlocks
+* PothosComms
+* PothosFlow
+* PothosPlotters
+* PothosPython
+* PothosSoapy
+* PothosWidgets
+
+## Building
+
+configure, build, and install with CMake
+
+## Layout
+
+* include/ - public API C++11 header files
+* lib/ - C++ sources for the Pothos library
+* docs/ - doxygen configuration and generation
+* apps/ - the source for the PothosUtil binary
+* cmake/ - cmake utilities for building projects
+
+## Licensing library
+
+Use, modification and distribution is subject to the Boost Software
+License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+http://www.boost.org/LICENSE_1_0.txt)
+
+## Licensing other
+
+This repository is a meta-project for developing, building, and installing
+the main Pothos framework, core dependency libraries, and official toolkits.
+License files and source code are available in each project sub-directory.
+
+The core Pothos library, Poco and libsimdpp C++ libraries,
+and official toolkits found in this repository
+are available under the Boost Software License - Version 1.0.
+
+Please note that Pothos toolkits that are NOT found in this repository,
+both official and unofficial, may have different licensing terms.
+
+Several external libraries have been included into this meta-project
+that are not licensed under the Boost Software License - Version 1.0,
+however are available under a permissive compatible software license.
+
+### kissfft
+
+* Description: C and C++ Fast Fourier Transform library
+* Homepage: https://github.com/itdaniher/kissfft/blob/master/README
+* License: https://github.com/itdaniher/kissfft/blob/master/COPYING
+* Usage: Pothos comms FFT transform blocks
+* Source: comms/fft/ (embedded copy)
+
+### muparserX
+
+* Description: C++ mathematical expression evaluator library
+* Homepage: http://articles.beltoforion.de/article.php?a=muparserx
+* License: http://opensource.org/licenses/BSD-3-Clause
+* Usage: Pothos util tookit expression parser support
+* Source: muparserx/ (top level submodule)
+
+### Qwt
+
+* Description: C++ plotting library based around Qt widgets
+* Homepage: http://qwt.sourceforge.net/
+* License: http://qwt.sourceforge.net/qwtlicense.html
+* Usage: Pothos plotters toolkit support library
+* Source: plotters/qwt/ (nested submodule)
+
+### qtcolorpicker
+
+* Description: C++ drop-down color selection Qt widget
+* License: GNU Lesser General Public License Usage
+* Usage: Pothos GUI designer affinity color selection
+* Source: flow/qtcolorpicker/ (embedded copy)

+ 34 - 0
apps/CMakeLists.txt

@@ -0,0 +1,34 @@
+########################################################################
+## Feature registration
+########################################################################
+cmake_dependent_option(ENABLE_LIBRARY_APPS "Enable Pothos Library.Apps component" ON "ENABLE_LIBRARY" OFF)
+add_feature_info("  Apps" ENABLE_LIBRARY_APPS "Utility application for Pothos library")
+if (NOT ENABLE_LIBRARY_APPS)
+    return()
+endif()
+
+########################################################################
+# build PothosUtil
+########################################################################
+add_executable(PothosUtil
+    PothosUtil.cpp
+    PothosUtilSystemInfo.cpp
+    PothosUtilModuleInfo.cpp
+    PothosUtilSelfTests.cpp
+    PothosUtilPluginTree.cpp
+    PothosUtilDeviceInfo.cpp
+    PothosUtilProxyServer.cpp
+    PothosUtilLoadModule.cpp
+    PothosUtilDocParse.cpp
+    PothosUtilRunTopology.cpp
+    PothosUtilListModules.cpp
+    PothosUtilProxyEnvironmentInfo.cpp
+    PothosUtilSIMDFeatures.cpp
+    PothosUtilGenerateSIMDDispatchers.cpp
+    PothosUtilListTypeConversions.cpp
+)
+target_include_directories(PothosUtil PRIVATE ${JSON_HPP_INCLUDE_DIR})
+target_link_libraries(PothosUtil PRIVATE Pothos)
+install(TARGETS PothosUtil
+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT pothos_runtime
+)

+ 274 - 0
apps/PothosUtil.cpp

@@ -0,0 +1,274 @@
+// Copyright (c) 2013-2018 Josh Blum
+//                    2020 Nicholas Corgan
+// SPDX-License-Identifier: BSL-1.0
+
+#include "PothosUtil.hpp"
+#include <Poco/Util/Application.h>
+#include <Poco/Util/ServerApplication.h>
+#include <Poco/Util/Option.h>
+#include <Poco/Util/OptionSet.h>
+#include <Poco/Util/HelpFormatter.h>
+#include <Poco/Util/IntValidator.h>
+#include <Pothos/System.hpp>
+#include <Pothos/Exception.hpp>
+#include <iostream>
+
+class PothosUtil : public PothosUtilBase
+{
+public:
+    PothosUtil(int argc):
+        _helpRequested(argc <= 1),
+        _docParseRequested(false),
+        _deviceInfoRequested(false),
+        _runTopologyRequested(false),
+        _simdFeaturesRequested(false)
+    {
+        this->setUnixOptions(true); //always unix style --option
+
+        //restore logging config after Poco::Util::Application::initialize() obliterates it
+        Pothos::System::Logger::setupDefaultLogging();
+    }
+
+    ~PothosUtil()
+    {
+        return;
+    }
+
+protected:
+
+    void defineOptions(Poco::Util::OptionSet &options)
+    {
+        Poco::Util::Application::defineOptions(options);
+
+        options.addOption(Poco::Util::Option("help", "h", "display argument help information")
+            .required(false)
+            .repeatable(false));
+
+        options.addOption(Poco::Util::Option("system-info", "", "display system information")
+            .required(false)
+            .repeatable(false)
+            .callback(Poco::Util::OptionCallback<PothosUtil>(this, &PothosUtil::printSystemInfo)));
+
+        options.addOption(Poco::Util::Option("module-info", "",
+            "Display a summary of loaded modules.\n"
+            "Or specify an optional module path to print the list of associated plugins."
+            "Or specify the special value of 'builtin' to see Builtin library plugins.")
+            .required(false)
+            .repeatable(false)
+            .argument("modulePath", false/*optional*/)
+            .binding("modulePath")
+            .callback(Poco::Util::OptionCallback<PothosUtil>(this, &PothosUtil::printModuleInfo)));
+
+        options.addOption(Poco::Util::Option("list-modules", "", "list all loaded modules")
+            .required(false)
+            .repeatable(false)
+            .callback(Poco::Util::OptionCallback<PothosUtil>(this, &PothosUtil::listModules)));
+
+        options.addOption(Poco::Util::Option("device-info", "", "display device information")
+            .required(false)
+            .repeatable(false)
+            .argument("deviceType", false/*optional*/)
+            .binding("deviceType"));
+
+        options.addOption(Poco::Util::Option("plugin-tree", "", "display plugin tree")
+            .required(false)
+            .repeatable(false)
+            .argument("pluginPath", false/*optional*/)
+            .callback(Poco::Util::OptionCallback<PothosUtil>(this, &PothosUtil::printPluginTree)));
+
+        options.addOption(Poco::Util::Option("proxy-server", "", "run the proxy server, tcp://bindHost:bindPort")
+            .required(false)
+            .repeatable(false)
+            .argument("URI", false/*optional*/)
+            .callback(Poco::Util::OptionCallback<PothosUtil>(this, &PothosUtil::proxyServer)));
+
+        options.addOption(Poco::Util::Option("load-module", "", "test load a library module")
+            .required(false)
+            .repeatable(false)
+            .argument("modulePath")
+            .callback(Poco::Util::OptionCallback<PothosUtil>(this, &PothosUtil::loadModule)));
+
+        options.addOption(Poco::Util::Option("run-topology", "", "run a topology from a JSON description")
+            .required(false)
+            .repeatable(false)
+            .argument("inputFile")
+            .binding("inputFile"));
+
+        options.addOption(Poco::Util::Option("run-duration", "", "run the topology for the duration in seconds")
+            .required(false)
+            .repeatable(false)
+            .argument("runDuration")
+            .binding("runDuration"));
+
+        options.addOption(Poco::Util::Option("idle-time", "",
+            "The maximum allowed idle time in seconds.\n"
+            "The topology will exit after all flows remain idle for the specified time in seconds. "
+            "Use this option with --run-duration to specify a timeout to wait for idle to occur. "
+            "PothosUtil will return an error code if the timeout is reached before idle occurs.")
+            .required(false)
+            .repeatable(false)
+            .argument("idleTime")
+            .binding("idleTime"));
+
+        options.addOption(Poco::Util::Option("var", "",
+            "Specify an arbitrary keyword + value variable\n"
+            "using the format --var=name:value\n"
+            "Multiple instances of --var are possible.\n"
+            "Use with --run-topology to overload globals.")
+            .required(false)
+            .repeatable(true)
+            .argument("variable")
+            .binding("variable"));
+
+        options.addOption(Poco::Util::Option("self-tests", "", "run all plugin self tests")
+            .required(false)
+            .repeatable(false)
+            .argument("pluginPath", false/*optional*/)
+            .callback(Poco::Util::OptionCallback<PothosUtil>(this, &PothosUtil::selfTests)));
+
+        options.addOption(Poco::Util::Option("self-test1", "", "run a particular plugin self test")
+            .required(false)
+            .repeatable(false)
+            .argument("pluginPath")
+            .callback(Poco::Util::OptionCallback<PothosUtil>(this, &PothosUtil::selfTestOne)));
+
+        options.addOption(Poco::Util::Option("num-trials", "", "how many times to run each self test")
+            .required(false)
+            .repeatable(false)
+            .argument("numTrials")
+            .validator(new Poco::Util::IntValidator(1, 255))
+            .binding("numTrials"));
+
+        options.addOption(Poco::Util::Option("success-code", "", "the success status return code (default 0)")
+            .required(false)
+            .repeatable(false)
+            .argument("successCode")
+            .validator(new Poco::Util::IntValidator(0, 255))
+            .binding("successCode"));
+
+        options.addOption(Poco::Util::Option("require-active", "", "proxy server shuts off without active clients")
+            .required(false)
+            .repeatable(false)
+            .binding("requireActive"));
+
+        options.addOption(Poco::Util::Option("output", "",
+            "Specify an output file (used by various options)\n"
+            "Use with --run-topology to dump JSON statistics.")
+            .required(false)
+            .repeatable(false)
+            .argument("outputFile")
+            .binding("outputFile"));
+
+        options.addOption(Poco::Util::Option("doc-parse", "", "parse specified files for documentation markup")
+            .required(false)
+            .repeatable(false));
+
+        options.addOption(Poco::Util::Option("proxy-environment-info", "", "display information for a given proxy environment")
+            .required(false)
+            .repeatable(false)
+            .argument("proxyEnvName", false/*optional*/)
+            .binding("proxyEnvName")
+            .callback(Poco::Util::OptionCallback<PothosUtil>(this, &PothosUtil::printProxyEnvironmentInfo)));
+
+        options.addOption(Poco::Util::Option("simd-features", "", "print available SIMD features")
+            .required(false)
+            .repeatable(false));
+
+        options.addOption(Poco::Util::Option("generate-simd-dispatchers", "", "Generate SIMD dispatchers based on a given JSON file")
+            .required(false)
+            .repeatable(false)
+            .argument("inputFile")
+            .binding("inputFile")
+            .callback(Poco::Util::OptionCallback<PothosUtil>(this, &PothosUtil::generateSIMDDispatchers)));
+
+        options.addOption(Poco::Util::Option("simd-arches", "", "A comma-delimited list of SIMD arches, as generated at CMake-time")
+            .required(false)
+            .repeatable(false)
+            .argument("simdArches")
+            .binding("simdArches"));
+
+        options.addOption(Poco::Util::Option("type-conversions", "", "Print types convertible to and from a given type")
+            .required(false)
+            .repeatable(false)
+            .argument("type", false /*optional*/)
+            .binding("type")
+            .callback(Poco::Util::OptionCallback<PothosUtil>(this, &PothosUtil::printTypeConversions)));
+    }
+
+    void handleOption(const std::string &name, const std::string &value)
+    {
+        ServerApplication::handleOption(name, value);
+        if (name == "help") _helpRequested = true;
+        if (name == "doc-parse") _docParseRequested = true;
+        if (name == "device-info") _deviceInfoRequested = true;
+        if (name == "run-topology") _runTopologyRequested = true;
+        if (name == "simd-features") _simdFeaturesRequested = true;
+        if (name == "help") this->stopOptionsProcessing();
+
+        //store --var options into the ordered vars map
+        if (name == "var")
+        {
+            const auto pos = value.find(":");
+            if (pos == std::string::npos) throw Pothos::InvalidArgumentException(
+                "Cannot parse --var="+value+", expected --var=name:value format");
+            _vars.emplace_back(value.substr(0, pos), value.substr(pos+1));
+        }
+    }
+
+    void displayHelp(void)
+    {
+        Poco::Util::HelpFormatter helpFormatter(this->options());
+        helpFormatter.setUnixStyle(true); //always unix style --option
+        helpFormatter.setCommand(commandName());
+        helpFormatter.setUsage("OPTIONS");
+        helpFormatter.setHeader("\n"
+            "PothosUtil is a helper executable for the Pothos Library; "
+            "used both internally by the library, and externally by the user. "
+            "The util provides a command-line interface for the self-tests, "
+            "and can spawn servers and daemons for remote interfaces. ");
+        helpFormatter.format(std::cout);
+    }
+
+    int main(const std::vector<std::string> &args)
+    {
+        try
+        {
+            if (_helpRequested) this->displayHelp();
+            else if (_docParseRequested) this->docParse(args);
+            else if (_deviceInfoRequested) this->printDeviceInfo();
+            else if (_runTopologyRequested) this->runTopology();
+            else if (_simdFeaturesRequested) this->printSIMDFeatures();
+        }
+        catch(const Pothos::Exception &ex)
+        {
+            std::cerr << ex.displayText() << std::endl;
+            std::cout << std::endl;
+            throw ex;
+        }
+        return Poco::Util::Application::EXIT_OK;
+    }
+
+private:
+    bool _helpRequested;
+    bool _docParseRequested;
+    bool _deviceInfoRequested;
+    bool _runTopologyRequested;
+    bool _simdFeaturesRequested;
+};
+
+int main(int argc, char *argv[])
+{
+    POTHOS_EXCEPTION_TRY
+    {
+        PothosUtil app(argc);
+        const int ret = app.run(argc, argv);
+        if (ret == 0) return app.config().getInt("successCode", 0);
+        return ret;
+    }
+    POTHOS_EXCEPTION_CATCH(const Pothos::Exception &ex)
+    {
+        std::cerr << ex.displayText() << std::endl;
+        std::cout << std::endl;
+    }
+    return Poco::Util::Application::EXIT_USAGE;
+}

+ 34 - 0
apps/PothosUtil.hpp

@@ -0,0 +1,34 @@
+// Copyright (c) 2013-2018 Josh Blum
+//                    2020 Nicholas Corgan
+// SPDX-License-Identifier: BSL-1.0
+
+#pragma once
+#include <string>
+#include <Pothos/Init.hpp>
+#include <Poco/Util/ServerApplication.h>
+#include <utility> //pair
+#include <vector>
+
+class PothosUtilBase : public Poco::Util::ServerApplication
+{
+public:
+    virtual ~PothosUtilBase(void){}
+    void printSystemInfo(const std::string &, const std::string &);
+    void printModuleInfo(const std::string &, const std::string &);
+    void printDeviceInfo(void);
+    void printPluginTree(const std::string &, const std::string &);
+    void selfTests(const std::string &, const std::string &);
+    void selfTestOne(const std::string &, const std::string &);
+    void proxyServer(const std::string &, const std::string &);
+    void loadModule(const std::string &, const std::string &);
+    void runTopology(void);
+    void docParse(const std::vector<std::string> &);
+    void listModules(const std::string &, const std::string &);
+    void printProxyEnvironmentInfo(const std::string &, const std::string &);
+    void printSIMDFeatures(void);
+    void generateSIMDDispatchers(const std::string &, const std::string &);
+    void printTypeConversions(const std::string &, const std::string &);
+
+    //! Variables passed in via the --vars option
+    std::vector<std::pair<std::string, std::string>> _vars;
+};

+ 53 - 0
apps/PothosUtilDeviceInfo.cpp

@@ -0,0 +1,53 @@
+// Copyright (c) 2013-2017 Josh Blum
+// SPDX-License-Identifier: BSL-1.0
+
+#include "PothosUtil.hpp"
+#include <Pothos/Plugin.hpp>
+#include <Pothos/Proxy.hpp>
+#include <Poco/Path.h>
+#include <sstream>
+#include <fstream>
+#include <iostream>
+#include <json.hpp>
+
+using json = nlohmann::json;
+
+void PothosUtilBase::printDeviceInfo(void)
+{
+    Pothos::ScopedInit init;
+
+    const auto deviceType = this->config().getString("deviceType");
+    if (deviceType.empty())
+    {
+        std::cout << std::endl;
+        std::cout << ">>> Specify --device-info=deviceType for more information..." << std::endl;
+        std::cout << ">>> Available device types in the plugin tree are: " << std::endl;
+        for (const auto &name : Pothos::PluginRegistry::list("/devices"))
+        {
+            std::cout << "  * " << name << std::endl;
+        }
+        std::cout << std::endl;
+        return;
+    }
+
+    //extract the JSON device information
+    auto path = Pothos::PluginPath("/devices").join(deviceType).join("info");
+    std::cout << ">>> Querying device info: " << path.toString() << std::endl;
+    auto plugin = Pothos::PluginRegistry::get(path);
+    auto call = plugin.getObject().extract<Pothos::Callable>();
+    auto info = json::parse(call.call<std::string>());
+
+    //dump the information to file
+    if (this->config().has("outputFile"))
+    {
+        const auto infoFile = this->config().getString("outputFile");
+        std::cout << ">>> Dumping info: " << infoFile << std::endl;
+        std::ofstream ofs(Poco::Path::expand(infoFile));
+        ofs << info.dump(4);
+    }
+    //or otherwise to stdout
+    else
+    {
+        std::cout << info.dump(4) << std::endl;
+    }
+}

+ 70 - 0
apps/PothosUtilDocParse.cpp

@@ -0,0 +1,70 @@
+// Copyright (c) 2014-2016 Josh Blum
+// SPDX-License-Identifier: BSL-1.0
+
+#include "PothosUtil.hpp"
+#include <Pothos/Util/BlockDescription.hpp>
+#include <Pothos/Plugin.hpp>
+#include <Poco/Format.h>
+#include <Poco/NumberFormatter.h>
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <string>
+
+/***********************************************************************
+ * generate a cpp source that adds the json string to the registry
+ **********************************************************************/
+static void jsonArrayToCppStaticBlock(const Pothos::Util::BlockDescriptionParser &parser, std::ostream &os, const std::string &target)
+{
+    os << "#include <Pothos/Framework.hpp>\n";
+    os << "#include <Pothos/Plugin.hpp>\n";
+    os << Poco::format("pothos_static_block(registerPothosBlockDocs%s)\n", target);
+    os << "{\n";
+    for (const auto &factory : parser.listFactories())
+    {
+        //create escaped string of json
+        std::string escaped;
+        for (const auto &ch : parser.getJSONObject(factory))
+        {
+            escaped += "\\x" + Poco::NumberFormatter::formatHex(int(ch), 2/*width*/, false/*no 0x*/);
+        }
+
+        //register the block description at the specified path
+        const auto pluginPath = Pothos::PluginPath("/blocks/docs", factory);
+        os << Poco::format("    Pothos::PluginRegistry::add(\"%s\", std::string(\"%s\"));\n", pluginPath.toString(), escaped);
+    }
+    os << "}\n";
+}
+
+void PothosUtilBase::docParse(const std::vector<std::string> &inputFilePaths)
+{
+    Pothos::Util::BlockDescriptionParser parser;
+
+    //feed all input files into the parser
+    for (const auto &inputFilePath : inputFilePaths)
+    {
+        parser.feedFilePath(inputFilePath);
+    }
+
+    //write to output (file if specified, otherwise stdout)
+    const auto outputFilePath = this->config().getString("outputFile", "");
+    const size_t indentSpaces = 4;
+    if (outputFilePath.empty())
+    {
+        std::cout << std::endl;
+        std::cout << parser.getJSONArray(indentSpaces);
+        std::cout << std::endl;
+    }
+    else
+    {
+        const auto outputFileName = Poco::Path(outputFilePath).getBaseName();
+        const auto outputFileExt = Poco::Path(outputFilePath).getExtension();
+
+        std::ofstream outputFile(outputFilePath.c_str());
+        if (outputFileExt == "json") outputFile << parser.getJSONArray(indentSpaces);
+        else if (outputFileExt == "cpp") jsonArrayToCppStaticBlock(parser, outputFile, outputFileName);
+        else throw Pothos::Exception("PothosUtilBase::docParse()", "unsupported file extension: " + outputFilePath);
+        outputFile << std::endl;
+        outputFile.close();
+    }
+}

+ 42 - 0
apps/PothosUtilGenerateSIMDDispatchers.cpp

@@ -0,0 +1,42 @@
+// Copyright (c) 2020 Nicholas Corgan
+// SPDX-License-Identifier: BSL-1.0
+
+#include "PothosUtil.hpp"
+
+#include <Pothos/Plugin.hpp>
+#include <Pothos/Proxy.hpp>
+
+#include <Poco/File.h>
+#include <Poco/StringTokenizer.h>
+
+#include <fstream>
+#include <iostream>
+#include <string>
+#include <vector>
+
+/***********************************************************************
+ * Generate a C++ header with SIMD dispatchers for a given Pothos module
+ **********************************************************************/
+void PothosUtilBase::generateSIMDDispatchers(const std::string&, const std::string& jsonPath)
+{
+    auto env = Pothos::ProxyEnvironment::make("managed");
+    auto simdDispatcher = env->findProxy("Pothos/Util/SIMDDispatcher");
+
+    const auto simdArchesStr = this->config().getString("simdArches");
+    const auto outputFilePath = this->config().getString("outputFile");
+
+    Poco::StringTokenizer simdArchesTokenizer(simdArchesStr, ",", Poco::StringTokenizer::TOK_TRIM);
+    std::vector<std::string> simdArches(simdArchesTokenizer.begin(), simdArchesTokenizer.end());
+
+    const auto fileSize = Poco::File(jsonPath).getSize();
+
+    std::ifstream ifile(jsonPath.c_str(), std::ios::in);
+    std::string jsonInput;
+    jsonInput.resize(fileSize);
+    ifile.read((char*)jsonInput.data(), fileSize);
+
+    const auto outputHeaderString = simdDispatcher.call<std::string>("generateAndDumpHeader", jsonInput, simdArches);
+
+    std::ofstream ofile(outputFilePath.c_str(), std::ios::out);
+    ofile << outputHeaderString;
+}

+ 66 - 0
apps/PothosUtilListModules.cpp

@@ -0,0 +1,66 @@
+// Copyright (c) 2020 NIcholas Corgan
+// SPDX-License-Identifier: BSL-1.0
+
+#include "PothosUtil.hpp"
+
+#include <Pothos/Plugin.hpp>
+
+#include <algorithm>
+#include <cassert>
+#include <iomanip>
+#include <iostream>
+#include <map>
+#include <string>
+
+static std::map<std::string, std::string> modVers;
+static std::map<std::string, size_t> modNumsPlugins;
+static size_t maxPathLength = 0;
+
+static void traverseDump(const Pothos::PluginRegistryInfoDump& dump)
+{
+    if(!dump.modulePath.empty())
+    {
+        if(modNumsPlugins.count(dump.modulePath) > 0)
+        {
+            assert(modVers.count(dump.modulePath) > 0);
+            ++modNumsPlugins[dump.modulePath];
+        }
+        else
+        {
+            modVers[dump.modulePath] = dump.moduleVersion;
+            modNumsPlugins[dump.modulePath] = 1;
+
+            maxPathLength = std::max(maxPathLength, dump.modulePath.size());
+        }
+    }
+    for(const auto& sub: dump.subInfo)
+    {
+        traverseDump(sub);
+    }
+}
+
+void PothosUtilBase::listModules(const std::string&, const std::string&)
+{
+    Pothos::ScopedInit init;
+
+    traverseDump(Pothos::PluginRegistry::dump());
+
+    using MapPair = std::map<std::string, size_t>::value_type;
+    const auto maxNumPluginsIter = std::max_element(
+                                       modNumsPlugins.begin(),
+                                       modNumsPlugins.end(),
+                                       [](const MapPair& p1, const MapPair& p2)
+                                       {
+                                           return (p1.second < p2.second);
+                                       });
+    const auto maxNumPluginsLength = std::to_string(maxNumPluginsIter->second).size();
+
+    for(const auto& modVersMapPair: modVers)
+    {
+        const auto& modulePath = modVersMapPair.first;
+
+        std::cout << std::left << std::setw(maxPathLength) << modulePath << " ("
+                  << std::right << std::setw(maxNumPluginsLength) << modNumsPlugins[modulePath]
+                  << " plugins) [" << modVersMapPair.second << "]" << std::endl;
+    }
+}

+ 105 - 0
apps/PothosUtilListTypeConversions.cpp

@@ -0,0 +1,105 @@
+// Copyright (c) 2021 Nicholas Corgan
+// SPDX-License-Identifier: BSL-1.0
+
+#include "PothosUtil.hpp"
+
+#include <Pothos/Callable.hpp>
+#include <Pothos/Plugin.hpp>
+#include <Pothos/Proxy.hpp>
+#include <Pothos/System/Paths.hpp>
+#include <Pothos/Util/TypeInfo.hpp>
+
+#include <Poco/Format.h>
+#include <Poco/Path.h>
+
+#include <iostream>
+#include <string>
+#include <vector>
+
+static bool isConvertCallable(const Pothos::Callable& callable)
+{
+    if(callable.getNumArgs() != 1) return false;
+    if(callable.type(-1) == typeid(void)) return false;
+
+    return true;
+}
+
+// Assumption: callable type validated
+static void getConvertTypeNames(
+    const Pothos::Callable& callable,
+    std::string* srcTypeOut,
+    std::string* dstTypeOut)
+{
+    *srcTypeOut = Pothos::Util::typeInfoToString(callable.type(0));
+    *dstTypeOut = Pothos::Util::typeInfoToString(callable.type(-1));
+}
+
+static void getTypeConversions(
+    const Pothos::PluginPath& pluginPath,
+    const std::string& typeName,
+    std::vector<std::string>* convertibleFromOut,
+    std::vector<std::string>* convertibleToOut)
+{
+    Pothos::Plugin plugin(pluginPath);
+    if(!Pothos::PluginRegistry::empty(pluginPath))
+    {
+        plugin = Pothos::PluginRegistry::get(pluginPath);
+    }
+    const auto& pluginObj = plugin.getObject();
+
+    if(pluginObj.type() == typeid(Pothos::Callable))
+    {
+        const auto& callable = pluginObj.extract<Pothos::Callable>();
+        if(isConvertCallable(callable))
+        {
+            std::string srcType;
+            std::string dstType;
+            getConvertTypeNames(callable, &srcType, &dstType);
+
+            if(srcType == typeName)      convertibleFromOut->emplace_back(std::move(dstType));
+            else if(dstType == typeName) convertibleToOut->emplace_back(std::move(srcType));
+        }
+    }
+
+    for(const auto& subpath: Pothos::PluginRegistry::list(pluginPath))
+    {
+        getTypeConversions(
+            pluginPath.join(subpath),
+            typeName,
+            convertibleFromOut,
+            convertibleToOut);
+    }
+}
+
+void PothosUtilBase::printTypeConversions(const std::string&, const std::string&)
+{
+    Pothos::ScopedInit init;
+
+    const auto typeName = this->config().getString("type");
+    if (typeName.empty())
+    {
+        std::cout << ">>> Specify --type=typeName to list conversions..." << std::endl;
+        return;
+    }
+
+    std::vector<std::string> convertibleFrom;
+    std::vector<std::string> convertibleTo;
+    getTypeConversions(
+        Pothos::PluginPath("/object/convert"),
+        typeName,
+        &convertibleFrom,
+        &convertibleTo);
+
+    std::cout << "Convertible from " << typeName << ":" << std::endl;
+    for(const auto& type: convertibleFrom)
+    {
+        std::cout << " * " << type << std::endl;
+    }
+    std::cout << std::endl;
+
+    std::cout << "Convertible to " << typeName << ":" << std::endl;
+    for(const auto& type: convertibleTo)
+    {
+        std::cout << " * " << type << std::endl;
+    }
+}

+ 27 - 0
apps/PothosUtilLoadModule.cpp

@@ -0,0 +1,27 @@
+// Copyright (c) 2013-2015 Josh Blum
+// SPDX-License-Identifier: BSL-1.0
+
+#include "PothosUtil.hpp"
+#include <Pothos/Plugin/Module.hpp>
+#include <iostream>
+#include <cstdlib>
+
+//remove outer quotes if they exist
+static std::string unquote(const std::string &s)
+{
+    if (s.size() > 2 and s.front() == '"' and s.back() == '"')
+    {
+        return s.substr(1, s.length()-2);
+    }
+    else return s;
+}
+
+void PothosUtilBase::loadModule(const std::string &, const std::string &path)
+{
+    std::cout << "Loading: " << path << std::endl;
+    //this tests module load and unload -- could throw or cause abort
+    {
+        Pothos::PluginModule module(unquote(path));
+    }
+    std::cout << "success!" << std::endl;
+}

+ 63 - 0
apps/PothosUtilModuleInfo.cpp

@@ -0,0 +1,63 @@
+// Copyright (c) 2018-2018 Josh Blum
+// SPDX-License-Identifier: BSL-1.0
+
+#include "PothosUtil.hpp"
+#include <Pothos/Plugin.hpp>
+#include <map>
+#include <algorithm>
+#include <iostream>
+#include <iomanip>
+
+static std::map<std::string, std::vector<std::string>> modMap;
+static std::map<std::string, std::string> modVers;
+
+static void traverseDump(const std::string &modulePath, const Pothos::PluginRegistryInfoDump &dump)
+{
+    const bool isBuiltin = modulePath == "builtin" and dump.modulePath.empty();
+    const bool filterPass = modulePath.empty() or modulePath == dump.modulePath;
+    if (not dump.objectType.empty() and (isBuiltin or filterPass))
+    {
+        modMap[dump.modulePath].push_back(dump.pluginPath);
+        modVers[dump.modulePath] = dump.moduleVersion;
+    }
+
+    for (const auto &subInfo : dump.subInfo)
+    {
+        traverseDump(modulePath, subInfo);
+    }
+}
+
+static const std::string stringifyName(const std::string &modulePath)
+{
+    return modulePath.empty()?"Builtin":modulePath;
+}
+
+void PothosUtilBase::printModuleInfo(const std::string &, const std::string &modulePath)
+{
+    Pothos::ScopedInit init;
+    traverseDump(modulePath, Pothos::PluginRegistry::dump());
+    size_t maxPathLength(0);
+    for (const auto &module : modMap)
+    {
+        const auto displayName = stringifyName(module.first);
+        maxPathLength = std::max(maxPathLength, displayName.size());
+    }
+
+    for (const auto &module : modMap)
+    {
+        const auto displayName = stringifyName(module.first);
+        const auto paddedName = displayName + std::string(maxPathLength-displayName.size()+1, ' ');
+        std::cout << paddedName << "(" << std::setw(2) << module.second.size() << " plugins)";
+        const auto modVer = modVers.at(module.first);
+        if (not modVer.empty()) std::cout << " [" << modVer << "]";
+        std::cout << std::endl;
+        if (not modulePath.empty())
+        {
+            for (const auto &pluginPath : module.second)
+            {
+                std::cout << "  " << pluginPath << std::endl;
+            }
+        }
+    }
+    std::cout << std::endl;
+}

+ 30 - 0
apps/PothosUtilPluginTree.cpp

@@ -0,0 +1,30 @@
+// Copyright (c) 2013-2015 Josh Blum
+// SPDX-License-Identifier: BSL-1.0
+
+#include "PothosUtil.hpp"
+#include <Pothos/Plugin.hpp>
+#include <iostream>
+
+static void printPluginTreeR(const Pothos::PluginPath &path)
+{
+    Pothos::Plugin plugin(path);
+    if (not Pothos::PluginRegistry::empty(path))
+    {
+        plugin = Pothos::PluginRegistry::get(path);
+    }
+    std::cout << plugin.toString() << std::endl;
+
+    //iterate on the subtree stuff
+    auto nodes = Pothos::PluginRegistry::list(path);
+    for (auto it = nodes.begin(); it != nodes.end(); it++)
+    {
+        printPluginTreeR(path.join(*it));
+    }
+}
+
+void PothosUtilBase::printPluginTree(const std::string &, const std::string &pluginPath)
+{
+    Pothos::ScopedInit init;
+    printPluginTreeR(pluginPath.empty()?"/":pluginPath);
+    std::cout << std::endl;
+}

+ 144 - 0
apps/PothosUtilProxyEnvironmentInfo.cpp

@@ -0,0 +1,144 @@
+// Copyright (c) 2020 Nicholas Corgan
+// SPDX-License-Identifier: BSL-1.0
+
+#include "PothosUtil.hpp"
+
+#include <Pothos/Callable.hpp>
+#include <Pothos/Plugin.hpp>
+#include <Pothos/Proxy.hpp>
+#include <Pothos/System/Paths.hpp>
+#include <Pothos/Util/TypeInfo.hpp>
+
+#include <Poco/Format.h>
+#include <Poco/Path.h>
+
+#include <iostream>
+#include <vector>
+
+// Expected signature: Pothos::Proxy(Pothos::ProxyEnvironment::Sptr, const CppType&)
+static bool isCallableConverterToEnv(const Pothos::Callable& callable)
+{
+    if (callable.getNumArgs() != 2) return false;
+    if (callable.type(-1) != typeid(Pothos::Proxy)) return false;
+    if (callable.type(0) != typeid(Pothos::ProxyEnvironment::Sptr)) return false;
+
+    return true;
+}
+
+// Expected signature: CppType(const Pothos::Proxy&)
+static bool isCallableConverterFromEnv(const Pothos::Callable& callable)
+{
+    if (callable.getNumArgs() != 1) return false;
+    if (callable.type(0) != typeid(const Pothos::Proxy&)) return false;
+
+    return true;
+}
+
+static std::string getEnvironmentModuleFilepath(const std::string& proxyEnvName)
+{
+    if ((proxyEnvName == "managed") || (proxyEnvName == "remote")) return Pothos::System::getPothosRuntimeLibraryPath();
+
+    // Since we can't necessarily assume there are are specific converters or tests,
+    // look in all potential locations for a plugin registered in paths designated
+    // for proxy-specific plugins.
+    const auto convertersPluginPath = "/proxy/converters/" + proxyEnvName;
+    const auto testsPluginPath = Poco::format("/proxy/%s/tests", proxyEnvName);
+
+    for (const auto& pluginLeaf : Pothos::PluginRegistry::list(convertersPluginPath))
+    {
+        const auto pluginPath = Poco::format("%s/%s", convertersPluginPath, pluginLeaf);
+        const auto plugin = Pothos::PluginRegistry::get(pluginPath);
+
+        return plugin.getModule().getFilePath();
+    }
+    for (const auto& pluginLeaf : Pothos::PluginRegistry::list(testsPluginPath))
+    {
+        const auto pluginPath = Poco::format("%s/%s", testsPluginPath, pluginLeaf);
+        const auto plugin = Pothos::PluginRegistry::get(pluginPath);
+
+        return plugin.getModule().getFilePath();
+    }
+
+    return "";
+}
+
+static void printConverters(const std::string& proxyEnvName)
+{
+    const auto convertersPluginPath = "/proxy/converters/" + proxyEnvName;
+
+    if (Pothos::PluginRegistry::exists(convertersPluginPath))
+    {
+        std::vector<Pothos::Callable> convertersToEnvironment;
+        std::vector<Pothos::ProxyConvertPair> convertersFromEnvironment;
+
+        for (const auto& pluginLeaf : Pothos::PluginRegistry::list(convertersPluginPath))
+        {
+            const auto pluginPath = Poco::format("%s/%s", convertersPluginPath, pluginLeaf);
+            const auto plugin = Pothos::PluginRegistry::get(pluginPath);
+
+            if (plugin.getObject().type() == typeid(Pothos::Callable))
+            {
+                auto pluginCallable = plugin.getObject().extract<Pothos::Callable>();
+                if (isCallableConverterToEnv(pluginCallable)) convertersToEnvironment.emplace_back(std::move(pluginCallable));
+            }
+            else if (plugin.getObject().type() == typeid(Pothos::ProxyConvertPair))
+            {
+                auto pluginPair = plugin.getObject().extract<Pothos::ProxyConvertPair>();
+                if (isCallableConverterFromEnv(pluginPair.second)) convertersFromEnvironment.emplace_back(std::move(pluginPair));
+            }
+        }
+
+        if (!convertersToEnvironment.empty())
+        {
+            std::cout << std::endl << "Types directly convertible to environment:" << std::endl;
+            for (const auto& converterCallable : convertersToEnvironment)
+            {
+                std::cout << " * " << Pothos::Util::typeInfoToString(converterCallable.type(1)) << std::endl;
+            }
+        }
+        if (!convertersFromEnvironment.empty())
+        {
+            std::cout << std::endl << "Type conversions from environment:" << std::endl;
+            for (const auto& converterPair : convertersFromEnvironment)
+            {
+                std::cout << " * " << converterPair.first << " -> " << Pothos::Util::typeInfoToString(converterPair.second.type(-1)) << std::endl;
+            }
+        }
+    }
+}
+
+static void printTests(const std::string& proxyEnvName)
+{
+    const auto testsPluginPath = Poco::format("/proxy/%s/tests", proxyEnvName);
+
+    if (Pothos::PluginRegistry::exists(testsPluginPath))
+    {
+        std::cout << std::endl << "Self-tests:" << std::endl;
+        for (const auto& pluginLeaf : Pothos::PluginRegistry::list(testsPluginPath))
+        {
+            std::cout << " * " << pluginLeaf << std::endl;
+        }
+    }
+}
+
+void PothosUtilBase::printProxyEnvironmentInfo(const std::string&, const std::string&)
+{
+    Pothos::ScopedInit init;
+
+    const auto proxyEnvName = this->config().getString("proxyEnvName");
+    if (proxyEnvName.empty())
+    {
+        std::cout << ">>> Specify --proxy-environment-info=proxyEnvName for more information..." << std::endl;
+        std::cout << ">>> Available proxy environments are:" << std::endl;
+        for (const auto& name : Pothos::PluginRegistry::list("/proxy"))
+        {
+            if (name != "converters") std::cout << "  * " << name << std::endl;
+        }
+        std::cout << std::endl;
+        return;
+    }
+
+    std::cout << "Proxy environment " << proxyEnvName << " (" << getEnvironmentModuleFilepath(proxyEnvName) << ")" << std::endl;
+    printConverters(proxyEnvName);
+    printTests(proxyEnvName);
+}

+ 145 - 0
apps/PothosUtilProxyServer.cpp

@@ -0,0 +1,145 @@
+// Copyright (c) 2013-2017 Josh Blum
+// SPDX-License-Identifier: BSL-1.0
+
+#include "PothosUtil.hpp"
+#include <Pothos/Init.hpp>
+#include <Pothos/Remote.hpp>
+#include <Pothos/Util/Network.hpp>
+#include <Poco/Net/ServerSocket.h>
+#include <Poco/Net/SocketStream.h>
+#include <Poco/Net/TCPServer.h>
+#include <Poco/Process.h>
+#include <Poco/URI.h>
+#include <mutex>
+#include <cassert>
+#include <iostream>
+
+/***********************************************************************
+ * TCP connection factory
+ *  - create connection handler threads
+ *  - monitor connection start and stop
+ *  - kill process in require active mode
+ **********************************************************************/
+class MyTCPServerConnectionFactory : public Poco::Net::TCPServerConnectionFactory
+{
+public:
+    MyTCPServerConnectionFactory(const bool requireActive):
+        _numConnections(0),
+        _requireActive(requireActive)
+    {
+        return;
+    }
+
+    Poco::Net::TCPServerConnection *createConnection(const Poco::Net::StreamSocket &socket);
+
+    void connectionStart(void)
+    {
+        std::unique_lock<std::mutex> lock(_mutex);
+        _numConnections++;
+    }
+
+    void connectionStop(void)
+    {
+        std::unique_lock<std::mutex> lock(_mutex);
+        assert(_numConnections != 0);
+        _numConnections--;
+        if (_numConnections == 0 and _requireActive)
+        {
+            std::cerr << "Proxy server: No active connections - terminating" << std::endl;
+            Poco::Process::requestTermination(Poco::Process::id());
+        }
+    }
+
+private:
+    std::mutex _mutex;
+    size_t _numConnections;
+    const bool _requireActive;
+};
+
+/***********************************************************************
+ * TCP connection thread
+ *  - create the remote handler for the connection
+ *  - service the remote handler until disconnect
+ **********************************************************************/
+class MyTCPServerConnection : public Poco::Net::TCPServerConnection
+{
+public:
+    MyTCPServerConnection(MyTCPServerConnectionFactory &factory, const Poco::Net::StreamSocket &socket):
+        Poco::Net::TCPServerConnection(socket),
+        _factory(factory),
+        _handler(Pothos::RemoteHandler(socket.peerAddress().host().toString()))
+    {
+        _factory.connectionStart();
+    }
+
+    ~MyTCPServerConnection(void)
+    {
+        _factory.connectionStop();
+    }
+
+    void run(void)
+    {
+        this->socket().setNoDelay(true);
+        Poco::Net::SocketStream socketStream(this->socket());
+        _handler.runHandler(socketStream, socketStream);
+    }
+
+private:
+    MyTCPServerConnectionFactory &_factory;
+    Pothos::RemoteHandler _handler;
+};
+
+Poco::Net::TCPServerConnection *MyTCPServerConnectionFactory::createConnection(const Poco::Net::StreamSocket &socket)
+{
+    return new MyTCPServerConnection(*this, socket);
+}
+
+/***********************************************************************
+ * Spawn TCP proxy server given server URI
+ **********************************************************************/
+void PothosUtilBase::proxyServer(const std::string &, const std::string &uriStr)
+{
+    //remove automatic flushing from iostreams
+    //only flushes on newlines and intentional flushes
+    std::cout << std::nounitbuf;
+    std::cerr << std::nounitbuf;
+    std::clog << std::nounitbuf;
+
+    //fully buffered IO backs up and is not acceptable for logging
+    //set stdio to be line buffered which is useful for logging
+    //on windows, line buffering is not supported, use unbuffered
+    #ifdef _MSC_VER
+    setvbuf(stdout, nullptr, _IONBF, 0);
+    setvbuf(stderr, nullptr, _IONBF, 0);
+    #else
+    setvbuf(stdout, nullptr, _IOLBF, 0);
+    setvbuf(stderr, nullptr, _IOLBF, 0);
+    #endif
+
+    Pothos::ScopedInit init;
+
+    //parse the URI
+    const std::string defaultUri = "tcp://"+Pothos::Util::getWildcardAddr(Pothos::RemoteServer::getLocatorPort());
+    Poco::URI uri(uriStr.empty()?defaultUri:uriStr);
+    const std::string &host = uri.getHost();
+    const std::string &port = std::to_string(uri.getPort());
+    if (uri.getScheme() != "tcp")
+    {
+        throw Pothos::Exception("PothosUtil::proxyServer("+uriStr+")", "unsupported URI scheme");
+    }
+
+    //create server socket
+    Poco::Net::SocketAddress sa(host, port);
+    Poco::Net::ServerSocket serverSocket(sa);
+    Poco::Net::TCPServerConnectionFactory::Ptr factory;
+    factory = new MyTCPServerConnectionFactory(this->config().hasOption("requireActive"));
+    Poco::Net::TCPServer tcpServer(factory, serverSocket);
+
+    //start the server
+    tcpServer.start();
+    std::cout << "Host: " << serverSocket.address().host().toString() << std::endl;
+    std::cout << "Port: " << serverSocket.address().port() << std::endl;
+
+    //wait here until the term signal is received
+    this->waitForTerminationRequest();
+}

+ 112 - 0
apps/PothosUtilRunTopology.cpp

@@ -0,0 +1,112 @@
+// Copyright (c) 2014-2017 Josh Blum
+// SPDX-License-Identifier: BSL-1.0
+
+#include "PothosUtil.hpp"
+#include <Pothos/Framework.hpp>
+#include <Pothos/Exception.hpp>
+#include <Poco/Path.h>
+#include <fstream>
+#include <thread>
+#include <iostream>
+#include <json.hpp>
+
+using json = nlohmann::json;
+
+void PothosUtilBase::runTopology(void)
+{
+    Pothos::ScopedInit init;
+
+    //sanity check the file
+    const auto path = this->config().getString("inputFile");
+    if (Poco::Path(path).getExtension() == "pothos" or
+        Poco::Path(path).getExtension() == "pth")
+    {
+        throw Pothos::DataFormatException("Cannot load "+path+"!\n"
+            "Please export the design to the JSON topology format.");
+    }
+    std::ifstream ifs(Poco::Path::expand(path));
+    if (not ifs) throw Pothos::FileException("Can't open "+path+" for reading!");
+
+    //parse the json formatted string into a JSON object
+    json topObj;
+    try
+    {
+        topObj = json::parse(ifs);
+    }
+    catch (const std::exception &ex)
+    {
+        throw Pothos::DataFormatException(ex.what());
+    }
+
+    //apply the global variable overlays
+    if (topObj.count("globals") == 0) topObj["globals"] = json::array();
+    auto &globalsArray = topObj["globals"];
+    for (const auto &pair : _vars)
+    {
+        //look for a match in the existing globals and override its value
+        for (auto &globalVarObj : globalsArray)
+        {
+            if (globalVarObj.value<std::string>("name", "") == pair.first)
+            {
+                globalVarObj["value"] = pair.second;
+                goto nextVar;
+            }
+        }
+
+        //otherwise add to the end of the globals array
+        {
+            std::cout << "add name " << pair.first << std::endl;
+            json globalVarObj;
+            globalVarObj["name"] = pair.first;
+            globalVarObj["value"] = pair.second;
+            globalsArray.push_back(globalVarObj);
+        }
+
+        nextVar: continue;
+    }
+
+    //create the topology from the JSON string
+    std::cout << ">>> Create Topology: " << path << std::endl;
+    auto topology = Pothos::Topology::make(topObj.dump());
+
+    //commit the topology and wait for specified time for CTRL+C
+    if (this->config().has("idleTime"))
+    {
+        const auto idleTime = this->config().getDouble("idleTime");
+        double timeout = 0.0;
+        std::string timeoutMsg = "no timeout";
+        if (this->config().has("runDuration"))
+        {
+            timeout = this->config().getDouble("runDuration");
+            timeoutMsg = "timeout " + std::to_string(timeout) + " seconds";
+        }
+        std::cout << ">>> Running topology until idle with " << timeoutMsg << std::endl;
+        topology->commit();
+        if (not topology->waitInactive(idleTime, timeout))
+        {
+            throw Pothos::RuntimeException("Topology::waitInactive() reached timeout");
+        }
+    }
+    else if (this->config().has("runDuration"))
+    {
+        const auto runDuration = this->config().getDouble("runDuration");
+        std::cout << ">>> Running topology for " << runDuration << " seconds" << std::endl;
+        topology->commit();
+        std::this_thread::sleep_for(std::chrono::milliseconds(long(runDuration*1000)));
+    }
+    else
+    {
+        std::cout << ">>> Running topology, press CTRL+C to exit" << std::endl;
+        topology->commit();
+        this->waitForTerminationRequest();
+    }
+
+    //dump the stats to file if specified
+    if (this->config().has("outputFile"))
+    {
+        const auto statsFile = this->config().getString("outputFile");
+        std::cout << ">>> Dumping stats: " << statsFile << std::endl;
+        std::ofstream ofs(Poco::Path::expand(statsFile));
+        ofs << topology->queryJSONStats() << std::endl;
+    }
+}

+ 17 - 0
apps/PothosUtilSIMDFeatures.cpp

@@ -0,0 +1,17 @@
+// Copyright (c) 2020 Nicholsa Corgan
+// SPDX-License-Identifier: BSL-1.0
+
+#include "PothosUtil.hpp"
+
+#include <Pothos/System.hpp>
+
+#include <iostream>
+
+void PothosUtilBase::printSIMDFeatures(void)
+{
+    std::cout << "SIMD features supported on this processor:" << std::endl;
+    for(const auto& arch: Pothos::System::getSupportedSIMDFeatureSet())
+    {
+        std::cout << " * " << arch << std::endl;
+    }
+}

+ 202 - 0
apps/PothosUtilSelfTests.cpp

@@ -0,0 +1,202 @@
+// Copyright (c) 2013-2020 Josh Blum
+//                    2020 Nicholas Corgan
+// SPDX-License-Identifier: BSL-1.0
+
+#include "PothosUtil.hpp"
+#include <Pothos/Testing.hpp>
+#include <Pothos/Plugin/Loader.hpp>
+#include <Pothos/System/Paths.hpp>
+#include <Poco/Process.h>
+#include <Poco/Pipe.h>
+#include <Poco/PipeStream.h>
+#include <Poco/String.h>
+#include <Poco/Glob.h>
+#include <iostream>
+#include <sstream>
+#include <vector>
+#include <future>
+#include <cctype>
+#include <algorithm> //max
+
+struct SelfTestResults
+{
+    std::vector<std::string> testsPassed;
+    std::vector<std::string> testsFailed;
+};
+
+static std::string collectVerbose(const Poco::Pipe &pipe)
+{
+    size_t maxLen = 0;
+    Poco::PipeInputStream is(pipe);
+    std::vector<std::string> lines;
+    try
+    {
+        std::string line;
+        while (is.good())
+        {
+            std::getline(is, line);
+            while (not line.empty() and std::isspace(line.back()))
+            {
+                line.pop_back();
+            }
+            if (line.empty()) continue;
+            maxLen = std::max(maxLen, line.length());
+            lines.push_back(line);
+        }
+    }
+    catch (...){}
+    std::ostringstream ss;
+    ss << " +-" << std::string(maxLen, '-') << "-+" << std::endl;
+    for (const auto &line : lines)
+    {
+        const size_t padLen = maxLen-line.length();
+        ss << " | " << line << std::string(padLen, ' ') << " |" << std::endl;
+    }
+    ss << " +-" << std::string(maxLen, '-') << "-+" << std::endl;
+    return ss.str();
+}
+
+static bool spawnSelfTestOneProcess(const std::string &path, size_t numTrials)
+{
+    const bool multipleTrials = (numTrials > 1);
+    const int success = 200;
+
+    std::cout << "Testing " << path << "... ";
+    if(multipleTrials) std::cout << std::endl;
+    else std::cout << std::flush;
+
+    //create args
+    Poco::Process::Args args;
+    args.push_back("--self-test1");
+    args.push_back(path);
+    args.push_back("--success-code");
+    args.push_back(std::to_string(success));
+    args.push_back("--num-trials");
+    args.push_back(std::to_string(numTrials));
+
+    size_t numOk = 0;
+
+    for(size_t trialNum = 0; trialNum < numTrials; ++trialNum)
+    {
+        //launch
+        Poco::Process::Env env;
+        Poco::Pipe outPipe; //no fwd stdio
+        Poco::ProcessHandle ph(Poco::Process::launch(
+            Pothos::System::getPothosUtilExecutablePath(),
+            args, nullptr, &outPipe, &outPipe, env));
+
+        std::future<std::string> verboseFuture(std::async(std::launch::async, &collectVerbose, outPipe));
+        const bool ok = (ph.wait() == success);
+        if(multipleTrials)
+        {
+            std::cout << " * Trial " << (trialNum+1) << ": " << std::flush;
+        }
+        std::cout << ((ok)? "success!" : "FAIL!") << std::endl;
+
+        outPipe.close();
+        verboseFuture.wait();
+        if (not ok) std::cout << verboseFuture.get();
+        else numOk++;
+    }
+
+    return numOk != 0;
+}
+
+static void runPluginSelfTestsR(const Pothos::PluginPath &path, SelfTestResults &results, Poco::Glob &glob, size_t numTrials)
+{
+    //run the test found at path
+    if (not Pothos::PluginRegistry::empty(path) and glob.match(path.toString()))
+    {
+        auto plugin = Pothos::PluginRegistry::get(path);
+        if (plugin.getObject().type() == typeid(std::shared_ptr<Pothos::TestingBase>))
+        {
+            if (spawnSelfTestOneProcess(path.toString(), numTrials))
+            {
+                results.testsPassed.push_back(path.toString());
+            }
+            else
+            {
+                results.testsFailed.push_back(path.toString());
+            }
+        }
+    }
+    //iterate on the subtree stuff
+    auto nodes = Pothos::PluginRegistry::list(path);
+    for (auto it = nodes.begin(); it != nodes.end(); it++)
+    {
+        runPluginSelfTestsR(path.join(*it), results, glob, numTrials);
+    }
+}
+
+void PothosUtilBase::selfTestOne(const std::string &, const std::string &path)
+{
+    Pothos::ScopedInit init;
+
+    const auto numTrials = this->config().getUInt("numTrials", 1);
+    const bool multipleTrials = (numTrials > 1);
+
+    auto plugin = Pothos::PluginRegistry::get(path);
+    auto test = plugin.getObject().extract<std::shared_ptr<Pothos::TestingBase>>();
+
+    if(!multipleTrials)
+    {
+        std::cout << "Testing " << plugin.getPath().toString() << "..." << std::endl;
+    }
+
+    try
+    {
+        for(size_t trialNum = 0; trialNum < numTrials; ++trialNum)
+        {
+            if(multipleTrials)
+            {
+                std::cout << "--------------------------------------------" << std::endl
+                          <<  "Testing " << plugin.getPath().toString() << " (trial "
+                          << (trialNum+1) << ")..." << std::endl << std::endl;
+            }
+
+            test->runTests();
+            std::cout << "success!" << std::endl;
+        }
+    }
+    catch(...)
+    {
+        throw;
+    }
+}
+
+void PothosUtilBase::selfTests(const std::string &, const std::string &path)
+{
+    Pothos::ScopedInit init;
+
+    const auto numTrials = this->config().getUInt("numTrials", 1);
+
+    SelfTestResults results;
+    if (path.find('*') == std::string::npos)
+    {
+        Poco::Glob glob("*"); //not globing, match all
+        runPluginSelfTestsR(path.empty()? "/" : path, results, glob, numTrials);
+    }
+    else
+    {
+        Poco::Glob glob(path); //path is a glob rule
+        runPluginSelfTestsR("/", results, glob, numTrials);
+    }
+    std::cout << std::endl;
+
+    const size_t totalTests = results.testsPassed.size() + results.testsFailed.size();
+    if (results.testsFailed.empty())
+    {
+        std::cout << "All " << totalTests << " tests passed!" << std::endl;
+    }
+    else
+    {
+        std::cout << "Failed " << results.testsFailed.size() << " out of " << totalTests << " tests" << std::endl;
+        for (auto it = results.testsFailed.begin(); it != results.testsFailed.end(); it++)
+        {
+            std::cout << "  FAIL: " << *it << std::endl;
+        }
+        std::cout << std::endl;
+        throw Pothos::Exception("Failures occurred in self test suite.");
+    }
+    std::cout << std::endl;
+}

+ 27 - 0
apps/PothosUtilSystemInfo.cpp

@@ -0,0 +1,27 @@
+// Copyright (c) 2013-2018 Josh Blum
+//                    2019 Nicholas Corgan
+// SPDX-License-Identifier: BSL-1.0
+
+#include "PothosUtil.hpp"
+#include <Pothos/System.hpp>
+#include <iostream>
+
+void PothosUtilBase::printSystemInfo(const std::string &, const std::string &)
+{
+    std::cout << "Lib Version: " << Pothos::System::getLibVersion() << std::endl;
+    std::cout << "API Version: " << Pothos::System::getApiVersion() << std::endl;
+    std::cout << "ABI Version: " << Pothos::System::getAbiVersion() << std::endl;
+    std::cout << "Root Path: " << Pothos::System::getRootPath() << std::endl;
+    std::cout << "Data Path: " << Pothos::System::getDataPath() << std::endl;
+    std::cout << "User Data: " << Pothos::System::getUserDataPath() << std::endl;
+    std::cout << "User Config: " << Pothos::System::getUserConfigPath() << std::endl;
+    std::cout << "Runtime Library: " << Pothos::System::getPothosRuntimeLibraryPath() << std::endl;
+    std::cout << "Util Executable: " << Pothos::System::getPothosUtilExecutablePath() << std::endl;
+    std::cout << "Dev Include Path: " << Pothos::System::getPothosDevIncludePath() << std::endl;
+    std::cout << "Dev Library Path: " << Pothos::System::getPothosDevLibraryPath() << std::endl;
+    std::cout << "Module Search Paths:" << std::endl;
+    for(const auto& searchPath: Pothos::System::getPothosModuleSearchPaths())
+    {
+        std::cout << " * " << searchPath << std::endl;
+    }
+}

+ 73 - 0
appveyor.yml

@@ -0,0 +1,73 @@
+########################################################################
+## AppVeyor config for Pothos
+##
+## * not all components will be configured
+## * build only on a 64-bit environment
+## * only builds for release configuration
+## * install Poco from pre-built zip
+##
+## FAIL: The build takes too long, most components are disabled.
+## TODO: but build takes too long... 40 min limit
+## * install SoapySDR from source
+## * run the self tests after install
+########################################################################
+
+version: '{build}'
+
+platform: x64
+
+configuration:
+  - RelWithDebInfo
+
+environment:
+  global:
+    GENERATOR: Visual Studio 14 Win64
+    POTHOS_PREFIX: C:/Program Files/Pothos
+    SOAPY_PREFIX: C:/Program Files/SoapySDR
+    SOAPY_BRANCH: master
+
+# Operating system (build VM template)
+os: Windows Server 2012 R2
+
+# branches to build
+branches:
+  # whitelist
+  only:
+    - master
+    - maint
+
+before_build:
+  # install SoapySDR from source
+  #- git clone https://github.com/pothosware/SoapySDR.git
+  #- cd SoapySDR
+  #- git checkout %SOAPY_BRANCH%
+  #- mkdir build && cd build
+  #- cmake ../ -G "%GENERATOR%" -DCMAKE_INSTALL_PREFIX="%SOAPY_PREFIX%" -DCMAKE_BUILD_TYPE=%CONFIGURATION%
+  #- cmake --build . --config %CONFIGURATION%
+  #- cmake --build . --config %CONFIGURATION% --target install
+  #- cd ../..
+
+  # download pre-built poco
+  - ps: Start-FileDownload 'http://www.joshknows.com/download/Poco_1.6.0_x64_rel.zip'
+  - 7z x Poco_1.6.0_x64_rel.zip -o"C:/Program Files"
+
+# configure and build
+build_script:
+  - set PATH=C:/Program Files/Poco/bin;%PATH%
+  - echo %PATH%
+  - git submodule update --init --recursive
+  - mkdir build && cd build
+  - cmake ../ -G "%GENERATOR%" -DCMAKE_INSTALL_PREFIX="%POTHOS_PREFIX%" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DENABLE_TOOLKITS=OFF -DENABLE_DOCS=OFF -DBUILD_TESTING=OFF
+  - cmake --build . --config %CONFIGURATION%
+  - cmake --build . --config %CONFIGURATION% --target install
+
+# setup environment paths
+before_test:
+  - set PATH=%POTHOS_PREFIX%/bin;%PATH%
+  - set PATH=%SOAPY_PREFIX%/bin;%PATH%
+  - echo %PATH%
+
+# basic test for command line utility
+#test_script:
+#  - PothosUtil --system-info
+#  - PothosUtil --self-tests

+ 32 - 0
cmake/Modules/CMakeLists.txt

@@ -0,0 +1,32 @@
+########################################################################
+## Feature registration
+########################################################################
+cmake_dependent_option(ENABLE_LIBRARY_CMAKE "Enable Pothos Library.CMake component" ON "ENABLE_LIBRARY" OFF)
+add_feature_info("  CMake" ENABLE_LIBRARY_CMAKE "CMake project utilities for Pothos library")
+if (NOT ENABLE_LIBRARY_CMAKE)
+    return()
+endif()
+
+########################################################################
+# Install cmake helper modules
+########################################################################
+include(CMakePackageConfigHelpers)
+
+write_basic_package_version_file(
+    ${PROJECT_BINARY_DIR}/PothosConfigVersion.cmake
+    VERSION ${POTHOS_VERSION}
+    COMPATIBILITY AnyNewerVersion)
+
+install(FILES
+    ${PROJECT_SOURCE_DIR}/cmake/Modules/PothosConfig.cmake
+    ${PROJECT_SOURCE_DIR}/cmake/Modules/PothosUtil.cmake
+    ${PROJECT_BINARY_DIR}/PothosConfigVersion.cmake
+    #poco support
+    ${PROJECT_SOURCE_DIR}/cmake/Modules/FindPkgMacros.cmake
+    ${PROJECT_SOURCE_DIR}/cmake/Modules/FindPoco.cmake
+    ${PROJECT_SOURCE_DIR}/cmake/Modules/SetupPoco.cmake
+    #SIMD
+    ${PROJECT_SOURCE_DIR}/cmake/Modules/PothosConfigSIMD.cmake
+
+    DESTINATION ${POTHOS_CMAKE_DIRECTORY}
+    COMPONENT pothos_devel)

+ 144 - 0
cmake/Modules/FindPkgMacros.cmake

@@ -0,0 +1,144 @@
+#-------------------------------------------------------------------
+# This file is part of the CMake build system for OGRE
+#     (Object-oriented Graphics Rendering Engine)
+# For the latest info, see http://www.ogre3d.org/
+#
+# The contents of this file are placed in the public domain. Feel
+# free to make use of it in any way you like.
+#-------------------------------------------------------------------
+
+##################################################################
+# Provides some common functionality for the FindPackage modules
+##################################################################
+
+# Begin processing of package
+macro(findpkg_begin PREFIX)
+  if (NOT ${PREFIX}_FIND_QUIETLY)
+    message(STATUS "Looking for ${PREFIX}...")
+  endif ()
+endmacro(findpkg_begin)
+
+# Display a status message unless FIND_QUIETLY is set
+macro(pkg_message PREFIX)
+  if (NOT ${PREFIX}_FIND_QUIETLY)
+    message(STATUS ${ARGN})
+  endif ()
+endmacro(pkg_message)
+
+# Get environment variable, define it as ENV_$var and make sure backslashes are converted to forward slashes
+macro(getenv_path VAR)
+   set(ENV_${VAR} $ENV{${VAR}})
+   # replace won't work if var is blank
+   if (ENV_${VAR})
+     string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} )
+   endif ()
+endmacro(getenv_path)
+
+# Construct search paths for includes and libraries from a PREFIX_PATH
+macro(create_search_paths PREFIX)
+  foreach(dir ${${PREFIX}_PREFIX_PATH})
+    set(${PREFIX}_INC_SEARCH_PATH ${${PREFIX}_INC_SEARCH_PATH}
+      ${dir}/include ${dir}/include/${PREFIX} ${dir}/Headers)
+    set(${PREFIX}_LIB_SEARCH_PATH ${${PREFIX}_LIB_SEARCH_PATH}
+      ${dir}/lib ${dir}/lib/${PREFIX} ${dir}/Libs)
+    set(${PREFIX}_BIN_SEARCH_PATH ${${PREFIX}_BIN_SEARCH_PATH}
+      ${dir}/bin)
+  endforeach(dir)
+  set(${PREFIX}_FRAMEWORK_SEARCH_PATH ${${PREFIX}_PREFIX_PATH})
+endmacro(create_search_paths)
+
+# clear cache variables if a certain variable changed
+macro(clear_if_changed TESTVAR)
+  # test against internal check variable
+  if (NOT "${${TESTVAR}}" STREQUAL "${${TESTVAR}_INT_CHECK}")
+    message(STATUS "${TESTVAR} changed.")
+    foreach(var ${ARGN})
+      set(${var} "NOTFOUND" CACHE STRING "x" FORCE)
+    endforeach(var)
+  endif ()
+  set(${TESTVAR}_INT_CHECK ${${TESTVAR}} CACHE INTERNAL "x" FORCE)
+endmacro(clear_if_changed)
+
+# Try to get some hints from pkg-config, if available
+macro(use_pkgconfig PREFIX PKGNAME)
+  find_package(PkgConfig)
+  if (PKG_CONFIG_FOUND)
+    pkg_check_modules(${PREFIX} ${PKGNAME})
+  endif ()
+endmacro (use_pkgconfig)
+
+# Couple a set of release AND debug libraries (or frameworks)
+macro(make_library_set PREFIX)
+  if (${PREFIX}_FWK)
+    set(${PREFIX} ${${PREFIX}_FWK})
+  elseif (${PREFIX}_REL AND ${PREFIX}_DBG)
+    set(${PREFIX} optimized ${${PREFIX}_REL} debug ${${PREFIX}_DBG})
+  elseif (${PREFIX}_REL)
+    set(${PREFIX} ${${PREFIX}_REL})
+  elseif (${PREFIX}_DBG)
+    set(${PREFIX} ${${PREFIX}_DBG})
+  endif ()
+endmacro(make_library_set)
+
+# Generate debug names from given release names
+macro(get_debug_names PREFIX)
+  foreach(i ${${PREFIX}})
+    set(${PREFIX}_DBG ${${PREFIX}_DBG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i})
+  endforeach(i)
+endmacro(get_debug_names)
+
+# Add the parent dir from DIR to VAR 
+macro(add_parent_dir VAR DIR)
+  get_filename_component(${DIR}_TEMP "${${DIR}}/.." ABSOLUTE)
+  set(${VAR} ${${VAR}} ${${DIR}_TEMP})
+endmacro(add_parent_dir)
+
+# Do the final processing for the package find.
+macro(findpkg_finish PREFIX)
+  # skip if already processed during this run
+  if (NOT ${PREFIX}_FOUND)
+    if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY)
+      set(${PREFIX}_FOUND TRUE)
+      set(${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR})
+      set(${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY})
+      if (NOT ${PREFIX}_FIND_QUIETLY)
+        message(STATUS "Found ${PREFIX}: ${${PREFIX}_LIBRARIES}")
+      endif ()
+    else ()
+      if (NOT ${PREFIX}_FIND_QUIETLY)
+        message(STATUS "Could not locate ${PREFIX}")
+      endif ()
+      if (${PREFIX}_FIND_REQUIRED)
+        message(FATAL_ERROR "Required library ${PREFIX} not found! Install the library (including dev packages) and try again. If the library is already installed, set the missing variables manually in cmake.")
+      endif ()
+    endif ()
+
+    mark_as_advanced(${PREFIX}_INCLUDE_DIR ${PREFIX}_LIBRARY ${PREFIX}_LIBRARY_REL ${PREFIX}_LIBRARY_DBG ${PREFIX}_LIBRARY_FWK)
+  endif ()
+endmacro(findpkg_finish)
+
+
+# Slightly customised framework finder
+MACRO(findpkg_framework fwk)
+  IF(APPLE)
+    SET(${fwk}_FRAMEWORK_PATH
+      ${${fwk}_FRAMEWORK_SEARCH_PATH}
+      ${CMAKE_FRAMEWORK_PATH}
+      ~/Library/Frameworks
+      /Library/Frameworks
+      /System/Library/Frameworks
+      /Network/Library/Frameworks
+      /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/Frameworks/
+    )
+    FOREACH(dir ${${fwk}_FRAMEWORK_PATH})
+      SET(fwkpath ${dir}/${fwk}.framework)
+      IF(EXISTS ${fwkpath})
+        SET(${fwk}_FRAMEWORK_INCLUDES ${${fwk}_FRAMEWORK_INCLUDES}
+          ${fwkpath}/Headers ${fwkpath}/PrivateHeaders)
+        if (NOT ${fwk}_LIBRARY_FWK)
+          SET(${fwk}_LIBRARY_FWK "-framework ${fwk}")
+        endif ()
+      ENDIF(EXISTS ${fwkpath})
+    ENDFOREACH(dir)
+  ENDIF(APPLE)
+ENDMACRO(findpkg_framework)

+ 110 - 0
cmake/Modules/FindPoco.cmake

@@ -0,0 +1,110 @@
+#-------------------------------------------------------------------
+# This file is part of the CMake build system for OGRE
+#     (Object-oriented Graphics Rendering Engine)
+# For the latest info, see http://www.ogre3d.org/
+#
+# The contents of this file are placed in the public domain. Feel
+# free to make use of it in any way you like.
+#-------------------------------------------------------------------
+
+# - Try to find POCO libraries
+# Once done, this will define
+#
+#  POCO_FOUND - system has POCO
+#  POCO_INCLUDE_DIRS - the POCO include directories
+#  POCO_LIBRARIES - link these to use POCO
+
+include(FindPkgMacros)
+findpkg_begin(POCO)
+
+# Get path, convert backslashes as ${ENV_${var}}
+getenv_path(POCO_HOME)
+getenv_path(POCO_ROOT)
+getenv_path(POCO_BASE)
+
+# construct search paths
+set(POCO_PREFIX_PATH
+  ${POCO_HOME} ${ENV_POCO_HOME}
+  ${POCO_ROOT} ${ENV_POCO_ROOT}
+  ${POCO_BASE} ${ENV_POCO_BASE}
+)
+# redo search if prefix path changed
+clear_if_changed(POCO_PREFIX_PATH
+  POCO_LIBRARY_FWK
+  POCO_LIBRARY_REL
+  POCO_LIBRARY_DBG
+  POCO_INCLUDE_DIR
+)
+
+create_search_paths(POCO)
+set(POCO_INC_SEARCH_PATH ${POCO_INC_SEARCH_PATH} ${POCO_PREFIX_PATH})
+
+
+set(POCO_LIBRARY_NAMES PocoFoundation PocoFoundationmt)
+get_debug_names(POCO_LIBRARY_NAMES)
+
+use_pkgconfig(POCO_PKGC POCO)
+
+findpkg_framework(POCO)
+
+find_path(POCO_INCLUDE_DIR NAMES Poco/Foundation.h HINTS ${POCO_INC_SEARCH_PATH} ${POCO_PKGC_INCLUDE_DIRS} PATH_SUFFIXES Foundation/include)
+find_library(POCO_LIBRARY_REL NAMES ${POCO_LIBRARY_NAMES} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
+find_library(POCO_LIBRARY_DBG NAMES ${POCO_LIBRARY_NAMES_DBG} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
+make_library_set(POCO_LIBRARY)
+
+findpkg_finish(POCO)
+
+if (NOT POCO_FOUND)
+  return()
+endif ()
+
+
+# Look for Poco's Util package
+findpkg_begin(POCO_Util)
+set(POCO_Util_LIBRARY_NAMES PocoUtil PocoUtilmt)
+get_debug_names(POCO_Util_LIBRARY_NAMES)
+find_path(POCO_Util_INCLUDE_DIR NAMES Poco/Util/Util.h HINTS ${POCO_INCLUDE_DIR} ${POCO_INC_SEARCH_PATH} ${POCO_PKGC_INCLUDE_DIRS} PATH_SUFFIXES Util/include)
+find_library(POCO_Util_LIBRARY_REL NAMES ${POCO_Util_LIBRARY_NAMES} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
+find_library(POCO_Util_LIBRARY_DBG NAMES ${POCO_Util_LIBRARY_NAMES_DBG} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
+make_library_set(POCO_Util_LIBRARY)
+findpkg_finish(POCO_Util)
+
+# Look for Poco's Net package
+findpkg_begin(POCO_Net)
+set(POCO_Net_LIBRARY_NAMES PocoNet PocoNetmt)
+get_debug_names(POCO_Net_LIBRARY_NAMES)
+find_path(POCO_Net_INCLUDE_DIR NAMES Poco/Net/Net.h HINTS ${POCO_INCLUDE_DIR} ${POCO_INC_SEARCH_PATH} ${POCO_PKGC_INCLUDE_DIRS} PATH_SUFFIXES Net/include)
+find_library(POCO_Net_LIBRARY_REL NAMES ${POCO_Net_LIBRARY_NAMES} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
+find_library(POCO_Net_LIBRARY_DBG NAMES ${POCO_Net_LIBRARY_NAMES_DBG} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
+make_library_set(POCO_Net_LIBRARY)
+findpkg_finish(POCO_Net)
+
+# Look for Poco's NetSSL package
+findpkg_begin(POCO_NetSSL)
+set(POCO_NetSSL_LIBRARY_NAMES PocoNetSSL PocoNetSSLmt)
+get_debug_names(POCO_NetSSL_LIBRARY_NAMES)
+find_path(POCO_NetSSL_INCLUDE_DIR NAMES Poco/Net/NetSSL.h HINTS ${POCO_INCLUDE_DIR} ${POCO_INC_SEARCH_PATH} ${POCO_PKGC_INCLUDE_DIRS} PATH_SUFFIXES NetSSL/include)
+find_library(POCO_NetSSL_LIBRARY_REL NAMES ${POCO_NetSSL_LIBRARY_NAMES} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
+find_library(POCO_NetSSL_LIBRARY_DBG NAMES ${POCO_NetSSL_LIBRARY_NAMES_DBG} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
+make_library_set(POCO_NetSSL_LIBRARY)
+findpkg_finish(POCO_NetSSL)
+
+# Look for Poco's XML package
+findpkg_begin(POCO_XML)
+set(POCO_XML_LIBRARY_NAMES PocoXML PocoXMLmt)
+get_debug_names(POCO_XML_LIBRARY_NAMES)
+find_path(POCO_XML_INCLUDE_DIR NAMES Poco/XML/XML.h HINTS ${POCO_INCLUDE_DIR} ${POCO_INC_SEARCH_PATH} ${POCO_PKGC_INCLUDE_DIRS} PATH_SUFFIXES XML/include)
+find_library(POCO_XML_LIBRARY_REL NAMES ${POCO_XML_LIBRARY_NAMES} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
+find_library(POCO_XML_LIBRARY_DBG NAMES ${POCO_XML_LIBRARY_NAMES_DBG} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
+make_library_set(POCO_XML_LIBRARY)
+findpkg_finish(POCO_XML)
+
+# Look for Poco's JSON package
+findpkg_begin(POCO_JSON)
+set(POCO_JSON_LIBRARY_NAMES PocoJSON PocoJSONLmt)
+get_debug_names(POCO_JSON_LIBRARY_NAMES)
+find_path(POCO_JSON_INCLUDE_DIR NAMES Poco/JSON/JSON.h HINTS ${POCO_INCLUDE_DIR} ${POCO_INC_SEARCH_PATH} ${POCO_PKGC_INCLUDE_DIRS} PATH_SUFFIXES JSON/include)
+find_library(POCO_JSON_LIBRARY_REL NAMES ${POCO_JSON_LIBRARY_NAMES} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
+find_library(POCO_JSON_LIBRARY_DBG NAMES ${POCO_JSON_LIBRARY_NAMES_DBG} HINTS ${POCO_LIB_SEARCH_PATH} ${POCO_PKGC_LIBRARY_DIRS} PATH_SUFFIXES Linux/i686)
+make_library_set(POCO_JSON_LIBRARY)
+findpkg_finish(POCO_JSON)

+ 130 - 0
cmake/Modules/GetGitRevisionDescription.cmake

@@ -0,0 +1,130 @@
+# - Returns a version string from Git
+#
+# These functions force a re-configure on each git commit so that you can
+# trust the values of the variables in your build system.
+#
+#  get_git_head_revision(<refspecvar> <hashvar> [<additional arguments to git describe> ...])
+#
+# Returns the refspec and sha hash of the current head revision
+#
+#  git_describe(<var> [<additional arguments to git describe> ...])
+#
+# Returns the results of git describe on the source tree, and adjusting
+# the output so that it tests false if an error occurs.
+#
+#  git_get_exact_tag(<var> [<additional arguments to git describe> ...])
+#
+# Returns the results of git describe --exact-match on the source tree,
+# and adjusting the output so that it tests false if there was no exact
+# matching tag.
+#
+# Requires CMake 2.6 or newer (uses the 'function' command)
+#
+# Original Author:
+# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
+# http://academic.cleardefinition.com
+# Iowa State University HCI Graduate Program/VRAC
+#
+# Copyright Iowa State University 2009-2010.
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+if(__get_git_revision_description)
+	return()
+endif()
+set(__get_git_revision_description YES)
+
+# We must run the following at "include" time, not at function call time,
+# to find the path to this module rather than the path to a calling list file
+get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
+
+function(get_git_head_revision _refspecvar _hashvar)
+	set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+	set(GIT_DIR "${GIT_PARENT_DIR}/.git")
+	while(NOT EXISTS "${GIT_DIR}")	# .git dir not found, search parent directories
+		set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}")
+		get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH)
+		if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT)
+			# We have reached the root directory, we are not in git
+			set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
+			set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE)
+			return()
+		endif()
+		set(GIT_DIR "${GIT_PARENT_DIR}/.git")
+	endwhile()
+	# check if this is a submodule
+	if(NOT IS_DIRECTORY ${GIT_DIR})
+		file(READ ${GIT_DIR} submodule)
+		string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule})
+		get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
+		get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE)
+	endif()
+	set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
+	if(NOT EXISTS "${GIT_DATA}")
+		file(MAKE_DIRECTORY "${GIT_DATA}")
+	endif()
+
+	if(NOT EXISTS "${GIT_DIR}/HEAD")
+		return()
+	endif()
+	set(HEAD_FILE "${GIT_DATA}/HEAD")
+	configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY)
+
+	configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
+		"${GIT_DATA}/grabRef.cmake"
+		@ONLY)
+	include("${GIT_DATA}/grabRef.cmake")
+
+	set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE)
+	set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE)
+endfunction()
+
+function(git_describe _var)
+	if(NOT GIT_FOUND)
+		find_package(Git QUIET)
+	endif()
+	get_git_head_revision(refspec hash)
+	if(NOT GIT_FOUND)
+		set(${_var} "GIT-NOTFOUND" PARENT_SCOPE)
+		return()
+	endif()
+	if(NOT hash)
+		set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE)
+		return()
+	endif()
+
+	# TODO sanitize
+	#if((${ARGN}" MATCHES "&&") OR
+	#	(ARGN MATCHES "||") OR
+	#	(ARGN MATCHES "\\;"))
+	#	message("Please report the following error to the project!")
+	#	message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
+	#endif()
+
+	#message(STATUS "Arguments to execute_process: ${ARGN}")
+
+	execute_process(COMMAND
+		"${GIT_EXECUTABLE}"
+		describe
+		${hash}
+		${ARGN}
+		WORKING_DIRECTORY
+		"${CMAKE_SOURCE_DIR}"
+		RESULT_VARIABLE
+		res
+		OUTPUT_VARIABLE
+		out
+		ERROR_QUIET
+		OUTPUT_STRIP_TRAILING_WHITESPACE)
+	if(NOT res EQUAL 0)
+		set(out "${out}-${res}-NOTFOUND")
+	endif()
+
+	set(${_var} "${out}" PARENT_SCOPE)
+endfunction()
+
+function(git_get_exact_tag _var)
+	git_describe(out --exact-match ${ARGN})
+	set(${_var} "${out}" PARENT_SCOPE)
+endfunction()

+ 38 - 0
cmake/Modules/GetGitRevisionDescription.cmake.in

@@ -0,0 +1,38 @@
+# 
+# Internal file for GetGitRevisionDescription.cmake
+#
+# Requires CMake 2.6 or newer (uses the 'function' command)
+#
+# Original Author:
+# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
+# http://academic.cleardefinition.com
+# Iowa State University HCI Graduate Program/VRAC
+#
+# Copyright Iowa State University 2009-2010.
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+set(HEAD_HASH)
+
+file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
+
+string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
+if(HEAD_CONTENTS MATCHES "ref")
+	# named branch
+	string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
+	if(EXISTS "@GIT_DIR@/${HEAD_REF}")
+		configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
+	elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}")
+		configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
+		set(HEAD_HASH "${HEAD_REF}")
+	endif()
+else()
+	# detached HEAD
+	configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
+endif()
+
+if(NOT HEAD_HASH)
+	file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
+	string(STRIP "${HEAD_HASH}" HEAD_HASH)
+endif()

+ 184 - 0
cmake/Modules/PothosConfig.cmake

@@ -0,0 +1,184 @@
+if(DEFINED INCLUDED_POTHOS_CONFIG_CMAKE)
+    return()
+endif()
+set(INCLUDED_POTHOS_CONFIG_CMAKE TRUE)
+
+########################################################################
+# PothosConfig - sets Pothos installation variables
+#
+# POTHOS_UTIL_EXE - the path to PothosUtil executable
+# Pothos_INCLUDE_DIRS - Pothos development includes
+# Pothos_LIBRARIES - Pothos development libraries
+# POTHOS_CMAKE_DIRECTORY - where to install CMake files
+########################################################################
+list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_LIST_DIR})
+include(PothosUtil) #utility functions
+
+########################################################################
+# select the release build type by default to get optimization flags
+########################################################################
+if(NOT CMAKE_BUILD_TYPE)
+   set(CMAKE_BUILD_TYPE "Release")
+   message(STATUS "Build type not specified: defaulting to release.")
+endif(NOT CMAKE_BUILD_TYPE)
+set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
+
+########################################################################
+# Use GNU Install Dirs, but support LIB_SUFFIX if specified
+########################################################################
+include(GNUInstallDirs)
+if(LIB_SUFFIX)
+    set(CMAKE_INSTALL_LIBDIR "lib${LIB_SUFFIX}") #support old lib suffix
+endif(LIB_SUFFIX)
+
+########################################################################
+# extract the ABI version string from the Version.hpp header
+########################################################################
+function(_POTHOS_GET_ABI_VERSION VERSION INCLUDE_DIR)
+    file(READ "${INCLUDE_DIR}/Pothos/System/Version.hpp" version_hpp)
+    string(REGEX MATCH "\\#define POTHOS_ABI_VERSION \"([0-9]+\\.[0-9]+(-[A-Za-z0-9]+)?)\"" POTHOS_ABI_VERSION_MATCHES "${version_hpp}")
+    if(NOT POTHOS_ABI_VERSION_MATCHES)
+        message(FATAL_ERROR "Failed to extract version number from Version.hpp")
+    endif(NOT POTHOS_ABI_VERSION_MATCHES)
+    set(${VERSION} "${CMAKE_MATCH_1}" CACHE INTERNAL "")
+endfunction(_POTHOS_GET_ABI_VERSION)
+
+########################################################################
+# install directory for cmake files
+# used publicly in PothosPython
+########################################################################
+if (UNIX)
+    set(POTHOS_CMAKE_DIRECTORY ${CMAKE_INSTALL_DATADIR}/cmake/Pothos)
+elseif (WIN32)
+    set(POTHOS_CMAKE_DIRECTORY cmake)
+endif ()
+
+########################################################################
+## in-tree build support
+########################################################################
+if (POTHOS_IN_TREE_SOURCE_DIR)
+
+    if(NOT POTHOS_ROOT)
+        set(POTHOS_ROOT ${CMAKE_INSTALL_PREFIX})
+    endif(NOT POTHOS_ROOT)
+
+    _POTHOS_GET_ABI_VERSION(POTHOS_ABI_VERSION ${POTHOS_IN_TREE_SOURCE_DIR}/include)
+
+    #a list of in-tree built libraries to generate a library path script
+    set(IN_TREE_LIBRARIES Pothos)
+    if (POCO_IN_TREE)
+        list(APPEND IN_TREE_LIBRARIES ${Poco_LIBRARIES})
+    endif()
+    if (MUPARSERX_IN_TREE)
+        list(APPEND IN_TREE_LIBRARIES ${muparserx_LIBRARIES})
+    endif()
+
+    if(MSVC)
+        set(built_dll_paths "%PATH%")
+        foreach(target ${IN_TREE_LIBRARIES})
+            set(built_dll_paths "$<TARGET_FILE_DIR:${target}>;${built_dll_paths}")
+        endforeach(target)
+        set(POTHOS_UTIL_EXE ${PROJECT_BINARY_DIR}/PothosUtil.bat)
+        add_custom_command(
+            OUTPUT ${POTHOS_UTIL_EXE}
+            DEPENDS PothosUtil
+            COMMAND ${CMAKE_COMMAND} -E echo "set PATH=${built_dll_paths}" > ${POTHOS_UTIL_EXE}
+            COMMAND ${CMAKE_COMMAND} -E echo "\"$<TARGET_FILE:PothosUtil>\" %*" >> ${POTHOS_UTIL_EXE}
+            VERBATIM
+        )
+    endif()
+
+    if(UNIX)
+        set(built_dll_paths "\${LD_LIBRARY_PATH}")
+        foreach(target ${IN_TREE_LIBRARIES})
+            set(built_dll_paths "$<TARGET_FILE_DIR:${target}>:${built_dll_paths}")
+        endforeach(target)
+        find_program(SH_EXE sh)
+        find_program(CHMOD_EXE chmod)
+        set(POTHOS_UTIL_EXE ${PROJECT_BINARY_DIR}/PothosUtil.sh)
+        add_custom_command(
+            OUTPUT ${POTHOS_UTIL_EXE}
+            DEPENDS PothosUtil
+            COMMAND ${CMAKE_COMMAND} -E echo "#!${SH_EXE}" > ${POTHOS_UTIL_EXE}
+            COMMAND ${CMAKE_COMMAND} -E echo "export LD_LIBRARY_PATH=${built_dll_paths}" >> ${POTHOS_UTIL_EXE}
+            COMMAND ${CMAKE_COMMAND} -E echo "export DYLD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:\${DYLD_LIBRARY_PATH}" >> ${POTHOS_UTIL_EXE}
+            COMMAND ${CMAKE_COMMAND} -E echo "\"$<TARGET_FILE:PothosUtil>\" $@" >> ${POTHOS_UTIL_EXE}
+            COMMAND ${CHMOD_EXE} +x ${POTHOS_UTIL_EXE}
+            VERBATIM
+        )
+    endif()
+
+    set(__POTHOS_UTIL_TARGET_NAME ${PROJECT_NAME}PothosUtil)
+    add_custom_target(${__POTHOS_UTIL_TARGET_NAME} DEPENDS ${POTHOS_UTIL_EXE})
+
+    #set old-style variables
+    unset(Pothos_INCLUDE_DIRS)
+    set(Pothos_LIBRARIES Pothos)
+    return()
+endif ()
+
+########################################################################
+## Determine root installation path
+########################################################################
+file(RELATIVE_PATH POTHOS_ROOT_RELDIR "${CMAKE_INSTALL_PREFIX}/${POTHOS_CMAKE_DIRECTORY}" "${CMAKE_INSTALL_PREFIX}")
+get_filename_component(POTHOS_ROOT "${CMAKE_CURRENT_LIST_DIR}/${POTHOS_ROOT_RELDIR}" ABSOLUTE)
+
+########################################################################
+## locate the PothosUtil application
+########################################################################
+find_program(
+    POTHOS_UTIL_EXE PothosUtil
+    PATHS ${POTHOS_ROOT}/bin
+    NO_DEFAULT_PATH
+)
+if(NOT POTHOS_UTIL_EXE)
+    message(FATAL_ERROR "cannot find PothosUtil in ${POTHOS_ROOT}/bin")
+endif()
+
+if(MSVC)
+    file(TO_NATIVE_PATH "${POTHOS_ROOT}/bin" bin_path)
+    file(TO_NATIVE_PATH "${POTHOS_UTIL_EXE}" POTHOS_UTIL_EXE)
+    file(WRITE ${PROJECT_BINARY_DIR}/PothosUtil.bat
+        "set PATH=${bin_path};%PATH%\n"
+        "\"${POTHOS_UTIL_EXE}\" %*\n"
+    )
+    set(POTHOS_UTIL_EXE ${PROJECT_BINARY_DIR}/PothosUtil.bat)
+endif()
+
+if(UNIX)
+    file(TO_NATIVE_PATH "${POTHOS_ROOT}/${CMAKE_INSTALL_LIBDIR}" lib_path)
+    file(TO_NATIVE_PATH "${POTHOS_UTIL_EXE}" POTHOS_UTIL_EXE)
+    find_program(SH_EXE sh)
+    find_program(CHMOD_EXE chmod)
+    file(WRITE ${PROJECT_BINARY_DIR}/PothosUtil.sh
+        "#!${SH_EXE}\n"
+        "export LD_LIBRARY_PATH=${lib_path}:\${LD_LIBRARY_PATH}\n"
+        "export DYLD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:\${DYLD_LIBRARY_PATH}\n"
+        "\"${POTHOS_UTIL_EXE}\" $@\n"
+    )
+    execute_process(COMMAND ${CHMOD_EXE} +x ${PROJECT_BINARY_DIR}/PothosUtil.sh)
+    set(POTHOS_UTIL_EXE ${PROJECT_BINARY_DIR}/PothosUtil.sh)
+endif()
+
+set(__success_code "200")
+execute_process(
+    COMMAND ${POTHOS_UTIL_EXE} --success-code ${__success_code}
+    RESULT_VARIABLE __result_code
+)
+if(NOT __result_code STREQUAL __success_code)
+    message(FATAL_ERROR "PothosUtil execution test failed")
+endif()
+
+########################################################################
+## create import library target
+########################################################################
+enable_language(C) #newer Poco config scrips require c to be enabled
+include(SetupPoco) #Poco is a Pothos library public dependency
+
+include(PothosExport)
+
+#set old-style variables
+get_target_property(POTHOS_INCLUDE_DIR Pothos INTERFACE_INCLUDE_DIRECTORIES)
+set(Pothos_INCLUDE_DIRS ${POTHOS_INCLUDE_DIR})
+set(Pothos_LIBRARIES Pothos)
+_POTHOS_GET_ABI_VERSION(POTHOS_ABI_VERSION ${POTHOS_INCLUDE_DIR})

+ 1333 - 0
cmake/Modules/PothosConfigSIMD.cmake

@@ -0,0 +1,1333 @@
+#   Copyright (C) 2012-2013  Povilas Kanapickas <povilas@radix.lt>
+#                      2020  Nicholas Corgan <n.corgan@gmail.com>
+#
+#   Distributed under the Boost Software License, Version 1.0.
+#       (See accompanying file LICENSE_1_0.txt or copy at
+#           http://www.boost.org/LICENSE_1_0.txt)
+
+include(CheckCXXSourceRuns)
+include(CheckCXXSourceCompiles)
+
+# We need this because calling CMAKE_CURRENT_LIST_DIR returns the directory
+# of the caller, and CMake doesn't provide a solution until 3.17.
+set(POTHOS_CONFIG_SIMD_LIST_DIR ${CMAKE_CURRENT_LIST_DIR} CACHE INTERNAL "")
+
+# ------------------------------------------------------------------------------
+# Compiler checks (internal)
+set(POTHOS_GCC 0)
+set(POTHOS_CLANG 0)
+set(POTHOS_MSVC 0)
+set(POTHOS_INTEL 0)
+set(POTHOS_MSVC_INTEL 0)
+
+if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+    set(POTHOS_CLANG 1)
+elseif(CMAKE_CXX_COMPILER_ID MATCHES "Apple")
+    set(POTHOS_CLANG 1)
+elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+    set(POTHOS_GCC 1)
+elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
+    if(MSVC)
+        set(POTHOS_MSVC_INTEL 1)
+    else()
+        set(POTHOS_INTEL 1)
+    endif()
+elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
+    set(POTHOS_MSVC 1)
+else()
+    message(FATAL_ERROR "Compiler '${CMAKE_CXX_COMPILER_ID}' not recognized")
+endif()
+
+if(CMAKE_SIZEOF_VOID_P MATCHES "8")
+    set(POTHOS_64BIT 1)
+else()
+    set(POTHOS_32BIT 1)
+endif()
+
+# ------------------------------------------------------------------------------
+# Architecture descriptions (internal)
+#
+# Each architecture has the following information specific to it:
+#  - POTHOS_${ARCH}_TEST_CODE: source code snippet that uses functionality
+#       from that arch. Used for @c check_cxx_source_runs macro.
+#       We are taking extra care to confuse the compiler so that it does not
+#       optimize things out. Nowadays compilers have good sense of when things
+#       don't have side effects and will see through simple obfuscation
+#       patterns.
+#  - POTHOS_${ARCH}_CXX_FLAGS: compiler flags that are needed for compilation.
+#  - POTHOS_${ARCH}_DEFINE: defines the macro that is needed to enable the
+#       specific instruction set within the library.
+#  - POTHOS_${ARCH}_SUFFIX: defines a suffix to append to the filename of the
+#       source file specific to this architecture.
+#
+# Three lists are created:
+#
+#  - POTHOS_ARCHS_PRI - primary architectures.
+#  - POTHOS_ARCHS_SEC - secondary architectures. Effectively equivalent to one
+#       of the primary architectures, just different instructions are generated
+#       in specific scenarios.
+#  - POTHOS_ARCHS - all architectures
+#
+
+list(APPEND POTHOS_ARCHS_PRI "X86_SSE2")
+if(POTHOS_CLANG OR POTHOS_GCC OR POTHOS_INTEL)
+    set(POTHOS_X86_SSE2_CXX_FLAGS "-msse2")
+elseif((POTHOS_MSVC OR POTHOS_MSVC_INTEL) AND POTHOS_WIN32)
+    set(POTHOS_X86_SSE2_CXX_FLAGS "/arch:SSE2")
+endif()
+set(POTHOS_X86_SSE2_DEFINE "POTHOS_ARCH_X86_SSE2")
+set(POTHOS_X86_SSE2_SUFFIX "-x86_sse2")
+set(POTHOS_X86_SSE2_TEST_CODE
+    "#include <emmintrin.h>
+    #include <iostream>
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[16];
+            __m128i align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        __m128i one = _mm_load_si128((__m128i*)p);
+        one = _mm_or_si128(one, one);
+        _mm_store_si128((__m128i*)p, one);
+
+        p = prevent_optimization(p);
+    }"
+)
+
+list(APPEND POTHOS_ARCHS_PRI "X86_SSE3")
+if(POTHOS_CLANG OR POTHOS_GCC OR POTHOS_INTEL)
+    set(POTHOS_X86_SSE3_CXX_FLAGS "-msse3")
+elseif(POTHOS_MSVC AND POTHOS_WIN32)
+    # Default for x64, so flag not supported
+    set(POTHOS_X86_SSE3_CXX_FLAGS "/arch:SSE2")
+elseif(POTHOS_MSVC_INTEL)
+    set(POTHOS_X86_SSE3_CXX_FLAGS "/arch:SSE3")
+endif()
+set(POTHOS_X86_SSE3_DEFINE "POTHOS_ARCH_X86_SSE3")
+set(POTHOS_X86_SSE3_SUFFIX "-x86_sse3")
+set(POTHOS_X86_SSE3_TEST_CODE
+    "#include <pmmintrin.h>
+    #include <iostream>
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[16];
+            __m128 align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        __m128 one = _mm_load_ps((float*)p);
+        one = _mm_hadd_ps(one, one);
+        _mm_store_ps((float*)p, one);
+
+        p = prevent_optimization(p);
+    }"
+)
+
+list(APPEND POTHOS_ARCHS_PRI "X86_SSSE3")
+if(POTHOS_CLANG OR POTHOS_GCC OR POTHOS_INTEL)
+    set(POTHOS_X86_SSSE3_CXX_FLAGS "-mssse3")
+elseif(POTHOS_MSVC AND POTHOS_WIN32)
+    # Default for x64, so flag not supported
+    set(POTHOS_X86_SSSE3_CXX_FLAGS "/arch:SSE2")
+elseif(POTHOS_MSVC_INTEL)
+    set(POTHOS_X86_SSSE3_CXX_FLAGS "/arch:SSSE3")
+endif()
+set(POTHOS_X86_SSSE3_DEFINE "POTHOS_ARCH_X86_SSSE3")
+set(POTHOS_X86_SSSE3_SUFFIX "-x86_ssse3")
+set(POTHOS_X86_SSSE3_TEST_CODE
+    "#include <tmmintrin.h>
+    #include <iostream>
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[16];
+            __m128i align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        __m128i one = _mm_load_si128((__m128i*)p);
+        one = _mm_abs_epi8(one);
+        _mm_store_si128((__m128i*)p, one);
+
+        p = prevent_optimization(p);
+    }"
+)
+
+list(APPEND POTHOS_ARCHS_PRI "X86_SSE4_1")
+if(POTHOS_CLANG OR POTHOS_GCC OR POTHOS_INTEL)
+    set(POTHOS_X86_SSE4_1_CXX_FLAGS "-msse4.1")
+elseif(POTHOS_MSVC AND POTHOS_WIN32)
+    # Default for x64, so flag not supported
+    set(POTHOS_X86_SSE4_1_CXX_FLAGS "/arch:SSE2")
+elseif(POTHOS_MSVC_INTEL)
+    set(POTHOS_X86_SSE4_1_CXX_FLAGS "/arch:SSE4.1")
+endif()
+set(POTHOS_X86_SSE4_1_DEFINE "POTHOS_ARCH_X86_SSE4_1")
+set(POTHOS_X86_SSE4_1_SUFFIX "-x86_sse4_1")
+set(POTHOS_X86_SSE4_1_TEST_CODE
+    "#include <smmintrin.h>
+    #include <iostream>
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[16];
+            __m128i align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        __m128i one = _mm_load_si128((__m128i*)p);
+        one = _mm_cvtepi16_epi32(one);
+        _mm_store_si128((__m128i*)p, one);
+
+        p = prevent_optimization(p);
+    }"
+)
+
+list(APPEND POTHOS_ARCHS_PRI "X86_POPCNT_INSN")
+# No MSVC flag
+if(POTHOS_CLANG OR POTHOS_GCC OR POTHOS_INTEL)
+    set(POTHOS_X86_POPCNT_INSN_CXX_FLAGS "-mssse3 -mpopcnt")
+elseif(POTHOS_MSVC_INTEL)
+    set(POTHOS_X86_POPCNT_INSN_CXX_FLAGS "/arch:SSE4.2")
+endif()
+set(POTHOS_X86_POPCNT_INSN_DEFINE "POTHOS_ARCH_X86_POPCNT_INSN")
+set(POTHOS_X86_POPCNT_INSN_SUFFIX "-x86_popcnt")
+set(POTHOS_X86_POPCNT_INSN_TEST_CODE
+    "#include <nmmintrin.h>
+    #include <iostream>
+
+    unsigned* prevent_optimization(unsigned* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        unsigned* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        unsigned data;
+        unsigned* p = &data;
+        p = prevent_optimization(p);
+
+        *p = _mm_popcnt_u32(*p);
+
+        p = prevent_optimization(p);
+    }"
+)
+###
+
+list(APPEND POTHOS_ARCHS_PRI "X86_AVX")
+if(POTHOS_CLANG OR POTHOS_GCC OR POTHOS_INTEL)
+    set(POTHOS_X86_AVX_CXX_FLAGS "-mavx")
+elseif(POTHOS_MSVC OR POTHOS_MSVC_INTEL)
+    set(POTHOS_X86_AVX_CXX_FLAGS "/arch:AVX")
+endif()
+set(POTHOS_X86_AVX_DEFINE "POTHOS_ARCH_X86_AVX")
+set(POTHOS_X86_AVX_SUFFIX "-x86_avx")
+set(POTHOS_X86_AVX_TEST_CODE
+    "#include <immintrin.h>
+    #include <iostream>
+
+    #if (__clang_major__ == 3) && (__clang_minor__ == 6)
+    #error Not supported.
+    #endif
+    #if (__GNUC__ == 4) && (__GNUC_MINOR__ == 4) && !defined(__INTEL_COMPILER) && !defined(__clang__)
+    #error Not supported.
+    #endif
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[32];
+            __m256 align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        __m256 one = _mm256_load_ps((float*)p);
+        one = _mm256_add_ps(one, one);
+        _mm256_store_ps((float*)p, one);
+
+        p = prevent_optimization(p);
+    }"
+)
+
+list(APPEND POTHOS_ARCHS_PRI "X86_AVX2")
+if(POTHOS_CLANG OR POTHOS_GCC)
+    set(POTHOS_X86_AVX2_CXX_FLAGS "-mavx2")
+elseif(POTHOS_INTEL)
+    set(POTHOS_X86_AVX2_CXX_FLAGS "-xCORE-AVX2")
+elseif(POTHOS_MSVC)
+    set(POTHOS_X86_AVX2_CXX_FLAGS "/arch:AVX2")
+elseif(POTHOS_MSVC_INTEL)
+    set(POTHOS_X86_AVX2_CXX_FLAGS "/arch:CORE-AVX2")
+endif()
+set(POTHOS_X86_AVX2_DEFINE "POTHOS_ARCH_X86_AVX2")
+set(POTHOS_X86_AVX2_SUFFIX "-x86_avx2")
+set(POTHOS_X86_AVX2_TEST_CODE
+    "#include <immintrin.h>
+    #include <iostream>
+
+    #if (__clang_major__ == 3) && (__clang_minor__ == 6)
+    #error Not supported.
+    #endif
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[32];
+            __m256 align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        __m256i one = _mm256_load_si256((__m256i*)p);
+        one = _mm256_or_si256(one, one);
+        _mm256_store_si256((__m256i*)p, one);
+
+        p = prevent_optimization(p);
+    }"
+)
+
+list(APPEND POTHOS_ARCHS_PRI "X86_FMA3")
+if(POTHOS_CLANG OR POTHOS_GCC)
+    set(POTHOS_X86_FMA3_CXX_FLAGS "-mfma")
+elseif(POTHOS_INTEL)
+    set(POTHOS_X86_FMA3_CXX_FLAGS "-xCORE-AVX2")
+elseif(POTHOS_MSVC)
+    set(POTHOS_X86_FMA3_CXX_FLAGS "/arch:AVX2")
+elseif(POTHOS_MSVC_INTEL)
+    set(POTHOS_X86_FMA3_CXX_FLAGS "/arch:CORE-AVX2")
+endif()
+set(POTHOS_X86_FMA3_DEFINE "POTHOS_ARCH_X86_FMA3")
+set(POTHOS_X86_FMA3_SUFFIX "-x86_fma3")
+set(POTHOS_X86_FMA3_TEST_CODE
+    "#include <immintrin.h>
+    #include <iostream>
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[16];
+            __m128 align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        __m128 one = _mm_load_ps((float*)p);
+        one = _mm_fmadd_ps(one, one, one);
+        _mm_store_ps((float*)p, one);
+
+        p = prevent_optimization(p);
+    }"
+)
+
+list(APPEND POTHOS_ARCHS_PRI "X86_FMA4")
+if(POTHOS_CLANG OR POTHOS_GCC)
+    # intel does not support FMA4
+    set(POTHOS_X86_FMA4_CXX_FLAGS "-mfma4")
+elseif(POTHOS_MSVC OR POTHOS_MSVC_INTEL)
+    set(POTHOS_X86_FMA4_CXX_FLAGS "/arch:AVX2")
+endif()
+set(POTHOS_X86_FMA4_DEFINE "POTHOS_ARCH_X86_FMA4")
+set(POTHOS_X86_FMA4_SUFFIX "-x86_fma4")
+set(POTHOS_X86_FMA4_TEST_CODE
+    "#include <x86intrin.h>
+    #include <iostream>
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[16];
+            __m128 align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        __m128 one = _mm_load_ps((float*)p);
+        one = _mm_macc_ps(one, one, one);
+        _mm_store_ps((float*)p, one);
+
+        p = prevent_optimization(p);
+    }"
+)
+
+list(APPEND POTHOS_ARCHS_PRI "X86_XOP")
+# No flag for MSVC
+if(POTHOS_CLANG OR POTHOS_GCC)
+    set(POTHOS_X86_XOP_CXX_FLAGS "-mxop")
+endif()
+set(POTHOS_X86_XOP_DEFINE "POTHOS_ARCH_X86_XOP")
+set(POTHOS_X86_XOP_SUFFIX "-x86_xop")
+set(POTHOS_X86_XOP_TEST_CODE
+    "#include <x86intrin.h>
+    #include <iostream>
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[16];
+            __m128i align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        __m128i one = _mm_load_si128((__m128i*)p);
+        one = _mm_cmov_si128(one, one, one);
+        one = _mm_comeq_epi64(one, one);
+        _mm_store_si128((__m128i*)p, one);
+
+        p = prevent_optimization(p);
+    }"
+)
+
+# No flag for MSVC
+list(APPEND POTHOS_ARCHS_PRI "X86_AVX512F")
+if(POTHOS_CLANG OR POTHOS_GCC)
+    set(POTHOS_X86_AVX512F_CXX_FLAGS "-mavx512f -mavx512dq")
+elseif(POTHOS_INTEL)
+    set(POTHOS_X86_AVX512F_CXX_FLAGS "-xCOMMON-AVX512")
+elseif(POTHOS_MSVC_INTEL)
+    set(POTHOS_X86_AVX512F_CXX_FLAGS "/arch:COMMON-AVX512")
+endif()
+set(POTHOS_X86_AVX512F_DEFINE "POTHOS_ARCH_X86_AVX512F")
+set(POTHOS_X86_AVX512F_SUFFIX "-x86_avx512f")
+set(POTHOS_X86_AVX512F_TEST_CODE
+    "#include <immintrin.h>
+    #include <iostream>
+
+    #if defined(__GNUC__) && (__GNUC__ < 6) && !defined(__INTEL_COMPILER) && !defined(__clang__)
+    #error GCC 5.x and older are not supported on AVX512F.
+    #endif
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[64];
+            __m512 align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+        __m512 f = _mm512_load_ps((float*)p);
+        p = prevent_optimization(p);
+        __m512i i = _mm512_load_epi32((__m512i*)p);
+        p = prevent_optimization(p);
+
+        f = _mm512_add_ps(f, f);
+
+        // MSVC 2017 miss this
+        i = _mm512_or_epi32(i, i);
+        f = _mm512_ceil_ps(f);
+
+        // ICE on various versions of Clang trying to select palignr
+        __m512i i2 = _mm512_load_epi32((__m512i*)p);
+        __m512i ap = _mm512_alignr_epi32(i, i, 2);
+        i = _mm512_mask_alignr_epi32(ap, 0xcccc, i2, i2, 14);
+
+        p = prevent_optimization(p);
+        _mm512_store_ps((float*)p, f);
+        p = prevent_optimization(p);
+        _mm512_store_epi32((void*)p, i);
+        p = prevent_optimization(p);
+    }"
+)
+
+# No flag for MSVC
+list(APPEND POTHOS_ARCHS_PRI "X86_AVX512BW")
+if(POTHOS_CLANG OR POTHOS_GCC)
+    set(POTHOS_X86_AVX512BW_CXX_FLAGS "-mavx512bw")
+elseif(POTHOS_INTEL)
+    set(POTHOS_X86_AVX512BW_CXX_FLAGS "-xCORE-AVX512")
+elseif(POTHOS_MSVC_INTEL)
+    set(POTHOS_X86_AVX512BW_CXX_FLAGS "/arch:CORE-AVX512")
+endif()
+set(POTHOS_X86_AVX512BW_DEFINE "POTHOS_ARCH_X86_AVX512BW")
+set(POTHOS_X86_AVX512BW_SUFFIX "-x86_avx512bw")
+set(POTHOS_X86_AVX512BW_TEST_CODE
+    "#include <immintrin.h>
+    #include <iostream>
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[64];
+            __m512i align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        __m512i i = _mm512_load_si512((void*)p);
+        i = _mm512_add_epi16(i, i); // only in AVX-512BW
+        _mm512_store_si512((void*)p, i);
+
+        p = prevent_optimization(p);
+    }"
+)
+
+# No flag for MSVC
+list(APPEND POTHOS_ARCHS_PRI "X86_AVX512DQ")
+if(POTHOS_CLANG OR POTHOS_GCC OR POTHOS_INTEL)
+    set(POTHOS_X86_AVX512DQ_CXX_FLAGS "-mavx512dq")
+endif()
+set(POTHOS_X86_AVX512DQ_DEFINE "POTHOS_ARCH_X86_AVX512DQ")
+set(POTHOS_X86_AVX512DQ_SUFFIX "-x86_avx512dq")
+set(POTHOS_X86_AVX512DQ_TEST_CODE
+    "#include <immintrin.h>
+    #include <iostream>
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[64];
+            __m512 align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        __m512 f = _mm512_load_ps((float*)p);
+        f = _mm512_and_ps(f, f); // only in AVX512-DQ
+        _mm512_store_ps((float*)p, f);
+
+        p = prevent_optimization(p);
+    }"
+)
+
+# No flag for MSVC
+list(APPEND POTHOS_ARCHS_PRI "X86_AVX512VL")
+if(POTHOS_CLANG OR POTHOS_GCC OR POTHOS_INTEL)
+    set(POTHOS_X86_AVX512VL_CXX_FLAGS "-mavx512vl")
+endif()
+set(POTHOS_X86_AVX512VL_DEFINE "POTHOS_ARCH_X86_AVX512VL")
+set(POTHOS_X86_AVX512VL_SUFFIX "-x86_avx512vl")
+set(POTHOS_X86_AVX512VL_TEST_CODE
+    "#if !defined(__APPLE__) && (__clang_major__ == 3)
+    #error AVX512VL is not supported on clang 3.9 and earlier.
+    #endif
+
+    #include <immintrin.h>
+    #include <iostream>
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[16];
+            __m128 align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        __m128 f = _mm_load_ps((float*)p);
+        f = _mm_rcp14_ps(f); // only in AVX512-VL
+        _mm_store_ps((float*)p, f);
+
+        p = prevent_optimization(p);
+    }"
+)
+
+list(APPEND POTHOS_ARCHS_PRI "ARM_NEON")
+if(POTHOS_CLANG OR POTHOS_GCC)
+    set(POTHOS_ARM_NEON_CXX_FLAGS "-mfpu=neon")
+endif()
+set(POTHOS_ARM_NEON_DEFINE "POTHOS_ARCH_ARM_NEON")
+set(POTHOS_ARM_NEON_SUFFIX "-arm_neon")
+set(POTHOS_ARM_NEON_TEST_CODE
+    "#if defined(__clang_major__)
+    #if (__clang_major__ < 3) || ((__clang_major__ == 3) && (__clang_minor__ <= 3))
+    #error NEON is not supported on clang 3.3 and earlier.
+    #endif
+    #endif
+
+    #include <arm_neon.h>
+    #include <iostream>
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[16];
+            uint32x4_t align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        uint32x4_t one = vld1q_u32((uint32_t*)p);
+        one = vaddq_u32(one, one);
+        vst1q_u32((uint32_t*)p, one);
+
+        p = prevent_optimization(p);
+    }"
+)
+
+list(APPEND POTHOS_ARCHS_SEC "ARM_NEON_FLT_SP")
+if(POTHOS_CLANG OR POTHOS_GCC)
+    set(POTHOS_ARM_NEON_FLT_SP_CXX_FLAGS "-mfpu=neon")
+endif()
+set(POTHOS_ARM_NEON_FLT_SP_DEFINE "POTHOS_ARCH_ARM_NEON_FLT_SP")
+set(POTHOS_ARM_NEON_FLT_SP_SUFFIX "-arm_neon_flt_sp")
+
+list(APPEND POTHOS_ARCHS_PRI "ARM64_NEON")
+if(POTHOS_CLANG)
+    set(POTHOS_ARM64_NEON_CXX_FLAGS "-arch arm64")
+elseif(POTHOS_GCC)
+    set(POTHOS_ARM64_NEON_CXX_FLAGS "-mcpu=generic+simd")
+endif()
+set(POTHOS_ARM64_NEON_DEFINE "POTHOS_ARCH_ARM_NEON")
+set(POTHOS_ARM64_NEON_SUFFIX "-arm64_neon")
+set(POTHOS_ARM64_NEON_TEST_CODE
+    "#include <arm_neon.h>
+    #include <iostream>
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[16];
+            uint32x4_t align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        uint32x4_t one = vld1q_u32((uint32_t*)(*p));
+        one = vaddq_u32(one, one);
+
+        // GCC 4.8 misses a subset of functions
+        one = vdupq_laneq_u32(one, 1);
+
+        vst1q_u32((uint32_t*)(*p), one);
+        p = prevent_optimization(p);
+    }"
+)
+
+list(APPEND POTHOS_ARCHS_PRI "MIPS_MSA")
+set(POTHOS_MIPS_MSA_CXX_FLAGS "-mips64r5 -mmsa -mhard-float -mfp64 -mnan=legacy")
+set(POTHOS_MIPS_MSA_DEFINE "POTHOS_ARCH_MIPS_MSA")
+set(POTHOS_MIPS_MSA_SUFFIX "-mips_msa")
+set(POTHOS_MIPS_MSA_TEST_CODE
+    "#include <msa.h>
+    #include <iostream>
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[16];
+            v4i32 align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        v16i8 v = __msa_ld_b(p, 0);
+        v = __msa_add_a_b(v, v);
+        __msa_st_b(v, p, 0);
+
+        p = prevent_optimization(p);
+    }"
+)
+
+list(APPEND POTHOS_ARCHS_PRI "POWER_ALTIVEC")
+set(POTHOS_POWER_ALTIVEC_CXX_FLAGS "-maltivec")
+set(POTHOS_POWER_ALTIVEC_DEFINE "POTHOS_ARCH_POWER_ALTIVEC")
+set(POTHOS_POWER_ALTIVEC_SUFFIX "-power_altivec")
+set(POTHOS_POWER_ALTIVEC_TEST_CODE
+    "#include <altivec.h>
+    #include <iostream>
+
+    #if defined(__GNUC__) && (__GNUC__ < 6) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
+    #if !defined(__INTEL_COMPILER) && !defined(__clang__)
+    #error GCC 5.0 and older are not supported on PPC little-endian.
+    #endif
+    #endif
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[16];
+            vector unsigned char align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        vector unsigned char v = vec_ld(0, (unsigned char*)p);
+        v = vec_add(v, v);
+        vec_st(v, 0, (unsigned char*)p);
+
+        p = prevent_optimization(p);
+    }"
+)
+
+list(APPEND POTHOS_ARCHS_PRI "POWER_VSX_206")
+set(POTHOS_POWER_VSX_206_CXX_FLAGS "-mvsx")
+set(POTHOS_POWER_VSX_206_DEFINE "POTHOS_ARCH_POWER_VSX_206")
+set(POTHOS_POWER_VSX_206_SUFFIX "-power_vsx_2.06")
+set(POTHOS_POWER_VSX_206_TEST_CODE
+    "#include <altivec.h>
+    #include <iostream>
+
+    #if defined(__GNUC__) && (__GNUC__ < 6) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+    #if !defined(__INTEL_COMPILER) && !defined(__clang__)
+    #error GCC 5.0 and older are not supported on PPC little-endian.
+    #endif
+    #endif
+
+    #if defined(__GNUC__) && (__GNUC__ < 6) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+    #if !defined(__INTEL_COMPILER) && !defined(__clang__)
+    // Internal compiler errors or wrong behaviour on various SIMD memory operations
+    #error GCC 5.x and older not supported on VSX big-endian.
+    #endif
+    #endif
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[16];
+            vector unsigned char align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        vector unsigned char v = vec_vsx_ld(0, (unsigned char*)p);
+        v = vec_add(v, v);
+        vec_vsx_st(v, 0, (unsigned char*)p);
+
+        p = prevent_optimization(p);
+    }"
+)
+
+list(APPEND POTHOS_ARCHS_PRI "POWER_VSX_207")
+set(POTHOS_POWER_VSX_207_CXX_FLAGS "-mvsx -mcpu=power8")
+set(POTHOS_POWER_VSX_207_DEFINE "POTHOS_ARCH_POWER_VSX_207")
+set(POTHOS_POWER_VSX_207_SUFFIX "-power_vsx_2.07")
+set(POTHOS_POWER_VSX_207_TEST_CODE
+    "#include <altivec.h>
+    #include <iostream>
+
+    #if defined(__GNUC__) && (__GNUC__ < 6) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+    #if !defined(__INTEL_COMPILER) && !defined(__clang__)
+    #error GCC 5.0 and older are not supported on PPC little-endian.
+    #endif
+    #endif
+
+    #if defined(__GNUC__) && (__GNUC__ < 6) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+    #if !defined(__INTEL_COMPILER) && !defined(__clang__)
+    #error GCC 5.x and older not supported on VSX big-endian.
+    #endif
+    #endif
+
+    char* prevent_optimization(char* ptr)
+    {
+        volatile bool never = false;
+        if (never) {
+            while (*ptr++)
+                std::cout << *ptr;
+        }
+        char* volatile* volatile opaque;
+        opaque = &ptr;
+        return *opaque;
+    }
+
+    int main()
+    {
+        union {
+            char data[16];
+            vector unsigned char align;
+        };
+        char* p = data;
+        p = prevent_optimization(p);
+
+        vector unsigned char v = vec_vsx_ld(0, (unsigned char*)p);
+        v = vec_vpopcnt(v);
+        vec_vsx_st(v, 0, (unsigned char*)p);
+
+        p = prevent_optimization(p);
+    }"
+)
+
+set(POTHOS_ARCHS "${POTHOS_ARCHS_PRI};${POTHOS_ARCHS_SEC}")
+
+# ------------------------------------------------------------------------------
+# Given one arch, returns compilation flags and an unique identifier (internal)
+# If the given architecture does not exist, sets both result variables to ""
+#
+# Arguments:
+#
+# - CXX_FLAGS_VAR: the name of a variable to store the compilation flags to
+#
+# - DEFINES_LIST_VAR: the name of a variable to store comma defimited list of
+# preprocessor defines for the current architecture.
+#
+# - UNIQUE_ID_VAR: the name of a variable to store the unique identifier to
+#
+# - ARCH: an architecture
+#
+function(pothos_get_arch_info CXX_FLAGS_VAR DEFINES_LIST_VAR UNIQUE_ID_VAR ARCH)
+    set(UNIQUE_ID "")
+    set(CXX_FLAGS "")
+    set(DISPATCH_FLAGS "")
+    set(DEFINES_LIST "")
+
+    string(REPLACE "," ";" ARCH_IDS "${ARCH}")
+    list(SORT ARCH_IDS)
+    foreach(ID ${ARCH_IDS})
+        if(${ID} STREQUAL "NONE_NULL")
+            set(UNIQUE_ID "${UNIQUE_ID}-fallback")
+        else()
+            list(FIND POTHOS_ARCHS "${ID}" FOUND)
+            if(NOT ${FOUND} EQUAL -1)
+                list(APPEND DEFINES_LIST "${POTHOS_${ID}_DEFINE}")
+                set(CXX_FLAGS "${CXX_FLAGS} ${POTHOS_${ID}_CXX_FLAGS} -D${POTHOS_${ID}_DEFINE}")
+                set(UNIQUE_ID "${UNIQUE_ID}${POTHOS_${ID}_SUFFIX}")
+            endif()
+        endif()
+    endforeach()
+
+    string(REPLACE ";" "," DEFINES_LIST "${DEFINES_LIST}")
+
+    set(${CXX_FLAGS_VAR} "${CXX_FLAGS}" PARENT_SCOPE)
+    set(${UNIQUE_ID_VAR} "${UNIQUE_ID}" PARENT_SCOPE)
+    set(${DEFINES_LIST_VAR} "${DEFINES_LIST}" PARENT_SCOPE)
+endfunction()
+
+# ------------------------------------------------------------------------------
+#
+# pothos_multiarch(FILE_LIST_VAR SRC_FILE [ARCH...])
+#
+# A function that encapsulates the generation of build rules for libpothos
+# multi-architecture source files. The function creates a copy of @a SRC_FILE
+# for each supplied architecture definition. Each of these files is configured
+# with appropriate compile flags for the given architecture. The list of copied
+# files is appended to the variable supplied by @a FILE_LIST_VAR which can then
+# be used in add_library or add_executable calls.
+#
+# All copied files are placed in the build directory. The directory of
+# @a SRC_FILE is added to the default include paths.
+#
+# Arguments:
+#
+# * FILE_LIST_VAR: the name of the variable to append the list of generated
+#   files to
+#
+# * ARCHSTRING_VAR: the name of the variable to set the list of arches to for
+#   PothosUtil
+#
+# * SRC_FILE: the name of the source file relative to the @a
+#   CMAKE_CURRENT_SOURCE_DIR
+#
+# * ARCH...: a list of architecture definitions. Each architecture definition
+#   consist of comma separated list of identifiers directly corresponding to
+#   macros defined in simdpp/simd.h, which ultimately identify instruction set
+#   features. The user of the function must ensure that sensible combination of
+#   identifiers is supplied.
+#
+#   The following identifiers are currently supported:
+#   X86_SSE2, X86_SSE3, X86_SSSE3, X86_SSE4_1,
+#   X86_AVX, X86_AVX2, X86_FMA3, X86_FMA4,
+#   X86_AVX512F, X86_AVX512BW, X86_AVX512DQ, X86_AVX512VL, X86_XOP,
+#   ARM_NEON, ARM_NEON_FLT_SP, ARM64_NEON,
+#   MIPS_MSA, POWER_ALTIVEC, POWER_VSX_206, POWER_VSX_207
+#
+function(pothos_multiarch FILE_LIST_VAR ARCHSTRING_VAR SRC_FILE)
+    if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE}")
+        message(FATAL_ERROR "File \"${SRC_FILE}\" does not exist")
+    endif()
+    get_filename_component(SRC_PATH "${SRC_FILE}" PATH)
+    get_filename_component(SRC_NAME "${SRC_FILE}" NAME_WE)
+    get_filename_component(SRC_EXT "${SRC_FILE}" EXT)
+
+    set(FILE_LIST "")
+    set(SUFFIXES "")
+
+    list(APPEND ARCHS ${ARGV})
+    list(REMOVE_AT ARCHS 0 1 2) # strip non-arch parameters
+    foreach(ARCH ${ARCHS})
+        pothos_get_arch_info(CXX_FLAGS DEFINES_LIST SUFFIX ${ARCH})
+
+        # Shorter way of removing first character
+        string(REGEX REPLACE "^-" "" SUFFIX ${SUFFIX})
+
+        # Hash and truncate the string to shorten the output filepath
+        string(REPLACE "-" "__" namespace ${SUFFIX})
+        list(APPEND SUFFIXES ${SUFFIX})
+        string(MD5 suffixhash ${SUFFIX})
+        string(SUBSTRING ${suffixhash} 0 6 suffixhash)
+
+        # The space is necessary, or for some reason, the flag will be prepended to the next.
+        set(CXX_FLAGS "-I\"${CMAKE_CURRENT_SOURCE_DIR}/${SRC_PATH}\" ${CXX_FLAGS} -DPOTHOS_SIMD_NAMESPACE=${namespace} ")
+        if(NOT "${SUFFIX}" STREQUAL "")
+            # Copy the source file and add the required flags
+            set(DST_ABS_FILE "${CMAKE_CURRENT_BINARY_DIR}/${SRC_PATH}/${SRC_NAME}-${suffixhash}${SRC_EXT}")
+            set(SRC_ABS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE}")
+
+            # CMake does not support adding per-source-file include directories.
+            # Also when CXX_FLAGS is used for this purpose, CMake does not add
+            # local includes as the dependencies of the result object file thus
+            # does not rebuild the file when these included files are changed.
+            # The work around is to use add_custom_command with IMPLICIT_DEPENDS
+            # option which only works on make-based systems
+            add_custom_command(OUTPUT "${DST_ABS_FILE}"
+                               COMMAND ${CMAKE_COMMAND} -E copy "${SRC_ABS_FILE}" "${DST_ABS_FILE}"
+                               COMMENT "Generating ${SRC_FILE} ${SUFFIX} implementation"
+                               IMPLICIT_DEPENDS CXX "${SRC_ABS_FILE}")
+
+            list(APPEND FILE_LIST "${DST_ABS_FILE}")
+            set_source_files_properties("${DST_ABS_FILE}" PROPERTIES COMPILE_FLAGS ${CXX_FLAGS}
+                                                                     GENERATED TRUE)
+        endif()
+    endforeach()
+
+    # Equivalent of string(JOIN ...), which is too recent for us
+    foreach(suffix ${SUFFIXES})
+        set(ARCHSTRING "${ARCHSTRING},${suffix}")
+    endforeach()
+    string(REPLACE "-" "__" ARCHSTRING ${ARCHSTRING})
+    string(SUBSTRING ${ARCHSTRING} 1 -1 ARCHSTRING)
+    set(${ARCHSTRING_VAR} ${ARCHSTRING} PARENT_SCOPE)
+
+    set(RECV_FILE_LIST ${${FILE_LIST_VAR}})
+    list(APPEND RECV_FILE_LIST ${FILE_LIST})
+    set(${FILE_LIST_VAR} ${RECV_FILE_LIST} PARENT_SCOPE)
+endfunction()
+
+# ------------------------------------------------------------------------------
+# Given a list of archs, return all possible permutations of them (internal)
+#
+# Arguments:
+#
+# - ALL_ARCHS_VAL: the name of the variable to store the permutation to
+#
+# - ARCH...: a list of supported architectures
+function(pothos_get_arch_perm ALL_ARCHS_VAR)
+    list(APPEND ARCHS ${ARGV})
+    list(REMOVE_AT ARCHS 0)
+
+    foreach(ARCH ${ARCHS})
+        set(ARCH_SUPPORTED_${ARCH} "1")
+    endforeach()
+
+    set(ALL_ARCHS "NONE_NULL")
+    if(DEFINED ARCH_SUPPORTED_X86_SSE2)
+        # all x86_64 processors
+        list(APPEND ALL_ARCHS "X86_SSE2")
+    endif()
+    if(DEFINED ARCH_SUPPORTED_X86_SSE3)
+        # Since Prescott, Merom (Core architecture)
+        # Since later K8 steppings, fully supported since K10
+        list(APPEND ALL_ARCHS "X86_SSE3")
+    endif()
+    if(DEFINED ARCH_SUPPORTED_X86_SSSE3)
+        # Since Merom (Core architecture)
+        # Since Bobcat and Bulldozer
+        list(APPEND ALL_ARCHS "X86_SSSE3")
+    endif()
+    if(DEFINED ARCH_SUPPORTED_X86_SSE4_1)
+        # Since Penryl (45 nm Merom shrink)
+        # Since Bulldozer
+        list(APPEND ALL_ARCHS "X86_SSE4_1")
+    endif()
+    if(DEFINED ARCH_SUPPORTED_X86_POPCNT_INSN)
+        # Since Nehalem and K10.
+
+        # NOTE: These two architectures are the only that support popcnt and
+        # don't support AVX. There's no full overlap of the instruction set
+        # support in these architectures, thus these two separate configs were
+        # omitted from the default instruction set matrix.
+    endif()
+    if(DEFINED ARCH_SUPPORTED_X86_AVX)
+        # Since Sandy Bridge, Bulldozer, Jaguar
+        list(APPEND ALL_ARCHS "X86_AVX,X86_POPCNT_INSN")
+
+        if(DEFINED ARCH_SUPPORTED_X86_FMA3)
+            # Since Haswell, Piledriver (later Bulldozer variant)
+            # All CPUs in this range support popcnt
+        endif()
+        if(DEFINED ARCH_SUPPORTED_X86_FMA4)
+            # Since Bulldozer until Zen. Jaguar does not support FMA4 nor FMA3
+            # All CPUs in this range support popcnt
+            list(APPEND ALL_ARCHS "X86_AVX,X86_FMA4,X86_POPCNT_INSN")
+        endif()
+    endif()
+    if(DEFINED ARCH_SUPPORTED_X86_AVX2)
+        # Since Haswell and Zen
+        # All Intel and AMD CPUs that support AVX2 also support FMA3 and POPCNT,
+        # thus separate X86_AVX2 config is not needed.
+        if(DEFINED ARCH_SUPPORTED_X86_FMA3)
+            list(APPEND ALL_ARCHS "X86_AVX2,X86_FMA3,X86_POPCNT_INSN")
+        endif()
+    endif()
+    if(DEFINED ARCH_SUPPORTED_X86_FMA3)
+        # Since Haswell, Piledriver (later Bulldozer variant)
+        # All Intel and AMD CPUs that support FMA3 also support AVX, thus
+        # separate X86_FMA3 config is not needed
+    endif()
+    if(DEFINED ARCH_SUPPORTED_X86_FMA4)
+        # Since Bulldozer until Zen
+        # All AMD CPUs that support FMA4 also support AVX, thus
+        # separate X86_FMA4 config is not needed
+    endif()
+    if(DEFINED ARCH_SUPPORTED_X86_AVX512F)
+        # Since Knights Landing, Skylake-X
+        # All Intel CPUs that support AVX512F also support FMA3 and POPCNT,
+        # thus separate X86_512F config is not needed.
+
+        if(DEFINED ARCH_SUPPORTED_X86_AVX512BW)
+            if(DEFINED ARCH_SUPPORTED_X86_AVX512DQ)
+                if(DEFINED ARCH_SUPPORTED_X86_AVX512VL)
+                    # All Intel processors that support AVX512BW also support
+                    # AVX512DQ and AVX512VL
+                    list(APPEND ALL_ARCHS "X86_AVX512BW,X86_AVX512DQ,X86_AVX512VL")
+                endif()
+            endif()
+        else()
+            list(APPEND ALL_ARCHS "X86_AVX512F,X86_FMA3,X86_POPCNT_INSN")
+        endif()
+    endif()
+    if(DEFINED ARCH_SUPPORTED_X86_XOP)
+        list(APPEND ALL_ARCHS "X86_XOP")
+        if(DEFINED ARCH_SUPPORTED_X86_AVX)
+            list(APPEND ALL_ARCHS "X86_AVX,X86_XOP")
+        endif()
+    endif()
+    if(DEFINED ARCH_SUPPORTED_ARM_NEON)
+        list(APPEND ALL_ARCHS "ARM_NEON")
+        list(APPEND ALL_ARCHS "ARM_NEON_FLT_SP")
+    endif()
+    if(DEFINED ARCH_SUPPORTED_ARM64_NEON)
+        list(APPEND ALL_ARCHS "ARM64_NEON")
+    endif()
+    if(DEFINED ARCH_SUPPORTED_MIPS_MSA)
+        list(APPEND ALL_ARCHS "MIPS_MSA")
+    endif()
+    if(DEFINED ARCH_SUPPORTED_POWER_ALTIVEC)
+        list(APPEND ALL_ARCHS "POWER_ALTIVEC")
+    endif()
+    if(DEFINED ARCH_SUPPORTED_POWER_VSX_206)
+        list(APPEND ALL_ARCHS "POWER_VSX_206")
+    endif()
+    if(DEFINED ARCH_SUPPORTED_POWER_VSX_207)
+        list(APPEND ALL_ARCHS "POWER_VSX_207")
+    endif()
+    set(${ALL_ARCHS_VAR} "${ALL_ARCHS}" PARENT_SCOPE)
+endfunction()
+
+# ------------------------------------------------------------------------------
+#
+# pothos_get_compilable_archs(ARCH_LIST_VAR)
+#
+# Returns a list of architectures that are supported by the current build
+# system. The generated list may be used as an argument to pothos_multiarch.
+#
+# Arguments:
+#
+# * ARCH_LIST_VAR: the name of the variable to put the architecture list to
+#
+function(pothos_get_compilable_archs ARCH_LIST_VAR)
+
+    foreach(ARCH ${POTHOS_ARCHS_PRI})
+        set(CMAKE_REQUIRED_FLAGS "${POTHOS_${ARCH}_CXX_FLAGS}")
+        check_cxx_source_compiles("${POTHOS_${ARCH}_TEST_CODE}" CAN_COMPILE_${ARCH})
+        if(CAN_COMPILE_${ARCH})
+            list(APPEND ARCHS ${ARCH})
+        endif()
+    endforeach()
+
+    pothos_get_arch_perm(ALL_ARCHS "${ARCHS}")
+    set(${ARCH_LIST_VAR} "${ALL_ARCHS}" PARENT_SCOPE)
+
+endfunction()
+
+# ------------------------------------------------------------------------------
+#
+# pothos_get_runnable_archs(ARCH_LIST_VAR)
+#
+# Returns a list of architectures that are supported by the current build
+# system and the processor. The generated list may be used as an argument to
+# pothos_multiarch.
+#
+# Arguments:
+#
+# * ARCH_LIST_VAR: the name of the variable to put the architecture list to
+#
+function(pothos_get_runnable_archs ARCH_LIST_VAR)
+
+    foreach(ARCH ${POTHOS_ARCHS_PRI})
+        set(CMAKE_REQUIRED_FLAGS "${POTHOS_${ARCH}_CXX_FLAGS}")
+        check_cxx_source_runs("${POTHOS_${ARCH}_TEST_CODE}" CAN_RUN_${ARCH})
+        if(CAN_RUN_${ARCH})
+            list(APPEND ARCHS ${ARCH})
+        endif()
+    endforeach()
+
+    pothos_get_arch_perm(ALL_ARCHS "${ARCHS}")
+    set(${ARCH_LIST_VAR} "${ALL_ARCHS}" PARENT_SCOPE)
+
+endfunction()
+
+# ------------------------------------------------------------------------------
+# This is the entry point for Pothos modules to invoke this functionality.
+#
+# Arguments:
+#
+# * FileListVariable: the name of the file to put the list of arch-specific files
+#                     into
+# * JSONInputFile: the path to a JSON file to pass into PothosUtil to generate the
+#                  dynamic dispatch header file
+#
+function(PothosGenerateSIMDSources FileListVariable JSONInputFile)
+    set(SIMDSourceFiles ${ARGV})
+    list(REMOVE_AT SIMDSourceFiles 0 1) # Remove non-source parameters
+
+    pothos_get_compilable_archs(SIMDBuildArchs)
+
+    foreach(SrcFile ${SIMDSourceFiles})
+        set(SingleFileSIMDSources "")
+        pothos_multiarch(SingleFileSIMDSources ArchString ${SrcFile} ${SIMDBuildArchs})
+        list(APPEND TempFileList ${SingleFileSIMDSources})
+    endforeach()
+
+    # Convert to relative path so PothosUtil will accept the path
+    foreach(AbsPath ${TempFileList})
+        file(RELATIVE_PATH RelPath ${CMAKE_CURRENT_SOURCE_DIR} ${AbsPath})
+        list(APPEND FileList ${RelPath})
+    endforeach()
+
+    get_filename_component(JSONInputFilename ${JSONInputFile} NAME_WE)
+    get_filename_component(JSONInputFileAbsolute ${JSONInputFile} ABSOLUTE)
+    set(outputHeaderPath ${CMAKE_CURRENT_BINARY_DIR}/${JSONInputFilename}_SIMD.hpp)
+
+    add_custom_command(
+        OUTPUT ${outputHeaderPath}
+        COMMENT "Generating ${JSONInputFilename} SIMD dynamic dispatchers"
+        COMMAND ${POTHOS_UTIL_EXE} --simd-arches=${ArchString} --output=${outputHeaderPath} --generate-simd-dispatchers=${JSONInputFileAbsolute}
+        DEPENDS ${JSONInputFileAbsolute})
+    add_custom_target(${JSONInputFilename}_SIMDDispatcher DEPENDS ${outputHeaderPath})
+
+    set(${FileListVariable} ${FileList} PARENT_SCOPE)
+endfunction()

+ 12 - 0
cmake/Modules/PothosConfigVersion.in.cmake

@@ -0,0 +1,12 @@
+set(PACKAGE_FIND_NAME "Pothos")
+set(PACKAGE_VERSION "@POTHOS_VERSION@")
+
+# Check whether the requested PACKAGE_FIND_VERSION is compatible
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
+  set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+  set(PACKAGE_VERSION_COMPATIBLE TRUE)
+  if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
+    set(PACKAGE_VERSION_EXACT TRUE)
+  endif()
+endif()

+ 173 - 0
cmake/Modules/PothosUtil.cmake

@@ -0,0 +1,173 @@
+if(DEFINED INCLUDED_POTHOS_UTIL_CMAKE)
+    return()
+endif()
+set(INCLUDED_POTHOS_UTIL_CMAKE TRUE)
+
+########################################################################
+## POTHOS_MODULE_UTIL - build and install modules for Pothos
+##
+## This utility can handle the build and installation operations
+## for most Pothos user projects. Otherwise, please copy and modify.
+##
+## Arguments:
+##
+## TARGET - the name of the module to build
+## The target name should be unique per project.
+## If this target shares a destination with other modules,
+## Then the target should also be unique among those modules.
+##
+## SOURCES - a list of c++ source files
+## This list will primarily consist of c++ source files and not headers.
+## However, if header files contain documentation markup for the GUI,
+## then these header files should be included for markup parsing.
+## See ENABLE_DOCS which is required to enable SOURCES for scanning.
+##
+## LIBRARIES - a list of libraries to link the module to
+## The module will automatically link to Pothos and Poco libraries.
+## This argument should be used to specify additional libraries.
+##
+## DESTINATION - relative destination path
+## The destination path is relative to the module directory.
+## Try to use destination paths that reflect the plugin registry path.
+## Example: Suppose you are building a module for /blocks/foo/bar,
+## Then the destination should be blocks/foo and the TARGET bar.
+## However, this is simply a recomendation.
+##
+## DOC_SOURCES - an alternative list of sources to scan for docs
+## This allows the user to explicitly specity the list of sources
+## that are used exclusively for documentation markup for the GUI.
+##
+## ENABLE_DOCS - enable scanning of SOURCES for documentation markup.
+## Pass this flag to the util function to enable scanning of SOURCES.
+## This is required to scan SOURCES but not when DOC_SOURCES are used.
+##
+## PREFIX - override the default install prefix when specified
+## The prefix modifies the destination with an absolute path
+## to replace the typical CMAKE_INSTALL_PREFIX install rules.
+##
+## VERSION - specify a version string to build into this module
+## When not specified, the util will fall-back to PROJECT_VERSION,
+## and scanning the in-tree Changelog.txt file (if available).
+## Packagers can pass PROJECT_VERSION_EXTRA for additional version info.
+##
+########################################################################
+function(POTHOS_MODULE_UTIL)
+
+    include(CMakeParseArguments)
+    CMAKE_PARSE_ARGUMENTS(POTHOS_MODULE_UTIL "ENABLE_DOCS" "TARGET;DESTINATION;PREFIX;VERSION" "SOURCES;LIBRARIES;DOC_SOURCES" ${ARGN})
+
+    #version not specified, try to use project version
+    if (NOT POTHOS_MODULE_UTIL_VERSION AND PROJECT_VERSION)
+        set(POTHOS_MODULE_UTIL_VERSION "${PROJECT_VERSION}")
+    endif()
+
+    #version not specified, try to use changelog entry
+    if (NOT POTHOS_MODULE_UTIL_VERSION AND EXISTS "${PROJECT_SOURCE_DIR}/Changelog.txt")
+        file(READ "${PROJECT_SOURCE_DIR}/Changelog.txt" changelog_txt)
+        string(REGEX MATCH "Release ([-\\._0-9a-zA-Z]*) \\(" CHANGELOG_MATCH "${changelog_txt}")
+        if(CHANGELOG_MATCH)
+            set(POTHOS_MODULE_UTIL_VERSION "${CMAKE_MATCH_1}")
+        endif(CHANGELOG_MATCH)
+    endif()
+
+    #additional version information when specified
+    if (PROJECT_VERSION_EXTRA)
+        if (POTHOS_MODULE_UTIL_VERSION)
+            set(POTHOS_MODULE_UTIL_VERSION "${POTHOS_MODULE_UTIL_VERSION}-${PROJECT_VERSION_EXTRA}")
+        else()
+            set(POTHOS_MODULE_UTIL_VERSION "${PROJECT_VERSION_EXTRA}")
+        endif()
+    endif()
+
+    #add git hash when possible
+    if (EXISTS "${PROJECT_SOURCE_DIR}/.git")
+        find_package(Git)
+        if(GIT_FOUND)
+            execute_process(
+                COMMAND ${GIT_EXECUTABLE} -C "${PROJECT_SOURCE_DIR}" rev-parse --short HEAD
+                OUTPUT_STRIP_TRAILING_WHITESPACE
+                OUTPUT_VARIABLE GIT_HASH)
+            if (GIT_HASH)
+                if (POTHOS_MODULE_UTIL_VERSION)
+                    set(POTHOS_MODULE_UTIL_VERSION "${POTHOS_MODULE_UTIL_VERSION}-${GIT_HASH}")
+                else()
+                    set(POTHOS_MODULE_UTIL_VERSION "${GIT_HASH}")
+                endif()
+            endif()
+        endif(GIT_FOUND)
+    endif()
+
+    #setup module build and install rules
+    add_library(${POTHOS_MODULE_UTIL_TARGET} MODULE ${POTHOS_MODULE_UTIL_SOURCES})
+    target_link_libraries(${POTHOS_MODULE_UTIL_TARGET} PRIVATE Pothos ${POTHOS_MODULE_UTIL_LIBRARIES})
+    set_target_properties(${POTHOS_MODULE_UTIL_TARGET} PROPERTIES DEBUG_POSTFIX "") #same name in debug mode
+
+    #symbols are only exported from the module explicitly
+    set_property(TARGET ${POTHOS_MODULE_UTIL_TARGET} PROPERTY C_VISIBILITY_PRESET hidden)
+    set_property(TARGET ${POTHOS_MODULE_UTIL_TARGET} PROPERTY CXX_VISIBILITY_PRESET hidden)
+    set_property(TARGET ${POTHOS_MODULE_UTIL_TARGET} PROPERTY VISIBILITY_INLINES_HIDDEN ON)
+
+    #version specified, build into source file
+    if (POTHOS_MODULE_UTIL_VERSION)
+        message(STATUS "Module ${POTHOS_MODULE_UTIL_TARGET} configured with version: ${POTHOS_MODULE_UTIL_VERSION}")
+        set(version_file "${CMAKE_CURRENT_BINARY_DIR}/Version.cpp")
+        file(WRITE "${version_file}" "#include <Pothos/Plugin/Module.hpp>
+            static const Pothos::ModuleVersion register${MODULE_TARGET}Version(\"${POTHOS_MODULE_UTIL_VERSION}\");
+        ")
+        target_sources(${POTHOS_MODULE_UTIL_TARGET} PRIVATE "${version_file}")
+    endif()
+
+    #always enable docs if user specifies doc sources
+    if (POTHOS_MODULE_UTIL_DOC_SOURCES)
+        set(POTHOS_MODULE_UTIL_ENABLE_DOCS TRUE)
+    #otherwise doc sources come from the regular sources
+    else()
+        set(POTHOS_MODULE_UTIL_DOC_SOURCES ${POTHOS_MODULE_UTIL_SOURCES})
+    endif()
+
+    #setup json doc file generation and install
+    if (POTHOS_MODULE_UTIL_ENABLE_DOCS)
+
+        #turn sources into an absolute path
+        unset(__POTHOS_SOURCES)
+        foreach(source ${POTHOS_MODULE_UTIL_DOC_SOURCES})
+            if (EXISTS ${source})
+                list(APPEND __POTHOS_SOURCES ${source})
+            else()
+                list(APPEND __POTHOS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/${source})
+            endif()
+        endforeach(source)
+        set(POTHOS_MODULE_UTIL_DOC_SOURCES ${__POTHOS_SOURCES})
+
+        set(cpp_doc_file ${CMAKE_CURRENT_BINARY_DIR}/${POTHOS_MODULE_UTIL_TARGET}Docs.cpp)
+        add_custom_command(
+            OUTPUT ${cpp_doc_file}
+            COMMAND ${POTHOS_UTIL_EXE}
+                --doc-parse ${POTHOS_MODULE_UTIL_DOC_SOURCES}
+                --output ${cpp_doc_file}
+            DEPENDS ${POTHOS_MODULE_UTIL_DOC_SOURCES}
+            DEPENDS ${__POTHOS_UTIL_TARGET_NAME}
+        )
+        target_sources(${POTHOS_MODULE_UTIL_TARGET} PRIVATE ${cpp_doc_file})
+        set_property(SOURCE ${cpp_doc_file} PROPERTY SKIP_AUTOMOC ON)
+    endif()
+
+    set(MODULE_DESTINATION ${CMAKE_INSTALL_LIBDIR}/Pothos/modules${POTHOS_ABI_VERSION}/${POTHOS_MODULE_UTIL_DESTINATION})
+
+    #determine user-specified or automatic install prefix
+    if (POTHOS_MODULE_UTIL_PREFIX)
+        set(MODULE_DESTINATION ${POTHOS_MODULE_UTIL_PREFIX}/${MODULE_DESTINATION})
+    endif()
+
+    if(CMAKE_COMPILER_IS_GNUCXX)
+        #force a compile-time error when symbols are missing
+        #otherwise modules will cause a runtime error on load
+        target_link_libraries(${POTHOS_MODULE_UTIL_TARGET} PRIVATE "-Wl,--no-undefined")
+    endif()
+
+    install(
+        TARGETS ${POTHOS_MODULE_UTIL_TARGET}
+        DESTINATION ${MODULE_DESTINATION}
+    )
+
+endfunction(POTHOS_MODULE_UTIL)

+ 57 - 0
cmake/Modules/SetupPoco.cmake

@@ -0,0 +1,57 @@
+if(DEFINED INCLUDED_SETUP_POCO_CMAKE)
+    return()
+endif()
+set(INCLUDED_SETUP_POCO_CMAKE TRUE)
+
+########################################################################
+# Find Poco with PocoConfig.cmake (installed copy)
+########################################################################
+if("${CMAKE_VERSION}" VERSION_LESS "3.0.0")
+else()
+    set(Poco_INCLUDE_DIRS "")
+    find_package(Poco CONFIG COMPONENTS Foundation Util XML Net)
+    if (Poco_FOUND)
+        return()
+    endif()
+endif()
+
+########################################################################
+# Find Poco with FindPoco.cmake (local copy)
+########################################################################
+message(STATUS "PocoConfig not found - trying with FindPoco")
+list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_LIST_DIR})
+find_package(Poco)
+if (POCO_FOUND AND POCO_Util_FOUND AND POCO_Net_FOUND AND POCO_XML_FOUND)
+    ########################################################################
+    # Check version >= 1.5.4
+    ########################################################################
+    FILE (READ "${POCO_INCLUDE_DIRS}/Poco/Version.h" Poco_VERSION_H)
+    set(_ws "[ \r\t\n^$]+")
+    STRING (REGEX REPLACE "^.*#define${_ws}POCO_VERSION${_ws}(0x[0-9a-fA-F]*)${_ws}.*$" "\\1" Poco_VERSION "${Poco_VERSION_H}")
+    set(_ws)
+    if ("${Poco_VERSION}" LESS 0x01050400)
+        return()
+    endif()
+
+    ########################################################################
+    # Set variables
+    ########################################################################
+    set(Poco_FOUND 1)
+    set(Poco_INCLUDE_DIRS ${POCO_INCLUDE_DIRS})
+    set(Poco_LIBRARIES
+        ${POCO_LIBRARIES}
+        ${POCO_Util_LIBRARIES}
+        ${POCO_Net_LIBRARIES}
+        ${POCO_XML_LIBRARIES}
+    )
+
+    ########################################################################
+    # Link with the thread library
+    ########################################################################
+    if (UNIX)
+        set(CMAKE_THREAD_PREFER_PTHREAD ON)
+        enable_language(C)
+        find_package(Threads)
+        list(APPEND Poco_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
+    endif()
+endif()

+ 21 - 0
cmake/cmake_uninstall.cmake.in

@@ -0,0 +1,21 @@
+if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+  message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+string(REGEX REPLACE "\n" ";" files "${files}")
+foreach(file ${files})
+  message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
+  if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+    exec_program(
+      "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+      OUTPUT_VARIABLE rm_out
+      RETURN_VALUE rm_retval
+      )
+    if(NOT "${rm_retval}" STREQUAL 0)
+      message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
+    endif(NOT "${rm_retval}" STREQUAL 0)
+  else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+    message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
+  endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+endforeach(file)

+ 101 - 0
debian/changelog

@@ -0,0 +1,101 @@
+pothos (0.7.1-1) unstable; urgency=low
+
+  * Release 0.7.1 (2021-01-24)
+
+ -- Josh Blum <josh@pothosware.com>  Sun, 24 Jan 2021 21:32:09 -0000
+
+pothos (0.7.0-1) unstable; urgency=low
+
+  * Release 0.7.0 (2020-07-19)
+
+ -- Josh Blum <josh@pothosware.com>  Sun, 19 Jul 2020 22:24:38 -0000
+
+pothos (0.6.1-1) unstable; urgency=low
+
+  * Release 0.6.1 (2018-04-30)
+
+ -- Josh Blum <josh@pothosware.com>  Mon, 30 Apr 2018 19:41:37 -0000
+
+pothos (0.6.0-1) unstable; urgency=low
+
+  * Release 0.6.0 (2017-12-25)
+
+ -- Josh Blum <josh@pothosware.com>  Mon, 25 Dec 2017 11:35:00 -0000
+
+pothos (0.5.1-1) unstable; urgency=low
+
+  * Release 0.5.1 (2017-08-16)
+
+ -- Josh Blum <josh@pothosware.com>  Wed, 16 Aug 2017 21:41:56 -0000
+
+pothos (0.5.0-1) unstable; urgency=low
+
+  * Release 0.5.0 (2017-04-27)
+
+ -- Josh Blum <josh@pothosware.com>  Thu, 27 Apr 2017 17:33:56 -0000
+
+pothos (0.4.3-1) unstable; urgency=low
+
+  * Release 0.4.3 (2017-04-23)
+
+ -- Josh Blum <josh@pothosware.com>  Sun, 23 Apr 2017 21:12:52 -0000
+
+pothos (0.4.2-1) unstable; urgency=low
+
+  * Release 0.4.2 (2017-01-26)
+
+ -- Josh Blum <josh@pothosware.com>  Thu, 26 Jan 2017 22:30:51 -0800
+
+pothos (0.4.1-ppa1) unstable; urgency=low
+
+  * Release 0.4.1 (2016-09-26)
+
+ -- Josh Blum <josh@pothosware.com>  Mon, 26 Sep 2016 10:56:23 -0700
+
+pothos (0.4.0) unstable; urgency=low
+
+  * Release 0.4.0 (2016-08-02)
+
+ -- Josh Blum <josh@pothosware.com>  Tue, 02 Aug 2016 14:42:10 -0700
+
+pothos (0.3.3) unstable; urgency=low
+
+  * Release 0.3.3 (2016-05-10)
+
+ -- Josh Blum <josh@pothosware.com>  Tue, 10 May 2016 16:34:00 -0700
+
+pothos (0.3.2) unstable; urgency=low
+
+  * Release 0.3.2 (2016-03-06)
+
+ -- Josh Blum <josh@pothosware.com>  Sun, 06 Mar 2016 12:16:33 -0800
+
+pothos (0.3.1) unstable; urgency=low
+
+  * Release 0.3.1 (2016-01-01)
+
+ -- Josh Blum <josh@pothosware.com>  Fri, 01 Jan 2016 15:14:41 -0800
+
+pothos (0.3.0) unstable; urgency=low
+
+  * Release 0.3.0 (2015-12-16)
+
+ -- Josh Blum <josh@pothosware.com>  Wed, 16 Dec 2015 19:45:48 -0800
+
+pothos (0.2.2) unstable; urgency=low
+
+  * Release 0.2.2 (2015-12-07)
+
+ -- Josh Blum <josh@pothosware.com>  Mon, 07 Dec 2015 12:07:12 -0800
+
+pothos (0.2.1) unstable; urgency=low
+
+  * Release 0.2.1 (2015-08-26)
+
+ -- Josh Blum <josh@pothosware.com>  Wed, 26 Aug 2015 16:20:52 -0700
+
+pothos (0.2.0) unstable; urgency=low
+
+  * Release 0.2.0 (2015-06-17)
+
+ -- Josh Blum <josh@pothosware.com>  Wed, 17 Jun 2015 00:09:56 -0400

+ 1 - 0
debian/compat

@@ -0,0 +1 @@
+9

+ 54 - 0
debian/control

@@ -0,0 +1,54 @@
+Source: pothos
+Section: science
+Priority: optional
+Maintainer: Josh Blum <josh@pothosware.com>
+Build-Depends:
+    debhelper (>= 9.0.0),
+    cmake (>= 2.8.9),
+    libpoco-dev (>= 1.6),
+    libmuparserx-dev,
+    nlohmann-json3-dev,
+    libnuma-dev [amd64 i386]
+Standards-Version: 4.5.0
+Homepage: https://github.com/pothosware/PothosCore/wiki
+Vcs-Git: https://github.com/pothosware/PothosCore.git
+Vcs-Browser: https://github.com/pothosware/PothosCore
+
+Package: pothos-util
+Section: science
+Architecture: any
+Depends: libpothos0.7 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
+Description: runtime application
+ The Pothos data-flow software suite.
+
+Package: libpothos0.7
+Section: libs
+Architecture: any
+Multi-Arch: same
+Pre-Depends: ${misc:Pre-Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: shared library
+ The Pothos data-flow software suite.
+
+Package: libpothos-dev
+Section: libdevel
+Architecture: any
+Depends: libpothos0.7 (= ${binary:Version}), ${misc:Depends}, pothos-util
+Description: development files
+ The Pothos data-flow software suite.
+
+Package: pothos-all
+Section: libs
+Architecture: all
+Depends:
+    pothos-util,
+    pothos-flow,
+    pothos-modules-audio,
+    pothos-modules-blocks,
+    pothos-modules-comms,
+    pothos-modules-plotters,
+    pothos-modules-widgets,
+    pothos-modules-soapy,
+    ${misc:Depends}
+Description: Meta package for all official toolkits
+ This is a metapackage for the most common Pothos toolkits.

+ 32 - 0
debian/copyright

@@ -0,0 +1,32 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: pothos
+Source: https://github.com/pothosware/PothosCore/wiki
+
+Files: *
+Copyright:
+    Copyright (c) 2020-2020 Nicholas Corgan
+    Copyright (c) 2013-2021 Josh Blum <josh@pothosware.com>
+License: BSL-1.0
+ Boost Software License - Version 1.0 - August 17th, 2003
+ .
+ Permission is hereby granted, free of charge, to any person or organization
+ obtaining a copy of the software and accompanying documentation covered by
+ this license (the "Software") to use, reproduce, display, distribute,
+ execute, and transmit the Software, and to prepare derivative works of the
+ Software, and to permit third-parties to whom the Software is furnished to
+ do so, all subject to the following:
+ .
+ The copyright notices in the Software and this entire statement, including
+ the above license grant, this restriction and the following disclaimer,
+ must be included in all copies of the Software, in whole or in part, and
+ all derivative works of the Software, unless such copies or derivative
+ works are solely in the form of machine-executable object code generated by
+ a source language processor.
+ .
+ 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+ SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+ FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.

+ 1 - 0
debian/docs

@@ -0,0 +1 @@
+README.md

+ 4 - 0
debian/libpothos-dev.install

@@ -0,0 +1,4 @@
+usr/include
+usr/share/cmake
+usr/lib/*/pkgconfig
+usr/lib/*/*.so

+ 1 - 0
debian/libpothos0.7.install

@@ -0,0 +1 @@
+usr/lib/*/*.so.*

+ 1 - 0
debian/pothos-util.install

@@ -0,0 +1 @@
+usr/bin

+ 21 - 0
debian/rules

@@ -0,0 +1,21 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+# extract the last section of the changelog version for extra info
+DEB_VERSION ?= $(shell dpkg-parsechangelog -S Version)
+DEB_VERSION_EXTRA := $(lastword $(subst -, ,$(DEB_VERSION)))
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+%:
+	dh $@ --buildsystem=cmake --parallel
+
+override_dh_auto_configure:
+	dh_auto_configure -- \
+		-DPOTHOS_EXTVER="$(DEB_VERSION_EXTRA)" \
+		-DCMAKE_AUTOSET_INSTALL_RPATH=FALSE \
+		-DENABLE_TOOLKITS=OFF
+
+override_dh_installchangelogs:
+	dh_installchangelogs Changelog.txt

+ 1 - 0
debian/source/format

@@ -0,0 +1 @@
+3.0 (quilt)

+ 43 - 0
docs/CMakeLists.txt

@@ -0,0 +1,43 @@
+########################################################################
+# Optional doxygen generation
+########################################################################
+find_package(Doxygen)
+
+if (DOXYGEN_DOT_FOUND)
+    set(HAVE_DOT YES)
+else()
+    set(HAVE_DOT NO)
+endif()
+
+########################################################################
+## Feature registration
+########################################################################
+cmake_dependent_option(ENABLE_LIBRARY_DOCS "Enable Pothos Library.Docs component" ON "ENABLE_LIBRARY;DOXYGEN_FOUND" OFF)
+add_feature_info("  Docs" ENABLE_LIBRARY_DOCS "Doxygen generated docs for Pothos library")
+if (NOT ENABLE_LIBRARY_DOCS)
+    return()
+endif()
+
+#header sources used in the generate rule
+file(GLOB_RECURSE POTHOS_INCLUDES ${PROJECT_SOURCE_DIR}/include/*.hpp)
+
+#formated list of sources to parse
+string(REPLACE ";" " " DOXYGEN_SOURCES "${POTHOS_INCLUDES}")
+
+#Configure doxygen config file
+configure_file(
+    ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
+    ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+@ONLY)
+
+#Create doxygen generation build rules
+if (DOXYGEN_FOUND)
+    set(CMAKE_CURRENT_BINARY_DIR_DOXYGEN ${CMAKE_CURRENT_BINARY_DIR}/html)
+    add_custom_command(
+        OUTPUT ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN}
+        DEPENDS ${POTHOS_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+        COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
+        COMMENT "Generating documentation with doxygen"
+    )
+    add_custom_target(docs ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN})
+endif()

+ 2428 - 0
docs/Doxyfile.in

@@ -0,0 +1,2428 @@
+# Doxyfile 1.8.11
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
+# for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME           = "Pothos"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER         = "@POTHOS_VERSION@"
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF          = "The Pothos dataflow programming software suite"
+
+# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
+# in the documentation. The maximum height of the logo should not exceed 55
+# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
+# the logo to the output directory.
+
+PROJECT_LOGO           = "@CMAKE_CURRENT_SOURCE_DIR@/PothosGui.png"
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = "@CMAKE_CURRENT_BINARY_DIR@"
+
+# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS         = NO
+
+# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
+# characters to appear in the names of generated files. If set to NO, non-ASCII
+# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
+# U+3044.
+# The default value is: NO.
+
+ALLOW_UNICODE_NAMES    = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF       =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES        = YES
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH        = "@PROJECT_SOURCE_DIR@"
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
+# page for each member. If set to NO, the documentation of a member will be part
+# of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE               = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES                =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST              =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
+# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
+# Fortran. In the later case the parser tries to guess whether the code is fixed
+# or free formatted code, this is the default for Fortran type files), VHDL. For
+# instance to make doxygen treat .inc files as Fortran files (default is PHP),
+# and .f files as C (default is Fortran), use: inc=Fortran f=C.
+#
+# Note: For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT       = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by putting a % sign in front of the word or
+# globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT       = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT    = NO
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC   = YES
+
+# If one adds a struct or class to a group and this option is enabled, then also
+# any nested class or struct is added to the same group. By default this option
+# is disabled and one has to add nested compounds explicitly via \ingroup.
+# The default value is: NO.
+
+GROUP_NESTED_COMPOUNDS = NO
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING            = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS  = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO,
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. If set to YES, local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO, only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO, these classes will be included in the various overviews. This option
+# has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO, these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO, these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES, upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES, the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
+# append additional text to a page's title, such as Class Reference. If set to
+# YES the compound reference will be hidden.
+# The default value is: NO.
+
+HIDE_COMPOUND_REFERENCE= NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC  = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO, the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING  = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
+# list. This list is created by putting \todo commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
+# list. This list is created by putting \test commands in the documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES, the
+# list will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES        = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE            =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. See also \cite for info how to create references.
+
+CITE_BIB_FILES         =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS               = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO, doxygen will only warn about wrong or incomplete
+# parameter documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC       = NO
+
+# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
+# a warning is encountered.
+# The default value is: NO.
+
+WARN_AS_ERROR          = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE           = "@CMAKE_CURRENT_BINARY_DIR@/warn.log"
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
+# Note: If this tag is empty the current directory is searched.
+
+INPUT                  = @DOXYGEN_SOURCES@
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: http://www.gnu.org/software/libiconv) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# read by doxygen.
+#
+# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
+# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
+# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
+# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl,
+# *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js.
+
+FILE_PATTERNS          =
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE              = NO
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE                =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS        = Pothos::Detail \
+                         Pothos::*::Detail
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH           =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS       =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE      = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES    = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS        = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see http://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS       = YES
+
+# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
+# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
+# cost of reduced performance. This can be particularly helpful with template
+# rich C++ code for which doxygen's built-in parser lacks the necessary type
+# information.
+# Note: The availability of this option depends on whether or not doxygen was
+# generated with the -Duse-libclang=ON option for CMake.
+# The default value is: NO.
+
+CLANG_ASSISTED_PARSING = NO
+
+# If clang assisted parsing is enabled you can provide the compiler with command
+# line options that you would normally use when invoking the compiler. Note that
+# the include paths will already be set by doxygen for the files and directories
+# specified with INPUT and INCLUDE_PATH.
+# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
+
+CLANG_OPTIONS          =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX     = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET        =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# cascading style sheets that are included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefore more robust against future updates.
+# Doxygen will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list). For an example see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET  =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES       =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the style sheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to YES can help to show when doxygen was last run and thus if the
+# documentation is up to date.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS  = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: http://developer.apple.com/tools/xcode/), introduced with
+# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET        = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP      = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE               =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler (hhc.exe). If non-empty,
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION           =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated
+# (YES) or that it should be included in the master .chm file (NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI           = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING     =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated
+# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
+# enables the Previous and Next buttons.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX          = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW      = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH         = 250
+
+# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT    = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# http://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX            = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT         = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from http://www.mathjax.org before deployment.
+# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS     =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE       =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
+# setting. When disabled, doxygen will generate a PHP script for searching and
+# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
+# and searching needs to be provided by external tools. See the section
+# "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH    = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH        = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer (doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL       =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE        = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID     =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS  =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE             = a4
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. The package can be specified just
+# by its name or with the correct syntax as to be used with the LaTeX
+# \usepackage command. To get the times font for instance you can specify :
+# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
+# To use the option intlimits with the amsmath package you can specify:
+# EXTRA_PACKAGES=[intlimits]{amsmath}
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
+# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
+# string, for the replacement values of the other commands the user is referred
+# to HTML_HEADER.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER           =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer. See
+# LATEX_HEADER for more information on how to generate a default footer and what
+# special commands can be used inside the footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER           =
+
+# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
+# LaTeX style sheets that are included after the standard style sheets created
+# by doxygen. Using this option one can overrule certain style aspects. Doxygen
+# will copy the style sheet files to the output directory.
+# Note: The order of the extra style sheet files is of importance (e.g. the last
+# style sheet in the list overrules the setting of the previous ones in the
+# list).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_STYLESHEET =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES      =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES, to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE        = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES     = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE      = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE        = plain
+
+# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_TIMESTAMP        = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE    =
+
+# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
+# with syntax highlighting in the RTF output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_SOURCE_CODE        = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION          = .3
+
+# The MAN_SUBDIR tag determines the name of the directory created within
+# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
+# MAN_EXTENSION with the initial . removed.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_SUBDIR             =
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT             = xml
+
+# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK       = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT         = docbook
+
+# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
+# program listings (including syntax highlighting and cross-referencing
+# information) to the DOCBOOK output. Note that enabling this will significantly
+# increase the size of the DOCBOOK output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_PROGRAMLISTING = NO
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
+# AutoGen Definitions (see http://autogen.sf.net) file that captures the
+# structure of the code including all documentation. Note that this feature is
+# still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO, the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
+# in the source code. If set to NO, only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION        = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES, the include files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED             =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all references to function-like macros that are alone on a line, have
+# an all uppercase name, and do not end with a semicolon. Such function macros
+# are typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have a unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
+# the class index. If set to NO, only the inherited external classes will be
+# listed.
+# The default value is: NO.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS        = YES
+
+# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES         = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see:
+# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            =
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH               =
+
+# If set to YES the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: YES.
+
+HAVE_DOT               = @HAVE_DOT@
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS        = 0
+
+# When you want a differently looking font in the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME           = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH    = NO
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK               = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS   = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH          = NO
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH      = NO
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command. Disabling a call graph can be
+# accomplished by means of the command \hidecallgraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command. Disabling a caller graph can be
+# accomplished by means of the command \hidecallergraph.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH        = NO
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. For an explanation of the image formats see the section
+# output formats in the documentation of the dot tool (Graphviz (see:
+# http://www.graphviz.org/)).
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd,
+# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo,
+# gif:cairo:gd, gif:gd, gif:gd:gd, svg, png:gd, png:gd:gd, png:cairo,
+# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
+# png:gdiplus:gdiplus.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT       = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG        = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH               = "@DOXYGEN_DOT_PATH@"
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS           =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS           =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS           =
+
+# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
+# path where java can find the plantuml.jar file. If left blank, it is assumed
+# PlantUML is not used or called during a preprocessing step. Doxygen will
+# generate a warning when it encounters a \startuml command in this case and
+# will not generate output for the diagram.
+
+PLANTUML_JAR_PATH      =
+
+# When using plantuml, the specified paths are searched for files specified by
+# the !include statement in a plantuml block.
+
+PLANTUML_INCLUDE_PATH  =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES    = 1000
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS      = YES
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP            = YES

BIN
docs/PothosGui.png


+ 17 - 0
include/CMakeLists.txt

@@ -0,0 +1,17 @@
+########################################################################
+## Feature registration
+########################################################################
+cmake_dependent_option(ENABLE_LIBRARY_INCLUDE "Enable Pothos Library.Include component" ON "ENABLE_LIBRARY" OFF)
+add_feature_info("  Include" ENABLE_LIBRARY_INCLUDE "Public C++ headers for Pothos library")
+if (NOT ENABLE_LIBRARY_INCLUDE)
+    return()
+endif()
+
+########################################################################
+# install include files
+########################################################################
+install(
+    DIRECTORY Pothos
+    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+    COMPONENT pothos_devel
+)

+ 26 - 0
include/Pothos/Archive.hpp

@@ -0,0 +1,26 @@
+///
+/// \file Pothos/Archive.hpp
+///
+/// Top level include wrapper for Archive classes.
+///
+/// \copyright
+/// Copyright (c) 2016 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Archive/Split.hpp>
+#include <Pothos/Archive/Export.hpp>
+#include <Pothos/Archive/Numbers.hpp>
+#include <Pothos/Archive/Complex.hpp>
+#include <Pothos/Archive/String.hpp>
+#include <Pothos/Archive/Map.hpp>
+#include <Pothos/Archive/Set.hpp>
+#include <Pothos/Archive/Pair.hpp>
+#include <Pothos/Archive/Vector.hpp>
+#include <Pothos/Archive/BinaryObject.hpp>
+#include <Pothos/Archive/Polymorphic.hpp>
+#include <Pothos/Archive/ArchiveEntry.hpp>
+#include <Pothos/Archive/StreamArchiver.hpp>
+#include <Pothos/Archive/Exception.hpp>

+ 110 - 0
include/Pothos/Archive/ArchiveEntry.hpp

@@ -0,0 +1,110 @@
+///
+/// \file Archive/ArchiveEntry.hpp
+///
+/// Library storage for archive entries.
+/// Entries are used for polymorphic factories.
+///
+/// \copyright
+/// Copyright (c) 2016-2017 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Archive/StreamArchiver.hpp>
+#include <type_traits>
+#include <typeinfo>
+#include <iosfwd>
+#include <string>
+
+namespace Pothos {
+namespace Archive {
+
+/*!
+ * Base class for an archive entry.
+ * Stores and ID and overloads for polymorphic support.
+ */
+class POTHOS_API ArchiveEntry
+{
+public:
+
+    //! Create and register an entry given the type and unique ID
+    ArchiveEntry(const std::type_info &type, const std::string &id);
+
+    //! Virtual destructor for derived type classes
+    virtual ~ArchiveEntry(void);
+
+    //! Save a pointer to the archive in a derived class
+    virtual void save(OStreamArchiver &ar, const void *t) const = 0;
+
+    //! Load a pointer from the archive in a derived class
+    virtual void *load(IStreamArchiver &ar) const = 0;
+
+    //! Lookup the entry given the type info or throw if not found
+    static const ArchiveEntry &find(const std::type_info &type);
+
+    //! Lookup the entry given the unique id or throw if not found
+    static const ArchiveEntry &find(const std::string &id);
+
+    //! Lookup the entry given the the id hash or throw if not found
+    static const ArchiveEntry &find(const unsigned long long &hash);
+
+    //! Get the associated unique ID
+    const std::string &getId(void) const;
+
+    //! Get a reproducible hash for this entry
+    const unsigned long long &getHash(void) const;
+
+private:
+    const std::string _id;
+    const unsigned long long _hash;
+};
+
+/*!
+ * Archive entry for specific types.
+ * When instantiated, the library can
+ * save, create, and load this type.
+ */
+template <typename T>
+struct ArchiveEntryT : ArchiveEntry
+{
+    ArchiveEntryT(const std::string &id);
+
+    void save(OStreamArchiver &ar, const void *t) const;
+
+    void *load(IStreamArchiver &ar) const;
+};
+
+} //namespace Archive
+} //namespace Pothos
+
+inline const std::string &Pothos::Archive::ArchiveEntry::getId(void) const
+{
+    return _id;
+}
+
+inline const unsigned long long &Pothos::Archive::ArchiveEntry::getHash(void) const
+{
+    return _hash;
+}
+
+template <typename T>
+Pothos::Archive::ArchiveEntryT<T>::ArchiveEntryT(const std::string &id):
+    ArchiveEntry(typeid(T), id)
+{
+    return;
+}
+
+template <typename T>
+void Pothos::Archive::ArchiveEntryT<T>::save(OStreamArchiver &ar, const void *t) const
+{
+    ar << (*static_cast<const T *>(t));
+}
+
+template <typename T>
+void *Pothos::Archive::ArchiveEntryT<T>::load(IStreamArchiver &ar) const
+{
+    T *t = new T();
+    ar >> *t;
+    return t;
+}

+ 51 - 0
include/Pothos/Archive/BinaryObject.hpp

@@ -0,0 +1,51 @@
+///
+/// \file Archive/BinaryObject.hpp
+///
+/// String binary chunk serialization.
+///
+/// \copyright
+/// Copyright (c) 2016 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Archive/Split.hpp>
+#include <cstddef> //size_t
+
+namespace Pothos {
+namespace serialization {
+
+/*!
+ * Wrap a chunk given a pointer and length in bytes.
+ * This interface is lightweight and does not copy.
+ */
+class BinaryObject
+{
+public:
+    BinaryObject(const void * const buff, const size_t len):
+        buff(buff), len(len)
+    {
+        return;
+    }
+
+    template <typename Archive>
+    void save(Archive &ar, const unsigned int)
+    {
+        ar.writeBytes(buff, len);
+    }
+
+    template <typename Archive>
+    void load(Archive &ar, const unsigned int)
+    {
+        ar.readBytes(const_cast<void *>(buff), len);
+    }
+
+    POTHOS_SERIALIZATION_SPLIT_MEMBER()
+
+private:
+    const void * const buff;
+    const size_t len;
+};
+
+}}

+ 42 - 0
include/Pothos/Archive/Complex.hpp

@@ -0,0 +1,42 @@
+///
+/// \file Archive/Pair.hpp
+///
+/// Complex support for serialization.
+///
+/// \copyright
+/// Copyright (c) 2016 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Archive/Invoke.hpp>
+#include <complex> //pair
+
+namespace Pothos {
+namespace serialization {
+
+template<typename Archive, typename T>
+void save(Archive &ar, const std::complex<T> &t, const unsigned int)
+{
+    ar << t.real();
+    ar << t.imag();
+}
+
+template<typename Archive, typename T>
+void load(Archive &ar, std::complex<T> &t, const unsigned int)
+{
+    T real, imag;
+    ar >> real;
+    ar >> imag;
+    t.real(real);
+    t.imag(imag);
+}
+
+template <typename Archive, typename T>
+void serialize(Archive &ar, std::complex<T> &t, const unsigned int ver)
+{
+    Pothos::serialization::invokeSplit(ar, t, ver);
+}
+
+}}

+ 22 - 0
include/Pothos/Archive/Exception.hpp

@@ -0,0 +1,22 @@
+///
+/// \file Archive/Exception.hpp
+///
+/// Exceptions thrown by the Archive methods.
+///
+/// \copyright
+/// Copyright (c) 2016-2016 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Exception.hpp>
+
+namespace Pothos {
+
+/*!
+ * An ArchiveException is thrown when an archive operation fails.
+ */
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, ArchiveException, RuntimeException);
+
+} //namespace Pothos

+ 39 - 0
include/Pothos/Archive/Export.hpp

@@ -0,0 +1,39 @@
+///
+/// \file Archive/Export.hpp
+///
+/// Serialization registration macros.
+///
+/// \copyright
+/// Copyright (c) 2016 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Archive/ArchiveEntry.hpp>
+
+/*!
+ * Register archival functions for a given class.
+ * A unique name is required with the class because
+ * the typeinfo name is not consistent across platforms.
+ */
+#define POTHOS_CLASS_EXPORT_GUID(T, id) \
+    namespace Pothos { namespace Archive { \
+        template <> struct ArchiveEntryContainer<T> { \
+            static const ArchiveEntry &entry; \
+        }; \
+        const ArchiveEntry &ArchiveEntryContainer<T>::entry = \
+            ArchiveEntryT<T>(id) ; \
+    }}
+
+//! Register archival functions using the stringified type as the ID
+#define POTHOS_CLASS_EXPORT(T) POTHOS_CLASS_EXPORT_GUID(T, #T)
+
+namespace Pothos {
+namespace Archive {
+
+template <typename T>
+struct ArchiveEntryContainer;
+
+} //namespace Archive
+} //namespace Pothos

+ 108 - 0
include/Pothos/Archive/Invoke.hpp

@@ -0,0 +1,108 @@
+///
+/// \file Archive/Invoke.hpp
+///
+/// Invoke load/save/serialize without being defined.
+/// Relies-on and forces two-phase template resolution.
+///
+/// \copyright
+/// Copyright (c) 2016-2017 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <type_traits>
+#include <utility> //std::declval
+
+namespace Pothos {
+namespace serialization {
+
+    /*!
+     * A type that looks like the version number.
+     * This forces two-phase template resolution.
+     */
+    class VersionType
+    {
+    public:
+        VersionType(const unsigned int ver):
+            ver(ver)
+        {
+            return;
+        }
+
+        operator const unsigned int &(void) const
+        {
+            return ver;
+        }
+
+        operator unsigned int &(void)
+        {
+            return ver;
+        }
+
+    private:
+        unsigned int ver;
+    };
+
+    /*!
+     * Check for the presence of a serialize member function for class T.
+     * https://stackoverflow.com/questions/34595072/error-with-decltype-template-with-msvc2013
+     */
+    template <typename T, typename Archive>
+    struct hasSerialize
+    {
+        template <typename U>
+        static auto test(U* p) -> decltype(p->serialize(std::declval<Archive&>(), std::declval<const unsigned int>()));
+
+        template <typename U>
+        static auto test(...) -> std::false_type;
+
+        using type = typename std::is_same<decltype(test<T>(nullptr)), void>::type;
+        static const auto value = type::value;
+    };
+
+    /*!
+     * Invoke a save operation given an output stream archiver
+     */
+    template <typename Archive, typename T>
+    typename std::enable_if<Archive::isSave::value>::type
+    invokeSplit(Archive &ar, T &value, const unsigned int ver)
+    {
+        const VersionType vt(ver);
+        save(ar, value, vt);
+    }
+
+    /*!
+     * Invoke a load operation given an input stream archiver
+     */
+    template <typename Archive, typename T>
+    typename std::enable_if<!Archive::isSave::value>::type
+    invokeSplit(Archive &ar, T &value, const unsigned int ver)
+    {
+        const VersionType vt(ver);
+        load(ar, value, vt);
+    }
+
+    /*!
+     * Invoke serialize when its not a member function
+     */
+    template <typename Archive, typename T>
+    typename std::enable_if<!hasSerialize<T, Archive>::value>::type
+    invokeSerialize(Archive &ar, T &value, const unsigned int ver)
+    {
+        const VersionType vt(ver);
+        serialize(ar, value, vt);
+    }
+
+    /*!
+     * Invoke serialize when it is a member function
+     */
+    template <typename Archive, typename T>
+    typename std::enable_if<hasSerialize<T, Archive>::value>::type
+    invokeSerialize(Archive &ar, T &value, const unsigned int ver)
+    {
+        value.serialize(ar, ver);
+    }
+
+} //namespace serialization
+} //namespace Pothos

+ 52 - 0
include/Pothos/Archive/Map.hpp

@@ -0,0 +1,52 @@
+///
+/// \file Archive/Map.hpp
+///
+/// Map support for serialization.
+///
+/// \copyright
+/// Copyright (c) 2016-2019 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Archive/Invoke.hpp>
+#include <Pothos/Archive/Numbers.hpp>
+#include <Pothos/Archive/Pair.hpp>
+#include <utility> //move
+#include <map>
+
+namespace Pothos {
+namespace serialization {
+
+template<typename Archive, typename K, typename T, typename Compare, typename Allocator>
+void save(Archive &ar, const std::map<K, T, Compare, Allocator> &t, const unsigned int)
+{
+    ar << unsigned(t.size());
+    for (const auto &pair : t)
+    {
+        ar << pair;
+    }
+}
+
+template<typename Archive, typename K, typename T, typename Compare, typename Allocator>
+void load(Archive &ar, std::map<K, T, Compare, Allocator> &t, const unsigned int)
+{
+    t.clear();
+    unsigned size(0);
+    ar >> size;
+    for (size_t i = 0; i < size_t(size); i++)
+    {
+        std::pair<K, T> pair;
+        ar >> pair;
+        t.emplace_hint(t.end(), std::move(pair));
+    }
+}
+
+template <typename Archive, typename K, typename T, typename Compare, typename Allocator>
+void serialize(Archive &ar, std::map<K, T, Compare, Allocator> &t, const unsigned int ver)
+{
+    Pothos::serialization::invokeSplit(ar, t, ver);
+}
+
+}}

+ 233 - 0
include/Pothos/Archive/Numbers.hpp

@@ -0,0 +1,233 @@
+///
+/// \file Archive/Numbers.hpp
+///
+/// Numeric support for serialization.
+///
+/// Integers are serialized into a portable byte ordering
+/// to work across big and little platform endianness.
+/// In addition, all long types get serialized as 8 bytes
+/// because the size of long may vary from 4 to 8 bytes.
+///
+/// Floats are cast to an integer type of identical size
+/// and serialized as an integer; also for platform endianness.
+/// The implementation assumes the IEEE-754 format for floats,
+/// but could easily be expanded for soft packing of IEEE-754.
+///
+/// \copyright
+/// Copyright (c) 2016-2017 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Archive/Invoke.hpp>
+#include <Pothos/Archive/BinaryObject.hpp>
+#include <type_traits>
+#include <limits> //is_iec559
+
+namespace Pothos {
+namespace serialization {
+
+//------------ boolean support --------------//
+template<typename Archive>
+void save(Archive &ar, const bool &t, const unsigned int)
+{
+    unsigned char value(t?1:0);
+    ar << value;
+}
+
+template<typename Archive>
+void load(Archive &ar, bool &t, const unsigned int)
+{
+    unsigned char value;
+    ar >> value;
+    t = (value == 0)?false:true;
+}
+
+//------------ 8 bit integer support (all char types) --------------//
+template<typename Archive, typename T>
+typename std::enable_if<
+    std::is_same<T, unsigned char>::value or
+    std::is_same<T, signed char>::value or
+    std::is_same<T, char>::value
+>::type save(Archive &ar, const T &t, const unsigned int)
+{
+    BinaryObject bo(&t, 1);
+    ar << bo;
+}
+
+template<typename Archive, typename T>
+typename std::enable_if<
+    std::is_same<T, unsigned char>::value or
+    std::is_same<T, signed char>::value or
+    std::is_same<T, char>::value
+>::type load(Archive &ar, T &t, const unsigned int)
+{
+    BinaryObject bo(&t, 1);
+    ar >> bo;
+}
+
+//------------ 16 bit integer support (short types) --------------//
+template<typename Archive, typename T>
+typename std::enable_if<
+    std::is_same<T, unsigned short>::value or
+    std::is_same<T, signed short>::value
+>::type save(Archive &ar, const T &t, const unsigned int)
+{
+    unsigned char buff[2];
+    const auto v = static_cast<unsigned short>(t);
+    buff[0] = static_cast<unsigned char>(v >> 0);
+    buff[1] = static_cast<unsigned char>(v >> 8);
+    BinaryObject bo(buff, sizeof(buff));
+    ar << bo;
+}
+
+template<typename Archive, typename T>
+typename std::enable_if<
+    std::is_same<T, unsigned short>::value or
+    std::is_same<T, signed short>::value
+>::type load(Archive &ar, T &t, const unsigned int)
+{
+    unsigned char buff[2];
+    BinaryObject bo(buff, sizeof(buff));
+    ar >> bo;
+    t = static_cast<T>(
+        (static_cast<unsigned short>(buff[0]) << 0) |
+        (static_cast<unsigned short>(buff[1]) << 8));
+}
+
+//------------ 32-64 bit signed integer types --------------//
+// use signed LEB128 encoding for variable length encoding
+// https://en.wikipedia.org/wiki/LEB128
+template<typename Archive, typename T>
+typename std::enable_if<
+    std::is_same<T, signed int>::value or
+    std::is_same<T, signed long>::value or
+    std::is_same<T, signed long long>::value
+>::type save(Archive &ar, const T &t, const unsigned int)
+{
+    T value(t);
+    unsigned char byte;
+    do
+    {
+        byte = static_cast<unsigned char>(value) & 0x7f;
+        value >>= 7; //must be arithmetic shift
+        const auto signbit = byte & 0x40;
+        if ((value != 0 or signbit != 0) and
+            (value != -1 or signbit == 0)) byte |= 0x80;
+        ar << byte;
+    } while ((byte & 0x80) != 0);
+}
+
+template<typename Archive, typename T>
+typename std::enable_if<
+    std::is_same<T, signed int>::value or
+    std::is_same<T, signed long>::value or
+    std::is_same<T, signed long long>::value
+>::type load(Archive &ar, T &t, const unsigned int)
+{
+    t = T(0);
+    unsigned shift(0);
+    unsigned char byte;
+    do
+    {
+        ar >> byte;
+        t |= T(byte & 0x7f) << shift;
+        shift += 7;
+    } while ((byte & 0x80) != 0);
+
+    //sign extend the remaining bits when negative
+    const auto signbit = byte & 0x40;
+    if (signbit != 0 and shift < (sizeof(T)*8)) t |= -(1 << shift);
+}
+
+//------------ 32-64 bit unsigned integer types --------------//
+// use unsigned LEB128 encoding for variable length encoding
+// https://en.wikipedia.org/wiki/LEB128
+template<typename Archive, typename T>
+typename std::enable_if<
+    std::is_same<T, unsigned int>::value or
+    std::is_same<T, unsigned long>::value or
+    std::is_same<T, unsigned long long>::value
+>::type save(Archive &ar, const T &t, const unsigned int)
+{
+    T value(t);
+    unsigned char byte;
+    do
+    {
+        byte = static_cast<unsigned char>(value) & 0x7f;
+        value >>= 7;
+        if (value != 0) byte |= 0x80;
+        ar << byte;
+    } while ((byte & 0x80) != 0);
+}
+
+template<typename Archive, typename T>
+typename std::enable_if<
+    std::is_same<T, unsigned int>::value or
+    std::is_same<T, unsigned long>::value or
+    std::is_same<T, unsigned long long>::value
+>::type load(Archive &ar, T &t, const unsigned int)
+{
+    t = T(0);
+    unsigned shift(0);
+    unsigned char byte;
+    do
+    {
+        ar >> byte;
+        t |= T(byte & 0x7f) << shift;
+        shift += 7;
+    } while ((byte & 0x80) != 0);
+}
+
+//------------ 32-bit float support --------------//
+static_assert(std::numeric_limits<float>::is_iec559, "System is IEEE-754");
+
+template<typename Archive>
+typename std::enable_if<std::numeric_limits<float>::is_iec559>::type
+save(Archive &ar, const float &t, const unsigned int)
+{
+    const void *bin(&t);
+    ar << *static_cast<const unsigned int *>(bin);
+}
+
+template<typename Archive>
+typename std::enable_if<std::numeric_limits<float>::is_iec559>::type
+load(Archive &ar, float &t, const unsigned int)
+{
+    unsigned int num;
+    ar >> num;
+    const void *bin(&num);
+    t = *reinterpret_cast<const float *>(bin);
+}
+
+//------------ 64-bit float support --------------//
+static_assert(std::numeric_limits<double>::is_iec559, "System is IEEE-754");
+
+template<typename Archive>
+typename std::enable_if<std::numeric_limits<double>::is_iec559>::type
+save(Archive &ar, const double &t, const unsigned int)
+{
+    const void *bin(&t);
+    ar << *static_cast<const unsigned long long *>(bin);
+}
+
+template<typename Archive>
+typename std::enable_if<std::numeric_limits<double>::is_iec559>::type
+load(Archive &ar, double &t, const unsigned int)
+{
+    unsigned long long num;
+    ar >> num;
+    const void *bin(&num);
+    t = *reinterpret_cast<const double *>(bin);
+}
+
+//------------ serialize for integers and floats --------------//
+template <typename Archive, typename T>
+typename std::enable_if<std::is_arithmetic<T>::value>::type
+serialize(Archive &ar, T &t, const unsigned int ver)
+{
+    Pothos::serialization::invokeSplit(ar, t, ver);
+}
+
+}}

+ 25 - 0
include/Pothos/Archive/Pair.hpp

@@ -0,0 +1,25 @@
+///
+/// \file Archive/Pair.hpp
+///
+/// Pair support for serialization.
+///
+/// \copyright
+/// Copyright (c) 2016 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <utility> //pair
+
+namespace Pothos {
+namespace serialization {
+
+template <typename Archive, typename F, typename L>
+void serialize(Archive &ar, std::pair<F, L> &t, const unsigned int)
+{
+    ar & t.first;
+    ar & t.second;
+}
+
+}}

+ 48 - 0
include/Pothos/Archive/Polymorphic.hpp

@@ -0,0 +1,48 @@
+///
+/// \file Archive/Polymorphic.hpp
+///
+/// Polymorphic pointer support for serialization.
+///
+/// \copyright
+/// Copyright (c) 2016 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Archive/ArchiveEntry.hpp>
+#include <Pothos/Archive/Numbers.hpp>
+#include <Pothos/Archive/Invoke.hpp>
+#include <type_traits>
+
+namespace Pothos {
+namespace serialization {
+
+template <typename Archive, typename T>
+typename std::enable_if<std::is_polymorphic<T>::value>::type
+save(Archive &ar, const T* const &t, const unsigned int)
+{
+    const auto &entry = Pothos::Archive::ArchiveEntry::find(typeid(*t));
+    ar << entry.getHash();
+    entry.save(ar, t);
+}
+
+template <typename Archive, typename T>
+typename std::enable_if<std::is_polymorphic<T>::value>::type
+load(Archive &ar, T* &t, const unsigned int)
+{
+    unsigned long long idHash;
+    ar >> idHash;
+    const auto &entry = Pothos::Archive::ArchiveEntry::find(idHash);
+    delete t; //delete previous pointer or its null
+    t = static_cast<T*>(entry.load(ar));
+}
+
+template <typename Archive, typename T>
+typename std::enable_if<std::is_polymorphic<T>::value>::type
+serialize(Archive &ar, T* &t, const unsigned int ver)
+{
+    Pothos::serialization::invokeSplit(ar, t, ver);
+}
+
+}}

+ 51 - 0
include/Pothos/Archive/Set.hpp

@@ -0,0 +1,51 @@
+///
+/// \file Archive/Set.hpp
+///
+/// Set support for serialization.
+///
+/// \copyright
+/// Copyright (c) 2016-2019 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Archive/Invoke.hpp>
+#include <Pothos/Archive/Numbers.hpp>
+#include <utility> //move
+#include <set>
+
+namespace Pothos {
+namespace serialization {
+
+template<typename Archive, typename T, typename Compare, typename Allocator>
+void save(Archive &ar, const std::set<T, Compare, Allocator> &t, const unsigned int)
+{
+    ar << unsigned(t.size());
+    for (const auto &elem : t)
+    {
+        ar << elem;
+    }
+}
+
+template<typename Archive, typename T, typename Compare, typename Allocator>
+void load(Archive &ar, std::set<T, Compare, Allocator> &t, const unsigned int)
+{
+    t.clear();
+    unsigned size(0);
+    ar >> size;
+    for (size_t i = 0; i < size_t(size); i++)
+    {
+        T elem;
+        ar >> elem;
+        t.emplace_hint(t.end(), std::move(elem));
+    }
+}
+
+template <typename Archive, typename T, typename Compare, typename Allocator>
+void serialize(Archive &ar, std::set<T, Compare, Allocator> &t, const unsigned int ver)
+{
+    Pothos::serialization::invokeSplit(ar, t, ver);
+}
+
+}}

+ 44 - 0
include/Pothos/Archive/Split.hpp

@@ -0,0 +1,44 @@
+///
+/// \file Archive/Split.hpp
+///
+/// Serialization dispatch macros for separate save/load.
+///
+/// \copyright
+/// Copyright (c) 2016-2017 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Archive/Invoke.hpp>
+#include <type_traits>
+
+/*!
+ * Declare a serialize() function that can dispatch to
+ * an individually declared save and load function.
+ * Call in the outside scope, no namespaces or functions.
+ */
+#define POTHOS_SERIALIZATION_SPLIT_FREE(T) \
+    namespace Pothos { namespace serialization { \
+        template <typename Archive> \
+        void serialize(Archive &ar, T &t, const unsigned int ver) { \
+            Pothos::serialization::invokeSplit(ar, t, ver); \
+        } \
+    }}
+
+/*!
+ * Declare a serialize() function that can dispatch to
+ * individually declared save and load member functions.
+ * Call in the public part of a struct or class declaration.
+ */
+#define POTHOS_SERIALIZATION_SPLIT_MEMBER() \
+    template <typename Archive> \
+    typename std::enable_if<Archive::isSave::value>::type \
+    serialize(Archive &ar, const unsigned int ver) { \
+        this->save(ar, ver); \
+    } \
+    template <typename Archive> \
+    typename std::enable_if<!Archive::isSave::value>::type \
+    serialize(Archive &ar, const unsigned int ver) { \
+        this->load(ar, ver); \
+    }

+ 131 - 0
include/Pothos/Archive/StreamArchiver.hpp

@@ -0,0 +1,131 @@
+///
+/// \file Archive/StreamArchiver.hpp
+///
+/// Archive implementation on top of streaming interfaces.
+///
+/// \copyright
+/// Copyright (c) 2016-2017 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <type_traits>
+#include <iosfwd>
+#include <cstddef> //size_t
+
+namespace Pothos {
+namespace Archive {
+
+/*!
+ * The output stream archiver serializes types to an output stream.
+ */
+class POTHOS_API OStreamArchiver
+{
+public:
+    /*!
+     * Create an output stream archiver
+     * \param os the stream to write to
+     */
+    OStreamArchiver(std::ostream &os);
+
+    //! Tell the invoker that this archiver saves
+    typedef std::true_type isSave;
+
+    /*!
+     * Serialize value with the & operator
+     * \param value the value to serialize
+     */
+    template <typename T>
+    void operator&(const T &value);
+
+    /*!
+     * Serialize value with the stream operator
+     * \param value the value to serialize
+     */
+    template <typename T>
+    void operator<<(const T &value);
+
+    /*!
+     * Directly write an array of bytes to the output stream
+     */
+    void writeBytes(const void *buff, const size_t len);
+
+private:
+
+    std::ostream &os;
+    unsigned int ver;
+};
+
+/*!
+ * The input stream archiver deserializes types from an input stream.
+ */
+class POTHOS_API IStreamArchiver
+{
+public:
+    /*!
+     * Create an input stream archiver
+     * \param is the stream to read from
+     */
+    IStreamArchiver(std::istream &is);
+
+    //! Tell the invoker that this archiver loads
+    typedef std::false_type isSave;
+
+    /*!
+     * Deserialize value with the & operator
+     * \param value the value to deserialize
+     */
+    template <typename T>
+    void operator&(T &value);
+
+    /*!
+     * Deserialize value with the stream operator
+     * \param value the value to deserialize
+     */
+    template <typename T>
+    void operator>>(T &value);
+
+    /*!
+     * Directly read an array of bytes from the input stream
+     */
+    void readBytes(void *buff, const size_t len);
+
+private:
+
+    std::istream &is;
+    unsigned int ver;
+};
+
+} //namespace Archive
+} //namespace Pothos
+
+//! \cond
+
+#include <Pothos/Archive/Invoke.hpp>
+
+template <typename T>
+void Pothos::Archive::OStreamArchiver::operator&(const T &value)
+{
+    Pothos::serialization::invokeSerialize(*this, const_cast<T &>(value), ver);
+}
+
+template <typename T>
+void Pothos::Archive::OStreamArchiver::operator<<(const T &value)
+{
+    *this & value;
+}
+
+template <typename T>
+void Pothos::Archive::IStreamArchiver::operator&(T &value)
+{
+    Pothos::serialization::invokeSerialize(*this, value, ver);
+}
+
+template <typename T>
+void Pothos::Archive::IStreamArchiver::operator>>(T &value)
+{
+    *this & value;
+}
+
+//! \endcond

+ 45 - 0
include/Pothos/Archive/String.hpp

@@ -0,0 +1,45 @@
+///
+/// \file Archive/String.hpp
+///
+/// String support for serialization.
+///
+/// \copyright
+/// Copyright (c) 2016 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Archive/Invoke.hpp>
+#include <Pothos/Archive/Numbers.hpp>
+#include <Pothos/Archive/BinaryObject.hpp>
+#include <string>
+
+namespace Pothos {
+namespace serialization {
+
+template<typename Archive, typename T, typename Traits, typename Allocator>
+void save(Archive &ar, const std::basic_string<T, Traits, Allocator> &t, const unsigned int)
+{
+    ar << unsigned(t.size());
+    BinaryObject bo(t.data(), t.size());
+    ar << bo;
+}
+
+template<typename Archive, typename T, typename Traits, typename Allocator>
+void load(Archive &ar, std::basic_string<T, Traits, Allocator> &t, const unsigned int)
+{
+    unsigned size(0);
+    ar >> size;
+    t.resize(size);
+    BinaryObject bo(t.data(), t.size());
+    ar >> bo;
+}
+
+template <typename Archive, typename T, typename Traits, typename Allocator>
+void serialize(Archive &ar, std::basic_string<T, Traits, Allocator> &t, const unsigned int ver)
+{
+    Pothos::serialization::invokeSplit(ar, t, ver);
+}
+
+}}

+ 78 - 0
include/Pothos/Archive/Vector.hpp

@@ -0,0 +1,78 @@
+///
+/// \file Archive/Vector.hpp
+///
+/// Vector support for serialization.
+///
+/// \copyright
+/// Copyright (c) 2016-2019 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Archive/Invoke.hpp>
+#include <Pothos/Archive/Numbers.hpp>
+#include <utility> //move
+#include <vector>
+
+namespace Pothos {
+namespace serialization {
+
+//------------ boolean vectors use a special internal type --------------//
+template <typename Archive, typename Allocator>
+void save(Archive &ar, const std::vector<bool, Allocator> &t, const unsigned int)
+{
+    ar << unsigned(t.size());
+    for (const bool elem : t)
+    {
+        ar << elem;
+    }
+}
+
+template <typename Archive, typename Allocator>
+void load(Archive &ar, std::vector<bool, Allocator> &t, const unsigned int)
+{
+    unsigned size(0);
+    ar >> size;
+    t.resize(size);
+    for (size_t i = 0; i < size_t(size); i++)
+    {
+        bool elem;
+        ar >> elem;
+        t[i] = elem;
+    }
+}
+
+//------------ a vector of any type --------------//
+template<typename Archive, typename T, typename Allocator>
+void save(Archive &ar, const std::vector<T, Allocator> &t, const unsigned int)
+{
+    ar << unsigned(t.size());
+    for (const auto &elem : t)
+    {
+        ar << elem;
+    }
+}
+
+template<typename Archive, typename T, typename Allocator>
+void load(Archive &ar, std::vector<T, Allocator> &t, const unsigned int)
+{
+    unsigned size(0);
+    ar >> size;
+    t.clear();
+    t.reserve(size);
+    for (size_t i = 0; i < size_t(size); i++)
+    {
+        T elem;
+        ar >> elem;
+        t.emplace_back(std::move(elem));
+    }
+}
+
+template <typename Archive, typename T, typename Allocator>
+void serialize(Archive &ar, std::vector<T, Allocator> &t, const unsigned int ver)
+{
+    Pothos::serialization::invokeSplit(ar, t, ver);
+}
+
+}}

+ 17 - 0
include/Pothos/Callable.hpp

@@ -0,0 +1,17 @@
+///
+/// \file Pothos/Callable.hpp
+///
+/// Top level include wrapper for Callable classes.
+///
+/// \copyright
+/// Copyright (c) 2013-2016 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Callable/Callable.hpp>
+#include <Pothos/Callable/CallableImpl.hpp>
+#include <Pothos/Callable/CallRegistry.hpp>
+#include <Pothos/Callable/CallRegistryImpl.hpp>
+#include <Pothos/Callable/Exception.hpp>

+ 64 - 0
include/Pothos/Callable/CallInterface.hpp

@@ -0,0 +1,64 @@
+///
+/// \file Callable/CallInterface.hpp
+///
+/// CallInterface provides an method call abstraction interface.
+///
+/// \copyright
+/// Copyright (c) 2013-2017 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Object/Object.hpp>
+
+namespace Pothos {
+
+/*!
+ * CallInterface provides a set of templated call functions.
+ * Derived classes overload opaqueCall() to handle the call.
+ */
+class POTHOS_API CallInterface
+{
+public:
+    /*!
+     * virtual destructor for inheritance
+     */
+    virtual ~CallInterface(void);
+
+    //! Call a bound method/function with a return type and variable args
+    template <typename ReturnType, typename... ArgsType>
+    ReturnType call(ArgsType&&... args) const;
+
+    //! Call a bound method/function with an Object return and variable args
+    template <typename... ArgsType>
+    Object call(ArgsType&&... args) const;
+
+    /*!
+     * Call a bound method/function with an Object return and variable args
+     * \deprecated use call overload without return type
+     */
+    template <typename... ArgsType>
+    POTHOS_DEPRECATED("Replaced by call() overload without return type")
+    Object callObject(ArgsType&&... args) const;
+
+    /*!
+     * Call a bound method/function with a void return and variable args
+     * \deprecated use call overload without return type
+     */
+    template <typename... ArgsType>
+    POTHOS_DEPRECATED("Replaced by call() overload without return type")
+    void callVoid(ArgsType&&... args) const;
+
+protected:
+    /*!
+     * Call into the function/method with opaque input and return types.
+     * For a void return type of call, the returned Object will be null.
+     * \param inputArgs an array of call arguments of type Object
+     * \param numArgs the number of arguments in inputArgs
+     * \return the return value of the call as type Object
+     */
+    virtual Object opaqueCall(const Object *inputArgs, const size_t numArgs) const = 0;
+};
+
+} //namespace Pothos

+ 54 - 0
include/Pothos/Callable/CallInterfaceImpl.hpp

@@ -0,0 +1,54 @@
+///
+/// \file Callable/CallInterfaceImpl.hpp
+///
+/// Template implementation details for CallInterface.
+///
+/// \copyright
+/// Copyright (c) 2013-2017 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Callable/CallInterface.hpp>
+#include <Pothos/Callable/Exception.hpp>
+#include <Pothos/Object/ObjectImpl.hpp>
+#include <utility> //std::forward
+#include <array>
+
+namespace Pothos {
+
+template <typename ReturnType, typename... ArgsType>
+ReturnType CallInterface::call(ArgsType&&... args) const
+{
+    Object r = this->call(std::forward<ArgsType>(args)...);
+    try
+    {
+        return r.convert<ReturnType>();
+    }
+    catch(const Exception &ex)
+    {
+        throw CallableReturnError("Pothos::Callable::call()", ex);
+    }
+}
+
+template <typename... ArgsType>
+Object CallInterface::call(ArgsType&&... args) const
+{
+    const std::array<Object, sizeof...(ArgsType)> objArgs{{Object(std::forward<ArgsType>(args))...}};
+    return this->opaqueCall(objArgs.data(), sizeof...(args));
+}
+
+template <typename... ArgsType>
+Object CallInterface::callObject(ArgsType&&... args) const
+{
+    return this->call(std::forward<ArgsType>(args)...);
+}
+
+template <typename... ArgsType>
+void CallInterface::callVoid(ArgsType&&... args) const
+{
+    this->call(std::forward<ArgsType>(args)...);
+}
+
+} //namespace Pothos

+ 49 - 0
include/Pothos/Callable/CallRegistry.hpp

@@ -0,0 +1,49 @@
+///
+/// \file Callable/CallRegistry.hpp
+///
+/// CallRegistry is an interface for registering class methods.
+///
+/// \copyright
+/// Copyright (c) 2014-2016 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Callable/Callable.hpp>
+#include <string>
+
+namespace Pothos {
+
+/*!
+ * CallRegistry is an interface for registering class methods.
+ */
+class POTHOS_API CallRegistry
+{
+public:
+
+    //! Virtual destructor for subclassing
+    virtual ~CallRegistry(void);
+
+    /*!
+     * Register a class method with the given name.
+     * Usage: this->registerCall(this, "foo", &MyClass::foo);
+     */
+    template <typename... ArgsType, typename ReturnType, typename ClassType, typename InstanceType>
+    void registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(ArgsType...));
+
+    /*!
+     * Register a class method with the given name.
+     * Usage: this->registerCall(this, "foo", &MyClass::foo);
+     */
+    template <typename... ArgsType, typename ReturnType, typename ClassType, typename InstanceType>
+    void registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(ArgsType...) const);
+
+    /*!
+     * Register a bound call with the given name.
+     * The first argument of the call should have the class instance bound.
+     */
+    virtual void registerCallable(const std::string &name, const Callable &call) = 0;
+};
+
+} //namespace Pothos

+ 35 - 0
include/Pothos/Callable/CallRegistryImpl.hpp

@@ -0,0 +1,35 @@
+///
+/// \file Callable/CallRegistryImpl.hpp
+///
+/// Template method implementations for CallRegistry.
+///
+/// \copyright
+/// Copyright (c) 2014-2016 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Callable/CallRegistry.hpp>
+#include <Pothos/Callable/CallableImpl.hpp>
+#include <functional> //std::ref
+
+namespace Pothos {
+
+template <typename... ArgsType, typename ReturnType, typename ClassType, typename InstanceType>
+void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(ArgsType...))
+{
+    Callable call(method);
+    call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
+    this->registerCallable(name, call);
+}
+
+template <typename... ArgsType, typename ReturnType, typename ClassType, typename InstanceType>
+void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(ArgsType...) const)
+{
+    Callable call(method);
+    call.bind(std::ref(*static_cast<ClassType *>(instance)), 0);
+    this->registerCallable(name, call);
+}
+
+} //namespace Pothos

+ 221 - 0
include/Pothos/Callable/Callable.hpp

@@ -0,0 +1,221 @@
+///
+/// \file Callable/Callable.hpp
+///
+/// Callable provides an opaque proxy for function or method calls.
+///
+/// \copyright
+/// Copyright (c) 2013-2019 Josh Blum
+///                    2019 Nicholas Corgan
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Callable/CallInterface.hpp>
+#include <Pothos/Object/Object.hpp>
+#include <vector>
+#include <memory>
+
+namespace Pothos {
+
+//messy forward declares
+namespace Detail {
+struct CallableContainer;
+} //namespace Detail
+
+/*!
+ * The Callable class binds a class method or function.
+ * The method/function can be called through an opaque Object interface,
+ * or through a templated call interface with an arbitrary number of args.
+ */
+class POTHOS_API Callable : public CallInterface
+{
+public:
+
+    /*!
+     * Create a null Callable.
+     * Calling a null instance will throw CallableNullError.
+     */
+    Callable(void);
+
+    /*!
+     * Does the Callable hold a bound function?
+     * \return true if callable holds a bound function
+     */
+    explicit operator bool(void) const;
+
+    /*!
+     * Call into the function/method with opaque input and return types.
+     * For a void return type of call, the returned Object will be null.
+     * \throws CallableNullError if the Callable is null
+     * \throws CallableArgumentError for bad arguments in number or type
+     * \param inputArgs an array of call arguments of type Object
+     * \param numArgs the number of arguments in inputArgs
+     * \return the return value of the call as type Object
+     */
+    Object opaqueCall(const Object *inputArgs, const size_t numArgs) const;
+
+    /*!
+     * Get the number of arguments for this call.
+     * For methods, the class instance also counts
+     * \return the number of arguments
+     */
+    size_t getNumArgs(void) const;
+
+    /*!
+     * Get the type info for a particular argument.
+     * For the return type, use argNo = -1.
+     * For argument 0 use argNo = 0, etc.
+     * For methods, argNo = 0 is the class type.
+     * \throws CallableArgumentError if the argNo is invalid
+     * \return the type info for the argument
+     */
+    const std::type_info &type(const int argNo) const;
+
+    /*!
+     * Bind an argument to the given argument index - template version.
+     * The user will not specify this argument at call time,
+     * the bound argument will be used as a substitute.
+     * The bind call does not throw.
+     * \param val the value to put into the argument list
+     * \param argNo the argument index to bind to
+     * \return this Callable for operator chaining
+     */
+    template <typename ValueType>
+    Callable &bind(ValueType &&val, const size_t argNo);
+
+    /*!
+     * Bind an argument to the given argument index - Object version.
+     * The user will not specify this argument at call time,
+     * the bound argument will be used as a substitute.
+     * The bind call does not throw.
+     * \param val the value to put into the argument list
+     * \param argNo the argument index to bind to
+     * \return this Callable for operator chaining
+     */
+    Callable &bind(Object &&val, const size_t argNo);
+
+    /*!
+     * Remove a binding at the given argument index.
+     * The unbind call does not throw.
+     * \param argNo the argument index to clear
+     * \return this Callable for operator chaining
+     */
+    Callable &unbind(const size_t argNo);
+
+    /*!
+     * Get a string representation for this Callable.
+     * The string holds the return type, and argument types.
+     * \return the string with type names
+     */
+    std::string toString(void) const;
+
+    //! Create a Callable for a class method with variable args
+    template <typename ReturnType, typename ClassType, typename... ArgsType>
+    Callable(ReturnType(ClassType::*fcn)(ArgsType...));
+
+    //! Create a Callable for a const class method with variable args
+    template <typename ReturnType, typename ClassType, typename... ArgsType>
+    Callable(ReturnType(ClassType::*fcn)(ArgsType...) const);
+
+    //! Create a Callable for a function with variable args
+    template <typename ReturnType, typename... ArgsType>
+    Callable(ReturnType(*fcn)(ArgsType...));
+
+    //! Create a Callable for a std::function with variable args
+    template <typename ReturnType, typename... ArgsType>
+    Callable(const std::function<ReturnType(ArgsType...)> &fcn);
+
+    /*!
+     * Create a Callable for a class method with variable args.
+     * Use make to specify explicit template arguments
+     * to differentiate overloads with the same name.
+     * In this case, the entire pack must be specified.
+     */
+    template <typename ReturnType, typename ClassType, typename... ArgsType>
+    static Callable make(ReturnType(ClassType::*fcn)(ArgsType...));
+
+    /*!
+     * Create a Callable for a const class method with variable args.
+     * Use make to specify explicit template arguments
+     * to differentiate overloads with the same name.
+     * In this case, the entire pack must be specified.
+     */
+    template <typename ReturnType, typename ClassType, typename... ArgsType>
+    static Callable make(ReturnType(ClassType::*fcn)(ArgsType...) const);
+
+    /*!
+     * Create a Callable for a function with variable args.
+     * Use make to specify explicit template arguments
+     * to differentiate overloads with the same name.
+     * In this case, the entire pack must be specified.
+     */
+    template <typename ReturnType, typename... ArgsType>
+    static Callable make(ReturnType(*fcn)(ArgsType...));
+
+    /*!
+     * Create a Callable for a std::function with variable args
+     * Use make to specify explicit template arguments
+     * to differentiate overloads with the same name.
+     * In this case, the entire pack must be specified.
+     */
+    template <typename ReturnType, typename... ArgsType>
+    static Callable make(const std::function<ReturnType(ArgsType...)> &fcn);
+
+    /*!
+     * Create a Callable for a constructor with variable args.
+     * Template arguments must be explicitly specified.
+     */
+    template <typename ClassType, typename... ArgsType>
+    static Callable factory(void);
+
+    /*!
+     * Create a Callable for a constructor with variable args.
+     * The callable return type is a pointer to ClassType*.
+     * The user is responsible for managing the memory.
+     * Template arguments must be explicitly specified.
+     */
+    template <typename ClassType, typename... ArgsType>
+    static Callable factoryNew(void);
+
+    /*!
+     * Create a Callable for a constructor with variable args.
+     * The callable return type is a std::shared_ptr<ClassType>.
+     * Template arguments must be explicitly specified.
+     */
+    template <typename ClassType, typename... ArgsType>
+    static Callable factoryShared(void);
+
+private:
+    std::vector<Object> _boundArgs;
+    std::shared_ptr<Detail::CallableContainer> _impl;
+    Callable(Detail::CallableContainer *impl);
+    POTHOS_API friend bool operator==(const Callable &lhs, const Callable &rhs);
+    inline friend bool operator!=(const Callable &lhs, const Callable &rhs);
+};
+
+/*!
+ * The equals operators checks if two Callable represent the same internal data.
+ * The actual bound functions/methods cannot be checked for equality.
+ * Two callables are only equal if they originated from the same construction.
+ * \param lhs the left hand object of the comparison
+ * \param rhs the right hand object of the comparison
+ * \return true if the objects represent the same internal data
+ */
+POTHOS_API bool operator==(const Callable &lhs, const Callable &rhs);
+
+/*!
+ * The not-equals operators checks if two Callable do not represent the same
+ * internal data. The actual bound functions/methods cannot be checked for
+ * inequality. Two callables are only equal if they originated from the same
+ * construction.
+ * \param lhs the left hand object of the comparison
+ * \param rhs the right hand object of the comparison
+ * \return true if the objects represent different internal data
+ */
+inline bool operator!=(const Callable &lhs, const Callable &rhs)
+{
+    return !(lhs == rhs);
+}
+
+} //namespace Pothos

+ 232 - 0
include/Pothos/Callable/CallableImpl.hpp

@@ -0,0 +1,232 @@
+///
+/// \file Callable/CallableImpl.hpp
+///
+/// Template implementation details for Callable.
+///
+/// \copyright
+/// Copyright (c) 2013-2019 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Callable/Callable.hpp>
+#include <Pothos/Callable/CallInterfaceImpl.hpp>
+#include <Pothos/Object/ObjectImpl.hpp>
+#include <Pothos/Util/Templates.hpp> //integer_sequence
+#include <functional> //std::function
+#include <type_traits> //std::type_info, std::is_void
+#include <utility> //std::forward
+
+namespace Pothos {
+namespace Detail {
+
+struct POTHOS_API CallableContainer
+{
+    CallableContainer(void);
+    virtual ~CallableContainer(void);
+    virtual size_t getNumArgs(void) const = 0;
+    virtual const std::type_info &type(const int argNo) = 0;
+    virtual Object call(const Object *args) = 0;
+};
+
+} //namespace Detail
+
+template <typename ValueType>
+Callable &Callable::bind(ValueType &&val, const size_t argNo)
+{
+    return this->bind(Object(std::forward<ValueType>(val)), argNo);
+}
+
+namespace Detail {
+
+/***********************************************************************
+ * Function specialization for return type with variable args
+ **********************************************************************/
+template <typename ReturnType, typename FcnRType, typename... ArgsType>
+class CallableFunctionContainer : public Detail::CallableContainer
+{
+public:
+    template <typename FcnType>
+    CallableFunctionContainer(const FcnType &fcn):
+        _fcn(fcn)
+    {
+        return;
+    }
+
+    size_t getNumArgs(void) const
+    {
+        return sizeof...(ArgsType);
+    }
+
+    const std::type_info &type(const int argNo)
+    {
+        return typeR<ArgsType..., ReturnType>(argNo);
+    }
+
+    Object call(const Object *args)
+    {
+        return call(args, Pothos::Util::index_sequence_for<ArgsType...>{});
+    }
+
+private:
+
+    //! implement recursive type() tail-case
+    template <typename T>
+    const std::type_info &typeR(const int argNo)
+    {
+        if (argNo == 0) return typeid(T);
+        return typeid(ReturnType);
+    }
+
+    //! implement recursive type() for pack iteration
+    template <typename T0, typename T1, typename... Ts>
+    const std::type_info &typeR(const int argNo)
+    {
+        if (argNo == 0) return typeid(T0);
+        return typeR<T1, Ts...>(argNo-1);
+    }
+
+    //! implement call() using a generator sequence to handle array access
+    template<std::size_t ...S>
+    Object call(const Object *args, Pothos::Util::index_sequence<S...>)
+    {
+        checkArgs(args); //fixes warning for 0 args case
+        return CallHelper<
+            decltype(_fcn),
+            std::is_void<ReturnType>::value,
+            std::is_same<ReturnType, FcnRType>::value,
+            std::is_reference<ReturnType>::value and
+            not std::is_const<typename std::remove_reference<ReturnType>::type>::value
+        >::call(_fcn, args[S].extract<ArgsType>()...);
+    }
+
+    //! NOP call used to avoid warning above
+    void checkArgs(const Object *){}
+
+    //! templated call of function for optional return type
+    template <typename FcnType, bool isVoid, bool isSameR, bool isReference> struct CallHelper;
+    template <typename FcnType> struct CallHelper<FcnType, false, true, false>
+    {
+        static Object call(const FcnType &fcn, const ArgsType&... args)
+        {
+            return Object::make(fcn(args...));
+        }
+    };
+    template <typename FcnType> struct CallHelper<FcnType, false, false, false>
+    {
+        static Object call(const FcnType &fcn, const ArgsType&... args)
+        {
+            return fcn(args...);
+        }
+    };
+    template <typename FcnType> struct CallHelper<FcnType, false, true, true>
+    {
+        static Object call(const FcnType &fcn, const ArgsType&... args)
+        {
+            return Object::make(std::ref(fcn(args...)));
+        }
+    };
+    template <typename FcnType> struct CallHelper<FcnType, true, true, false>
+    {
+        static Object call(const FcnType &fcn, const ArgsType&... args)
+        {
+            fcn(args...); return Object();
+        }
+    };
+
+    std::function<FcnRType(ArgsType...)> _fcn;
+};
+
+template <typename ClassType, typename... ArgsType>
+Object CallableFactoryNewWrapper(ArgsType&&... args)
+{
+    return Object(new ClassType(std::forward<ArgsType>(args)...));
+}
+
+} //namespace Detail
+
+/***********************************************************************
+ * Templated factory/constructor calls with variable args
+ **********************************************************************/
+template <typename ReturnType, typename ClassType, typename... ArgsType>
+Callable::Callable(ReturnType(ClassType::*fcn)(ArgsType...)):
+    _impl(new Detail::CallableFunctionContainer<ReturnType, ReturnType, ClassType &, ArgsType...>(std::mem_fn(fcn)))
+{
+    return;
+}
+
+template <typename ReturnType, typename ClassType, typename... ArgsType>
+Callable::Callable(ReturnType(ClassType::*fcn)(ArgsType...) const):
+    _impl(new Detail::CallableFunctionContainer<ReturnType, ReturnType, const ClassType &, ArgsType...>(std::mem_fn(fcn)))
+{
+    return;
+}
+
+template <typename ReturnType, typename... ArgsType>
+Callable::Callable(ReturnType(*fcn)(ArgsType...)):
+    _impl(new Detail::CallableFunctionContainer<ReturnType, ReturnType, ArgsType...>(fcn))
+{
+    return;
+}
+
+template <typename ReturnType, typename... ArgsType>
+Callable::Callable(const std::function<ReturnType(ArgsType...)> &fcn):
+    _impl(new Detail::CallableFunctionContainer<ReturnType, ReturnType, ArgsType...>(fcn))
+{
+    return;
+}
+
+template <typename ReturnType, typename ClassType, typename... ArgsType>
+Callable Callable::make(ReturnType(ClassType::*fcn)(ArgsType...))
+{
+    return Callable(fcn);
+}
+
+template <typename ReturnType, typename ClassType, typename... ArgsType>
+Callable Callable::make(ReturnType(ClassType::*fcn)(ArgsType...) const)
+{
+    return Callable(fcn);
+}
+
+template <typename ReturnType, typename... ArgsType>
+Callable Callable::make(ReturnType(*fcn)(ArgsType...))
+{
+    return Callable(fcn);
+}
+
+template <typename ReturnType, typename... ArgsType>
+Callable Callable::make(const std::function<ReturnType(ArgsType...)> &fcn)
+{
+    return Callable(fcn);
+}
+
+template <typename ClassType, typename... ArgsType>
+Callable Callable::factory(void)
+{
+    return Callable(new Detail::CallableFunctionContainer<ClassType, Object, ArgsType...>(
+        &Object::emplace<ClassType, ArgsType...>));
+}
+
+template <typename ClassType, typename... ArgsType>
+Callable Callable::factoryNew(void)
+{
+    return Callable(new Detail::CallableFunctionContainer<ClassType *, Object, ArgsType...>(
+        &Detail::CallableFactoryNewWrapper<ClassType, ArgsType...>));
+}
+
+template <typename ClassType, typename... ArgsType>
+Callable Callable::factoryShared(void)
+{
+    using SharedType = std::shared_ptr<ClassType>;
+    return Callable(new Detail::CallableFunctionContainer<SharedType, SharedType, ArgsType...>(
+        &std::make_shared<ClassType, ArgsType...>));
+}
+
+inline Callable::Callable(Detail::CallableContainer *impl):
+    _impl(impl)
+{
+    return;
+}
+
+} //namespace Pothos

+ 32 - 0
include/Pothos/Callable/Exception.hpp

@@ -0,0 +1,32 @@
+///
+/// \file Callable/Exception.hpp
+///
+/// Exceptions thrown by the Callable methods.
+///
+/// \copyright
+/// Copyright (c) 2013-2014 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Exception.hpp>
+
+namespace Pothos {
+
+/*!
+ * A CallableArgumentError is thrown when invalid arguments are used.
+ */
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, CallableArgumentError, InvalidArgumentException)
+
+/*!
+ * A CallableReturnError is thrown when return can't be converted.
+ */
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, CallableReturnError, NotImplementedException)
+
+/*!
+ * A CallableNullError is thrown when a call is made on a null Callable.
+ */
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, CallableNullError, NullValueException)
+
+} //namespace Pothos

+ 101 - 0
include/Pothos/Config.hpp

@@ -0,0 +1,101 @@
+///
+/// \file Pothos/Config.hpp
+///
+/// Common macro definitions for library API export.
+///
+/// \copyright
+/// Copyright (c) 2013-2021 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+// http://gcc.gnu.org/wiki/Visibility
+// Generic helper definitions for shared library support
+#if defined _WIN32 || defined __CYGWIN__
+  #define POTHOS_HELPER_DLL_IMPORT __declspec(dllimport)
+  #define POTHOS_HELPER_DLL_EXPORT __declspec(dllexport)
+  #define POTHOS_HELPER_DLL_LOCAL
+#else
+  #if __GNUC__ >= 4
+    #define POTHOS_HELPER_DLL_IMPORT __attribute__ ((visibility ("default")))
+    #define POTHOS_HELPER_DLL_EXPORT __attribute__ ((visibility ("default")))
+    #define POTHOS_HELPER_DLL_LOCAL  __attribute__ ((visibility ("hidden")))
+  #else
+    #define POTHOS_HELPER_DLL_IMPORT
+    #define POTHOS_HELPER_DLL_EXPORT
+    #define POTHOS_HELPER_DLL_LOCAL
+  #endif
+#endif
+
+// Now we use the generic helper definitions above to define POTHOS_API and POTHOS_LOCAL.
+// POTHOS_API is used for the public API symbols. It either DLL imports or DLL exports (or does nothing for static build)
+// POTHOS_LOCAL is used for non-api symbols.
+
+#define POTHOS_DLL //always building a DLL
+
+#ifdef POTHOS_DLL // defined if POTHOS is compiled as a DLL
+  #ifdef POTHOS_DLL_EXPORTS // defined if we are building the POTHOS DLL (instead of using it)
+    #define POTHOS_API POTHOS_HELPER_DLL_EXPORT
+    #define POTHOS_EXTERN
+  #else
+    #define POTHOS_API POTHOS_HELPER_DLL_IMPORT
+    #define POTHOS_EXTERN extern
+  #endif // POTHOS_DLL_EXPORTS
+  #define POTHOS_LOCAL POTHOS_HELPER_DLL_LOCAL
+#else // POTHOS_DLL is not defined: this means POTHOS is a static lib.
+  #define POTHOS_API
+  #define POTHOS_LOCAL
+  #define POTHOS_EXTERN
+#endif // POTHOS_DLL
+
+// Explicit template specialization can be exported on gnu platforms
+// Required on apple clang for consistent type ids in archive system
+#if defined _WIN32 || defined __CYGWIN__
+  #define POTHOS_TEMPLATE_API
+#elif __GNUC__ >= 4
+  #define POTHOS_TEMPLATE_API POTHOS_API
+#else
+  #define POTHOS_TEMPLATE_API
+#endif
+
+#ifdef _MSC_VER
+  #ifndef _USE_MATH_DEFINES
+    #define _USE_MATH_DEFINES //math.h M_* constants
+  #endif //_USE_MATH_DEFINES
+#endif //_MSC_VER
+
+//deprecated macro for causing warnings on old calls
+#ifdef __has_cpp_attribute
+#  if __has_cpp_attribute(deprecated)
+#    define POTHOS_DEPRECATED(msg) [[deprecated(msg)]]
+#  endif
+#endif
+
+//fall-back compiler specific support for deprecated
+#ifndef POTHOS_DEPRECATED
+#  if defined(__GNUC__)
+#    define POTHOS_DEPRECATED(msg) __attribute__((deprecated(msg)))
+#  elif defined(_MSC_VER)
+#    define POTHOS_DEPRECATED(msg) __declspec(deprecated(msg))
+#  else
+#   pragma message("WARNING: You need to implement DEPRECATED for this compiler")
+#   define POTHOS_DEPRECATED(msg)
+#  endif
+#endif
+
+/*!
+ * The function tuple emits a string name + function pointer tuple.
+ * This macro simplifies specifying a function name more than once
+ * for API calls that take a string name and function pointer.
+ *
+ * Example:
+ * To simplify this->register("foo", &MyNamespace::MyClass::foo),
+ * this->register(POTHOS_FCN_TUPLE(MyNamespace::MyClass, foo));
+ *
+ * \param classPath the colon separated namespace and class name
+ * \param functionName the name of a function within the specified classPath
+ */
+#define POTHOS_FCN_TUPLE(classPath, functionName) \
+    #functionName, &classPath::functionName
+
+#include <ciso646>

+ 294 - 0
include/Pothos/Exception.hpp

@@ -0,0 +1,294 @@
+///
+/// \file Pothos/Exception.hpp
+///
+/// Definition of various Pothos exception classes.
+///
+/// \copyright
+/// Copyright (c) 2013-2020 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+/// \copyright
+/// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
+/// and Contributors.
+///
+/// Permission is hereby granted, free of charge, to any person or organization
+/// obtaining a copy of the software and accompanying documentation covered by
+/// this license (the "Software") to use, reproduce, display, distribute,
+/// execute, and transmit the Software, and to prepare derivative works of the
+/// Software, and to permit third-parties to whom the Software is furnished to
+/// do so, all subject to the following:
+///
+/// The copyright notices in the Software and this entire statement, including
+/// the above license grant, this restriction and the following disclaimer,
+/// must be included in all copies of the Software, in whole or in part, and
+/// all derivative works of the Software, unless such copies or derivative
+/// works are solely in the form of machine-executable object code generated by
+/// a source language processor.
+///
+/// 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+/// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+/// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN 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 <Pothos/Config.hpp>
+#include <Pothos/Util/TypeInfo.hpp>
+#include <stdexcept>
+#include <string>
+
+/*!
+ * The try block for a super catch-all exception.
+ * Use the standard try/catch syntax and bracketing,
+ * and always use this macro with POTHOS_EXCEPTION_CATCH.
+ */
+#define POTHOS_EXCEPTION_TRY try{try
+
+/*!
+ * The catch block for a super catch-all exception.
+ * Catch exceptions from all known exception types
+ * and rethrow any exception as a Pothos::Exception.
+ * \param catchExpr the contents of the catch() keyword
+ */
+#define POTHOS_EXCEPTION_CATCH(catchExpr) \
+	catch(const Pothos::Exception &){throw;}\
+	catch(const Poco::Exception &ex){throw Pothos::Exception(ex.displayText());}\
+	catch(const std::exception &ex){throw Pothos::Exception(ex.what());}\
+	catch(...){throw Pothos::Exception("unknown exception");}\
+	}catch(catchExpr)
+
+namespace Pothos {
+
+
+class POTHOS_API Exception: public std::exception
+	/// This is the base class for all exceptions defined
+	/// in the Pothos class library.
+{
+public:
+	Exception(const std::string& msg, int code = 0);
+		/// Creates an exception.
+
+	Exception(const std::string& msg, const std::string& arg, int code = 0);
+		/// Creates an exception.
+
+	Exception(const std::string& msg, const Exception& nested, int code = 0);
+		/// Creates an exception and stores a clone
+		/// of the nested exception.
+
+	Exception(const Exception& exc);
+		/// Copy constructor.
+		
+	~Exception() throw();
+		/// Destroys the exception and deletes the nested exception.
+
+	Exception& operator = (const Exception& exc);
+		/// Assignment operator.
+
+	virtual const char* name() const throw();
+		/// Returns a static string describing the exception.
+		
+	virtual const char* className() const throw();
+		/// Returns the name of the exception class.
+		
+	virtual const char* what() const throw();
+		/// Returns a static string describing the exception.
+		///
+		/// Same as name(), but for compatibility with std::exception.
+		
+	const Exception* nested() const;
+		/// Returns a pointer to the nested exception, or
+		/// null if no nested exception exists.
+			
+	const std::string& message() const;
+		/// Returns the message text.
+			
+	int code() const;
+		/// Returns the exception code if defined.
+		
+	std::string displayText() const;
+		/// Returns a string consisting of the
+		/// message name and the message text.
+
+	virtual Exception* clone() const;
+		/// Creates an exact copy of the exception.
+		///
+		/// The copy can later be thrown again by
+		/// invoking rethrow() on it.
+		
+	virtual void rethrow() const;
+		/// (Re)Throws the exception.
+		///
+		/// This is useful for temporarily storing a
+		/// copy of an exception (see clone()), then
+		/// throwing it again.
+
+protected:
+	Exception(int code = 0);
+		/// Standard constructor.
+
+	void message(const std::string& msg);
+		/// Sets the message for the exception.
+
+	void extendedMessage(const std::string& arg);
+		/// Sets the extended message for the exception.
+		
+private:
+	std::string _msg;
+	Exception*  _pNested;
+	int			_code;
+};
+
+
+//
+// inlines
+//
+inline const Exception* Exception::nested() const
+{
+	return _pNested;
+}
+
+
+inline const std::string& Exception::message() const
+{
+	return _msg;
+}
+
+
+inline void Exception::message(const std::string& msg)
+{
+	_msg = msg;
+}
+
+
+inline int Exception::code() const
+{
+	return _code;
+}
+
+
+//
+// Macros for quickly declaring and implementing exception classes.
+// Unfortunately, we cannot use a template here because character
+// pointers (which we need for specifying the exception name)
+// are not allowed as template arguments.
+//
+#define POTHOS_DECLARE_EXCEPTION_CODE(API, CLS, BASE, CODE) \
+	class API CLS: public BASE														\
+	{																				\
+	public:																			\
+		CLS(int code = CODE);														\
+		CLS(const std::string& msg, int code = CODE);								\
+		CLS(const std::string& msg, const std::string& arg, int code = CODE);		\
+		CLS(const std::string& msg, const Pothos::Exception& exc, int code = CODE);	\
+		CLS(const CLS& exc);														\
+		~CLS() throw();																\
+		CLS& operator = (const CLS& exc);											\
+		const char* name() const throw();											\
+		const char* className() const throw();										\
+		Pothos::Exception* clone() const;												\
+		void rethrow() const;														\
+	};
+
+#define POTHOS_DECLARE_EXCEPTION(API, CLS, BASE) \
+	POTHOS_DECLARE_EXCEPTION_CODE(API, CLS, BASE, 0)
+
+#define POTHOS_IMPLEMENT_EXCEPTION(CLS, BASE, NAME)													\
+	CLS::CLS(int code): BASE(code)																	\
+	{																								\
+	}																								\
+	CLS::CLS(const std::string& msg, int code): BASE(msg, code)										\
+	{																								\
+	}																								\
+	CLS::CLS(const std::string& msg, const std::string& arg, int code): BASE(msg, arg, code)		\
+	{																								\
+	}																								\
+	CLS::CLS(const std::string& msg, const Pothos::Exception& exc, int code): BASE(msg, exc, code)	\
+	{																								\
+	}																								\
+	CLS::CLS(const CLS& exc): BASE(exc)																\
+	{																								\
+	}																								\
+	CLS::~CLS() throw()																				\
+	{																								\
+	}																								\
+	CLS& CLS::operator = (const CLS& exc)															\
+	{																								\
+		BASE::operator = (exc);																		\
+		return *this;																				\
+	}																								\
+	const char* CLS::name() const throw()															\
+	{																								\
+		return NAME;																				\
+	}																								\
+	const char* CLS::className() const throw()														\
+	{																								\
+		const static auto name = Pothos::Util::typeInfoToString(typeid(*this));						\
+		return name.c_str();																		\
+	}																								\
+	Pothos::Exception* CLS::clone() const																\
+	{																								\
+		return new CLS(*this);																		\
+	}																								\
+	void CLS::rethrow() const																		\
+	{																								\
+		throw *this;																				\
+	}
+
+
+//
+// Standard exception classes
+//
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, LogicException, Exception)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, AssertionViolationException, LogicException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, NullPointerException, LogicException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, NullValueException, LogicException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, BugcheckException, LogicException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, InvalidArgumentException, LogicException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, NotImplementedException, LogicException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, RangeException, LogicException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, IllegalStateException, LogicException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, InvalidAccessException, LogicException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, SignalException, LogicException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, UnhandledException, LogicException)
+
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, RuntimeException, Exception)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, NotFoundException, RuntimeException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, ExistsException, RuntimeException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, TimeoutException, RuntimeException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, SystemException, RuntimeException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, RegularExpressionException, RuntimeException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, LibraryLoadException, RuntimeException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, LibraryAlreadyLoadedException, RuntimeException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, NoThreadAvailableException, RuntimeException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, PropertyNotSupportedException, RuntimeException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, PoolOverflowException, RuntimeException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, NoPermissionException, RuntimeException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, OutOfMemoryException, RuntimeException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, DataException, RuntimeException)
+
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, DataFormatException, DataException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, SyntaxException, DataException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, CircularReferenceException, DataException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, PathSyntaxException, SyntaxException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, IOException, RuntimeException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, ProtocolException, IOException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, FileException, IOException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, FileExistsException, FileException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, FileNotFoundException, FileException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, PathNotFoundException, FileException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, FileReadOnlyException, FileException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, FileAccessDeniedException, FileException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, CreateFileException, FileException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, OpenFileException, FileException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, WriteFileException, FileException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, ReadFileException, FileException)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, UnknownURISchemeException, RuntimeException)
+
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, ApplicationException, Exception)
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, BadCastException, RuntimeException)
+
+
+} // namespace Pothos

+ 36 - 0
include/Pothos/Framework.hpp

@@ -0,0 +1,36 @@
+///
+/// \file Pothos/Framework.hpp
+///
+/// Top level include wrapper for Framework classes.
+///
+/// \copyright
+/// Copyright (c) 2014-2016 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Framework/Packet.hpp>
+#include <Pothos/Framework/WorkInfo.hpp>
+#include <Pothos/Framework/DType.hpp>
+#include <Pothos/Framework/Label.hpp>
+#include <Pothos/Framework/InputPort.hpp>
+#include <Pothos/Framework/InputPortImpl.hpp>
+#include <Pothos/Framework/OutputPort.hpp>
+#include <Pothos/Framework/OutputPortImpl.hpp>
+#include <Pothos/Framework/Connectable.hpp>
+#include <Pothos/Framework/ConnectableImpl.hpp>
+#include <Pothos/Framework/ThreadPool.hpp>
+#include <Pothos/Framework/Block.hpp>
+#include <Pothos/Framework/BlockImpl.hpp>
+#include <Pothos/Framework/Topology.hpp>
+#include <Pothos/Framework/TopologyImpl.hpp>
+#include <Pothos/Framework/BlockRegistry.hpp>
+#include <Pothos/Framework/BlockRegistryImpl.hpp>
+#include <Pothos/Framework/BufferManager.hpp>
+#include <Pothos/Framework/BufferAccumulator.hpp>
+#include <Pothos/Framework/BufferPool.hpp>
+#include <Pothos/Framework/BufferChunk.hpp>
+#include <Pothos/Framework/SharedBuffer.hpp>
+#include <Pothos/Framework/ManagedBuffer.hpp>
+#include <Pothos/Framework/Exception.hpp>

+ 384 - 0
include/Pothos/Framework/Block.hpp

@@ -0,0 +1,384 @@
+///
+/// \file Framework/Block.hpp
+///
+/// This file contains the interface for creating custom Blocks.
+///
+/// \copyright
+/// Copyright (c) 2014-2019 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Framework/Connectable.hpp>
+#include <Pothos/Framework/WorkInfo.hpp>
+#include <Pothos/Framework/InputPort.hpp>
+#include <Pothos/Framework/OutputPort.hpp>
+#include <Pothos/Framework/ThreadPool.hpp>
+#include <memory>
+#include <string>
+#include <vector>
+#include <map>
+
+namespace Pothos {
+
+    class BufferManager;
+
+/*!
+ * Block is an interface for creating custom computational processing.
+ * Users should subclass Block, setup the input and output ports,
+ * and overload the work() method for a custom computational task.
+ *
+ * The outputs of a Block can be connected to the inputs of another.
+ * Any resources produced at the Block's output ports will be
+ * make available to the other Block's connected input ports.
+ */
+class POTHOS_API Block : public Connectable
+{
+public:
+
+    //! Default constructor
+    Block(void);
+
+    //! Virtual destructor
+    virtual ~Block(void);
+
+    //! Set the thread pool used by this block.
+    void setThreadPool(const ThreadPool &threadPool);
+
+    //! Get the thread pool used by this block
+    const ThreadPool &getThreadPool(void) const;
+
+protected:
+    /*!
+     * The prepare() method allows the block to say whether it will be able to
+     * do any work, regardless of whether input or output is available. For
+     * example, resources unknown to the framework may be unavailable. This call
+     * happens before the framework determines whether it thinks there is work
+     * for the block.
+     *
+     * The block should not access framework-managed (e.g., ports, messages,
+     * signals/slots) in this call, though it is free to do other things.
+     *
+     * Returns true if the framework should proceed normally and determine
+     * whether work is available, false if the block would be unable to run and
+     * should be passed over.
+     */
+    virtual bool prepare(void);
+
+    /*!
+     * The work() method, called when resources are available.
+     * Subclasses must override this call when creating a worker.
+     *
+     * When work() is invoked, the user's code can access the port,
+     * consume input resources, and produce output resources.
+     *
+     * Only the work() thread is allowed to call this method,
+     * therefore users should never directly invoke this method.
+     */
+    virtual void work(void);
+
+    /*!
+     * The activate() method, called when the topology execution begins.
+     * Override this call to implement a custom topology activation hook.
+     */
+    virtual void activate(void);
+
+    /*!
+     * The deactivate() method, called when the topology execution ends.
+     * Override this call to implement a custom topology deactivation hook.
+     */
+    virtual void deactivate(void);
+
+    /*!
+     * The work() thread calls the propagateLabels() method after work()
+     * when labels are available to propagate to downstream consumers.
+     *
+     * Default behavior: All labels with an index less than the number
+     * of consumed elements will be propagated to all output ports.
+     * Subclasses may override this call to customize its behavior.
+     *
+     * Only the work() thread is allowed to call this method,
+     * therefore users should never directly invoke this method.
+     *
+     * Access the labels iterator with the call to input->labels().
+     * This iterator will contain only labels from the consumed elements.
+     * Forward labels to the output ports using postLabel() on an output port object.
+     *
+     * \param input a pointer to the input port with labels
+     */
+    virtual void propagateLabels(const InputPort *input);
+
+    /*!
+     * The opaque call handler handles dispatching calls to registered methods.
+     * The user may overload this call to install their own custom handler.
+     * \throws BlockCallNotFound when no call registered for the provided name
+     * \throws Exception when the registered call itself throws an exception
+     * \param name the name of a call registered to this Block with registerCall()
+     * \param inputArgs an array of input arguments wrapped in type Object
+     * \param numArgs the number of arguments in the array inputArgs
+     * \return the result of making the registered call, wrapped in type Object
+     */
+    virtual Object opaqueCallHandler(const std::string &name, const Object *inputArgs, const size_t numArgs);
+
+    /*!
+     * Get a buffer manager for this input port.
+     * The user may overload this call to install a custom buffer manager.
+     *
+     * The domain parameter describes the memory used by the upstream blocks.
+     * Knowing the domain allows the implementer of getInputBufferManager to
+     *   - abdicate to the upstream's buffer managers (null return)
+     *   - provide a replacement upstream buffer manager (return manager)
+     *   - protest the ability to interact with the domain (throw exception)
+     *
+     * \throws PortDomainError when the domain is incompatible
+     * \param name the name of an input port on this block
+     * \param domain the domain of the upstream blocks
+     * \return a new buffer manager for this port or null sptr
+     */
+    virtual std::shared_ptr<BufferManager> getInputBufferManager(const std::string &name, const std::string &domain);
+
+    /*!
+     * Get a buffer manager for this output port.
+     * The user may overload this call to install a custom buffer manager.
+     *
+     * The domain parameter describes the memory used by the downstream blocks.
+     * Knowing the domain allows the implementer of getOutputBufferManager to
+     *   - abdicate to the downstream's buffer managers (null return)
+     *   - provide a replacement downstream buffer manager (return manager)
+     *   - protest the ability to interact with the domain (throw exception)
+     *
+     * \throws PortDomainError when the domain is incompatible
+     * \param name the name of an output port on this block
+     * \param domain the domain of the downstream blocks
+     * \return a new buffer manager for this port or null sptr
+     */
+    virtual std::shared_ptr<BufferManager> getOutputBufferManager(const std::string &name, const std::string &domain);
+
+public:
+
+    /*!
+     * Set the displayable alias for the specified input port.
+     */
+    void setInputAlias(const std::string &portName, const std::string &alias);
+
+    /*!
+     * Set the displayable alias for the specified output port.
+     */
+    void setOutputAlias(const std::string &portName, const std::string &alias);
+
+    /*!
+     * Get a vector of info about all of the input ports available.
+     */
+    std::vector<PortInfo> inputPortInfo(void);
+
+    /*!
+     * Get a vector of info about all of the output ports available.
+     */
+    std::vector<PortInfo> outputPortInfo(void);
+
+    /*!
+     * Get the input port at the specified port name.
+     */
+    InputPort *input(const std::string &name) const;
+
+    /*!
+     * Get the input port at the specified port index.
+     */
+    InputPort *input(const size_t index) const;
+
+    /*!
+     * Get the output port at the specified port name.
+     */
+    OutputPort *output(const std::string &name) const;
+
+    /*!
+     * Get the output port at the specified port index.
+     */
+    OutputPort *output(const size_t index) const;
+
+    /*!
+     * Get the indexable input ports.
+     * These ports have a port name which is an integer.
+     * Indexable ports can be accessed with O(1) access time.
+     * \return a vector of pointers to input port objects
+     */
+    const std::vector<InputPort*> &inputs(void) const;
+
+    /*!
+     * Get the indexable output ports.
+     * These ports have a port name which is an integer.
+     * Indexable ports can be accessed with O(1) access time.
+     * \return a vector of pointers to output port objects
+     */
+    const std::vector<OutputPort*> &outputs(void) const;
+
+    /*!
+     * Get all input ports.
+     * These ports can be accessed with the port name string.
+     * \return a map of pointers to input port objects
+     */
+    const std::map<std::string, InputPort*> &allInputs(void) const;
+
+    /*!
+     * Get all output ports.
+     * These ports can be accessed with the port name string.
+     * \return a map of pointers to output port objects
+     */
+    const std::map<std::string, OutputPort*> &allOutputs(void) const;
+
+    /*!
+     * Get information about a work session that is not port-specific.
+     * The info is valid during calls to work() and propagateLabels().
+     */
+    const WorkInfo &workInfo(void) const;
+
+    /*!
+     * Is the block in an active state?
+     * This is a thread-safe way for a block's methods
+     * to determine if the processing is currently active.
+     * \return true when the topology is executing
+     */
+    bool isActive(void) const;
+
+    /*!
+     * Configure an input port with the given data type.
+     * The data type parameter specifies the size in bytes per input element.
+     * The data type is only relevant when the port is used for streaming data.
+     * The domain parameter is used to specify the type of memory consumed.
+     * The domain will be passed into another block's getOutputBufferManager() call.
+     * \param name the name of this input port
+     * \param dtype the data type for elements
+     * \param domain the expected memory domain
+     * \return a pointer to the new input port
+     */
+    InputPort *setupInput(const std::string &name, const DType &dtype = "", const std::string &domain = "");
+
+    /*!
+     * Configure an input port with the given data type.
+     * This call is equivalent to setupInput(std::to_string(index), ...);
+     * \param index the index number of this input port
+     * \param dtype the data type for elements
+     * \param domain the expected memory domain
+     * \return a pointer to the new input port
+     */
+    InputPort *setupInput(const size_t index, const DType &dtype = "", const std::string &domain = "");
+
+    /*!
+     * Configure an output port with the given data type.
+     * The data type parameter specifies the size in bytes per output element.
+     * The data type is only relevant when the port is used for streaming data.
+     * The domain parameter is used to specify the type of memory produced.
+     * The domain will be passed into another block's getInputBufferManager() call.
+     * \param name the name of this output port
+     * \param dtype the data type for elements
+     * \param domain the expected memory domain
+     * \return a pointer to the new output port
+     */
+    OutputPort *setupOutput(const std::string &name, const DType &dtype = "", const std::string &domain = "");
+
+    /*!
+     * Configure an output port with the given data type.
+     * This call is equivalent to setupOutput(std::to_string(index), ...);
+     * \param index the index number of this output port
+     * \param dtype the data type for elements
+     * \param domain the expected memory domain
+     * \return a pointer to the new output port
+     */
+    OutputPort *setupOutput(const size_t index, const DType &dtype = "", const std::string &domain = "");
+
+    /*!
+     * Export a function call on this block to set/get parameters.
+     * This call will automatically register a slot of the same name
+     * when the call has a void return type and the name does not
+     * start with an underscore in which case its considered private.
+     * \param name the name of the callable
+     * \param call the bound callable method
+     */
+    void registerCallable(const std::string &name, const Callable &call);
+
+    /*!
+     * Register that this block has a signal of the given name.
+     * A signal is capable of emitting messages to a slot.
+     * The name should not overlap with the name of an output port.
+     * \param name the name of the signal
+     * \return a pointer to the new output port
+     */
+    void registerSignal(const std::string &name);
+
+    /*!
+     * Register that this block has a slot of the given name.
+     * A slot is capable of accepting messages from a signal.
+     * The name should not overlap with the name of an input port.
+     * Note: do not call the registerSlot function in C++,
+     * as registerCallable() automatically registers a slot.
+     * \param name the name of the slot
+     */
+    void registerSlot(const std::string &name);
+
+    /*!
+     * Register a probe given the name of a registered call.
+     * A probe creates a special slot that will probe the registered call,
+     * and creates a triggered signal that will emit the return value of that call.
+     *
+     *  - Arguments passed into the probe slot will be forwarded into the registered call.
+     *  - The return value of the registered call will be passed into the first argument of the triggered signal.
+     *  - If the return value of the registered call is void, then the triggered signal will have no arguments.
+     *  - When not specified, the slot's name will be probe[Name], and the signal's name will be [name]Triggered.
+     *
+     * \param name the name of a registered call
+     * \param signalName the name of the triggered signal or empty for automatic
+     * \param slotName the name of the probe slot or empty for automatic
+     */
+    void registerProbe(
+        const std::string &name,
+        const std::string &signalName="",
+        const std::string &slotName="");
+
+    /*!
+     * Notify the scheduler that the work() method will yield the thread context.
+     * Call this method when the work() function will not produce or consume,
+     * so that the scheduler will call work() again without an external stimulus.
+     * Only call this method from within a call to the work() function.
+     * A typical use case for calling yield are blocks that must wait on a resource.
+     * Such blocks cannot hold the thread context for more than the allowed time,
+     * and must therefore return from the work() call without producing output.
+     */
+    void yield(void);
+
+    /*!
+     * Emit a signal to all subscribed slots.
+     * \param name the name of a registered signal
+     * \param args a variable number of arguments
+     */
+    template <typename... ArgsType>
+    void emitSignal(const std::string &name, ArgsType&&... args);
+
+    /*!
+     * Call a method on a derived instance with opaque input and return types.
+     * \param name the name of the method as a string
+     * \param inputArgs an array of input arguments
+     * \param numArgs the size of the input array
+     * \return the return value as type Object
+     */
+    Object opaqueCallMethod(const std::string &name, const Object *inputArgs, const size_t numArgs) const;
+
+private:
+    WorkInfo _workInfo;
+    std::vector<std::string> _inputPortNames;
+    std::vector<std::string> _outputPortNames;
+    std::vector<InputPort*> _indexedInputs;
+    std::vector<OutputPort*> _indexedOutputs;
+    std::map<std::string, InputPort*> _namedInputs;
+    std::map<std::string, OutputPort*> _namedOutputs;
+    std::multimap<std::string, Callable> _calls;
+    std::map<std::string, std::pair<std::string, std::string>> _probes;
+    ThreadPool _threadPool;
+    Block(const Block &) = delete; // non construction-copyable
+    Block &operator=(const Block &) = delete; // non copyable
+public:
+    std::shared_ptr<WorkerActor> _actor;
+    friend class WorkerActor;
+};
+
+} //namespace Pothos

+ 82 - 0
include/Pothos/Framework/BlockImpl.hpp

@@ -0,0 +1,82 @@
+///
+/// \file Framework/BlockImpl.hpp
+///
+/// This file contains inline definitions for Block members.
+///
+/// \copyright
+/// Copyright (c) 2014-2016 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Framework/Block.hpp>
+#include <Pothos/Framework/ConnectableImpl.hpp>
+#include <Pothos/Framework/Exception.hpp>
+#include <Pothos/Object/Containers.hpp>
+#include <utility> //std::forward
+
+inline const Pothos::WorkInfo &Pothos::Block::workInfo(void) const
+{
+    return _workInfo;
+}
+
+inline Pothos::InputPort *Pothos::Block::input(const std::string &name) const
+{
+    auto it = _namedInputs.find(name);
+    if (it == _namedInputs.end()) throw PortAccessError(
+        "Pothos::Block::input("+name+")", "input port name does not exist");
+    return it->second;
+}
+
+inline Pothos::InputPort *Pothos::Block::input(const size_t index) const
+{
+    if (index >= _indexedInputs.size()) throw PortAccessError(
+        "Pothos::Block::input("+std::to_string(index)+")", "input port index does not exist");
+    return _indexedInputs[index];
+}
+
+inline Pothos::OutputPort *Pothos::Block::output(const std::string &name) const
+{
+    auto it = _namedOutputs.find(name);
+    if (it == _namedOutputs.end()) throw PortAccessError(
+        "Pothos::Block::output("+name+")", "output port name does not exist");
+    return it->second;
+}
+
+inline Pothos::OutputPort *Pothos::Block::output(const size_t index) const
+{
+    if (index >= _indexedOutputs.size()) throw PortAccessError(
+        "Pothos::Block::output("+std::to_string(index)+")", "output port index does not exist");
+    return _indexedOutputs[index];
+}
+
+inline const std::vector<Pothos::InputPort*> &Pothos::Block::inputs(void) const
+{
+    return _indexedInputs;
+}
+
+inline const std::vector<Pothos::OutputPort*> &Pothos::Block::outputs(void) const
+{
+    return _indexedOutputs;
+}
+
+inline const std::map<std::string, Pothos::InputPort*> &Pothos::Block::allInputs(void) const
+{
+    return _namedInputs;
+}
+
+inline const std::map<std::string, Pothos::OutputPort*> &Pothos::Block::allOutputs(void) const
+{
+    return _namedOutputs;
+}
+
+template <typename... ArgsType>
+void Pothos::Block::emitSignal(const std::string &name, ArgsType&&... args)
+{
+    const auto it = _namedOutputs.find(name);
+    if (it == _namedOutputs.end() or not it->second->isSignal()) throw PortAccessError(
+        "Pothos::Block::emitSignal("+name+")", "signal port does not exist");
+
+    const ObjectVector objArgs{{Object(std::forward<ArgsType>(args))...}};
+    it->second->postMessage(std::move(objArgs));
+}

+ 65 - 0
include/Pothos/Framework/BlockRegistry.hpp

@@ -0,0 +1,65 @@
+///
+/// \file Framework/BlockRegistry.hpp
+///
+/// A BlockRegistry registers a block's factory function.
+///
+/// \copyright
+/// Copyright (c) 2014-2016 Josh Blum
+///                    2021 Nicholas Corgan
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Callable/Callable.hpp>
+#include <Pothos/Proxy/Proxy.hpp>
+#include <string>
+
+namespace Pothos {
+
+/*!
+ * The BlockRegistry class registers factories for topological elements.
+ * These elements include Blocks and sub-Topologies (hierarchies of elements).
+ * A BlockRegistry can be created at static initialization time
+ * so that modules providing blocks will automatically register.
+ * Usage example (put this at the bottom of your c++ source file)
+ * static Pothos::BlockRegistry registerMyBlock("/my/factory/path", &MyBlock::make);
+ */
+class POTHOS_API BlockRegistry
+{
+public:
+
+    /*!
+     * Register a factory function into the plugin registry.
+     * The resulting factory path will be /blocks/path.
+     * Example: a path of /foo/bar will register to /blocks/foo/bar.
+     *
+     * Because this call is used at static initialization time,
+     * it does not throw. However, registration errors are logged,
+     * and the block will not be available at runtime.
+     *
+     * The return type of the call must be Block* or Topology*.
+     *
+     * \param path the factory path beginning with a slash ("/")
+     * \param factory the Callable factory function
+     */
+    BlockRegistry(const std::string &path, const Callable &factory);
+
+    /*!
+     * Instantiate a block given the factory path and arguments.
+     * \param path the factory path beginning with a slash ("/")
+     * \param args a variable number of factory arguments
+     * \return the newly created block instance as a Proxy
+     */
+    template <typename... ArgsType>
+    static Proxy make(const std::string &path, ArgsType&&... args);
+
+    /*!
+     * Checks if block is registered at a given path.
+     * \param path the factory path beginning with a slash ("/")
+     * \return whether a block is registered at the given path
+     */
+    static bool doesBlockExist(const std::string &path);
+};
+
+} //namespace Pothos

+ 22 - 0
include/Pothos/Framework/BlockRegistryImpl.hpp

@@ -0,0 +1,22 @@
+///
+/// \file Framework/BlockRegistryImpl.hpp
+///
+/// Inline member implementation for BlockRegistry class.
+///
+/// \copyright
+/// Copyright (c) 2016-2017 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Framework/BlockRegistry.hpp>
+#include <Pothos/Proxy.hpp>
+#include <utility> //std::forward
+
+template <typename... ArgsType>
+Pothos::Proxy Pothos::BlockRegistry::make(const std::string &path, ArgsType&&... args)
+{
+    auto env = Pothos::ProxyEnvironment::make("managed");
+    auto registry = env->findProxy("Pothos/BlockRegistry");
+    return registry.call(path, std::forward<ArgsType>(args)...);
+}

+ 109 - 0
include/Pothos/Framework/BufferAccumulator.hpp

@@ -0,0 +1,109 @@
+///
+/// \file Framework/BufferAccumulator.hpp
+///
+/// BufferAccumulator provides an input pool of buffers.
+///
+/// \copyright
+/// Copyright (c) 2013-2017 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Framework/BufferPool.hpp>
+#include <Pothos/Framework/BufferChunk.hpp>
+#include <Pothos/Util/RingDeque.hpp>
+#include <cassert>
+
+namespace Pothos {
+
+/*!
+ * The BufferAccumulator is a queue like interface
+ * for holding and interacting with buffer chunks.
+ *
+ * A BufferAccumulator enqueus input buffers and presents
+ * contiguous buffer chunks to the caller when applicable.
+ * The BufferAccumulator may do several things:
+ *  - Forward the same input buffers to the caller.
+ *  - Amalgamate contiguous buffers into one.
+ *  - Memcpy when the caller requires contiguity.
+ */
+class POTHOS_API BufferAccumulator
+{
+public:
+
+    //! Create a new buffer accumulator
+    BufferAccumulator(void);
+
+    //! Clear the contents of this buffer accumulator
+    void clear(void);
+
+    /*!
+     * Is the accumulator empty?
+     * \return true when zero bytes available
+     */
+    bool empty(void) const;
+
+    /*!
+     * Push a buffer chunk into the accumulator.
+     * \param buffer a buffer chunk
+     */
+    void push(BufferChunk &&buffer);
+
+    /*!
+     * Get the front buffer.
+     * This reference is invalidated after mutator calls.
+     * When empty, front returns an empty buffer.
+     * \return a const reference to the front buffer
+     */
+    const BufferChunk &front(void) const;
+
+    /*!
+     * Pop numBytes from the front of this accumulator.
+     * \param numBytes the number of bytes to remove
+     */
+    void pop(const size_t numBytes);
+
+    //! Get the total number of bytes held in this accumulator
+    size_t getTotalBytesAvailable(void) const;
+
+    /*!
+     * Enforce a requirement on the front buffer size.
+     * If the front buffer is less than numBytes,
+     * several buffers will be copied together
+     * into a larger buffer with at least numBytes.
+     * The effect of this call is over after pop().
+     * \param numBytes the number of bytes needed
+     */
+    void require(const size_t numBytes);
+
+    /*!
+     * How many unique managed buffers are enqueued in this accumulator?
+     * \warning expensive: this method is for debug/stats purposes.
+     */
+    size_t getUniqueManagedBufferCount(void) const;
+
+private:
+    Util::RingDeque<BufferChunk> _queue;
+    size_t _bytesAvailable;
+    bool _inPoolBuffer;
+    BufferPool _pool;
+};
+
+} //namespace Pothos
+
+inline bool Pothos::BufferAccumulator::empty(void) const
+{
+    return _bytesAvailable == 0;
+}
+
+inline const Pothos::BufferChunk &Pothos::BufferAccumulator::front(void) const
+{
+    assert(not _queue.empty());
+    return _queue.front();
+}
+
+inline size_t Pothos::BufferAccumulator::getTotalBytesAvailable(void) const
+{
+    return _bytesAvailable;
+}

+ 444 - 0
include/Pothos/Framework/BufferChunk.hpp

@@ -0,0 +1,444 @@
+///
+/// \file Framework/BufferChunk.hpp
+///
+/// A buffer chunk is a convenient interface to deal with
+/// a managed or shared buffer and address/length offsets.
+///
+/// \copyright
+/// Copyright (c) 2013-2017 Josh Blum
+///               2019-2021 Nicholas Corgan
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Framework/DType.hpp>
+#include <Pothos/Framework/SharedBuffer.hpp>
+#include <Pothos/Framework/ManagedBuffer.hpp>
+#include <utility> //move
+
+namespace Pothos {
+
+//! Forward declares
+class BufferAccumulator;
+
+/*!
+ * A BufferChunk holds a managed buffer, address, and length.
+ * BufferChunk makes it easy to manipulate pieces of a managed buffer.
+ * The caller manipulates a ManagedBuffer into multiple BufferChunks;
+ * then a BufferAccumulator can piece BufferChunks back together.
+ */
+class POTHOS_API BufferChunk
+{
+public:
+
+    //! Get a const reference to a null/empty BufferChunk
+    static const BufferChunk &null(void);
+
+    /*!
+     * Create a null BufferChunk.
+     * The fields will be zeroed out and buffer null.
+     */
+    BufferChunk(void);
+
+    /*!
+     * Create a BufferChunk given the number of bytes.
+     * This is a convenience method to create a BufferChunk
+     * using memory from the standard memory allocator (new/delete).
+     * Memory will automatically deallocate via reference counting.
+     * \param numBytes the number of bytes to allocate
+     */
+    BufferChunk(const size_t numBytes);
+
+    /*!
+     * Create a BufferChunk given data type and number of elements.
+     * This is a convenience method to create a BufferChunk from a type.
+     * using memory from the standard memory allocator (new/delete).
+     * Memory will automatically deallocate via reference counting.
+     * \param dtype the data type of the result buffer
+     * \param numElems the size in number of elements
+     */
+    BufferChunk(const DType &dtype, const size_t numElems);
+
+    /*!
+     * Create a BufferChunk from a SharedBuffer.
+     * The fields will be initialized to that of the shared buffer.
+     */
+    BufferChunk(const SharedBuffer &buffer, const DType &dtype = DType());
+
+    /*!
+     * Create a BufferChunk from a ManagedBuffer.
+     * The fields will be initialized to that of the managed buffer.
+     */
+    BufferChunk(const ManagedBuffer &buffer, const DType &dtype = DType());
+
+    //! BufferChunk copy constructor
+    BufferChunk(const BufferChunk &other);
+
+    //! BufferChunk move constructor
+    BufferChunk(BufferChunk &&other) noexcept;
+
+    //! BufferChunk destructor
+    ~BufferChunk(void);
+
+    //! BufferChunk copy assignment operator
+    BufferChunk &operator=(const BufferChunk &other);
+
+    //! BufferChunk move assignment operator
+    BufferChunk &operator=(BufferChunk &&other);
+
+    /*!
+     * The address of the start of the buffer.
+     */
+    size_t address;
+
+    /*!
+     * The number of valid bytes in the buffer.
+     */
+    size_t length;
+
+    /*!
+     * The data type of the contents of this buffer.
+     */
+    DType dtype;
+
+    /*!
+     * How many elements are held in this buffer chunk?
+     * \return the length in bytes divided by the dtype size.
+     */
+    size_t elements(void) const;
+
+    /*!
+     * Set the number of elements held by this buffer.
+     * This call modifies the length field in bytes based on the
+     * configured data type and the specified number of elements.
+     */
+    void setElements(const size_t numElements);
+
+    /*!
+     * The underlying reference counted shared buffer.
+     */
+    const SharedBuffer &getBuffer(void) const;
+
+    /*!
+     * The underlying reference counted managed buffer.
+     */
+    const ManagedBuffer &getManagedBuffer(void) const;
+
+    /*!
+     * Get the alias address of the address.
+     * Only valid when the underlying buffer is circular.
+     * \return the alias address or 0 if non-circular
+     */
+    size_t getAlias(void) const;
+
+    /*!
+     * Get the end address - front address + length.
+     * The end address is non-inclusive.
+     * \return the end address
+     */
+    size_t getEnd(void) const;
+
+    /*!
+     * Get a pointer to the front of the buffer as the specified data type.
+     * \code
+     * auto ptr = buffer.as<const int *>();
+     * \endcode
+     * \tparam ElementType the desired pointer type
+     * \return the front of the buffer casted into the specified pointer type
+     */
+    template <typename ElementType>
+    ElementType as(void) const;
+
+    /*!
+     * Get a pointer to the front of the buffer as the specified data type.
+     * This call overloads the conversion operator to provide implicit conversion.
+     * \code
+     * const int *ptr = buffer;
+     * \endcode
+     * \return the front of the buffer casted into the specified pointer type
+     * \tparam ElementType the desired pointer type
+     */
+    template <typename ElementType>
+    operator ElementType(void) const;
+
+    /*!
+     * Is the reference to the shared buffer unique?
+     * \return true if this is the only copy of the shared buffer
+     */
+    bool unique(void) const;
+
+    /*!
+     * The number of copies of the shared buffer.
+     * An extra copy held by the managed buffer is not counted.
+     */
+    size_t useCount(void) const;
+
+    /*!
+     * Is this buffer chunk valid?
+     * \return true when there is underlying memory
+     */
+    explicit operator bool(void) const;
+
+    /*!
+     * Make this buffer chunk null by clearing its contents.
+     * All fields will be zero and containers will be empty.
+     */
+    void clear(void);
+
+    //! Serialization support
+    template<class Archive>
+    void serialize(Archive & ar, const unsigned int version);
+
+    /*!
+     * Append another buffer onto the back of this buffer.
+     * This call allocates a new memory slab the size of both buffers
+     * and copies the contents from each one into the new memory slab.
+     * The length and address members will be updated accordingly.
+     * When empty, append simply copies a reference to the other buffer.
+     * \param other the other buffer to append to the end
+     */
+    void append(const BufferChunk &other);
+
+    /*!
+     * Convert a buffer chunk to the specified data type.
+     * When the number of elements are 0, the entire buffer is converted.
+     * \throws BufferConvertError when the conversion is not possible
+     * \param dtype the data type of the result buffer
+     * \param numElems the number of elements to convert
+     * \return a new buffer chunk with converted elements
+     */
+    BufferChunk convert(const DType &dtype, const size_t numElems = 0) const;
+
+    /*!
+     * Convert a buffer chunk of complex elements to two real buffers.
+     * When the number of elements are 0, the entire buffer is converted.
+     * \throws BufferConvertError when the conversion is not possible
+     * \param dtype the data type of the result buffer
+     * \param numElems the number of elements to convert
+     * \return a real + complex pair of buffer chunks
+     */
+    std::pair<BufferChunk, BufferChunk> convertComplex(const DType &dtype, const size_t numElems = 0) const;
+
+    /*!
+     * Convert a buffer chunk into the specified output buffer.
+     * When the number of elements are 0, the entire buffer is converted.
+     * The buffer length should be large enough to contain the entire conversion.
+     * \throws BufferConvertError when the conversion is not possible
+     * \param [out] outBuff the output buffer, also specifies the dtype
+     * \param numElems the number of elements to convert
+     * \return the number of output elements written to the buffer
+     */
+    size_t convert(const BufferChunk &outBuff, const size_t numElems = 0) const;
+
+    /*!
+     * Convert a buffer chunk of complex elements into two real buffers.
+     * When the number of elements are 0, the entire buffer is converted.
+     * The buffer length should be large enough to contain the entire conversion.
+     * \throws BufferConvertError when the conversion is not possible
+     * \param [out] outBuffRe the real output buffer, also specifies the dtype
+     * \param [out] outBuffIm the imaginary output buffer, also specifies the dtype
+     * \param numElems the number of elements to convert
+     * \return the number of output elements written to the buffers
+     */
+    size_t convertComplex(const BufferChunk &outBuffRe, const BufferChunk &outBuffIm, const size_t numElems = 0) const;
+
+private:
+    friend BufferAccumulator;
+    ManagedBuffer _managedBuffer;
+    void _incrNextBuffers(void);
+    void _decrNextBuffers(void);
+    size_t _nextBuffers;
+};
+
+/*!
+ * Equality operator for BufferChunk objects.
+ * True when the address, length, and underlying buffer are the same.
+ */
+inline bool operator==(const BufferChunk &lhs, const BufferChunk &rhs);
+
+/*!
+ * Inquality operator for BufferChunk objects.
+ * True when the address, length, or underlying buffer are different.
+ */
+inline bool operator!=(const BufferChunk &lhs, const BufferChunk &rhs);
+
+} //namespace Pothos
+
+inline bool Pothos::operator==(const Pothos::BufferChunk &lhs, const Pothos::BufferChunk &rhs)
+{
+    return lhs.address == rhs.address and lhs.length == rhs.length and lhs.getBuffer() == rhs.getBuffer();
+}
+
+inline bool Pothos::operator!=(const Pothos::BufferChunk &lhs, const Pothos::BufferChunk &rhs)
+{
+    return !(lhs == rhs);
+}
+
+inline Pothos::BufferChunk::BufferChunk(void):
+    address(0),
+    length(0),
+    _nextBuffers(0)
+{
+    return;
+}
+
+inline Pothos::BufferChunk::BufferChunk(const size_t numBytes):
+    address(0),
+    length(numBytes),
+    _managedBuffer(Pothos::SharedBuffer::make(numBytes)),
+    _nextBuffers(0)
+{
+    address = getBuffer().getAddress();
+}
+
+inline Pothos::BufferChunk::BufferChunk(const DType &dtype, const size_t numElems):
+    address(0),
+    length(dtype.size()*numElems),
+    dtype(dtype),
+    _managedBuffer(Pothos::SharedBuffer::make(length)),
+    _nextBuffers(0)
+{
+    address = getBuffer().getAddress();
+}
+
+inline Pothos::BufferChunk::BufferChunk(const SharedBuffer &buffer, const Pothos::DType &dtype):
+    address(buffer.getAddress()),
+    length(buffer.getLength()),
+    dtype(dtype),
+    _managedBuffer(buffer),
+    _nextBuffers(0)
+{
+    return;
+}
+
+inline Pothos::BufferChunk::BufferChunk(const ManagedBuffer &buffer, const Pothos::DType &dtype):
+    address(buffer.getBuffer().getAddress()),
+    length(buffer.getBuffer().getLength()),
+    dtype(dtype),
+    _managedBuffer(buffer),
+    _nextBuffers(0)
+{
+    return;
+}
+
+inline Pothos::BufferChunk::BufferChunk(const BufferChunk &other):
+    address(other.address),
+    length(other.length),
+    dtype(other.dtype),
+    _managedBuffer(other._managedBuffer)
+{
+    _incrNextBuffers();
+}
+
+inline Pothos::BufferChunk::BufferChunk(BufferChunk &&other) noexcept:
+    address(std::move(other.address)),
+    length(std::move(other.length)),
+    dtype(std::move(other.dtype)),
+    _managedBuffer(std::move(other._managedBuffer)),
+    _nextBuffers(std::move(other._nextBuffers))
+{
+    other.address = 0;
+    other.length = 0;
+    other._nextBuffers = 0;
+}
+
+inline Pothos::BufferChunk::~BufferChunk(void)
+{
+    _decrNextBuffers();
+}
+
+inline Pothos::BufferChunk &Pothos::BufferChunk::operator=(const BufferChunk &other)
+{
+    _decrNextBuffers();
+    address = other.address;
+    length = other.length;
+    dtype = other.dtype;
+    _managedBuffer = other._managedBuffer;
+    _incrNextBuffers();
+    return *this;
+}
+
+inline Pothos::BufferChunk &Pothos::BufferChunk::operator=(BufferChunk &&other)
+{
+    _decrNextBuffers();
+    address = std::move(other.address);
+    length = std::move(other.length);
+    dtype = std::move(other.dtype);
+    _managedBuffer = std::move(other._managedBuffer);
+    _nextBuffers = std::move(other._nextBuffers);
+    other.address = 0;
+    other.length = 0;
+    other._nextBuffers = 0;
+    return *this;
+}
+
+inline void Pothos::BufferChunk::clear(void)
+{
+    _decrNextBuffers();
+    address = 0;
+    length = 0;
+    dtype = Pothos::DType();
+    _managedBuffer.reset();
+    _nextBuffers = 0;
+}
+
+inline size_t Pothos::BufferChunk::elements(void) const
+{
+    return this->length/this->dtype.size();
+}
+
+inline void Pothos::BufferChunk::setElements(const size_t numElements)
+{
+    this->length = numElements*this->dtype.size();
+}
+
+inline const Pothos::SharedBuffer &Pothos::BufferChunk::getBuffer(void) const
+{
+    return _managedBuffer.getBuffer();
+}
+
+inline const Pothos::ManagedBuffer &Pothos::BufferChunk::getManagedBuffer(void) const
+{
+    return _managedBuffer;
+}
+
+inline size_t Pothos::BufferChunk::getAlias(void) const
+{
+    const auto &buffer = getBuffer();
+    if (buffer.getAlias() == 0) return 0;
+    if (address > buffer.getAlias()) return address - buffer.getAliasOffset();
+    else return address + buffer.getAliasOffset();
+}
+
+inline size_t Pothos::BufferChunk::getEnd(void) const
+{
+    return address + length;
+}
+
+template <typename ElementType>
+ElementType Pothos::BufferChunk::as(void) const
+{
+    return reinterpret_cast<ElementType>(address);
+}
+
+template <typename ElementType>
+Pothos::BufferChunk::operator ElementType(void) const
+{
+    return reinterpret_cast<ElementType>(address);
+}
+
+inline Pothos::BufferChunk::operator bool(void) const
+{
+    return bool(_managedBuffer);
+}
+
+inline bool Pothos::BufferChunk::unique(void) const
+{
+    return _managedBuffer.unique();
+}
+
+inline size_t Pothos::BufferChunk::useCount(void) const
+{
+    return _managedBuffer.useCount();
+}

+ 203 - 0
include/Pothos/Framework/BufferManager.hpp

@@ -0,0 +1,203 @@
+///
+/// \file Framework/BufferManager.hpp
+///
+/// BufferManager provides an output pool of buffers.
+///
+/// \copyright
+/// Copyright (c) 2013-2017 Josh Blum
+///                    2020 Nicholas Corgan
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Framework/ManagedBuffer.hpp>
+#include <Pothos/Framework/BufferChunk.hpp>
+#include <memory> //shared_ptr
+#include <string>
+#include <functional>
+
+namespace Pothos {
+
+/*!
+ * BufferManagerArgs - constructor arguments for BufferManager.
+ */
+struct POTHOS_API BufferManagerArgs
+{
+    BufferManagerArgs(void);
+
+    /*!
+     * The number of managed buffers available from the manager.
+     * Buffers are checked into and out of the manager frequently.
+     * A small number of buffers are needed to allow for parallelism,
+     * so buffers can be checked out while other buffers are in use.
+     * Default: 4 buffers
+     */
+    size_t numBuffers;
+
+    /*!
+     * The number of bytes available per each managed buffer.
+     * Default: 8 kibibytes
+     */
+    size_t bufferSize;
+
+    /*!
+     * The NUMA node affinity for the generic slab allocator.
+     * This argument is not used for the special-case managers.
+     * Default: -1 or unspecified affinity
+     */
+    long nodeAffinity;
+};
+
+/*!
+ * A BufferManager has a queue-like interface to manage buffers.
+ * Since buffers can represent special DMA memory,
+ * the buffer manager is responsible for DMA hooks.
+ */
+class POTHOS_API BufferManager
+{
+public:
+
+    typedef std::shared_ptr<BufferManager> Sptr;
+
+    using AllocateFcn = std::function<SharedBuffer(const BufferManagerArgs& args)>;
+
+    //! Virtual destructor for derived buffer managers
+    virtual ~BufferManager(void);
+
+    /*!
+     * The BufferManager factory -- makes a new BufferManager given the factory name.
+     * This factory call does not invoke init() on the buffer manager.
+     * Plugins for custom BufferManagers should be located in
+     * the plugin registry: /framework/buffer_manager/[name]
+     * \throws BufferManagerFactoryError if the factory function fails.
+     * \param name the name of a BufferManager factory in the plugin tree
+     * \return a new shared pointer to a buffer manager
+     */
+    static Sptr make(const std::string &name);
+
+    /*!
+     * The BufferManager factory -- makes a new BufferManager given the factory name.
+     * Plugins for custom BufferManagers should be located in
+     * the plugin registry: /framework/buffer_manager/[name]
+     * \throws BufferManagerFactoryError if the factory function fails.
+     * \param name the name of a BufferManager factory in the plugin tree
+     * \param args the buffer manager init arguments
+     * \return a new shared pointer to a buffer manager
+     */
+    static Sptr make(const std::string &name, const BufferManagerArgs &args);
+
+    /*!
+     * The BufferManager factory -- makes a new BufferManager given the factory name.
+     * Plugins for custom BufferManagers should be located in
+     * the plugin registry: /framework/buffer_manager/[name]
+     * \throws BufferManagerFactoryError if the factory function fails.
+     * \param name the name of a BufferManager factory in the plugin tree
+     * \param args the buffer manager init arguments
+     * \param allocateFcn a custom function allocate memory
+     * \return a new shared pointer to a buffer manager
+     */
+    static Sptr make(const std::string &name, const BufferManagerArgs &args, const AllocateFcn &allocateFcn);
+
+    /*!
+     * Init is called once at factory time to initialize the buffers.
+     */
+    virtual void init(const BufferManagerArgs &args);
+
+    /*!
+     * Is the manager empty?
+     * \return true if no buffers are available
+     */
+    virtual bool empty(void) const = 0;
+
+    /*!
+     * Get a reference to the front buffer.
+     * front().address will be the start of a valid buffer,
+     * front().length will be the number of bytes available.
+     * The caller sets length to indicate bytes used.
+     * \return the buffer at the queue head
+     */
+    const BufferChunk &front(void) const;
+
+    /*!
+     * Pop bytes from the front buffer.
+     * This operation removes available bytes from the manager.
+     * Calling pop removes a managed buffer from an internal queue;
+     * the bytes removed are only restored to the manager via push.
+     *
+     * If this manager is responsible for DMA writes,
+     * the pop operation should cause a write operation.
+     * If this manager is responsible for DMA reads,
+     * this pop operation should cause a read operation.
+     *
+     * \param numBytes the number of bytes to remove
+     */
+    virtual void pop(const size_t numBytes) = 0;
+
+    /*!
+     * Push returns a buffer to the manager.
+     * The buffer may be available via a call to front()
+     * depending upon the implementation of the manager.
+     * \throw BufferPushError if buffer does not belong to this manager.
+     * \param buff the buffer to return
+     */
+    virtual void push(const ManagedBuffer &buff) = 0;
+
+    /*!
+     * Push external returns a buffer to the manager through a callback.
+     * This call is used to return a buffer from a different thread context.
+     * The callback implements the thread-safe delivery mechanism.
+     */
+    void pushExternal(const ManagedBuffer &buff);
+
+    /*!
+     * Specify a custom function that takes in a BufferManagerArgs instance
+     * and returns a SharedBuffer to be managed.
+     */
+    void setAllocateFunction(const AllocateFcn &allocateFcn);
+
+    /*!
+     * Set the callback for use with the pushExternal API call.
+     */
+    void setCallback(const std::function<void(const ManagedBuffer &)> &callback);
+
+    //! Has this buffer manager been initialized?
+    bool isInitialized(void) const;
+
+protected:
+    //! Default constructor
+    BufferManager(void);
+
+    //! Called by derived classes to set the buffer for front()
+    void setFrontBuffer(const BufferChunk &buff);
+
+    AllocateFcn _allocateFcn;
+
+private:
+    bool _initialized;
+    BufferChunk _frontBuffer;
+    std::function<void(const ManagedBuffer &)> _callback;
+};
+
+} //namespace Pothos
+
+inline const Pothos::BufferChunk &Pothos::BufferManager::front(void) const
+{
+    return _frontBuffer;
+}
+
+inline void Pothos::BufferManager::setFrontBuffer(const BufferChunk &buff)
+{
+    _frontBuffer = buff;
+}
+
+inline void Pothos::BufferManager::pushExternal(const ManagedBuffer &buff)
+{
+    if (_callback) _callback(buff);
+    else this->push(buff);
+}
+
+inline bool Pothos::BufferManager::isInitialized(void) const
+{
+    return _initialized;
+}

+ 48 - 0
include/Pothos/Framework/BufferPool.hpp

@@ -0,0 +1,48 @@
+///
+/// \file Framework/BufferPool.hpp
+///
+/// A simple buffer pool with re-usable buffers.
+///
+/// \copyright
+/// Copyright (c) 2016-2016 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Framework/BufferChunk.hpp>
+#include <vector>
+
+namespace Pothos {
+
+/*!
+ * The simple buffer pool holds a collection of re-usable buffers.
+ * When the client requests a particular buffer size from the pool,
+ * the pool first looks for an existing and unused buffer
+ * that matches the requested size, or allocates a new buffer.
+ */
+class POTHOS_API BufferPool
+{
+public:
+
+    //! Construct an empty buffer pool
+    BufferPool(void);
+
+    /*!
+     * Clear all existing entries in the pool.
+     */
+    void clear(void);
+
+    /*!
+     * Get a buffer from the pool or make one if none available.
+     * \param numBytes the size of the requested buffer in bytes
+     * \return an available buffer chunk of at least numBytes size
+     */
+    const Pothos::BufferChunk &get(const size_t numBytes);
+
+private:
+    size_t _minBuffSize;
+    std::vector<Pothos::BufferChunk> _buffs;
+};
+
+} //namespace Pothos

+ 105 - 0
include/Pothos/Framework/Connectable.hpp

@@ -0,0 +1,105 @@
+///
+/// \file Framework/Connectable.hpp
+///
+/// This file contains the connnectable interface for topology elements.
+///
+/// \copyright
+/// Copyright (c) 2014-2019 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Framework/DType.hpp>
+#include <Pothos/Util/UID.hpp>
+#include <Pothos/Util/RefHolder.hpp>
+#include <Pothos/Callable/CallInterface.hpp>
+#include <Pothos/Callable/CallRegistry.hpp>
+#include <string>
+#include <vector>
+
+namespace Pothos {
+
+//! Information about an IO port
+class POTHOS_API PortInfo
+{
+public:
+    PortInfo(void);
+
+    std::string name; //!< The port name
+
+    std::string alias; //!< A displayable name
+
+    bool isSigSlot; //!< Is signal or slot?
+
+    DType dtype; //!< The data type
+};
+
+/*!
+ * Connectable interface for topological elements.
+ */
+class POTHOS_API Connectable : protected CallRegistry, public CallInterface, public Util::UID, public Util::RefHolder
+{
+public:
+
+    //! virtual destructor for inheritance
+    virtual ~Connectable(void);
+
+    /*!
+     * Set a displayable name for this topology element.
+     * The name is a string to be used in debug outputs.
+     * \param name a new displayable name
+     */
+    void setName(const std::string &name);
+
+    /*!
+     * Get the displayable name for this topology element.
+     * \return the displayable name string
+     */
+    const std::string &getName(void) const;
+
+    /*!
+     * Set the displayable alias for the specified input port.
+     */
+    virtual void setInputAlias(const std::string &portName, const std::string &alias) = 0;
+
+    /*!
+     * Set the displayable alias for the specified output port.
+     */
+    virtual void setOutputAlias(const std::string &portName, const std::string &alias) = 0;
+
+    /*!
+     * Get a vector of info about all of the input ports available.
+     */
+    virtual std::vector<PortInfo> inputPortInfo(void) = 0;
+
+    /*!
+     * Get a vector of info about all of the output ports available.
+     */
+    virtual std::vector<PortInfo> outputPortInfo(void) = 0;
+
+    /*!
+     * Get the names of the input ports available.
+     */
+    std::vector<std::string> inputPortNames(void);
+
+    /*!
+     * Get the names of the output ports available.
+     */
+    std::vector<std::string> outputPortNames(void);
+
+    /*!
+     * Call a method on a derived instance of block with opaque input and return types.
+     * \param name the name of the method as a string
+     * \param inputArgs an array of input arguments
+     * \param numArgs the size of the input array
+     * \return the return value as type Object
+     */
+    virtual Object opaqueCallMethod(const std::string &name, const Object *inputArgs, const size_t numArgs) const = 0;
+
+private:
+    Object opaqueCall(const Object *inputArgs, const size_t numArgs) const;
+    std::string _name;
+};
+
+} //namespace Pothos

+ 14 - 0
include/Pothos/Framework/ConnectableImpl.hpp

@@ -0,0 +1,14 @@
+///
+/// \file Framework/ConnectableImpl.hpp
+///
+/// Templated implementation details for the Connectable class.
+///
+/// \copyright
+/// Copyright (c) 2014-2014 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Framework/Connectable.hpp>
+#include <Pothos/Callable/CallRegistryImpl.hpp>
+#include <Pothos/Callable/CallInterfaceImpl.hpp>

+ 215 - 0
include/Pothos/Framework/DType.hpp

@@ -0,0 +1,215 @@
+///
+/// \file Framework/DType.hpp
+///
+/// This file contains the definition for the DType object.
+///
+/// \copyright
+/// Copyright (c) 2014-2017 Josh Blum
+///                    2019 Nicholas Corgan
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <typeinfo>
+#include <string>
+
+namespace Pothos {
+
+/*!
+ * DType provides meta-information about a data type.
+ * A DType consists of a primitive element type and dimensionality.
+ * The dimensionality is a simple number that allows a DType
+ * to represent an integer number of primitive element per object.
+ *
+ * DType will recognize the alias names for the most common types like:
+ * primitive integers, fixed width types, floating point types, complex...
+ *
+ * Recognized name strings:
+ *  - un/signed char/int/short/long/long long
+ *  - u/int8, u/int16, u/int32, u/int64
+ *  - float, double, float32, float64
+ *  - complex_[known_type]
+ *  - complex64, complex128
+ *
+ * Special name strings:
+ *  - empty string for an unspecified size-zero data type
+ *  - "custom" for an unspecified dimensionality-size data type
+ */
+class POTHOS_API DType
+{
+public:
+
+    //! Create an unknown DType of size 1
+    DType(void);
+
+    /*!
+     * Create a DType from only a markup string (char * overload).
+     * \throw DTypeUnknownError when the name is not known
+     * \param markup the name identfier of a known DType
+     */
+    DType(const char *markup);
+
+    /*!
+     * Create a DType from only a markup string.
+     * The markup name is a type alias (like float32),
+     * with optional comma separated dimensionality.
+     *
+     *  - Example markup: "float32"
+     *  - Example markup: "uint8, 2"
+     *
+     * \throw DTypeUnknownError when the name is not known
+     * \param markup the name identfier of a known DType
+     */
+    DType(const std::string &markup);
+
+    /*!
+     * Create a DType from a type alias and dimensionality.
+     * \throw DTypeUnknownError when the name is not known
+     * \param alias a string identfier for a known data type
+     * \param dimension the number of elements per type
+     */
+    DType(const std::string &alias, const size_t dimension);
+
+    /*!
+     * Create a DType from a type_info identifier and optional dimensionality.
+     * The size and type enum are inferred from the type info.
+     * \throw DTypeUnknownError when the type is not known
+     * \param type a recognized type info object
+     * \param dimension the number of elements per type
+     */
+    DType(const std::type_info &type, const size_t dimension = 1);
+
+    /*!
+     * Create a DType from a DType object specified dimensionality.
+     * The dimensionality of the input dtype parameter is ignored.
+     * \param dtype supplies the primitive data type
+     * \param dimension the number of elements per type
+     */
+    static DType fromDType(const DType &dtype, const size_t dimension);
+
+    /*!
+     * Get a name that describes an element.
+     * Example: int32, uint16, complex_float32, etc...
+     */
+    const std::string &name(void) const;
+
+    //! Get the element type descriptor
+    unsigned char elemType(void) const;
+
+    //! Get the size of a single element in bytes
+    unsigned char elemSize(void) const;
+
+    //! Get the dimensionality of this type
+    size_t dimension(void) const;
+
+    //! Get the size of this DType in bytes
+    size_t size(void) const;
+
+    //! Create a printable string representation
+    std::string toString(void) const;
+
+    /*!
+     * Create a markup string which can be parsed by the constructor.
+     * \return the markup string with data type and optional dimensionality
+     */
+    std::string toMarkup(void) const;
+
+    /*!
+     * Does this dtype specify a non-empty type?
+     * \return false for default constructor/empty string
+     */
+    explicit operator bool(void) const;
+
+    /*!
+     * Does this dtype represent a custom type?
+     * \return true when the type was constructed with "custom"
+     */
+    bool isCustom(void) const;
+
+    /*!
+     * Does this dtype represent a floating point data type?
+     * \return true for floats, doubles, and complex floats, doubles
+     */
+    bool isFloat(void) const;
+
+    /*!
+     * Does this dtype represent an integer data type?
+     * \return true for fixed width integer types and complex integer types
+     */
+    bool isInteger(void) const;
+
+    /*!
+     * Does this dtype represent a signed data type?
+     * \return true for signed integer, complex signed integer types.
+     */
+    bool isSigned(void) const;
+
+    /*!
+     * Does this dtype represent a complex data type?
+     * \return true when the type is std::complex<primitive type>
+     */
+    bool isComplex(void) const;
+
+    //! Serialization support
+    template<class Archive>
+    void serialize(Archive & ar, const unsigned int version);
+
+private:
+    size_t _dimension;
+    unsigned char _elemType;
+    unsigned char _elemSize;
+};
+
+//! Equality operator for DType (all attributes must match for equality)
+POTHOS_API bool operator==(const DType &lhs, const DType &rhs);
+
+//! Inequality operator for DType (all attributes must match for equality)
+POTHOS_API bool operator!=(const DType &lhs, const DType &rhs);
+
+} //namespace Pothos
+
+inline bool Pothos::operator==(const DType &lhs, const DType &rhs)
+{
+    return lhs.elemType() == rhs.elemType() and
+        lhs.elemSize() == rhs.elemSize() and
+        lhs.dimension() == rhs.dimension();
+}
+
+inline bool Pothos::operator!=(const DType &lhs, const DType &rhs)
+{
+    return !(lhs == rhs);
+}
+
+inline Pothos::DType::DType(void):
+    _dimension(1),
+    _elemType(0),
+    _elemSize(1)
+{
+    return;
+}
+
+inline unsigned char Pothos::DType::elemType(void) const
+{
+    return _elemType;
+}
+
+inline unsigned char Pothos::DType::elemSize(void) const
+{
+    return _elemSize;
+}
+
+inline size_t Pothos::DType::dimension(void) const
+{
+    return _dimension;
+}
+
+inline size_t Pothos::DType::size(void) const
+{
+    return _elemSize*_dimension;
+}
+
+inline Pothos::DType::operator bool(void) const
+{
+    return _elemType != 0;
+}

+ 68 - 0
include/Pothos/Framework/Exception.hpp

@@ -0,0 +1,68 @@
+///
+/// \file Framework/Exception.hpp
+///
+/// Exceptions thrown by the Framework methods.
+///
+/// \copyright
+/// Copyright (c) 2013-2014 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Exception.hpp>
+
+namespace Pothos {
+
+/*!
+ * A SharedBufferError is thrown when the SharedBuffer can't allocate.
+ */
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, SharedBufferError, RuntimeException)
+
+/*!
+ * A BufferManagerFactoryError is thrown when the factory has an error.
+ */
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, BufferManagerFactoryError, RuntimeException)
+
+/*!
+ * A BufferPushError is thrown when buffers are pushed to the wrong queue.
+ */
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, BufferPushError, RuntimeException)
+
+/*!
+ * A PortAccessError is thrown when an invalid worker port identifier is used.
+ */
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, PortAccessError, RangeException)
+
+/*!
+ * A DTypeUnknownError is thrown when an unknown DType identifier is used.
+ */
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, DTypeUnknownError, RuntimeException)
+
+/*!
+ * A TopologyConnectError is thrown when a dis/connection is not possible.
+ */
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, TopologyConnectError, RuntimeException)
+
+/*!
+ * A BlockCallNotFound is thrown when a call by the given name cannot be found.
+ */
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, BlockCallNotFound, RuntimeException)
+
+/*!
+ * A PortDomainError is thrown from getInput/OutputBufferManager() for incompatible domains.
+ */
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, PortDomainError, RuntimeException)
+
+/*!
+ * A ThreadPoolError is thrown when ThreadPoolArgs are invalid.
+ */
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, ThreadPoolError, RuntimeException)
+
+/*!
+ * A BufferConvertError is thrown when a conversion is not possible.
+ */
+POTHOS_DECLARE_EXCEPTION(POTHOS_API, BufferConvertError, RuntimeException)
+
+
+} //namespace Pothos

+ 285 - 0
include/Pothos/Framework/InputPort.hpp

@@ -0,0 +1,285 @@
+///
+/// \file Framework/InputPort.hpp
+///
+/// This file provides an interface for a worker's input port.
+///
+/// \copyright
+/// Copyright (c) 2014-2017 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Object/Object.hpp>
+#include <Pothos/Framework/DType.hpp>
+#include <Pothos/Framework/Label.hpp>
+#include <Pothos/Framework/BufferChunk.hpp>
+#include <Pothos/Framework/BufferAccumulator.hpp>
+#include <Pothos/Util/RingDeque.hpp>
+#include <Pothos/Util/SpinLock.hpp>
+#include <string>
+
+namespace Pothos {
+
+class WorkerActor;
+class OutputPort;
+
+/*!
+ * InputPort provides methods to interact with a worker's input ports.
+ */
+class POTHOS_API InputPort
+{
+public:
+
+    //! Destructor
+    ~InputPort(void);
+
+    /*!
+     * Get the index number of this port.
+     * An index of -1 means the port cannot be represented by an integer.
+     * \return the index or -1
+     */
+    int index(void) const;
+
+    //! Get the string name identifier for this port.
+    const std::string &name(void) const;
+
+    //! Get a displayable name for this port.
+    const std::string &alias(void) const;
+
+    //! Set the displayable alias for this port.
+    void setAlias(const std::string &alias);
+
+    //! Get the data type information for this port.
+    const DType &dtype(void) const;
+
+    //! Get the domain information for this port
+    const std::string &domain(void) const;
+
+    /*!
+     * Get access to the stream buffer.
+     * For non-stream ports, this returns an empty buffer chunk.
+     */
+    const BufferChunk &buffer(void) const;
+
+    /*!
+     * Get the number of elements available in the stream buffer.
+     * The number of elements is the available bytes/dtype size.
+     */
+    size_t elements(void) const;
+
+    /*!
+     * Get the total number of elements consumed on this port.
+     * The value returned by this method will not change
+     * until after execution of work() and propagateLabels().
+     */
+    unsigned long long totalElements(void) const;
+
+    /*!
+     * Get the total number of buffers posted to this port.
+     * Note that this call tracks incoming buffer count,
+     * and not total buffer consumption (which is harder).
+     */
+    unsigned long long totalBuffers(void) const;
+
+    /*!
+     * Get the total number of labels consumed from this port.
+     * This count updates immediately upon calling removeLabel(),
+     * and after after execution of work() and propagateLabels().
+     */
+    unsigned long long totalLabels(void) const;
+
+    /*!
+     * Get the total number of messages popped from this port.
+     * The value returned by this method will be incremented
+     * immediately upon calling popMessage().
+     */
+    unsigned long long totalMessages(void) const;
+
+    //! Does the specified input port have an asynchronous message available?
+    bool hasMessage(void);
+
+    /*!
+     * Get an iterator to all input labels for the specified port.
+     * Labels are sorted in order of oldest to newest by label index.
+     * \return an iterable object with sorted labels
+     */
+    const LabelIteratorRange &labels(void) const;
+
+    /*!
+     * Remove a label from the internal storage structure.
+     * This invalidates the iterator retrieved from labels().
+     * Since labels are automatically removed by consume(),
+     * this call allows a users to simplify state tracking
+     * in their block implementations by removing labels,
+     * that might be iterated through on subsequent runs.
+     */
+    void removeLabel(const Label &label);
+
+    /*!
+     * Consume elements on this port.
+     * The number of elements specified must be less than
+     * or equal to the number of elements available.
+     * \param numElements the number of elements to consume
+     */
+    void consume(const size_t numElements);
+
+    /*!
+     * Take buffer transfers ownership of the buffer to the caller.
+     * Use takeBuffer() to support perfect buffer forwarding
+     * with postBuffer() and postMessage() on an output port.
+     * \code
+     * auto buff = inPort->takeBuffer();
+     * outPort->postBuffer(std::move(buff));
+     * \endcode
+     * \note Note that takeBuffer() does not consume. The caller must also call
+     * consume() with the number of elements actually read from the buffer.
+     * \post buffer() has undefined behavior after this call.
+     * \return the buffer from this input port
+     */
+    BufferChunk takeBuffer(void);
+
+    /*!
+     * Remove and return an asynchronous message from the port.
+     * If there is no message available, a null Object() is returned.
+     * \return an asynchronous message object
+     */
+    Object popMessage(void);
+
+    /*!
+     * Return an asynchronous message from the port without removing it.
+     * If there is no message available, a null Object() is returned.
+     * \return an asynchronous message object
+     */
+    Object peekMessage(void);
+
+    /*!
+     * Set a reserve requirement on this input port.
+     * The reserve size ensures that when sufficient resources are available,
+     * the buffer will contain at least the specified number of elements.
+     * By default, each input port has a reserve of zero elements,
+     * which means that the input port's buffer may be any size,
+     * including empty, depending upon the available resources.
+     * Note that work() may still be called when the reserve is not met,
+     * because the scheduler will only prevent work() from being called
+     * when all ports fail to meet their respective reserve requirements.
+     * \param numElements the number of elements to require
+     */
+    void setReserve(const size_t numElements);
+
+    /*!
+     * Is this port used for signal handling in a signals + slots paradigm?
+     */
+    bool isSlot(void) const;
+
+    /*!
+     * Push a buffer into the buffer queue of this input port.
+     * This is a thread-safe call, it can be made from any context.
+     * Use pushBuffer to preload an input port with elements, example:
+     * a window-sized history of elements for a filter block,
+     * or a preloaded number of elements for a feedback loop.
+     */
+    void pushBuffer(const BufferChunk &buffer);
+
+    /*!
+     * Push a label into the label storage of this input port.
+     * This is a thread-safe call, it can be made from any context.
+     * When using this call, first push the buffer with the
+     * corresponding label index *before* pushing the label.
+     */
+    void pushLabel(const Label &label);
+
+    /*!
+     * Push a message into the message queue of this input port.
+     * This is a thread-safe call, it can be made from any context.
+     */
+    void pushMessage(const Object &message);
+
+    /*!
+     * Clear all memory on this input port.
+     * Clear buffers, labels, and messages.
+     */
+    void clear(void);
+
+private:
+    WorkerActor *_actor;
+
+    //port configuration
+    bool _isSlot;
+    int _index;
+    std::string _name;
+    std::string _alias;
+    DType _dtype;
+    std::string _domain;
+
+    //state set in pre-work
+    BufferChunk _buffer;
+    size_t _elements;
+    LabelIteratorRange _labelIter;
+
+    //port stats
+    unsigned long long _totalElements;
+    unsigned long long _totalBuffers;
+    unsigned long long _totalLabels;
+    unsigned long long _totalMessages;
+
+    //state changes from work
+    size_t _pendingElements;
+    size_t _reserveElements;
+
+    //counts work actions which we will use to establish activity
+    size_t _workEvents;
+
+    Util::SpinLock _asyncMessagesLock;
+    Util::RingDeque<std::pair<Object, BufferChunk>> _asyncMessages;
+
+    Util::SpinLock _slotCallsLock;
+    Util::RingDeque<std::pair<Object, BufferChunk>> _slotCalls;
+
+    std::vector<Label> _inlineMessages; //user api structure
+    Util::RingDeque<Label> _inputInlineMessages; //shared structure
+
+    Util::SpinLock _bufferAccumulatorLock;
+    BufferAccumulator _bufferAccumulator;
+
+    std::vector<OutputPort *> _subscribers;
+
+    /////// async message interface /////////
+    void asyncMessagesPush(const Object &message, const BufferChunk &token = BufferChunk::null());
+    bool asyncMessagesEmpty(void);
+    Object asyncMessagesPop(void);
+    Object asyncMessagesPeek(void);
+    void asyncMessagesClear(void);
+
+    /////// slot call interface /////////
+    void slotCallsPush(const Object &args, const BufferChunk &token);
+    bool slotCallsEmpty(void);
+    Object slotCallsPop(void);
+    void slotCallsClear(void);
+
+    /////// inline message interface /////////
+    void inlineMessagesPush(const Label &label);
+    void inlineMessagesClear(void);
+
+    /////// input buffer interface /////////
+    void bufferAccumulatorFront(BufferChunk &);
+    void bufferAccumulatorPush(const BufferChunk &buffer);
+    void bufferAccumulatorPushNoLock(BufferChunk &&buffer);
+    void bufferAccumulatorPop(const size_t numBytes);
+    void bufferAccumulatorRequire(const size_t numBytes);
+    void bufferAccumulatorClear(void);
+
+    /////// combined label association push /////////
+    void bufferLabelPush(
+        const bool enableMove,
+        std::vector<Label> &postedLabels,
+        Util::RingDeque<BufferChunk> &postedBuffers);
+
+    InputPort(void);
+    InputPort(const InputPort &) = delete; // non construction-copyable
+    InputPort &operator=(const InputPort &) = delete; // non copyable
+    friend class WorkerActor;
+    friend class OutputPort;
+};
+
+} //namespace Pothos

+ 190 - 0
include/Pothos/Framework/InputPortImpl.hpp

@@ -0,0 +1,190 @@
+///
+/// \file Framework/InputPortImpl.hpp
+///
+/// Inline member implementation for InputPort class.
+///
+/// \copyright
+/// Copyright (c) 2014-2017 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Framework/InputPort.hpp>
+#include <mutex> //lock_guard
+
+inline int Pothos::InputPort::index(void) const
+{
+    return _index;
+}
+
+inline const std::string &Pothos::InputPort::name(void) const
+{
+    return _name;
+}
+
+inline const Pothos::DType &Pothos::InputPort::dtype(void) const
+{
+    return _dtype;
+}
+
+inline const std::string &Pothos::InputPort::domain(void) const
+{
+    return _domain;
+}
+
+inline const Pothos::BufferChunk &Pothos::InputPort::buffer(void) const
+{
+    return _buffer;
+}
+
+inline size_t Pothos::InputPort::elements(void) const
+{
+    return _elements;
+}
+
+inline unsigned long long Pothos::InputPort::totalElements(void) const
+{
+    return _totalElements;
+}
+
+inline unsigned long long Pothos::InputPort::totalBuffers(void) const
+{
+    return _totalBuffers;
+}
+
+inline unsigned long long Pothos::InputPort::totalLabels(void) const
+{
+    return _totalLabels;
+}
+
+inline unsigned long long Pothos::InputPort::totalMessages(void) const
+{
+    return _totalMessages;
+}
+
+inline const Pothos::LabelIteratorRange &Pothos::InputPort::labels(void) const
+{
+    return _labelIter;
+}
+
+inline void Pothos::InputPort::consume(const size_t numElements)
+{
+    _pendingElements += numElements;
+}
+
+inline Pothos::BufferChunk Pothos::InputPort::takeBuffer(void)
+{
+    return std::move(_buffer);
+}
+
+inline bool Pothos::InputPort::hasMessage(void)
+{
+    return not this->asyncMessagesEmpty();
+}
+
+inline bool Pothos::InputPort::isSlot(void) const
+{
+    return _isSlot;
+}
+
+inline Pothos::Object Pothos::InputPort::popMessage(void)
+{
+    auto msg = this->asyncMessagesPop();
+    _totalMessages++;
+    _workEvents++;
+    return msg;
+}
+
+inline Pothos::Object Pothos::InputPort::peekMessage(void)
+{
+    return this->asyncMessagesPeek();
+}
+
+inline void Pothos::InputPort::removeLabel(const Label &label)
+{
+    for (auto it = _inlineMessages.begin(); it != _inlineMessages.end(); it++)
+    {
+        if (*it == label)
+        {
+            _inlineMessages.erase(it);
+            _labelIter = _inlineMessages;
+            _totalLabels++;
+            _workEvents++;
+            return;
+        }
+    }
+}
+
+inline void Pothos::InputPort::setReserve(const size_t numElements)
+{
+    //only mark this change when setting a larger reserve
+    if (numElements > _reserveElements) _workEvents++;
+
+    _reserveElements = numElements;
+}
+
+inline bool Pothos::InputPort::asyncMessagesEmpty(void)
+{
+    std::lock_guard<Util::SpinLock> lock(_asyncMessagesLock);
+    return _asyncMessages.empty();
+}
+
+inline Pothos::Object Pothos::InputPort::asyncMessagesPop(void)
+{
+    std::lock_guard<Util::SpinLock> lock(_asyncMessagesLock);
+    if (_asyncMessages.empty()) return Pothos::Object();
+    auto msg = std::move(_asyncMessages.front().first);
+    _asyncMessages.pop_front();
+    return msg;
+}
+
+inline Pothos::Object Pothos::InputPort::asyncMessagesPeek(void)
+{
+    std::lock_guard<Util::SpinLock> lock(_asyncMessagesLock);
+    if (_asyncMessages.empty()) return Pothos::Object();
+    return _asyncMessages.front().first;
+}
+
+inline void Pothos::InputPort::inlineMessagesPush(const Pothos::Label &label)
+{
+    std::lock_guard<Util::SpinLock> lock(_bufferAccumulatorLock);
+    if (_inputInlineMessages.full()) _inputInlineMessages.set_capacity(_inputInlineMessages.capacity()*2);
+    _inputInlineMessages.push_back(label);
+}
+
+inline void Pothos::InputPort::inlineMessagesClear(void)
+{
+    std::lock_guard<Util::SpinLock> lock(_bufferAccumulatorLock);
+    _inputInlineMessages.clear();
+    _inlineMessages.clear();
+}
+
+inline void Pothos::InputPort::bufferAccumulatorFront(Pothos::BufferChunk &buff)
+{
+    std::lock_guard<Util::SpinLock> lock(_bufferAccumulatorLock);
+    while (not _inputInlineMessages.empty())
+    {
+        _inlineMessages.push_back(std::move(_inputInlineMessages.front()));
+        _inlineMessages.back().adjust(1, this->dtype().size());
+        _inputInlineMessages.pop_front();
+    }
+    buff = _bufferAccumulator.front();
+}
+
+inline void Pothos::InputPort::bufferAccumulatorPush(const BufferChunk &buffer)
+{
+    std::lock_guard<Util::SpinLock> lock(_bufferAccumulatorLock);
+    this->bufferAccumulatorPushNoLock(BufferChunk(buffer));
+}
+
+inline void Pothos::InputPort::bufferAccumulatorRequire(const size_t numBytes)
+{
+    std::lock_guard<Util::SpinLock> lock(_bufferAccumulatorLock);
+    _bufferAccumulator.require(numBytes);
+}
+
+inline void Pothos::InputPort::bufferAccumulatorClear(void)
+{
+    std::lock_guard<Util::SpinLock> lock(_bufferAccumulatorLock);
+    _bufferAccumulator = BufferAccumulator();
+}

+ 199 - 0
include/Pothos/Framework/Label.hpp

@@ -0,0 +1,199 @@
+///
+/// \file Framework/Label.hpp
+///
+/// Label and associated classes for decorating a stream of elements.
+///
+/// \copyright
+/// Copyright (c) 2014-2015 Josh Blum
+///                    2019 Nicholas Corgan
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Object/Object.hpp>
+#include <string>
+
+namespace Pothos {
+
+/*!
+ * A Label decorates a stream of information with meta-data.
+ * The label's data is an Object with arbitrary contents.
+ * The label's index identifies an element in a stream.
+ */
+class POTHOS_API Label
+{
+public:
+    //! Create an empty label with null data and zero index.
+    Label(void);
+
+    //! Create a label with specified data of ValueType and index
+    template <typename ValueType>
+    Label(const std::string &id, ValueType &&data, const unsigned long long index, const size_t width = 1);
+
+    /*!
+     * Create a new label with an adjusted index and width.
+     * Example convert bytes to elements: newLbl = lbl.toAdjusted(1, elemSize);
+     * Example convert elements to bytes: newLbl = lbl.toAdjusted(elemSize, 1);
+     * \param mult a positive multiplier (default 1)
+     * \param div a positive divider (default 1)
+     * \return a copy of this label with an adjusted position
+     */
+    template <typename MultType, typename DivType>
+    Label toAdjusted(const MultType &mult, const DivType &div) const;
+
+    /*!
+     * Adjust the index and width based on a multiplier/divider.
+     * \param mult a positive multiplier (default 1)
+     * \param div a positive divider (default 1)
+     * \return a reference to this label
+     */
+    template <typename MultType, typename DivType>
+    Label &adjust(const MultType &mult, const DivType &div);
+
+    /*!
+     * The identifier describes the label's type, meaning, or purpose.
+     * Identifiers only have meaning in the context of the blocks
+     * that are producing and consuming them. So any given pair of blocks
+     * need to agree on a particular set of identifiers and their meanings.
+     */
+    std::string id;
+
+    /*!
+     * The data can be anything that can be held by Object.
+     */
+    Object data;
+
+    /*!
+     * The index specifies an offset into a buffer of elements.
+     * To associate with the first element of a buffer, index should be 0.
+     * To associate with the Nth element of a buffer, index should be N-1.
+     */
+    unsigned long long index;
+
+    /*!
+     * The width specifies the number of elements to which this label applies.
+     * Width applies to every element from [index to index+width-1] inclusive.
+     * The default value of width is 1, and it may not take the value zero.
+     */
+    size_t width;
+
+    //! support for sorting Labels by index
+    bool operator<(const Label &other) const;
+
+    //! Serialization support
+    template<class Archive>
+    void serialize(Archive & ar, const unsigned int version);
+};
+
+//! Are these two labels equivalent? all fields must be equal
+inline bool operator==(const Label &rhs, const Label &lhs);
+
+//! Are these two labels not equivalent? at least one field must not be equal
+inline bool operator!=(const Label &rhs, const Label &lhs);
+
+/*!
+ * LabelIteratorRange represents a sorted range of labels.
+ * It has the standard iterator interface begin()/end().
+ */
+class POTHOS_API LabelIteratorRange
+{
+public:
+
+    //! Const Label iterator type
+    typedef const Label* const_iterator;
+
+    //! Create an empty/invalid LabelIteratorRange
+    LabelIteratorRange(void);
+
+    //! Create a LabelIteratorRange from a begin() and end() iterator
+    template <typename IterType>
+    LabelIteratorRange(const IterType &begin, const IterType &end);
+
+    //! Create a LabelIteratorRange from an existing range
+    template <typename RangeType>
+    LabelIteratorRange(const RangeType &range);
+
+    //! Get the beginning of the iterator range (inclusive)
+    const_iterator begin(void) const;
+
+    //! Get the end of the iterator range (exclusive)
+    const_iterator end(void) const;
+
+private:
+    const_iterator _begin;
+    const_iterator _end;
+};
+
+} //namespace Pothos
+
+template <typename ValueType>
+Pothos::Label::Label(const std::string &id, ValueType &&data, const unsigned long long index, const size_t width):
+    id(id),
+    data(Object(std::forward<ValueType>(data))),
+    index(index),
+    width(width)
+{
+    return;
+}
+
+template <typename MultType, typename DivType>
+Pothos::Label Pothos::Label::toAdjusted(const MultType &mult, const DivType &div) const
+{
+    Pothos::Label newLabel(*this);
+    newLabel.adjust(mult, div);
+    return newLabel;
+}
+
+template <typename MultType, typename DivType>
+Pothos::Label &Pothos::Label::adjust(const MultType &mult, const DivType &div)
+{
+    this->index *= mult;
+    this->width *= mult;
+    this->index /= div;
+    this->width /= div;
+    return *this;
+}
+
+inline bool Pothos::operator==(const Label &rhs, const Label &lhs)
+{
+    return
+        rhs.index == lhs.index and
+        rhs.width == lhs.width and
+        rhs.id == lhs.id and
+        rhs.data == lhs.data;
+}
+
+inline bool Pothos::operator!=(const Label &rhs, const Label &lhs)
+{
+    return !(rhs == lhs);
+}
+
+inline bool Pothos::Label::operator<(const Label &other) const
+{
+    return this->index < other.index;
+}
+
+template <typename IterType>
+Pothos::LabelIteratorRange::LabelIteratorRange(const IterType &begin, const IterType &end):
+    _begin(begin), _end(end)
+{
+    return;
+}
+
+template <typename RangeType>
+Pothos::LabelIteratorRange::LabelIteratorRange(const RangeType &range):
+    _begin(range.data()), _end(range.data() + range.size())
+{
+    return;
+}
+
+inline Pothos::LabelIteratorRange::const_iterator Pothos::LabelIteratorRange::begin(void) const
+{
+    return _begin;
+}
+
+inline Pothos::LabelIteratorRange::const_iterator Pothos::LabelIteratorRange::end(void) const
+{
+    return _end;
+}

+ 287 - 0
include/Pothos/Framework/ManagedBuffer.hpp

@@ -0,0 +1,287 @@
+///
+/// \file Framework/ManagedBuffer.hpp
+///
+/// A ManagedBuffer is checked-out and automatically returned to a BufferManager.
+///
+/// \copyright
+/// Copyright (c) 2013-2017 Josh Blum
+///                    2019 Nicholas Corgan
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Framework/SharedBuffer.hpp>
+#include <memory> //shared_ptr
+#include <atomic>
+#include <cassert>
+
+namespace Pothos {
+
+//! Forward declares
+class BufferManager;
+class BufferChunk;
+class BufferAccumulator;
+
+/*!
+ * A ManagedBuffer is a buffer that interacts with a BufferManager.
+ * The ManagedBuffer maintains a reference count, and when no more
+ * copies are held by the user, the ManagedBuffer will be returned
+ * to the BufferManager; unless the BufferManager has been deleted.
+ */
+class POTHOS_API ManagedBuffer
+{
+public:
+
+    /*!
+     * Create a null buffer.
+     * All fields are initialized to zero.
+     */
+    ManagedBuffer(void);
+
+    /*!
+     * Create from a shared buffer with no manager.
+     */
+    ManagedBuffer(const SharedBuffer &buff);
+
+    /*!
+     * Is this managed buffer valid?
+     * \return true if it holds an allocation.
+     */
+    explicit operator bool(void) const;
+
+    /*!
+     * Reset any reference held by the managed buffer.
+     * This managed buffer will become a null buffer.
+     */
+    void reset(void);
+
+    /*!
+     * Reset the managed buffer for its next usage.
+     * \param manager shared pointer to the buffer manager
+     * \param buff the shared buffer with memory and length
+     * \param slabIndex an identifying index used with slabs
+     */
+    void reset(std::shared_ptr<BufferManager> manager, const SharedBuffer &buff, const size_t slabIndex = 0);
+
+    /*!
+     * Get the internal buffer as set by the manager
+     * and which cannot be changed by the caller.
+     * \return a const reference to the buffer
+     */
+    const SharedBuffer &getBuffer(void) const;
+
+    /*!
+     * Get the slab index associated with this buffer.
+     * The slab index related to implementation specifics.
+     * Typically, this index is only used when the underlying
+     * buffer is sourced from a continuous slab of memory.
+     */
+    size_t getSlabIndex(void) const;
+
+    //! ManagedBuffer destructor
+    ~ManagedBuffer(void);
+
+    //! ManagedBuffer copy constructor
+    ManagedBuffer(const ManagedBuffer &obj);
+
+    //! ManagedBuffer move constructor
+    ManagedBuffer(ManagedBuffer &&obj) noexcept;
+
+    //! ManagedBuffer copy assignment
+    ManagedBuffer &operator=(const ManagedBuffer &obj);
+
+    //! ManagedBuffer move assignment
+    ManagedBuffer &operator=(ManagedBuffer &&obj);
+
+    //! Get the associated buffer manager
+    std::shared_ptr<BufferManager> getBufferManager(void) const;
+
+    //! sortable operator for ManagedBuffer
+    bool operator<(const ManagedBuffer &) const;
+
+    /*!
+     * Is the reference to the managed buffer unique?
+     * \return true if this is the only copy of the managed buffer
+     */
+    bool unique(void) const;
+
+    /*!
+     * The number of copies of the managed buffer.
+     */
+    size_t useCount(void) const;
+
+    /*!
+     * Set the next contiguous buffer in the chain.
+     */
+    void setNextBuffer(const ManagedBuffer &next);
+
+    /*!
+     * Get the next contiguous buffer in the chain.
+     * Or return a null managed buffer if there is none.
+     */
+    ManagedBuffer getNextBuffer(void) const;
+
+private:
+    friend BufferChunk;
+    friend BufferAccumulator;
+    struct Impl; Impl *_impl;
+    ManagedBuffer(Impl *impl);
+    POTHOS_API friend bool operator==(const ManagedBuffer &lhs, const ManagedBuffer &rhs);
+    POTHOS_API friend bool operator!=(const ManagedBuffer &lhs, const ManagedBuffer &rhs);
+};
+
+/*!
+ * Equality operator for ManagedBuffer.
+ * True when the containers are identical.
+ */
+inline bool operator==(const ManagedBuffer &lhs, const ManagedBuffer &rhs);
+
+/*!
+ * Inquality operator for ManagedBuffer.
+ * True when the containers are not identical.
+ */
+inline bool operator!=(const ManagedBuffer &lhs, const ManagedBuffer &rhs);
+
+} //namespace Pothos
+
+struct Pothos::ManagedBuffer::Impl
+{
+    Impl(void);
+
+    std::atomic<int> counter;
+    std::weak_ptr<BufferManager> weakManager;
+    SharedBuffer buffer;
+    size_t slabIndex;
+    Pothos::ManagedBuffer::Impl *nextBuffer;
+
+    void incr(void)
+    {
+        counter.fetch_add(1, std::memory_order_relaxed);
+    }
+
+    void decr(void)
+    {
+        //decrement the counter, and handle the last ref case
+        if (counter.fetch_sub(1, std::memory_order_release) == 1)
+        {
+            std::atomic_thread_fence(std::memory_order_acquire);
+            this->cleanup();
+        }
+    }
+
+    void cleanup(void);
+};
+
+inline Pothos::ManagedBuffer::ManagedBuffer(void):
+    _impl(nullptr)
+{
+    return;
+}
+
+inline Pothos::ManagedBuffer::operator bool(void) const
+{
+    return _impl != nullptr;
+}
+
+inline void Pothos::ManagedBuffer::reset(void)
+{
+    if (_impl != nullptr) _impl->decr();
+    _impl = nullptr;
+}
+
+inline const Pothos::SharedBuffer &Pothos::ManagedBuffer::getBuffer(void) const
+{
+    if (_impl == nullptr) return SharedBuffer::null();
+    return _impl->buffer;
+}
+
+inline size_t Pothos::ManagedBuffer::getSlabIndex(void) const
+{
+    assert(*this);
+    return _impl->slabIndex;
+}
+
+inline Pothos::ManagedBuffer::~ManagedBuffer(void)
+{
+    if (_impl != nullptr) _impl->decr();
+}
+
+inline Pothos::ManagedBuffer::ManagedBuffer(const ManagedBuffer &obj):
+    _impl(obj._impl)
+{
+    if (_impl != nullptr) _impl->incr();
+}
+
+inline Pothos::ManagedBuffer::ManagedBuffer(ManagedBuffer &&obj) noexcept:
+    _impl(obj._impl)
+{
+    obj._impl = nullptr;
+}
+
+inline Pothos::ManagedBuffer &Pothos::ManagedBuffer::operator=(const ManagedBuffer &obj)
+{
+    if (_impl != nullptr) _impl->decr();
+    this->_impl = obj._impl;
+    if (_impl != nullptr) _impl->incr();
+    return *this;
+}
+
+inline Pothos::ManagedBuffer &Pothos::ManagedBuffer::operator=(ManagedBuffer &&obj)
+{
+    if (_impl != nullptr) _impl->decr();
+    this->_impl = obj._impl;
+    obj._impl = nullptr;
+    return *this;
+}
+
+inline std::shared_ptr<Pothos::BufferManager> Pothos::ManagedBuffer::getBufferManager(void) const
+{
+    assert(*this);
+    return _impl->weakManager.lock();
+}
+
+inline bool Pothos::ManagedBuffer::operator<(const ManagedBuffer &rhs) const
+{
+    return _impl < rhs._impl;
+}
+
+inline bool Pothos::ManagedBuffer::unique(void) const
+{
+    if (_impl == nullptr) return false;
+    return _impl->counter.load(std::memory_order_relaxed) == 1;
+}
+
+inline size_t Pothos::ManagedBuffer::useCount(void) const
+{
+    if (_impl == nullptr) return 0;
+    return _impl->counter.load(std::memory_order_relaxed);
+}
+
+inline void Pothos::ManagedBuffer::setNextBuffer(const ManagedBuffer &next)
+{
+    assert(*this);
+    _impl->nextBuffer = next._impl;
+}
+
+inline Pothos::ManagedBuffer Pothos::ManagedBuffer::getNextBuffer(void) const
+{
+    assert(*this);
+    return Pothos::ManagedBuffer(_impl->nextBuffer);
+}
+
+inline Pothos::ManagedBuffer::ManagedBuffer(Impl *impl):
+    _impl(impl)
+{
+    if (_impl != nullptr) _impl->incr();
+}
+
+inline bool Pothos::operator==(const ManagedBuffer &lhs, const ManagedBuffer &rhs)
+{
+    return lhs._impl == rhs._impl;
+}
+
+inline bool Pothos::operator!=(const ManagedBuffer &lhs, const ManagedBuffer &rhs)
+{
+    return !(lhs == rhs);
+}

+ 287 - 0
include/Pothos/Framework/OutputPort.hpp

@@ -0,0 +1,287 @@
+///
+/// \file Framework/OutputPort.hpp
+///
+/// This file provides an interface for a worker's output port.
+///
+/// \copyright
+/// Copyright (c) 2014-2018 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Object/Object.hpp>
+#include <Pothos/Framework/DType.hpp>
+#include <Pothos/Framework/Label.hpp>
+#include <Pothos/Framework/BufferPool.hpp>
+#include <Pothos/Framework/BufferChunk.hpp>
+#include <Pothos/Framework/BufferManager.hpp>
+#include <Pothos/Util/RingDeque.hpp>
+#include <Pothos/Util/SpinLock.hpp>
+#include <string>
+
+namespace Pothos {
+
+class WorkerActor;
+class InputPort;
+
+/*!
+ * OutputPort provides methods to interact with a worker's output ports.
+ */
+class POTHOS_API OutputPort
+{
+public:
+
+    //! Destructor
+    ~OutputPort(void);
+
+    /*!
+     * Get the index number of this port.
+     * An index of -1 means the port cannot be represented by an integer.
+     * \return the index or -1
+     */
+    int index(void) const;
+
+    //! Get the string name identifier for this port.
+    const std::string &name(void) const;
+
+    //! Get a displayable name for this port.
+    const std::string &alias(void) const;
+
+    //! Set the displayable alias for this port.
+    void setAlias(const std::string &alias);
+
+    //! Get the data type information for this port.
+    const DType &dtype(void) const;
+
+    //! Get the domain information for this port
+    const std::string &domain(void) const;
+
+    /*!
+     * Get access to the stream buffer.
+     * For non-stream ports, this returns an empty buffer chunk.
+     */
+    const BufferChunk &buffer(void) const;
+
+    /*!
+     * Get the number of elements available in the stream buffer.
+     * The number of elements is the available bytes/dtype size.
+     */
+    size_t elements(void) const;
+
+    /*!
+     * Get the total number of elements produced from this port.
+     * The value returned by this method will not change
+     * until after execution of work() and propagateLabels().
+     */
+    unsigned long long totalElements(void) const;
+
+    /*!
+     * Get the total number of buffers produced from this port.
+     * This value will increment immediately after postBuffer().
+     * This call will also increment after every work execution
+     * where elements are produced using the produce() method.
+     */
+    unsigned long long totalBuffers(void) const;
+
+    /*!
+     * Get the total number of labels produced from this port.
+     * This value will increment immediately after postLabel().
+     */
+    unsigned long long totalLabels(void) const;
+
+    /*!
+     * Get the total number of messages posted to this port.
+     * The value returned by this method will be incremented
+     * immediately upon calling postMessage().
+     */
+    unsigned long long totalMessages(void) const;
+
+    /*!
+     * Produce elements from this port.
+     * The number of elements specified must be less than
+     * or equal to the number of elements available.
+     * \param numElements the number of elements to produce
+     */
+    void produce(const size_t numElements);
+
+    /*!
+     * Remove all or part of an output buffer from the port;
+     * without producing elements for downstream consumers.
+     * This call allows the user to use the output buffer
+     * for non-streaming purposes, such as an async message.
+     * The number of elements specified should be less than or
+     * equal to the available number elements on this port.
+     * \param numElements the number of elements to remove
+     */
+    void popElements(const size_t numElements);
+
+    /*!
+     * Get a buffer of a specified size in elements.
+     * The type of the buffer is specified by the port.
+     * Some blocks may require buffers of arbitrary size
+     * for use with postBuffer() and postMessage() calls.
+     * The call will attempt to use the front buffer from
+     * this output port and will fall-back to a reusable pool.
+     * \post buffer() has undefined behavior after this call.
+     * \param numElements the number of elements given the port's type
+     * \return a buffer chunk with the port's type and the specified length
+     */
+    BufferChunk getBuffer(const size_t numElements);
+
+    /*!
+     * Get a buffer of a specified size and type.
+     * This variant provides a user specified data type.
+     * \post buffer() has undefined behavior after this call.
+     * \param dtype the buffer's type (independent of port type)
+     * \param numElements the number of elements of type dtype
+     * \return a buffer chunk with the specified type and length
+     */
+    BufferChunk getBuffer(const DType &dtype, const size_t numElements);
+
+    /*!
+     * Post an output label to the subscribers on this port.
+     * postLabel also supports move and emplacement semantics.
+     * \code
+     * port->postLabel(label);
+     * port->postLabel(std::move(label));
+     * port->postLabel(id, data, index);
+     * \endcode
+     * \param label the label to post
+     */
+    template <typename... ValueType>
+    void postLabel(ValueType&&... label);
+
+    /*!
+     * Post an output message to the subscribers on this port.
+     * \param message the message to post
+     */
+    template <typename ValueType>
+    void postMessage(ValueType &&message);
+
+    /*!
+     * Construct a message from arguments and
+     * post it to the subscribers on this port.
+     * \code
+     * port->emplaceMessage<std::string>(ptr, len);
+     * \endcode
+     * \tparam T the type of the new message object
+     * \param args the constructor arguments for type T
+     */
+    template <typename T, typename... Args>
+    void emplaceMessage(Args&&... args);
+
+    /*!
+     * Post an output buffer to the subscribers on this port.
+     * This call allows external user-provided buffers to be used
+     * in place of the normal stream buffer provided by buffer().
+     * The number of elements to produce is determined from
+     * the buffer's length field divided by the dtype size.
+     * Do not call produce() when using postBuffer().
+     * \param buffer the buffer to post
+     */
+    template <typename ValueType>
+    void postBuffer(ValueType &&buffer);
+
+    /*!
+     * Set a reserve requirement on this output port.
+     * The reserve size ensures that when sufficient resources are available,
+     * the buffer will contain at least the specified number of elements.
+     * By default, each output port has a reserve of zero elements,
+     * which means that the output port's buffer may be any size,
+     * but not empty, depending upon the available resources.
+     * Note that work() may still be called when the reserve is not met,
+     * because the scheduler will only prevent work() from being called
+     * when any given port has no available output elements.
+     * \param numElements the number of elements to require
+     */
+    void setReserve(const size_t numElements);
+
+    /*!
+     * Is this port used for signaling in a signals + slots paradigm?
+     */
+    bool isSignal(void) const;
+
+    /*!
+     * Set read before write on this output port.
+     * Read before write indicates that an element will be read from the input
+     * before a corresponding element is written to an element from this output.
+     *
+     * This property implies that the input buffer can be used
+     * as an output buffer duing a call to the work operation.
+     * Also referred to as buffer inlining, the intention is to
+     * keep more memory in cache by using the same buffer
+     * for both reading and writing operations when possible.
+     *
+     * When this "read before write" property is enabled,
+     * and the only reference to the buffer is held by the input port,
+     * and the size of the input elements is the same as the output.
+     * then the input buffer may be substituted for an output buffer.
+     *
+     * \param port the input port to borrow the buffer from
+     */
+    void setReadBeforeWrite(InputPort *port);
+
+private:
+    WorkerActor *_actor;
+
+    //port configuration
+    bool _isSignal;
+    int _index;
+    std::string _name;
+    std::string _alias;
+    DType _dtype;
+
+    //state set in pre-work
+    std::string _domain;
+    BufferChunk _buffer;
+    size_t _elements;
+
+    //port stats
+    unsigned long long _totalElements;
+    unsigned long long _totalBuffers;
+    unsigned long long _totalLabels;
+    unsigned long long _totalMessages;
+
+    //state changes from work
+    size_t _pendingElements;
+    size_t _reserveElements;
+    std::vector<Label> _postedLabels;
+    Util::RingDeque<BufferChunk> _postedBuffers;
+
+    //counts work actions which we will use to establish activity
+    size_t _workEvents;
+
+    Util::SpinLock _bufferManagerLock;
+    BufferManager::Sptr _bufferManager;
+
+    Util::SpinLock _tokenManagerLock;
+    BufferManager::Sptr _tokenManager; //used for message backpressure
+
+    /////// buffer manager /////////
+    void bufferManagerSetup(const BufferManager::Sptr &manager);
+    bool bufferManagerEmpty(void);
+    void bufferManagerFront(BufferChunk &);
+    void bufferManagerPop(const size_t numBytes);
+    void bufferManagerPush(Pothos::Util::SpinLock *mutex, const ManagedBuffer &buff);
+
+    /////// token manager /////////
+    void tokenManagerInit(void);
+    bool tokenManagerEmpty(void);
+    BufferChunk tokenManagerPop(void);
+    void tokenManagerPop(const size_t numBytes);
+
+    std::vector<InputPort *> _subscribers;
+    InputPort *_readBeforeWritePort;
+    bool _bufferFromManager;
+    BufferPool _bufferPool;
+
+    OutputPort(void);
+    OutputPort(const OutputPort &) = delete; // non construction-copyable
+    OutputPort &operator=(const OutputPort &) = delete; // non copyable
+    friend class WorkerActor;
+    friend class InputPort;
+    void _postMessage(const Object &message);
+};
+
+} //namespace Pothos

+ 172 - 0
include/Pothos/Framework/OutputPortImpl.hpp

@@ -0,0 +1,172 @@
+///
+/// \file Framework/OutputPortImpl.hpp
+///
+/// Inline member implementation for OutputPort class.
+///
+/// \copyright
+/// Copyright (c) 2014-2018 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Framework/OutputPort.hpp>
+#include <mutex> //lock_guard
+
+inline int Pothos::OutputPort::index(void) const
+{
+    return _index;
+}
+
+inline const std::string &Pothos::OutputPort::name(void) const
+{
+    return _name;
+}
+
+inline const Pothos::DType &Pothos::OutputPort::dtype(void) const
+{
+    return _dtype;
+}
+
+inline const std::string &Pothos::OutputPort::domain(void) const
+{
+    return _domain;
+}
+
+inline const Pothos::BufferChunk &Pothos::OutputPort::buffer(void) const
+{
+    return _buffer;
+}
+
+inline size_t Pothos::OutputPort::elements(void) const
+{
+    return _elements;
+}
+
+inline unsigned long long Pothos::OutputPort::totalElements(void) const
+{
+    return _totalElements;
+}
+
+inline unsigned long long Pothos::OutputPort::totalBuffers(void) const
+{
+    return _totalBuffers;
+}
+
+inline unsigned long long Pothos::OutputPort::totalLabels(void) const
+{
+    return _totalLabels;
+}
+
+inline unsigned long long Pothos::OutputPort::totalMessages(void) const
+{
+    return _totalMessages;
+}
+
+inline void Pothos::OutputPort::produce(const size_t numElements)
+{
+    _pendingElements += numElements;
+}
+
+inline Pothos::BufferChunk Pothos::OutputPort::getBuffer(const size_t numElements)
+{
+    return this->getBuffer(_dtype, numElements);
+}
+
+inline bool Pothos::OutputPort::isSignal(void) const
+{
+    return _isSignal;
+}
+
+inline void Pothos::OutputPort::setReadBeforeWrite(InputPort *port)
+{
+    _readBeforeWritePort = port;
+}
+
+template <typename ValueType>
+void Pothos::OutputPort::postMessage(ValueType &&message)
+{
+    Pothos::OutputPort::_postMessage(Pothos::Object(std::forward<ValueType>(message)));
+}
+
+template <typename T, typename... Args>
+void Pothos::OutputPort::emplaceMessage(Args&&... args)
+{
+    Pothos::OutputPort::_postMessage(Pothos::Object::emplace<T>(std::forward<Args>(args)...));
+}
+
+inline void Pothos::OutputPort::popElements(const size_t numElements)
+{
+    this->bufferManagerPop(numElements*this->dtype().size());
+    _workEvents++;
+}
+
+template <typename ValueType>
+inline void Pothos::OutputPort::postBuffer(ValueType &&buffer)
+{
+    auto &queue = _postedBuffers;
+    if (queue.full()) queue.set_capacity(queue.size()*2);
+    auto &r = queue.emplace_back(std::forward<ValueType>(buffer));
+
+    //unspecified buffer dtype? copy it from the port
+    if (not r.dtype) r.dtype = this->dtype();
+
+    _totalElements += r.elements();
+    _totalBuffers++;
+    _workEvents++;
+}
+
+template <typename... ValueType>
+inline void Pothos::OutputPort::postLabel(ValueType&&... label)
+{
+    _postedLabels.emplace_back(std::forward<ValueType>(label)...);
+    _postedLabels.back().adjust(this->dtype().size(), 1);
+    _totalLabels++;
+    _workEvents++;
+}
+
+inline void Pothos::OutputPort::setReserve(const size_t numElements)
+{
+    //only mark this change when setting a larger reserve
+    if (numElements > _reserveElements) _workEvents++;
+
+    _reserveElements = numElements;
+}
+
+inline bool Pothos::OutputPort::bufferManagerEmpty(void)
+{
+    std::lock_guard<Util::SpinLock> lock(_bufferManagerLock);
+    return not _bufferManager or _bufferManager->empty();
+}
+
+inline void Pothos::OutputPort::bufferManagerFront(Pothos::BufferChunk &buff)
+{
+    std::lock_guard<Util::SpinLock> lock(_bufferManagerLock);
+    buff = _bufferManager?_bufferManager->front():Pothos::BufferChunk();
+}
+
+inline void Pothos::OutputPort::bufferManagerPop(const size_t numBytes)
+{
+    std::lock_guard<Util::SpinLock> lock(_bufferManagerLock);
+    return _bufferManager->pop(numBytes);
+}
+
+inline bool Pothos::OutputPort::tokenManagerEmpty(void)
+{
+    std::lock_guard<Util::SpinLock> lock(_tokenManagerLock);
+    return not _tokenManager or _tokenManager->empty();
+}
+
+inline Pothos::BufferChunk Pothos::OutputPort::tokenManagerPop(void)
+{
+    std::lock_guard<Util::SpinLock> lock(_tokenManagerLock);
+    if (_tokenManager->empty()) return Pothos::BufferChunk();
+    auto tok = _tokenManager->front();
+    _tokenManager->pop(0);
+    return tok;
+}
+
+inline void Pothos::OutputPort::tokenManagerPop(const size_t numBytes)
+{
+    std::lock_guard<Util::SpinLock> lock(_tokenManagerLock);
+    return _tokenManager->pop(numBytes);
+}

+ 58 - 0
include/Pothos/Framework/Packet.hpp

@@ -0,0 +1,58 @@
+///
+/// \file Framework/Packet.hpp
+///
+/// Definition for packet type found in asynchronous messages.
+///
+/// \copyright
+/// Copyright (c) 2014-2014 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Object/Containers.hpp>
+#include <Pothos/Framework/Label.hpp>
+#include <Pothos/Framework/BufferChunk.hpp>
+#include <string>
+#include <vector>
+
+namespace Pothos {
+
+/*!
+ * The Packet type is a general-purpose structure for asynchronous messages.
+ * A Packet contains a payload buffer with associated metadata and labels.
+ * Ideally, the Packet structure is a suitable container for most situations.
+ */
+struct POTHOS_API Packet
+{
+    //! Default constructor for Packet
+    Packet(void);
+
+    /*!
+     * The buffer payload for this message.
+     * The payload is just a memory buffer and a length in bytes.
+     * Payload can contains a slice of a continuous byte stream,
+     * a UDP datagram, a packet in a MAC layer protocol, etc...
+     * The interpretation of this payload buffer is up to the user.
+     */
+    BufferChunk payload;
+
+    /*!
+     * Arbitrary metadata for this message.
+     * Use metadata to associate arbitrary information with the payload.
+     * The are no specific requirements about what goes into metadata.
+     * The metadata structure is a dictionary of key-value pairs,
+     * where the keys for this dictionary are exclusively strings,
+     * and the values are opaque Objects which can contain anything.
+     */
+    ObjectKwargs metadata;
+
+    /*!
+     * Labels associated with the payload.
+     * Each label index is an element-offset relative to the start of the payload.
+     * The element size can be determined from the type of the payload buffer.
+     */
+    std::vector<Label> labels;
+};
+
+} //namespace Pothos

+ 209 - 0
include/Pothos/Framework/SharedBuffer.hpp

@@ -0,0 +1,209 @@
+///
+/// \file Framework/SharedBuffer.hpp
+///
+/// The shared buffer is an RAII buffer that automatically deallocates.
+///
+/// \copyright
+/// Copyright (c) 2013-2017 Josh Blum
+///                    2019 Nicholas Corgan
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <memory> //shared_ptr
+
+namespace Pothos {
+
+/*!
+ * The SharedBuffer represents the combination of address and length,
+ * and a shared pointer that will automatically cleanup the memory.
+ */
+class POTHOS_API SharedBuffer
+{
+public:
+
+    //! Get a const reference to a null/empty SharedBuffer
+    static const SharedBuffer &null(void);
+
+    //! Create a null SharedBuffer
+    SharedBuffer(void);
+
+    /*!
+     * Create a SharedBuffer given a length in bytes.
+     * This factory allocates memory which is held by the SharedBuffer.
+     * When the SharedBuffer is deleted, the memory will be freed as well.
+     * The node affinity is used to allocate physical memory on a NUMA node.
+     *
+     * \param numBytes the number of bytes to allocate in this buffer
+     * \param nodeAffinity which NUMA node to allocate on (-1 for don't care)
+     * \return a new shared buffer object
+     */
+    static SharedBuffer make(const size_t numBytes, const long nodeAffinity = -1);
+
+    /*!
+     * Create a circular SharedBuffer given a length in bytes.
+     * The rules for the circular or double mapping are as follows:
+     * for i in 0 to length-1: address + i == address + i + length
+     *
+     * This factory allocates memory which is held by the SharedBuffer.
+     * When the SharedBuffer is deleted, the memory will be freed as well.
+     * The node affinity is used to allocate physical memory on a NUMA node.
+     *
+     * \param numBytes the number of bytes to allocate in this buffer
+     * \param nodeAffinity which NUMA node to allocate on (-1 for don't care)
+     * \return a new circular shared buffer object
+     */
+    static SharedBuffer makeCirc(const size_t numBytes, const long nodeAffinity = -1);
+
+    /*!
+     * Create a SharedBuffer from address, length, and the container.
+     * The container is any object that can be put into a shared_ptr.
+     * When the shared pointer is deleted, the container's destructor
+     * (written by the user) should handle the cleanup of the memory.
+     */
+    SharedBuffer(const size_t address, const size_t length, std::shared_ptr<void> container);
+
+    /*!
+     * Create a sub-buffer that is a subset of the buffer.
+     * The shared container is copied so the sub-buffer holds a reference.
+     * \throws SharedBufferError if the parameters would be out of bounds
+     * \param address an address within the buffer
+     * \param length the new length of the sub buffer
+     * \param buffer a shared buffer which is a superset of this new one
+     */
+    SharedBuffer(const size_t address, const size_t length, const SharedBuffer &buffer);
+
+    //! Get the address of the first byte of the buffer
+    size_t getAddress(void) const;
+
+    //! Get the length of the buffer in bytes
+    size_t getLength(void) const;
+
+    /*!
+     * Get the alias address (non-zero for circular buffers).
+     * Address and alias will point to the same physical memory.
+     */
+    size_t getAlias(void) const;
+
+    /*!
+     * Get the alias offset (non-zero for circular buffers).
+     * Address and alias will point to the same physical memory.
+     */
+    size_t getAliasOffset(void) const;
+
+    /*!
+     * Set the alias address (non-zero for circular buffers).
+     * Address and alias will point to the same physical memory.
+     */
+    void setAlias(const size_t alias);
+
+    /*!
+     * Get the end address - front address + length.
+     * The end address is non-inclusive.
+     * \return the end address
+     */
+    size_t getEnd(void) const;
+
+    /*!
+     * Is this instance of this shared buffer unique?
+     * \return true if this is the only copy
+     */
+    bool unique(void) const;
+
+    /*!
+     * The number of copies of this shared buffer.
+     */
+    size_t useCount(void) const;
+
+    /*!
+     * Is this shared buffer valid?
+     */
+    explicit operator bool(void) const;
+
+    /*!
+     * Get access to the underlying memory container.
+     */
+    const std::shared_ptr<void> &getContainer(void) const;
+
+private:
+    static SharedBuffer makeCircUnprotected(const size_t numBytes, const long nodeAffinity);
+    size_t _address;
+    size_t _length;
+    size_t _alias;
+    std::shared_ptr<void> _container;
+};
+
+/*!
+ * Equality operator for SharedBuffer.
+ * True when the containers are identical.
+ */
+inline bool operator==(const SharedBuffer &lhs, const SharedBuffer &rhs);
+
+/*!
+ * Inquality operator for SharedBuffer.
+ * True when the containers are not identical.
+ */
+inline bool operator!=(const SharedBuffer &lhs, const SharedBuffer &rhs);
+
+} //namespace Pothos
+
+inline size_t Pothos::SharedBuffer::getAddress(void) const
+{
+    return _address;
+}
+
+inline size_t Pothos::SharedBuffer::getLength(void) const
+{
+    return _length;
+}
+
+inline size_t Pothos::SharedBuffer::getAlias(void) const
+{
+    return _alias;
+}
+
+inline size_t Pothos::SharedBuffer::getAliasOffset(void) const
+{
+    return _alias ? _alias - _address : 0;
+}
+
+inline void Pothos::SharedBuffer::setAlias(const size_t alias)
+{
+    _alias = alias;
+}
+
+inline size_t Pothos::SharedBuffer::getEnd(void) const
+{
+    return _address + _length;
+}
+
+inline bool Pothos::SharedBuffer::unique(void) const
+{
+    return _container.unique();
+}
+
+inline size_t Pothos::SharedBuffer::useCount(void) const
+{
+    return _container.use_count();
+}
+
+inline Pothos::SharedBuffer::operator bool(void) const
+{
+    return bool(_container);
+}
+
+inline const std::shared_ptr<void> &Pothos::SharedBuffer::getContainer(void) const
+{
+    return _container;
+}
+
+inline bool Pothos::operator==(const SharedBuffer &lhs, const SharedBuffer &rhs)
+{
+    return lhs.getContainer() == rhs.getContainer();
+}
+
+inline bool Pothos::operator!=(const SharedBuffer &lhs, const SharedBuffer &rhs)
+{
+    return !(lhs == rhs);
+}

+ 156 - 0
include/Pothos/Framework/ThreadPool.hpp

@@ -0,0 +1,156 @@
+///
+/// \file Framework/ThreadPool.hpp
+///
+/// Support for configuring and managing threading in the framework.
+///
+/// \copyright
+/// Copyright (c) 2014-2016 Josh Blum
+///                    2019 Nicholas Corgan
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <memory>
+#include <string>
+#include <vector>
+#include <cstddef>
+
+namespace Pothos {
+
+/*!
+ * Arguments used to configure a ThreadPool.
+ */
+class POTHOS_API ThreadPoolArgs
+{
+public:
+
+    //! Create a default ThreadPoolArgs
+    ThreadPoolArgs(void);
+
+    //! Create a ThreadPoolArgs given a specific number of threads
+    ThreadPoolArgs(const size_t numThreads);
+
+    /*!
+     * Create a ThreadPoolArgs from a JSON description.
+     * All fields are optional and have defined defaults.
+     *
+     * Example JSON markup for a ThreadPoolArgs description:
+     * \code {.json}
+     * {
+     *     "numThreads" : 2,
+     *     "priority" : 0.5,
+     *     "affinityMode" : "CPU",
+     *     "affinity" : [0, 2, 4, 6],
+     *     "yieldMode" : "SPIN"
+     * }
+     * \endcode
+     * \param json a JSON object markup string
+     */
+    ThreadPoolArgs(const std::string &json);
+
+    /*!
+     * The number of threads to create in this pool.
+     * The default value is 0, indicating the thread-per-block mechanic.
+     * Positive values for numThreads indicate the thread-pool mechanic.
+     */
+    size_t numThreads;
+
+    /*!
+     * Scheduling priority for all threads in the pool.
+     * The value can be in range -1.0 to 1.0.
+     * A value of 0.0 is the default thread scheduling.
+     * Positive values enable realtime scheduling mode.
+     * Negative values enable sub-priority scheduling.
+     *
+     * The default is 0.0 (normal).
+     */
+    double priority;
+
+    /*!
+     * The affinity mode for this thread pool.
+     * The affinityMode string can have the following values:
+     *
+     *  - "ALL" - affinitize to all available CPUs
+     *  - "CPU" - affinity list specifies CPUs
+     *  - "NUMA" - affinity list specifies NUMA nodes
+     *
+     * The default is "ALL".
+     */
+    std::string affinityMode;
+
+    //! A list of CPUs or NUMA nodes (depends on mode setting)
+    std::vector<size_t> affinity;
+
+    /*!
+     * The yieldMode specifies the internal threading mechanisms:
+     * 
+     *  - "CONDITION" - Threads wait on condition variables when no work is available.
+     *  - "HYBRID" - Threads spin for a while, then yield to other threads, when no work is available.
+     *  - "SPIN" - Threads busy-wait, without yielding, when no work is available.
+     *
+     * The default is "CONDITION".
+     */
+    std::string yieldMode;
+};
+
+/*!
+ * A ThreadPool manages a group of threads that perform work in a Topology.
+ * Not only can users configure the number of threads,
+ * but there are a variety of other settings such as affinity,
+ * real-time priority, and internal threading mechanisms.
+ *
+ * The thread pool can operate in two major modes:
+ *
+ *  - When numThreads is specified to be zero,
+ *    the thread pool is in thread-per-block mode.
+ *    Each block that is associated with this thread pool gets its own
+ *    dedicated thread spawned explicitly for its execution alone.
+ *
+ *  - Positive values for numThreads indicate pool-mode where a
+ *    fixed number of threads operate on the blocks in a round-robin fashion.
+ *    The thread pool will never spawn more threads than there are blocks.
+ */
+class POTHOS_API ThreadPool
+{
+public:
+
+    //! Create a null ThreadPool
+    ThreadPool(void);
+
+    //! Create a ThreadPool from an opaque shared_ptr
+    ThreadPool(const std::shared_ptr<void> &);
+
+    /*!
+     * Create a new ThreadPool from args.
+     * \param args the configuration struct
+     * \throws ThreadPoolError on bad values
+     */
+    ThreadPool(const ThreadPoolArgs &args);
+
+    /*!
+     * Is this thread pool valid/non-empty?
+     * \return true when the thread poll is non-null
+     */
+    explicit operator bool(void) const;
+
+    /*!
+     * Get access to the underlying container for the thread pool.
+     * \return an opaque shared_ptr to the internal object
+     */
+    const std::shared_ptr<void> &getContainer(void) const;
+
+private:
+    std::shared_ptr<void> _impl;
+};
+
+//! Are these two thread pools the same?
+POTHOS_API bool operator==(const ThreadPool &lhs, const ThreadPool &rhs);
+
+//! Are these two thread pool different?
+inline bool operator!=(const ThreadPool &lhs, const ThreadPool &rhs)
+{
+    return !(lhs == rhs);
+}
+
+} //namespace Pothos

+ 395 - 0
include/Pothos/Framework/Topology.hpp

@@ -0,0 +1,395 @@
+///
+/// \file Framework/Topology.hpp
+///
+/// This file contains the interface for creating a topology of blocks.
+///
+/// \copyright
+/// Copyright (c) 2014-2019 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <Pothos/Framework/Connectable.hpp>
+#include <Pothos/Framework/ThreadPool.hpp>
+#include <Pothos/Object/Object.hpp>
+#include <string>
+#include <memory>
+#include <iosfwd>
+
+namespace Pothos {
+
+/*!
+ * The Topology class maintains a list of data flows.
+ * The source of a flow is an output port on a Block or Topology.
+ * The destination of a flow is an input port on a Block or Topology.
+ * To create and destroy flows, make calls to connect and disconnect.
+ * To create hierarchy, a topology's connections can be made with itself;
+ * this action creates input and output ports for the topology.
+ */
+class POTHOS_API Topology : public Connectable
+{
+public:
+
+    /*!
+     * Create a new empty topology in a shared ptr.
+     * This is a convenience factory for Topology.
+     */
+    static std::shared_ptr<Topology> make(void);
+
+    /*!
+     * Create a topology from a JSON description.
+     *
+     * <h2>JSON fields</h2>
+     *
+     * The topology is a JSON object with fields to describe
+     * thread pools, global variables, blocks, and connections.
+     *
+     * <h3>Thread pools</h3>
+     * The "threadPools" field is an optional JSON object
+     * where each entry contains thread pool arguments which are
+     * documented by the ThreadPoolArgs JSON markup constructor.
+     * A block can be associated to a particular thread pool
+     * using the optional "threadPool" key and a pool name.
+     * The special thread pool with empty name "" will apply
+     * to all blocks that do not specify the "threadPool" key.
+     *
+     * <h3>Global variables</h3>
+     * The "globals" field is an optional JSON array
+     * where each entry is an object containing a variable name
+     * and value. The order of global variables matters here,
+     * because one global can reference another in an expression.
+     *
+     * <h3>Blocks</h3>
+     * The "blocks" field is an array of JSON objects,
+     * each of which describes a block by path,
+     * constructor args, and method calls.
+     * - The "id" of each block must be unique
+     *   and will be referenced by the connections.
+     * - The "path" is the registered block factory path.
+     * - The "args" is a list of constructor arguments.
+     * - The "calls" is a list of ordered method calls.
+     *   Each specified by the call name then arguments.
+     * - The "threadPool" specifies an optional thread pool by name
+     *
+     * <h3>Connections</h3>
+     * The "connections" field is an array of JSON arrays,
+     * where each array specifies a connection with source and destination ID and port name.
+     * The IDs are strings, but the port names can either be numbers or strings.
+     * Each connection entry has the following fields in order:
+     *  - source ID
+     *  - source port
+     *  - destination ID
+     *  - destination port
+     *
+     * <h2>Using expressions</h2>
+     *
+     * Global variable values and block arguments support expression parsing.
+     * The parser allows these values to be native JSON types:
+     * integers, floats, string, booleans, arrays, and objects.
+     * But they can also be strings containing expressions that
+     * make use of the global variables.
+     *
+     * Because string can ambiguously represent actual strings
+     * and expressions. Every string is parsed as an expression
+     * and will fall-back to a regular unparsed string type
+     * if the parser fails to perform the evaluation.
+     * To literally pass a string argument that contains an expression
+     * that would be evaluated by the parser, simply use escaped quotes:
+     *
+     * \code {.json}
+     * {"name" : "escapedExpr", "value" : "\"1+1\""}
+     * \endcode
+     *
+     * <h2>Example markup</h2>
+     *
+     * Example JSON markup for a topology description:
+     * \code {.json}
+     * {
+     *     "threadPools" : {
+     *         "default" : {"priority" : 0.5},
+     *         "myPool0" : {"yieldMode" : "SPIN"}
+     *     },
+     *     "globals" : [
+     *          {"name" : "fiz", "value" : 3.14},
+     *          {"name" : "baz", "value" : "-fiz"}
+     *     ],
+     *     "blocks" : [
+     *         {
+     *             "id" : "id0",
+     *             "path" : "/blocks/foo",
+     *             "args" : [1, "hello"],
+     *             "calls" : [
+     *                 ["setFoo", true],
+     *                 ["updateBaz", "baz"]
+     *             ]
+     *         },
+     *         {
+     *             "id" : "id1",
+     *             "path" : "/blocks/bar",
+     *             "threadPool" : "myPool0",
+     *             "args" : [],
+     *             "calls" : [
+     *                 ["setBar", "OK"],
+     *             ]
+     *         }
+     *     ],
+     *     "connections", [
+     *         ["self", "inputX", "id0", "in0"],
+     *         ["id0", "out0", "id1", "in0"],
+     *         ["id1", "out0", "self", "outputY"],
+     *     ]
+     * }
+     * \endcode
+     * \param json a JSON formatted string
+     */
+    static std::shared_ptr<Topology> make(const std::string &json);
+
+    //! Create a new empty topology
+    Topology(void);
+
+    /*!
+     * Cleanup and destroy a topology.
+     * This call simply disconnects all data flows and commits the changes.
+     */
+    ~Topology(void);
+
+    //! Set the thread pool used by all blocks in this topology.
+    void setThreadPool(const ThreadPool &threadPool);
+
+    //! Get the thread pool used by all blocks in this topology.
+    const ThreadPool &getThreadPool(void) const;
+
+    /*!
+     * Set the displayable alias for the specified input port.
+     */
+    void setInputAlias(const std::string &portName, const std::string &alias);
+
+    /*!
+     * Set the displayable alias for the specified output port.
+     */
+    void setOutputAlias(const std::string &portName, const std::string &alias);
+
+    /*!
+     * Get a vector of info about all of the input ports available.
+     */
+    std::vector<PortInfo> inputPortInfo(void);
+
+    /*!
+     * Get a vector of info about all of the output ports available.
+     */
+    std::vector<PortInfo> outputPortInfo(void);
+
+    /*!
+     * Commit changes made to the topology.
+     * Actual data flows created by connect and disconnect
+     * are not changed until a call to commit() is performed.
+     * Once commit is called, actual data flow processing begins.
+     * At this point the scheduler will call the block's work()
+     * functions when the data at its inputs becomes available.
+     */
+    void commit(void);
+
+    /*!
+     * Wait for a period of data flow inactivity.
+     * This call blocks until all flows become inactive for at least idleDuration seconds.
+     * This call is intended primarily for unit testing purposes to allow the topology
+     * to propagate test data through the entire flow from sources to sinks.
+     * Use a timeout value of 0.0 to wait forever for topology to become idle.
+     * \param idleDuration the maximum number of seconds that flows may idle
+     * \param timeout the maximum number of seconds to wait in this call
+     * \return true if the flow graph became inactive before the timeout
+     */
+    bool waitInactive(const double idleDuration = 0.1, const double timeout = 1.0);
+
+    /*!
+     * Create a connection between a source port and a destination port.
+     * \param src the data source (local/remote block/topology)
+     * \param srcPort an identifier for the source port (string or index)
+     * \param dst the data destination (local/remote block/topology)
+     * \param dstPort an identifier for the destination port (string or index)
+     */
+    template <
+        typename SrcType, typename SrcPortType,
+        typename DstType, typename DstPortType>
+    void connect(
+        SrcType &&src, const SrcPortType &srcPort,
+        DstType &&dst, const DstPortType &dstPort);
+
+    /*!
+     * Remove a connection between a source port and a destination port.
+     * \param src the data source (local/remote block/topology)
+     * \param srcPort an identifier for the source port (string or index)
+     * \param dst the data destination (local/remote block/topology)
+     * \param dstPort an identifier for the destination port (string or index)
+     */
+    template <
+        typename SrcType, typename SrcPortType,
+        typename DstType, typename DstPortType>
+    void disconnect(
+        SrcType &&src, const SrcPortType &srcPort,
+        DstType &&dst, const DstPortType &dstPort);
+
+    /*!
+     * Disconnect all data flows inside this topology.
+     * This call can be recursive and will disconnect all
+     * on the other sub-topologies within this data flow.
+     * No changes to the data flow occur until commit().
+     * \param recursive true to recurse through sub-topologies
+     */
+    void disconnectAll(const bool recursive = false);
+
+    //! Create a connection between a source port and a destination port.
+    void _connect(
+        const Object &src, const std::string &srcPort,
+        const Object &dst, const std::string &dstPort);
+
+    //! Remove a connection between a source port and a destination port.
+    void _disconnect(
+        const Object &src, const std::string &srcPort,
+        const Object &dst, const std::string &dstPort);
+
+    /*!
+     * Export a function call on this topology to set/get parameters.
+     * This call will automatically register a slot of the same name.
+     * \param name the name of the callable
+     * \param call the bound callable method
+     */
+    void registerCallable(const std::string &name, const Callable &call);
+
+    /*!
+     * Query performance statistics for all blocks in the topology.
+     *
+     * Example JSON markup for stats reporting:
+     * (The actual stats markup has many more fields.)
+     * \code {.json}
+     * {
+     *     "unique_id_of_blockA" : {
+     *         "blockName" : "blockA",
+     *         "numWorkCalls" : 12345,
+     *         "outputStats" : [
+     *              {"portName" : "0", totalElements : 42},
+     *         ]
+     *     },
+     *     "unique_id_of_blockB" : {
+     *         "blockName" : "blockB",
+     *         "numWorkCalls" : 6789,
+     *         "inputStats" : [
+     *              {"portName" : "0", totalElements : 0},
+     *              {"portName" : "1", totalElements : 100}
+     *         ]
+     *     }
+     * }
+     * \endcode
+     *
+     * \return a JSON formatted object string
+     */
+    std::string queryJSONStats(void);
+
+    /*!
+     * Dump the topology state to a JSON formatted string.
+     * This call provides a structured view of the hierarchy.
+     *
+     * Example request object {"mode" : "flat"}
+     *
+     * Mode options:
+     *  - "flat": Flattened hierarchies - only processing blocks.
+     *  - "top": Only top-level blocks without hierarchy traversal.
+     *  - "rendered": Flattened hierarchies with traversal blocks.
+     *
+     * Example JSON markup for presenting the topology:
+     * \code {.json}
+     * {
+     *     "blocks" : {
+     *         "uidblockA" : {
+     *             "name" : "blockA",
+     *             "outputs" : [
+     *                 {"name": "outx", "isSigSlot": false}
+     *             ]
+     *         },
+     *         "uidblockB" : {
+     *             "name" : "blockB",
+     *             "inputs" : [
+     *                 {"name": "in0", "isSigSlot": false},
+     *                 {"name": "setFoo", "isSigSlot": true}
+     *             ],
+     *             "outputs" : [
+     *                 {"name": "out0", "isSigSlot": false},
+     *                 {"name": "barChanged", "isSigSlot": true}
+     *             ]
+     *         },
+     *         "uidblockC" : {
+     *             "name" : "blockC",
+     *             "inputs" : [
+     *                 {"name": "iny", "isSigSlot": false}
+     *             ],
+     *             "blocks" : {#this is a hierarchy of blocks#},
+     *             "connections" : {#this is a hierarchy of blocks#},
+     *         }
+     *     },
+     *     "connections", [
+     *         {"srcId": "uidblockA", "srcName": "outx", "dstId": "uidblockB", "srcName": "in0"},
+     *         {"srcId": "uidblockB", "srcName": "out0", "dstId": "uidblockC", "srcName": "iny"}
+     *     ]
+     * }
+     * \endcode
+     *
+     * \param request a JSON object string with key/value arguments
+     * \return a JSON formatted object string
+     */
+    std::string dumpJSON(const std::string &request = "{}");
+
+    /*!
+     * Convert the topology to a string containing dot markup.
+     * This markup can be passed into the dot tool to create a visual graph.
+     * The markup can represent the connections as specified by the user,
+     * or if flat is true, the complete flattened topology with
+     * network blocks for crossing process/computer boundaries.
+     *
+     * Example request string {"mode" : "flat", "port" : "all"}
+     *
+     * Mode options:
+     *  - "flat": Flattened hierarchies - only processing blocks.
+     *  - "top": Only top-level blocks without hierarchy traversal.
+     *  - "rendered": Flattened hierarchies with traversal blocks.
+     *
+     * Port options:
+     *  - "all" Show all available IO ports.
+     *  - "connected" Show connected ports only.
+     *
+     * \param request a JSON object string with configuration parameters
+     * \return the dot markup as a string
+     */
+    std::string toDotMarkup(const std::string &request = "{}");
+
+    /*!
+     * Call a method on a derived instance with opaque input and return types.
+     * \param name the name of the method as a string
+     * \param inputArgs an array of input arguments
+     * \param numArgs the size of the input array
+     * \return the return value as type Object
+     */
+    Object opaqueCallMethod(const std::string &name, const Object *inputArgs, const size_t numArgs) const;
+
+protected:
+    /*!
+     * The opaque call handler handles dispatching calls to registered methods.
+     * The user may overload this call to install their own custom handler.
+     * \throws BlockCallNotFound when no call registered for the provided name
+     * \throws Exception when the registered call itself throws an exception
+     * \param name the name of a call registered to this Block with registerCall()
+     * \param inputArgs an array of input arguments wrapped in type Object
+     * \param numArgs the number of arguments in the array inputArgs
+     * \return the result of making the registered call, wrapped in type Object
+     */
+    virtual Object opaqueCallHandler(const std::string &name, const Object *inputArgs, const size_t numArgs);
+
+private:
+    Topology(const Topology &){} // non construction-copyable
+    Topology &operator=(const Topology &){return *this;} // non copyable
+public:
+    struct Impl;
+    std::shared_ptr<Impl> _impl;
+};
+
+} //namespace Pothos

+ 127 - 0
include/Pothos/Framework/TopologyImpl.hpp

@@ -0,0 +1,127 @@
+///
+/// \file Framework/TopologyImpl.hpp
+///
+/// Templated implementation details for the Topology class.
+///
+/// \copyright
+/// Copyright (c) 2014-2014 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Framework/Topology.hpp>
+#include <Pothos/Framework/ConnectableImpl.hpp>
+#include <type_traits> //enable_if
+
+namespace Pothos {
+
+class Block; //forward declare for templates below
+class Proxy; //forward declare for templates below
+
+namespace Detail {
+
+/***********************************************************************
+ * templated conversions for connectable objects - blocks
+ **********************************************************************/
+template <typename T>
+typename std::enable_if<std::is_base_of<Block, T>::value, Pothos::Object>::type
+connObjToObject(T &value)
+{
+    return Pothos::Object(&static_cast<Block &>(value));
+}
+
+template <typename T>
+typename std::enable_if<std::is_base_of<Block, T>::value, Pothos::Object>::type
+connObjToObject(T *value)
+{
+    return Pothos::Object(static_cast<Block *>(value));
+}
+
+template <typename T>
+typename std::enable_if<std::is_base_of<Block, T>::value, Pothos::Object>::type
+connObjToObject(std::shared_ptr<T> value)
+{
+    return Pothos::Object(std::static_pointer_cast<Block>(value));
+}
+
+/***********************************************************************
+ * templated conversions for connectable objects - topologies
+ **********************************************************************/
+template <typename T>
+typename std::enable_if<std::is_base_of<Topology, T>::value, Pothos::Object>::type
+connObjToObject(T &value)
+{
+    return Pothos::Object(&static_cast<Topology &>(value));
+}
+
+
+template <typename T>
+typename std::enable_if<std::is_base_of<Topology, T>::value, Pothos::Object>::type
+connObjToObject(T *value)
+{
+    return Pothos::Object(static_cast<Topology *>(value));
+}
+
+template <typename T>
+typename std::enable_if<std::is_base_of<Topology, T>::value, Pothos::Object>::type
+connObjToObject(std::shared_ptr<T> value)
+{
+    return Pothos::Object(std::static_pointer_cast<Topology>(value));
+}
+
+/***********************************************************************
+ * templated conversions for connectable objects - proxies
+ **********************************************************************/
+template <typename T>
+typename std::enable_if<std::is_same<Proxy, T>::value, Pothos::Object>::type
+connObjToObject(const T &value)
+{
+    return Pothos::Object(value);
+}
+
+/***********************************************************************
+ * templated conversions for port names
+ **********************************************************************/
+template <typename T>
+typename std::enable_if<std::is_integral<T>::value, std::string>::type
+portNameToStr(const T &value)
+{
+    return std::to_string(value);
+}
+
+template <typename T>
+typename std::enable_if<!std::is_integral<T>::value, std::string>::type
+portNameToStr(const T &value)
+{
+    return std::string(value);
+}
+
+} //namespace Detail
+} //namespace Pothos
+
+/***********************************************************************
+ * templated implementation for connect and disconnect
+ **********************************************************************/
+template <
+    typename SrcType, typename SrcPortType,
+    typename DstType, typename DstPortType>
+void Pothos::Topology::connect(
+    SrcType &&src, const SrcPortType &srcPort,
+    DstType &&dst, const DstPortType &dstPort)
+{
+    this->_connect(
+        Detail::connObjToObject(src), Detail::portNameToStr(srcPort),
+        Detail::connObjToObject(dst), Detail::portNameToStr(dstPort));
+}
+
+template <
+    typename SrcType, typename SrcPortType,
+    typename DstType, typename DstPortType>
+void Pothos::Topology::disconnect(
+    SrcType &&src, const SrcPortType &srcPort,
+    DstType &&dst, const DstPortType &dstPort)
+{
+    this->_disconnect(
+        Detail::connObjToObject(src), Detail::portNameToStr(srcPort),
+        Detail::connObjToObject(dst), Detail::portNameToStr(dstPort));
+}

+ 69 - 0
include/Pothos/Framework/WorkInfo.hpp

@@ -0,0 +1,69 @@
+///
+/// \file Framework/WorkInfo.hpp
+///
+/// WorkInfo provides information about a Worker's work() session.
+///
+/// \copyright
+/// Copyright (c) 2014-2014 Josh Blum
+/// SPDX-License-Identifier: BSL-1.0
+///
+
+#pragma once
+#include <Pothos/Config.hpp>
+#include <cstddef> //size_t
+#include <vector>
+
+namespace Pothos {
+
+/*!
+ * Information about a work session.
+ * The worker can query this info from calls to work().
+ * This information is not specific to a single port.
+ */
+struct POTHOS_API WorkInfo
+{
+    //! Default constructor -- zeros out members
+    WorkInfo(void);
+
+    /*!
+     * A vector of input pointers for indexable ports.
+     * inputPointers[i] == worker->input(i).buffer.as<const void>();
+     * This is a convenience for APIs that use a vector of pointers.
+     */
+    std::vector<const void *> inputPointers;
+
+    /*!
+     * A vector of output pointers for indexable ports.
+     * outputPointers[i] == worker->output(i).buffer.as<void>();
+     * This is a convenience for APIs that use a vector of pointers.
+     */
+    std::vector<void *> outputPointers;
+
+    //! The minimum number of elements of all indexed ports
+    size_t minElements;
+
+    //! The minimum number of elements of input indexed ports
+    size_t minInElements;
+
+    //! The minimum number of elements of output indexed ports
+    size_t minOutElements;
+
+    //! The minimum number of elements of all ports
+    size_t minAllElements;
+
+    //! The minimum number of elements of input ports
+    size_t minAllInElements;
+
+    //! The minimum number of elements of output ports
+    size_t minAllOutElements;
+
+    /*!
+     * The maximum time a call in work() is allowed to block.
+     * The maxTimeoutNs member is in units of nanoseconds.
+     * This is for workers that use blocking calls like select.
+     * Always use blocking calls with a timeout to be safe.
+     */
+    long long maxTimeoutNs;
+};
+
+} //namespace Pothos

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