├── .gitmodules ├── .travis.yml ├── CMakeLists.txt ├── Changelog.txt ├── LICENSE_1_0.txt ├── README.md ├── apps ├── CMakeLists.txt ├── PothosUtil.cpp ├── PothosUtil.hpp ├── PothosUtilDeviceInfo.cpp ├── PothosUtilDocParse.cpp ├── PothosUtilGenerateSIMDDispatchers.cpp ├── PothosUtilListModules.cpp ├── PothosUtilListTypeConversions.cpp ├── PothosUtilLoadModule.cpp ├── PothosUtilModuleInfo.cpp ├── PothosUtilPluginTree.cpp ├── PothosUtilProxyEnvironmentInfo.cpp ├── PothosUtilProxyServer.cpp ├── PothosUtilRunTopology.cpp ├── PothosUtilSIMDFeatures.cpp ├── PothosUtilSelfTests.cpp └── PothosUtilSystemInfo.cpp ├── appveyor.yml ├── cmake ├── Modules │ ├── CMakeLists.txt │ ├── FindPkgMacros.cmake │ ├── FindPoco.cmake │ ├── GetGitRevisionDescription.cmake │ ├── GetGitRevisionDescription.cmake.in │ ├── PothosConfig.cmake │ ├── PothosConfigSIMD.cmake │ ├── PothosConfigVersion.in.cmake │ ├── PothosUtil.cmake │ └── SetupPoco.cmake └── cmake_uninstall.cmake.in ├── debian ├── changelog ├── compat ├── control ├── copyright ├── docs ├── libpothos-dev.install ├── libpothos0.7.install ├── pothos-util.install ├── rules └── source │ └── format ├── docs ├── CMakeLists.txt ├── Doxyfile.in └── PothosGui.png ├── include ├── CMakeLists.txt └── Pothos │ ├── Archive.hpp │ ├── Archive │ ├── ArchiveEntry.hpp │ ├── BinaryObject.hpp │ ├── Complex.hpp │ ├── Exception.hpp │ ├── Export.hpp │ ├── Invoke.hpp │ ├── Map.hpp │ ├── Numbers.hpp │ ├── Pair.hpp │ ├── Polymorphic.hpp │ ├── Set.hpp │ ├── Split.hpp │ ├── StreamArchiver.hpp │ ├── String.hpp │ └── Vector.hpp │ ├── Callable.hpp │ ├── Callable │ ├── CallInterface.hpp │ ├── CallInterfaceImpl.hpp │ ├── CallRegistry.hpp │ ├── CallRegistryImpl.hpp │ ├── Callable.hpp │ ├── CallableImpl.hpp │ └── Exception.hpp │ ├── Config.hpp │ ├── Exception.hpp │ ├── Framework.hpp │ ├── Framework │ ├── Block.hpp │ ├── BlockImpl.hpp │ ├── BlockRegistry.hpp │ ├── BlockRegistryImpl.hpp │ ├── BufferAccumulator.hpp │ ├── BufferChunk.hpp │ ├── BufferManager.hpp │ ├── BufferPool.hpp │ ├── Connectable.hpp │ ├── ConnectableImpl.hpp │ ├── DType.hpp │ ├── Exception.hpp │ ├── InputPort.hpp │ ├── InputPortImpl.hpp │ ├── Label.hpp │ ├── ManagedBuffer.hpp │ ├── OutputPort.hpp │ ├── OutputPortImpl.hpp │ ├── Packet.hpp │ ├── SharedBuffer.hpp │ ├── ThreadPool.hpp │ ├── Topology.hpp │ ├── TopologyImpl.hpp │ └── WorkInfo.hpp │ ├── Init.hpp │ ├── Managed.hpp │ ├── Managed │ ├── Class.hpp │ ├── ClassImpl.hpp │ └── Exception.hpp │ ├── Object.hpp │ ├── Object │ ├── Containers.hpp │ ├── Exception.hpp │ ├── Object.hpp │ ├── ObjectImpl.hpp │ ├── RegisterToString.hpp │ └── Serialize.hpp │ ├── Plugin.hpp │ ├── Plugin │ ├── Exception.hpp │ ├── Loader.hpp │ ├── Module.hpp │ ├── Path.hpp │ ├── Plugin.hpp │ ├── Registry.hpp │ └── Static.hpp │ ├── Proxy.hpp │ ├── Proxy │ ├── Containers.hpp │ ├── Environment.hpp │ ├── Exception.hpp │ ├── Handle.hpp │ ├── Proxy.hpp │ └── ProxyImpl.hpp │ ├── Remote.hpp │ ├── Remote │ ├── Client.hpp │ ├── Exception.hpp │ ├── Handler.hpp │ └── Server.hpp │ ├── System.hpp │ ├── System │ ├── Exception.hpp │ ├── HostInfo.hpp │ ├── Logger.hpp │ ├── NumaInfo.hpp │ ├── Paths.hpp │ ├── SIMD.hpp │ └── Version.hpp │ ├── Testing.hpp │ └── Util │ ├── BlockDescription.hpp │ ├── CompareTo.hpp │ ├── Compiler.hpp │ ├── EvalEnvironment.hpp │ ├── ExceptionForErrorCode.hpp │ ├── FileLock.hpp │ ├── Network.hpp │ ├── OrderedQueue.hpp │ ├── QFormat.hpp │ ├── RefHolder.hpp │ ├── RingDeque.hpp │ ├── SpinLock.hpp │ ├── SpinLockRW.hpp │ ├── Templates.hpp │ ├── TypeInfo.hpp │ ├── UID.hpp │ └── XSIMDTraits.hpp ├── lib ├── Archive │ ├── ArchiveEntry.cpp │ ├── Exception.cpp │ ├── StreamArchiver.cpp │ ├── TestBasicTypes.cpp │ ├── TestCustomType.cpp │ └── TestPolymorphicType.cpp ├── CMakeLists.txt ├── Callable │ ├── CallInterface.cpp │ ├── CallRegistry.cpp │ ├── Callable.cpp │ ├── Exception.cpp │ └── Tests.cpp ├── ConfLoader │ ├── BlockDescLoader.cpp │ ├── ConfLoader.cpp │ ├── FileRealPath.cpp │ ├── JITCompilerLoader.cpp │ └── JSONTopologyLoader.cpp ├── Exception.cpp ├── Framework │ ├── ActorInterface.hpp │ ├── Block.cpp │ ├── BlockRegistry.cpp │ ├── BufferAccumulator.cpp │ ├── BufferChunk.cpp │ ├── BufferConvert.cpp │ ├── BufferManager.cpp │ ├── BufferPool.cpp │ ├── Builtin │ │ ├── CircularBufferManager.cpp │ │ ├── GenericBufferManager.cpp │ │ ├── TestAutomaticPorts.cpp │ │ ├── TestBufferChunkSerialization.cpp │ │ ├── TestBufferConvert.cpp │ │ ├── TestBufferManagerWithCustomAllocation.cpp │ │ ├── TestCircularBufferManager.cpp │ │ ├── TestDType.cpp │ │ ├── TestDoesBlockExist.cpp │ │ ├── TestGenericBufferManager.cpp │ │ ├── TestLabel.cpp │ │ ├── TestSharedBuffer.cpp │ │ ├── TestThreadPool.cpp │ │ ├── TestToString.cpp │ │ ├── TestTopology.cpp │ │ └── TestWorker.cpp │ ├── Connectable.cpp │ ├── DType.cpp │ ├── Exception.cpp │ ├── InputPort.cpp │ ├── Label.cpp │ ├── ManagedBuffer.cpp │ ├── MemoryMappedBufferContainer.cpp │ ├── MemoryMappedBufferContainer.hpp │ ├── OutputPort.cpp │ ├── Packet.cpp │ ├── PortsAndFlows.hpp │ ├── SharedBuffer.cpp │ ├── SharedBufferUnix.cpp │ ├── SharedBufferWindows.cpp │ ├── ThreadConfigUnix.cpp │ ├── ThreadConfigWindows.cpp │ ├── ThreadEnvironment.cpp │ ├── ThreadEnvironment.hpp │ ├── ThreadPool.cpp │ ├── Topology.cpp │ ├── TopologyCommit.cpp │ ├── TopologyDomainFlows.cpp │ ├── TopologyDotMarkup.cpp │ ├── TopologyDumpJSON.cpp │ ├── TopologyImpl.hpp │ ├── TopologyMakeJSON.cpp │ ├── TopologyNetworkFlows.cpp │ ├── TopologySquashFlows.cpp │ ├── TopologyStatsJSON.cpp │ ├── WorkInfo.cpp │ ├── WorkerActor.cpp │ ├── WorkerActor.hpp │ └── WorkerActorPortAllocation.cpp ├── Init.cpp ├── Managed │ ├── Builtin │ │ ├── ManagedHandle.cpp │ │ ├── ManagedProxy.cpp │ │ ├── ManagedProxy.hpp │ │ ├── TestManaged.cpp │ │ ├── TestManagedInheritance.cpp │ │ ├── TestManagedOpaque.cpp │ │ └── TestManagedWildcard.cpp │ ├── Class.cpp │ ├── Exception.cpp │ └── Registry.cpp ├── Object │ ├── Builtin │ │ ├── Compare.cpp │ │ ├── ConvertCommonImpl.hpp │ │ ├── ConvertFloats.cpp │ │ ├── ConvertIntegers.cpp │ │ ├── ConvertIntermediate.cpp │ │ ├── ConvertString.cpp │ │ ├── Hash.cpp │ │ ├── Serialize.cpp │ │ ├── TestConvertVectors.cpp │ │ └── Tests.cpp │ ├── Compare.cpp │ ├── Convert.cpp │ ├── Exception.cpp │ ├── Hash.cpp │ ├── Object.cpp │ ├── Serialize.cpp │ ├── ToString.cpp │ └── TypesHashCombine.hpp ├── Plugin │ ├── Exception.cpp │ ├── Loader.in.cpp │ ├── Module.cpp │ ├── ModulePaths.cpp │ ├── ModuleSafeLoad.cpp │ ├── Path.cpp │ ├── Plugin.cpp │ ├── Registry.cpp │ ├── Static.cpp │ └── Tests.cpp ├── Pothos.in.pc ├── Proxy │ ├── Builtin │ │ └── ConvertContainers.cpp │ ├── Convert.cpp │ ├── Environment.cpp │ ├── Exception.cpp │ ├── Handle.cpp │ └── Proxy.cpp ├── Remote │ ├── Builtin │ │ └── TestRemote.cpp │ ├── Client.cpp │ ├── Exception.cpp │ ├── RemoteProxy.cpp │ ├── RemoteProxy.hpp │ ├── RemoteProxyDatagram.cpp │ ├── RemoteProxyDatagram.hpp │ ├── RemoteProxyHandle.cpp │ ├── Server.cpp │ └── ServerHandler.cpp ├── SIMD │ ├── SIMDConvert.cpp │ └── SIMDConvert.hpp ├── System │ ├── Exception.cpp │ ├── HostInfo.cpp │ ├── Logger.cpp │ ├── NumaInfo.cpp │ ├── NumaInfoLinux.cpp │ ├── NumaInfoOSX.cpp │ ├── NumaInfoOther.cpp │ ├── NumaInfoWindows.cpp │ ├── Paths.in.cpp │ ├── SIMD.cpp │ └── Version.in.cpp ├── Testing │ ├── ScopedBlockInRegistry.hpp │ ├── ScopedPlugin.hpp │ └── Testing.cpp ├── Util │ ├── BlockDescription.cpp │ ├── Builtin │ │ ├── BlockEval.cpp │ │ ├── BlockEval.hpp │ │ ├── CompilerStdFlags.hpp │ │ ├── DeviceInfoUtils.cpp │ │ ├── DocUtils.cpp │ │ ├── GccClangCompilerSupport.in.cpp │ │ ├── MsvcCompilerSupport.in.cpp │ │ ├── MupOctalValReader.cpp │ │ ├── MupOctalValReader.hpp │ │ ├── SIMDDispatcherUtils.cpp │ │ ├── TestCompilerSupport.cpp │ │ ├── TestDocUtils.cpp │ │ ├── TestErrorCodeHandling.cpp │ │ ├── TestEvalExpression.cpp │ │ ├── TestRingDeque.cpp │ │ ├── TestSIMDDispatcherUtils.cpp │ │ └── WindowsGetLogicalProcessorInfo.cpp │ ├── Compiler.cpp │ ├── EvalEnvironment.cpp │ ├── EvalEnvironmentListParsers.cpp │ ├── FileLockUnix.cpp │ ├── FileLockWindows.cpp │ ├── Network.cpp │ ├── RefHolder.cpp │ ├── TypeInfo.cpp │ └── UID.cpp └── WindowsDelayLoadedSymbols.cpp └── sync_toolkits /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "spuce"] 2 | path = spuce 3 | url = https://github.com/audiofilter/spuce.git 4 | branch = master 5 | [submodule "muparserx"] 6 | path = muparserx 7 | url = https://github.com/beltoforion/muparserx.git 8 | branch = master 9 | [submodule "poco"] 10 | path = poco 11 | url = https://github.com/pocoproject/poco.git 12 | branch = poco-1.7.8 13 | [submodule "plotters"] 14 | path = plotters 15 | url = https://github.com/pothosware/PothosPlotters.git 16 | branch = master 17 | [submodule "widgets"] 18 | path = widgets 19 | url = https://github.com/pothosware/PothosWidgets.git 20 | branch = master 21 | [submodule "flow"] 22 | path = flow 23 | url = https://github.com/pothosware/PothosFlow.git 24 | branch = master 25 | [submodule "soapy"] 26 | path = soapy 27 | url = https://github.com/pothosware/PothosSoapy.git 28 | branch = master 29 | [submodule "blocks"] 30 | path = blocks 31 | url = https://github.com/pothosware/PothosBlocks.git 32 | branch = master 33 | [submodule "python"] 34 | path = python 35 | url = https://github.com/pothosware/PothosPython.git 36 | branch = master 37 | [submodule "audio"] 38 | path = audio 39 | url = https://github.com/pothosware/PothosAudio.git 40 | branch = master 41 | [submodule "comms"] 42 | path = comms 43 | url = https://github.com/pothosware/PothosComms.git 44 | branch = master 45 | [submodule "libsimdpp"] 46 | path = libsimdpp 47 | url = https://github.com/p12tic/libsimdpp 48 | -------------------------------------------------------------------------------- /LICENSE_1_0.txt: -------------------------------------------------------------------------------- 1 | Boost Software License - Version 1.0 - August 17th, 2003 2 | 3 | Permission is hereby granted, free of charge, to any person or organization 4 | obtaining a copy of the software and accompanying documentation covered by 5 | this license (the "Software") to use, reproduce, display, distribute, 6 | execute, and transmit the Software, and to prepare derivative works of the 7 | Software, and to permit third-parties to whom the Software is furnished to 8 | do so, all subject to the following: 9 | 10 | The copyright notices in the Software and this entire statement, including 11 | the above license grant, this restriction and the following disclaimer, 12 | must be included in all copies of the Software, in whole or in part, and 13 | all derivative works of the Software, unless such copies or derivative 14 | works are solely in the form of machine-executable object code generated by 15 | a source language processor. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /apps/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | ## Feature registration 3 | ######################################################################## 4 | cmake_dependent_option(ENABLE_LIBRARY_APPS "Enable Pothos Library.Apps component" ON "ENABLE_LIBRARY" OFF) 5 | add_feature_info(" Apps" ENABLE_LIBRARY_APPS "Utility application for Pothos library") 6 | if (NOT ENABLE_LIBRARY_APPS) 7 | return() 8 | endif() 9 | 10 | ######################################################################## 11 | # build PothosUtil 12 | ######################################################################## 13 | add_executable(PothosUtil 14 | PothosUtil.cpp 15 | PothosUtilSystemInfo.cpp 16 | PothosUtilModuleInfo.cpp 17 | PothosUtilSelfTests.cpp 18 | PothosUtilPluginTree.cpp 19 | PothosUtilDeviceInfo.cpp 20 | PothosUtilProxyServer.cpp 21 | PothosUtilLoadModule.cpp 22 | PothosUtilDocParse.cpp 23 | PothosUtilRunTopology.cpp 24 | PothosUtilListModules.cpp 25 | PothosUtilProxyEnvironmentInfo.cpp 26 | PothosUtilSIMDFeatures.cpp 27 | PothosUtilGenerateSIMDDispatchers.cpp 28 | PothosUtilListTypeConversions.cpp 29 | ) 30 | target_include_directories(PothosUtil PRIVATE ${JSON_HPP_INCLUDE_DIR}) 31 | target_link_libraries(PothosUtil PRIVATE Pothos) 32 | install(TARGETS PothosUtil 33 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT pothos_runtime 34 | ) 35 | -------------------------------------------------------------------------------- /apps/PothosUtil.hpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2018 Josh Blum 2 | // 2020 Nicholas Corgan 3 | // SPDX-License-Identifier: BSL-1.0 4 | 5 | #pragma once 6 | #include 7 | #include 8 | #include 9 | #include //pair 10 | #include 11 | 12 | class PothosUtilBase : public Poco::Util::ServerApplication 13 | { 14 | public: 15 | virtual ~PothosUtilBase(void){} 16 | void printSystemInfo(const std::string &, const std::string &); 17 | void printModuleInfo(const std::string &, const std::string &); 18 | void printDeviceInfo(void); 19 | void printPluginTree(const std::string &, const std::string &); 20 | void selfTests(const std::string &, const std::string &); 21 | void selfTestOne(const std::string &, const std::string &); 22 | void proxyServer(const std::string &, const std::string &); 23 | void loadModule(const std::string &, const std::string &); 24 | void runTopology(void); 25 | void docParse(const std::vector &); 26 | void listModules(const std::string &, const std::string &); 27 | void printProxyEnvironmentInfo(const std::string &, const std::string &); 28 | void printSIMDFeatures(void); 29 | void generateSIMDDispatchers(const std::string &, const std::string &); 30 | void printTypeConversions(const std::string &, const std::string &); 31 | 32 | //! Variables passed in via the --vars option 33 | std::vector> _vars; 34 | }; 35 | -------------------------------------------------------------------------------- /apps/PothosUtilDeviceInfo.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2017 Josh Blum 2 | // SPDX-License-Identifier: BSL-1.0 3 | 4 | #include "PothosUtil.hpp" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | using json = nlohmann::json; 14 | 15 | void PothosUtilBase::printDeviceInfo(void) 16 | { 17 | Pothos::ScopedInit init; 18 | 19 | const auto deviceType = this->config().getString("deviceType"); 20 | if (deviceType.empty()) 21 | { 22 | std::cout << std::endl; 23 | std::cout << ">>> Specify --device-info=deviceType for more information..." << std::endl; 24 | std::cout << ">>> Available device types in the plugin tree are: " << std::endl; 25 | for (const auto &name : Pothos::PluginRegistry::list("/devices")) 26 | { 27 | std::cout << " * " << name << std::endl; 28 | } 29 | std::cout << std::endl; 30 | return; 31 | } 32 | 33 | //extract the JSON device information 34 | auto path = Pothos::PluginPath("/devices").join(deviceType).join("info"); 35 | std::cout << ">>> Querying device info: " << path.toString() << std::endl; 36 | auto plugin = Pothos::PluginRegistry::get(path); 37 | auto call = plugin.getObject().extract(); 38 | auto info = json::parse(call.call()); 39 | 40 | //dump the information to file 41 | if (this->config().has("outputFile")) 42 | { 43 | const auto infoFile = this->config().getString("outputFile"); 44 | std::cout << ">>> Dumping info: " << infoFile << std::endl; 45 | std::ofstream ofs(Poco::Path::expand(infoFile)); 46 | ofs << info.dump(4); 47 | } 48 | //or otherwise to stdout 49 | else 50 | { 51 | std::cout << info.dump(4) << std::endl; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /apps/PothosUtilGenerateSIMDDispatchers.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 Nicholas Corgan 2 | // SPDX-License-Identifier: BSL-1.0 3 | 4 | #include "PothosUtil.hpp" 5 | 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | /*********************************************************************** 18 | * Generate a C++ header with SIMD dispatchers for a given Pothos module 19 | **********************************************************************/ 20 | void PothosUtilBase::generateSIMDDispatchers(const std::string&, const std::string& jsonPath) 21 | { 22 | auto env = Pothos::ProxyEnvironment::make("managed"); 23 | auto simdDispatcher = env->findProxy("Pothos/Util/SIMDDispatcher"); 24 | 25 | const auto simdArchesStr = this->config().getString("simdArches"); 26 | const auto outputFilePath = this->config().getString("outputFile"); 27 | 28 | Poco::StringTokenizer simdArchesTokenizer(simdArchesStr, ",", Poco::StringTokenizer::TOK_TRIM); 29 | std::vector simdArches(simdArchesTokenizer.begin(), simdArchesTokenizer.end()); 30 | 31 | const auto fileSize = Poco::File(jsonPath).getSize(); 32 | 33 | std::ifstream ifile(jsonPath.c_str(), std::ios::in); 34 | std::string jsonInput; 35 | jsonInput.resize(fileSize); 36 | ifile.read((char*)jsonInput.data(), fileSize); 37 | 38 | const auto outputHeaderString = simdDispatcher.call("generateAndDumpHeader", jsonInput, simdArches); 39 | 40 | std::ofstream ofile(outputFilePath.c_str(), std::ios::out); 41 | ofile << outputHeaderString; 42 | } -------------------------------------------------------------------------------- /apps/PothosUtilListModules.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 NIcholas Corgan 2 | // SPDX-License-Identifier: BSL-1.0 3 | 4 | #include "PothosUtil.hpp" 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | static std::map modVers; 16 | static std::map modNumsPlugins; 17 | static size_t maxPathLength = 0; 18 | 19 | static void traverseDump(const Pothos::PluginRegistryInfoDump& dump) 20 | { 21 | if(!dump.modulePath.empty()) 22 | { 23 | if(modNumsPlugins.count(dump.modulePath) > 0) 24 | { 25 | assert(modVers.count(dump.modulePath) > 0); 26 | ++modNumsPlugins[dump.modulePath]; 27 | } 28 | else 29 | { 30 | modVers[dump.modulePath] = dump.moduleVersion; 31 | modNumsPlugins[dump.modulePath] = 1; 32 | 33 | maxPathLength = std::max(maxPathLength, dump.modulePath.size()); 34 | } 35 | } 36 | for(const auto& sub: dump.subInfo) 37 | { 38 | traverseDump(sub); 39 | } 40 | } 41 | 42 | void PothosUtilBase::listModules(const std::string&, const std::string&) 43 | { 44 | Pothos::ScopedInit init; 45 | 46 | traverseDump(Pothos::PluginRegistry::dump()); 47 | 48 | using MapPair = std::map::value_type; 49 | const auto maxNumPluginsIter = std::max_element( 50 | modNumsPlugins.begin(), 51 | modNumsPlugins.end(), 52 | [](const MapPair& p1, const MapPair& p2) 53 | { 54 | return (p1.second < p2.second); 55 | }); 56 | const auto maxNumPluginsLength = std::to_string(maxNumPluginsIter->second).size(); 57 | 58 | for(const auto& modVersMapPair: modVers) 59 | { 60 | const auto& modulePath = modVersMapPair.first; 61 | 62 | std::cout << std::left << std::setw(maxPathLength) << modulePath << " (" 63 | << std::right << std::setw(maxNumPluginsLength) << modNumsPlugins[modulePath] 64 | << " plugins) [" << modVersMapPair.second << "]" << std::endl; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /apps/PothosUtilLoadModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2015 Josh Blum 2 | // SPDX-License-Identifier: BSL-1.0 3 | 4 | #include "PothosUtil.hpp" 5 | #include 6 | #include 7 | #include 8 | 9 | //remove outer quotes if they exist 10 | static std::string unquote(const std::string &s) 11 | { 12 | if (s.size() > 2 and s.front() == '"' and s.back() == '"') 13 | { 14 | return s.substr(1, s.length()-2); 15 | } 16 | else return s; 17 | } 18 | 19 | void PothosUtilBase::loadModule(const std::string &, const std::string &path) 20 | { 21 | std::cout << "Loading: " << path << std::endl; 22 | //this tests module load and unload -- could throw or cause abort 23 | { 24 | Pothos::PluginModule module(unquote(path)); 25 | } 26 | std::cout << "success!" << std::endl; 27 | } 28 | -------------------------------------------------------------------------------- /apps/PothosUtilModuleInfo.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018-2018 Josh Blum 2 | // SPDX-License-Identifier: BSL-1.0 3 | 4 | #include "PothosUtil.hpp" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | static std::map> modMap; 12 | static std::map modVers; 13 | 14 | static void traverseDump(const std::string &modulePath, const Pothos::PluginRegistryInfoDump &dump) 15 | { 16 | const bool isBuiltin = modulePath == "builtin" and dump.modulePath.empty(); 17 | const bool filterPass = modulePath.empty() or modulePath == dump.modulePath; 18 | if (not dump.objectType.empty() and (isBuiltin or filterPass)) 19 | { 20 | modMap[dump.modulePath].push_back(dump.pluginPath); 21 | modVers[dump.modulePath] = dump.moduleVersion; 22 | } 23 | 24 | for (const auto &subInfo : dump.subInfo) 25 | { 26 | traverseDump(modulePath, subInfo); 27 | } 28 | } 29 | 30 | static const std::string stringifyName(const std::string &modulePath) 31 | { 32 | return modulePath.empty()?"Builtin":modulePath; 33 | } 34 | 35 | void PothosUtilBase::printModuleInfo(const std::string &, const std::string &modulePath) 36 | { 37 | Pothos::ScopedInit init; 38 | traverseDump(modulePath, Pothos::PluginRegistry::dump()); 39 | size_t maxPathLength(0); 40 | for (const auto &module : modMap) 41 | { 42 | const auto displayName = stringifyName(module.first); 43 | maxPathLength = std::max(maxPathLength, displayName.size()); 44 | } 45 | 46 | for (const auto &module : modMap) 47 | { 48 | const auto displayName = stringifyName(module.first); 49 | const auto paddedName = displayName + std::string(maxPathLength-displayName.size()+1, ' '); 50 | std::cout << paddedName << "(" << std::setw(2) << module.second.size() << " plugins)"; 51 | const auto modVer = modVers.at(module.first); 52 | if (not modVer.empty()) std::cout << " [" << modVer << "]"; 53 | std::cout << std::endl; 54 | if (not modulePath.empty()) 55 | { 56 | for (const auto &pluginPath : module.second) 57 | { 58 | std::cout << " " << pluginPath << std::endl; 59 | } 60 | } 61 | } 62 | std::cout << std::endl; 63 | } 64 | -------------------------------------------------------------------------------- /apps/PothosUtilPluginTree.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2015 Josh Blum 2 | // SPDX-License-Identifier: BSL-1.0 3 | 4 | #include "PothosUtil.hpp" 5 | #include 6 | #include 7 | 8 | static void printPluginTreeR(const Pothos::PluginPath &path) 9 | { 10 | Pothos::Plugin plugin(path); 11 | if (not Pothos::PluginRegistry::empty(path)) 12 | { 13 | plugin = Pothos::PluginRegistry::get(path); 14 | } 15 | std::cout << plugin.toString() << std::endl; 16 | 17 | //iterate on the subtree stuff 18 | auto nodes = Pothos::PluginRegistry::list(path); 19 | for (auto it = nodes.begin(); it != nodes.end(); it++) 20 | { 21 | printPluginTreeR(path.join(*it)); 22 | } 23 | } 24 | 25 | void PothosUtilBase::printPluginTree(const std::string &, const std::string &pluginPath) 26 | { 27 | Pothos::ScopedInit init; 28 | printPluginTreeR(pluginPath.empty()?"/":pluginPath); 29 | std::cout << std::endl; 30 | } 31 | -------------------------------------------------------------------------------- /apps/PothosUtilSIMDFeatures.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 Nicholsa Corgan 2 | // SPDX-License-Identifier: BSL-1.0 3 | 4 | #include "PothosUtil.hpp" 5 | 6 | #include 7 | 8 | #include 9 | 10 | void PothosUtilBase::printSIMDFeatures(void) 11 | { 12 | std::cout << "SIMD features supported on this processor:" << std::endl; 13 | for(const auto& arch: Pothos::System::getSupportedSIMDFeatureSet()) 14 | { 15 | std::cout << " * " << arch << std::endl; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /apps/PothosUtilSystemInfo.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2018 Josh Blum 2 | // 2019 Nicholas Corgan 3 | // SPDX-License-Identifier: BSL-1.0 4 | 5 | #include "PothosUtil.hpp" 6 | #include 7 | #include 8 | 9 | void PothosUtilBase::printSystemInfo(const std::string &, const std::string &) 10 | { 11 | std::cout << "Lib Version: " << Pothos::System::getLibVersion() << std::endl; 12 | std::cout << "API Version: " << Pothos::System::getApiVersion() << std::endl; 13 | std::cout << "ABI Version: " << Pothos::System::getAbiVersion() << std::endl; 14 | std::cout << "Root Path: " << Pothos::System::getRootPath() << std::endl; 15 | std::cout << "Data Path: " << Pothos::System::getDataPath() << std::endl; 16 | std::cout << "User Data: " << Pothos::System::getUserDataPath() << std::endl; 17 | std::cout << "User Config: " << Pothos::System::getUserConfigPath() << std::endl; 18 | std::cout << "Runtime Library: " << Pothos::System::getPothosRuntimeLibraryPath() << std::endl; 19 | std::cout << "Util Executable: " << Pothos::System::getPothosUtilExecutablePath() << std::endl; 20 | std::cout << "Dev Include Path: " << Pothos::System::getPothosDevIncludePath() << std::endl; 21 | std::cout << "Dev Library Path: " << Pothos::System::getPothosDevLibraryPath() << std::endl; 22 | std::cout << "Module Search Paths:" << std::endl; 23 | for(const auto& searchPath: Pothos::System::getPothosModuleSearchPaths()) 24 | { 25 | std::cout << " * " << searchPath << std::endl; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | ## AppVeyor config for Pothos 3 | ## 4 | ## * not all components will be configured 5 | ## * build only on a 64-bit environment 6 | ## * only builds for release configuration 7 | ## * install Poco from pre-built zip 8 | ## 9 | ## FAIL: The build takes too long, most components are disabled. 10 | ## TODO: but build takes too long... 40 min limit 11 | ## * install SoapySDR from source 12 | ## * run the self tests after install 13 | ######################################################################## 14 | 15 | version: '{build}' 16 | 17 | platform: x64 18 | 19 | configuration: 20 | - RelWithDebInfo 21 | 22 | environment: 23 | global: 24 | GENERATOR: Visual Studio 14 Win64 25 | POTHOS_PREFIX: C:/Program Files/Pothos 26 | SOAPY_PREFIX: C:/Program Files/SoapySDR 27 | SOAPY_BRANCH: master 28 | 29 | # Operating system (build VM template) 30 | os: Windows Server 2012 R2 31 | 32 | # branches to build 33 | branches: 34 | # whitelist 35 | only: 36 | - master 37 | - maint 38 | 39 | before_build: 40 | # install SoapySDR from source 41 | #- git clone https://github.com/pothosware/SoapySDR.git 42 | #- cd SoapySDR 43 | #- git checkout %SOAPY_BRANCH% 44 | #- mkdir build && cd build 45 | #- cmake ../ -G "%GENERATOR%" -DCMAKE_INSTALL_PREFIX="%SOAPY_PREFIX%" -DCMAKE_BUILD_TYPE=%CONFIGURATION% 46 | #- cmake --build . --config %CONFIGURATION% 47 | #- cmake --build . --config %CONFIGURATION% --target install 48 | #- cd ../.. 49 | 50 | # download pre-built poco 51 | - ps: Start-FileDownload 'http://www.joshknows.com/download/Poco_1.6.0_x64_rel.zip' 52 | - 7z x Poco_1.6.0_x64_rel.zip -o"C:/Program Files" 53 | 54 | # configure and build 55 | build_script: 56 | - set PATH=C:/Program Files/Poco/bin;%PATH% 57 | - echo %PATH% 58 | - git submodule update --init --recursive 59 | - mkdir build && cd build 60 | - cmake ../ -G "%GENERATOR%" -DCMAKE_INSTALL_PREFIX="%POTHOS_PREFIX%" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DENABLE_TOOLKITS=OFF -DENABLE_DOCS=OFF -DBUILD_TESTING=OFF 61 | - cmake --build . --config %CONFIGURATION% 62 | - cmake --build . --config %CONFIGURATION% --target install 63 | 64 | # setup environment paths 65 | before_test: 66 | - set PATH=%POTHOS_PREFIX%/bin;%PATH% 67 | - set PATH=%SOAPY_PREFIX%/bin;%PATH% 68 | - echo %PATH% 69 | 70 | # basic test for command line utility 71 | #test_script: 72 | # - PothosUtil --system-info 73 | # - PothosUtil --self-tests 74 | -------------------------------------------------------------------------------- /cmake/Modules/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | ## Feature registration 3 | ######################################################################## 4 | cmake_dependent_option(ENABLE_LIBRARY_CMAKE "Enable Pothos Library.CMake component" ON "ENABLE_LIBRARY" OFF) 5 | add_feature_info(" CMake" ENABLE_LIBRARY_CMAKE "CMake project utilities for Pothos library") 6 | if (NOT ENABLE_LIBRARY_CMAKE) 7 | return() 8 | endif() 9 | 10 | ######################################################################## 11 | # Install cmake helper modules 12 | ######################################################################## 13 | include(CMakePackageConfigHelpers) 14 | 15 | write_basic_package_version_file( 16 | ${PROJECT_BINARY_DIR}/PothosConfigVersion.cmake 17 | VERSION ${POTHOS_VERSION} 18 | COMPATIBILITY AnyNewerVersion) 19 | 20 | install(FILES 21 | ${PROJECT_SOURCE_DIR}/cmake/Modules/PothosConfig.cmake 22 | ${PROJECT_SOURCE_DIR}/cmake/Modules/PothosUtil.cmake 23 | ${PROJECT_BINARY_DIR}/PothosConfigVersion.cmake 24 | #poco support 25 | ${PROJECT_SOURCE_DIR}/cmake/Modules/FindPkgMacros.cmake 26 | ${PROJECT_SOURCE_DIR}/cmake/Modules/FindPoco.cmake 27 | ${PROJECT_SOURCE_DIR}/cmake/Modules/SetupPoco.cmake 28 | #SIMD 29 | ${PROJECT_SOURCE_DIR}/cmake/Modules/PothosConfigSIMD.cmake 30 | 31 | DESTINATION ${POTHOS_CMAKE_DIRECTORY} 32 | COMPONENT pothos_devel) 33 | -------------------------------------------------------------------------------- /cmake/Modules/GetGitRevisionDescription.cmake.in: -------------------------------------------------------------------------------- 1 | # 2 | # Internal file for GetGitRevisionDescription.cmake 3 | # 4 | # Requires CMake 2.6 or newer (uses the 'function' command) 5 | # 6 | # Original Author: 7 | # 2009-2010 Ryan Pavlik 8 | # http://academic.cleardefinition.com 9 | # Iowa State University HCI Graduate Program/VRAC 10 | # 11 | # Copyright Iowa State University 2009-2010. 12 | # Distributed under the Boost Software License, Version 1.0. 13 | # (See accompanying file LICENSE_1_0.txt or copy at 14 | # http://www.boost.org/LICENSE_1_0.txt) 15 | 16 | set(HEAD_HASH) 17 | 18 | file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) 19 | 20 | string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) 21 | if(HEAD_CONTENTS MATCHES "ref") 22 | # named branch 23 | string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") 24 | if(EXISTS "@GIT_DIR@/${HEAD_REF}") 25 | configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) 26 | elseif(EXISTS "@GIT_DIR@/logs/${HEAD_REF}") 27 | configure_file("@GIT_DIR@/logs/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) 28 | set(HEAD_HASH "${HEAD_REF}") 29 | endif() 30 | else() 31 | # detached HEAD 32 | configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) 33 | endif() 34 | 35 | if(NOT HEAD_HASH) 36 | file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) 37 | string(STRIP "${HEAD_HASH}" HEAD_HASH) 38 | endif() 39 | -------------------------------------------------------------------------------- /cmake/Modules/PothosConfigVersion.in.cmake: -------------------------------------------------------------------------------- 1 | set(PACKAGE_FIND_NAME "Pothos") 2 | set(PACKAGE_VERSION "@POTHOS_VERSION@") 3 | 4 | # Check whether the requested PACKAGE_FIND_VERSION is compatible 5 | if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") 6 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 7 | else() 8 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 9 | if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") 10 | set(PACKAGE_VERSION_EXACT TRUE) 11 | endif() 12 | endif() 13 | -------------------------------------------------------------------------------- /cmake/Modules/SetupPoco.cmake: -------------------------------------------------------------------------------- 1 | if(DEFINED INCLUDED_SETUP_POCO_CMAKE) 2 | return() 3 | endif() 4 | set(INCLUDED_SETUP_POCO_CMAKE TRUE) 5 | 6 | ######################################################################## 7 | # Find Poco with PocoConfig.cmake (installed copy) 8 | ######################################################################## 9 | if("${CMAKE_VERSION}" VERSION_LESS "3.0.0") 10 | else() 11 | set(Poco_INCLUDE_DIRS "") 12 | find_package(Poco CONFIG COMPONENTS Foundation Util XML Net) 13 | if (Poco_FOUND) 14 | return() 15 | endif() 16 | endif() 17 | 18 | ######################################################################## 19 | # Find Poco with FindPoco.cmake (local copy) 20 | ######################################################################## 21 | message(STATUS "PocoConfig not found - trying with FindPoco") 22 | list(INSERT CMAKE_MODULE_PATH 0 ${CMAKE_CURRENT_LIST_DIR}) 23 | find_package(Poco) 24 | if (POCO_FOUND AND POCO_Util_FOUND AND POCO_Net_FOUND AND POCO_XML_FOUND) 25 | ######################################################################## 26 | # Check version >= 1.5.4 27 | ######################################################################## 28 | FILE (READ "${POCO_INCLUDE_DIRS}/Poco/Version.h" Poco_VERSION_H) 29 | set(_ws "[ \r\t\n^$]+") 30 | STRING (REGEX REPLACE "^.*#define${_ws}POCO_VERSION${_ws}(0x[0-9a-fA-F]*)${_ws}.*$" "\\1" Poco_VERSION "${Poco_VERSION_H}") 31 | set(_ws) 32 | if ("${Poco_VERSION}" LESS 0x01050400) 33 | return() 34 | endif() 35 | 36 | ######################################################################## 37 | # Set variables 38 | ######################################################################## 39 | set(Poco_FOUND 1) 40 | set(Poco_INCLUDE_DIRS ${POCO_INCLUDE_DIRS}) 41 | set(Poco_LIBRARIES 42 | ${POCO_LIBRARIES} 43 | ${POCO_Util_LIBRARIES} 44 | ${POCO_Net_LIBRARIES} 45 | ${POCO_XML_LIBRARIES} 46 | ) 47 | 48 | ######################################################################## 49 | # Link with the thread library 50 | ######################################################################## 51 | if (UNIX) 52 | set(CMAKE_THREAD_PREFER_PTHREAD ON) 53 | enable_language(C) 54 | find_package(Threads) 55 | list(APPEND Poco_LIBRARIES ${CMAKE_THREAD_LIBS_INIT}) 56 | endif() 57 | endif() 58 | -------------------------------------------------------------------------------- /cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 2 | message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 3 | endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | 5 | file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 6 | string(REGEX REPLACE "\n" ";" files "${files}") 7 | foreach(file ${files}) 8 | message(STATUS "Uninstalling $ENV{DESTDIR}${file}") 9 | if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 10 | exec_program( 11 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 12 | OUTPUT_VARIABLE rm_out 13 | RETURN_VALUE rm_retval 14 | ) 15 | if(NOT "${rm_retval}" STREQUAL 0) 16 | message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") 17 | endif(NOT "${rm_retval}" STREQUAL 0) 18 | else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 19 | message(STATUS "File $ENV{DESTDIR}${file} does not exist.") 20 | endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 21 | endforeach(file) 22 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: pothos 2 | Section: science 3 | Priority: optional 4 | Maintainer: Josh Blum 5 | Build-Depends: 6 | debhelper (>= 9.0.0), 7 | cmake (>= 2.8.9), 8 | libpoco-dev (>= 1.6), 9 | libmuparserx-dev, 10 | nlohmann-json3-dev, 11 | libnuma-dev [amd64 i386] 12 | Standards-Version: 4.5.0 13 | Homepage: https://github.com/pothosware/PothosCore/wiki 14 | Vcs-Git: https://github.com/pothosware/PothosCore.git 15 | Vcs-Browser: https://github.com/pothosware/PothosCore 16 | 17 | Package: pothos-util 18 | Section: science 19 | Architecture: any 20 | Depends: libpothos0.7 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} 21 | Description: runtime application 22 | The Pothos data-flow software suite. 23 | 24 | Package: libpothos0.7 25 | Section: libs 26 | Architecture: any 27 | Multi-Arch: same 28 | Pre-Depends: ${misc:Pre-Depends} 29 | Depends: ${shlibs:Depends}, ${misc:Depends} 30 | Description: shared library 31 | The Pothos data-flow software suite. 32 | 33 | Package: libpothos-dev 34 | Section: libdevel 35 | Architecture: any 36 | Depends: libpothos0.7 (= ${binary:Version}), ${misc:Depends}, pothos-util 37 | Description: development files 38 | The Pothos data-flow software suite. 39 | 40 | Package: pothos-all 41 | Section: libs 42 | Architecture: all 43 | Depends: 44 | pothos-util, 45 | pothos-flow, 46 | pothos-modules-audio, 47 | pothos-modules-blocks, 48 | pothos-modules-comms, 49 | pothos-modules-plotters, 50 | pothos-modules-widgets, 51 | pothos-modules-soapy, 52 | ${misc:Depends} 53 | Description: Meta package for all official toolkits 54 | This is a metapackage for the most common Pothos toolkits. 55 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: pothos 3 | Source: https://github.com/pothosware/PothosCore/wiki 4 | 5 | Files: * 6 | Copyright: 7 | Copyright (c) 2020-2020 Nicholas Corgan 8 | Copyright (c) 2013-2021 Josh Blum 9 | License: BSL-1.0 10 | Boost Software License - Version 1.0 - August 17th, 2003 11 | . 12 | Permission is hereby granted, free of charge, to any person or organization 13 | obtaining a copy of the software and accompanying documentation covered by 14 | this license (the "Software") to use, reproduce, display, distribute, 15 | execute, and transmit the Software, and to prepare derivative works of the 16 | Software, and to permit third-parties to whom the Software is furnished to 17 | do so, all subject to the following: 18 | . 19 | The copyright notices in the Software and this entire statement, including 20 | the above license grant, this restriction and the following disclaimer, 21 | must be included in all copies of the Software, in whole or in part, and 22 | all derivative works of the Software, unless such copies or derivative 23 | works are solely in the form of machine-executable object code generated by 24 | a source language processor. 25 | . 26 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 29 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 30 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 31 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 32 | DEALINGS IN THE SOFTWARE. 33 | -------------------------------------------------------------------------------- /debian/docs: -------------------------------------------------------------------------------- 1 | README.md 2 | -------------------------------------------------------------------------------- /debian/libpothos-dev.install: -------------------------------------------------------------------------------- 1 | usr/include 2 | usr/share/cmake 3 | usr/lib/*/pkgconfig 4 | usr/lib/*/*.so 5 | -------------------------------------------------------------------------------- /debian/libpothos0.7.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/*.so.* 2 | -------------------------------------------------------------------------------- /debian/pothos-util.install: -------------------------------------------------------------------------------- 1 | usr/bin 2 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | 4 | # extract the last section of the changelog version for extra info 5 | DEB_VERSION ?= $(shell dpkg-parsechangelog -S Version) 6 | DEB_VERSION_EXTRA := $(lastword $(subst -, ,$(DEB_VERSION))) 7 | 8 | # Uncomment this to turn on verbose mode. 9 | #export DH_VERBOSE=1 10 | 11 | %: 12 | dh $@ --buildsystem=cmake --parallel 13 | 14 | override_dh_auto_configure: 15 | dh_auto_configure -- \ 16 | -DPOTHOS_EXTVER="$(DEB_VERSION_EXTRA)" \ 17 | -DCMAKE_AUTOSET_INSTALL_RPATH=FALSE \ 18 | -DENABLE_TOOLKITS=OFF 19 | 20 | override_dh_installchangelogs: 21 | dh_installchangelogs Changelog.txt 22 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /docs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | # Optional doxygen generation 3 | ######################################################################## 4 | find_package(Doxygen) 5 | 6 | if (DOXYGEN_DOT_FOUND) 7 | set(HAVE_DOT YES) 8 | else() 9 | set(HAVE_DOT NO) 10 | endif() 11 | 12 | ######################################################################## 13 | ## Feature registration 14 | ######################################################################## 15 | cmake_dependent_option(ENABLE_LIBRARY_DOCS "Enable Pothos Library.Docs component" ON "ENABLE_LIBRARY;DOXYGEN_FOUND" OFF) 16 | add_feature_info(" Docs" ENABLE_LIBRARY_DOCS "Doxygen generated docs for Pothos library") 17 | if (NOT ENABLE_LIBRARY_DOCS) 18 | return() 19 | endif() 20 | 21 | #header sources used in the generate rule 22 | file(GLOB_RECURSE POTHOS_INCLUDES ${PROJECT_SOURCE_DIR}/include/*.hpp) 23 | 24 | #formated list of sources to parse 25 | string(REPLACE ";" " " DOXYGEN_SOURCES "${POTHOS_INCLUDES}") 26 | 27 | #Configure doxygen config file 28 | configure_file( 29 | ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in 30 | ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile 31 | @ONLY) 32 | 33 | #Create doxygen generation build rules 34 | if (DOXYGEN_FOUND) 35 | set(CMAKE_CURRENT_BINARY_DIR_DOXYGEN ${CMAKE_CURRENT_BINARY_DIR}/html) 36 | add_custom_command( 37 | OUTPUT ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN} 38 | DEPENDS ${POTHOS_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile 39 | COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile 40 | COMMENT "Generating documentation with doxygen" 41 | ) 42 | add_custom_target(docs ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR_DOXYGEN}) 43 | endif() 44 | -------------------------------------------------------------------------------- /docs/PothosGui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pothosware/PothosCore/4ca95cda7baea2eccbd068371142bc2b1db5ece5/docs/PothosGui.png -------------------------------------------------------------------------------- /include/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | ## Feature registration 3 | ######################################################################## 4 | cmake_dependent_option(ENABLE_LIBRARY_INCLUDE "Enable Pothos Library.Include component" ON "ENABLE_LIBRARY" OFF) 5 | add_feature_info(" Include" ENABLE_LIBRARY_INCLUDE "Public C++ headers for Pothos library") 6 | if (NOT ENABLE_LIBRARY_INCLUDE) 7 | return() 8 | endif() 9 | 10 | ######################################################################## 11 | # install include files 12 | ######################################################################## 13 | install( 14 | DIRECTORY Pothos 15 | DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} 16 | COMPONENT pothos_devel 17 | ) 18 | -------------------------------------------------------------------------------- /include/Pothos/Archive.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Pothos/Archive.hpp 3 | /// 4 | /// Top level include wrapper for Archive classes. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2016 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | -------------------------------------------------------------------------------- /include/Pothos/Archive/BinaryObject.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Archive/BinaryObject.hpp 3 | /// 4 | /// String binary chunk serialization. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2016 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include //size_t 15 | 16 | namespace Pothos { 17 | namespace serialization { 18 | 19 | /*! 20 | * Wrap a chunk given a pointer and length in bytes. 21 | * This interface is lightweight and does not copy. 22 | */ 23 | class BinaryObject 24 | { 25 | public: 26 | BinaryObject(const void * const buff, const size_t len): 27 | buff(buff), len(len) 28 | { 29 | return; 30 | } 31 | 32 | template 33 | void save(Archive &ar, const unsigned int) 34 | { 35 | ar.writeBytes(buff, len); 36 | } 37 | 38 | template 39 | void load(Archive &ar, const unsigned int) 40 | { 41 | ar.readBytes(const_cast(buff), len); 42 | } 43 | 44 | POTHOS_SERIALIZATION_SPLIT_MEMBER() 45 | 46 | private: 47 | const void * const buff; 48 | const size_t len; 49 | }; 50 | 51 | }} 52 | -------------------------------------------------------------------------------- /include/Pothos/Archive/Complex.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Archive/Pair.hpp 3 | /// 4 | /// Complex support for serialization. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2016 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include //pair 15 | 16 | namespace Pothos { 17 | namespace serialization { 18 | 19 | template 20 | void save(Archive &ar, const std::complex &t, const unsigned int) 21 | { 22 | ar << t.real(); 23 | ar << t.imag(); 24 | } 25 | 26 | template 27 | void load(Archive &ar, std::complex &t, const unsigned int) 28 | { 29 | T real, imag; 30 | ar >> real; 31 | ar >> imag; 32 | t.real(real); 33 | t.imag(imag); 34 | } 35 | 36 | template 37 | void serialize(Archive &ar, std::complex &t, const unsigned int ver) 38 | { 39 | Pothos::serialization::invokeSplit(ar, t, ver); 40 | } 41 | 42 | }} 43 | -------------------------------------------------------------------------------- /include/Pothos/Archive/Exception.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Archive/Exception.hpp 3 | /// 4 | /// Exceptions thrown by the Archive methods. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2016-2016 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | 15 | namespace Pothos { 16 | 17 | /*! 18 | * An ArchiveException is thrown when an archive operation fails. 19 | */ 20 | POTHOS_DECLARE_EXCEPTION(POTHOS_API, ArchiveException, RuntimeException); 21 | 22 | } //namespace Pothos 23 | -------------------------------------------------------------------------------- /include/Pothos/Archive/Export.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Archive/Export.hpp 3 | /// 4 | /// Serialization registration macros. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2016 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | 15 | /*! 16 | * Register archival functions for a given class. 17 | * A unique name is required with the class because 18 | * the typeinfo name is not consistent across platforms. 19 | */ 20 | #define POTHOS_CLASS_EXPORT_GUID(T, id) \ 21 | namespace Pothos { namespace Archive { \ 22 | template <> struct ArchiveEntryContainer { \ 23 | static const ArchiveEntry &entry; \ 24 | }; \ 25 | const ArchiveEntry &ArchiveEntryContainer::entry = \ 26 | ArchiveEntryT(id) ; \ 27 | }} 28 | 29 | //! Register archival functions using the stringified type as the ID 30 | #define POTHOS_CLASS_EXPORT(T) POTHOS_CLASS_EXPORT_GUID(T, #T) 31 | 32 | namespace Pothos { 33 | namespace Archive { 34 | 35 | template 36 | struct ArchiveEntryContainer; 37 | 38 | } //namespace Archive 39 | } //namespace Pothos 40 | -------------------------------------------------------------------------------- /include/Pothos/Archive/Map.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Archive/Map.hpp 3 | /// 4 | /// Map support for serialization. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2016-2019 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include //move 17 | #include 18 | 19 | namespace Pothos { 20 | namespace serialization { 21 | 22 | template 23 | void save(Archive &ar, const std::map &t, const unsigned int) 24 | { 25 | ar << unsigned(t.size()); 26 | for (const auto &pair : t) 27 | { 28 | ar << pair; 29 | } 30 | } 31 | 32 | template 33 | void load(Archive &ar, std::map &t, const unsigned int) 34 | { 35 | t.clear(); 36 | unsigned size(0); 37 | ar >> size; 38 | for (size_t i = 0; i < size_t(size); i++) 39 | { 40 | std::pair pair; 41 | ar >> pair; 42 | t.emplace_hint(t.end(), std::move(pair)); 43 | } 44 | } 45 | 46 | template 47 | void serialize(Archive &ar, std::map &t, const unsigned int ver) 48 | { 49 | Pothos::serialization::invokeSplit(ar, t, ver); 50 | } 51 | 52 | }} 53 | -------------------------------------------------------------------------------- /include/Pothos/Archive/Pair.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Archive/Pair.hpp 3 | /// 4 | /// Pair support for serialization. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2016 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include //pair 14 | 15 | namespace Pothos { 16 | namespace serialization { 17 | 18 | template 19 | void serialize(Archive &ar, std::pair &t, const unsigned int) 20 | { 21 | ar & t.first; 22 | ar & t.second; 23 | } 24 | 25 | }} 26 | -------------------------------------------------------------------------------- /include/Pothos/Archive/Polymorphic.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Archive/Polymorphic.hpp 3 | /// 4 | /// Polymorphic pointer support for serialization. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2016 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | namespace Pothos { 19 | namespace serialization { 20 | 21 | template 22 | typename std::enable_if::value>::type 23 | save(Archive &ar, const T* const &t, const unsigned int) 24 | { 25 | const auto &entry = Pothos::Archive::ArchiveEntry::find(typeid(*t)); 26 | ar << entry.getHash(); 27 | entry.save(ar, t); 28 | } 29 | 30 | template 31 | typename std::enable_if::value>::type 32 | load(Archive &ar, T* &t, const unsigned int) 33 | { 34 | unsigned long long idHash; 35 | ar >> idHash; 36 | const auto &entry = Pothos::Archive::ArchiveEntry::find(idHash); 37 | delete t; //delete previous pointer or its null 38 | t = static_cast(entry.load(ar)); 39 | } 40 | 41 | template 42 | typename std::enable_if::value>::type 43 | serialize(Archive &ar, T* &t, const unsigned int ver) 44 | { 45 | Pothos::serialization::invokeSplit(ar, t, ver); 46 | } 47 | 48 | }} 49 | -------------------------------------------------------------------------------- /include/Pothos/Archive/Set.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Archive/Set.hpp 3 | /// 4 | /// Set support for serialization. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2016-2019 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include 15 | #include //move 16 | #include 17 | 18 | namespace Pothos { 19 | namespace serialization { 20 | 21 | template 22 | void save(Archive &ar, const std::set &t, const unsigned int) 23 | { 24 | ar << unsigned(t.size()); 25 | for (const auto &elem : t) 26 | { 27 | ar << elem; 28 | } 29 | } 30 | 31 | template 32 | void load(Archive &ar, std::set &t, const unsigned int) 33 | { 34 | t.clear(); 35 | unsigned size(0); 36 | ar >> size; 37 | for (size_t i = 0; i < size_t(size); i++) 38 | { 39 | T elem; 40 | ar >> elem; 41 | t.emplace_hint(t.end(), std::move(elem)); 42 | } 43 | } 44 | 45 | template 46 | void serialize(Archive &ar, std::set &t, const unsigned int ver) 47 | { 48 | Pothos::serialization::invokeSplit(ar, t, ver); 49 | } 50 | 51 | }} 52 | -------------------------------------------------------------------------------- /include/Pothos/Archive/Split.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Archive/Split.hpp 3 | /// 4 | /// Serialization dispatch macros for separate save/load. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2016-2017 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include 15 | 16 | /*! 17 | * Declare a serialize() function that can dispatch to 18 | * an individually declared save and load function. 19 | * Call in the outside scope, no namespaces or functions. 20 | */ 21 | #define POTHOS_SERIALIZATION_SPLIT_FREE(T) \ 22 | namespace Pothos { namespace serialization { \ 23 | template \ 24 | void serialize(Archive &ar, T &t, const unsigned int ver) { \ 25 | Pothos::serialization::invokeSplit(ar, t, ver); \ 26 | } \ 27 | }} 28 | 29 | /*! 30 | * Declare a serialize() function that can dispatch to 31 | * individually declared save and load member functions. 32 | * Call in the public part of a struct or class declaration. 33 | */ 34 | #define POTHOS_SERIALIZATION_SPLIT_MEMBER() \ 35 | template \ 36 | typename std::enable_if::type \ 37 | serialize(Archive &ar, const unsigned int ver) { \ 38 | this->save(ar, ver); \ 39 | } \ 40 | template \ 41 | typename std::enable_if::type \ 42 | serialize(Archive &ar, const unsigned int ver) { \ 43 | this->load(ar, ver); \ 44 | } 45 | -------------------------------------------------------------------------------- /include/Pothos/Archive/String.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Archive/String.hpp 3 | /// 4 | /// String support for serialization. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2016 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | namespace Pothos { 19 | namespace serialization { 20 | 21 | template 22 | void save(Archive &ar, const std::basic_string &t, const unsigned int) 23 | { 24 | ar << unsigned(t.size()); 25 | BinaryObject bo(t.data(), t.size()); 26 | ar << bo; 27 | } 28 | 29 | template 30 | void load(Archive &ar, std::basic_string &t, const unsigned int) 31 | { 32 | unsigned size(0); 33 | ar >> size; 34 | t.resize(size); 35 | BinaryObject bo(t.data(), t.size()); 36 | ar >> bo; 37 | } 38 | 39 | template 40 | void serialize(Archive &ar, std::basic_string &t, const unsigned int ver) 41 | { 42 | Pothos::serialization::invokeSplit(ar, t, ver); 43 | } 44 | 45 | }} 46 | -------------------------------------------------------------------------------- /include/Pothos/Archive/Vector.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Archive/Vector.hpp 3 | /// 4 | /// Vector support for serialization. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2016-2019 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include 15 | #include //move 16 | #include 17 | 18 | namespace Pothos { 19 | namespace serialization { 20 | 21 | //------------ boolean vectors use a special internal type --------------// 22 | template 23 | void save(Archive &ar, const std::vector &t, const unsigned int) 24 | { 25 | ar << unsigned(t.size()); 26 | for (const bool elem : t) 27 | { 28 | ar << elem; 29 | } 30 | } 31 | 32 | template 33 | void load(Archive &ar, std::vector &t, const unsigned int) 34 | { 35 | unsigned size(0); 36 | ar >> size; 37 | t.resize(size); 38 | for (size_t i = 0; i < size_t(size); i++) 39 | { 40 | bool elem; 41 | ar >> elem; 42 | t[i] = elem; 43 | } 44 | } 45 | 46 | //------------ a vector of any type --------------// 47 | template 48 | void save(Archive &ar, const std::vector &t, const unsigned int) 49 | { 50 | ar << unsigned(t.size()); 51 | for (const auto &elem : t) 52 | { 53 | ar << elem; 54 | } 55 | } 56 | 57 | template 58 | void load(Archive &ar, std::vector &t, const unsigned int) 59 | { 60 | unsigned size(0); 61 | ar >> size; 62 | t.clear(); 63 | t.reserve(size); 64 | for (size_t i = 0; i < size_t(size); i++) 65 | { 66 | T elem; 67 | ar >> elem; 68 | t.emplace_back(std::move(elem)); 69 | } 70 | } 71 | 72 | template 73 | void serialize(Archive &ar, std::vector &t, const unsigned int ver) 74 | { 75 | Pothos::serialization::invokeSplit(ar, t, ver); 76 | } 77 | 78 | }} 79 | -------------------------------------------------------------------------------- /include/Pothos/Callable.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Pothos/Callable.hpp 3 | /// 4 | /// Top level include wrapper for Callable classes. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2013-2016 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | -------------------------------------------------------------------------------- /include/Pothos/Callable/CallInterface.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Callable/CallInterface.hpp 3 | /// 4 | /// CallInterface provides an method call abstraction interface. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2013-2017 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | 15 | namespace Pothos { 16 | 17 | /*! 18 | * CallInterface provides a set of templated call functions. 19 | * Derived classes overload opaqueCall() to handle the call. 20 | */ 21 | class POTHOS_API CallInterface 22 | { 23 | public: 24 | /*! 25 | * virtual destructor for inheritance 26 | */ 27 | virtual ~CallInterface(void); 28 | 29 | //! Call a bound method/function with a return type and variable args 30 | template 31 | ReturnType call(ArgsType&&... args) const; 32 | 33 | //! Call a bound method/function with an Object return and variable args 34 | template 35 | Object call(ArgsType&&... args) const; 36 | 37 | /*! 38 | * Call a bound method/function with an Object return and variable args 39 | * \deprecated use call overload without return type 40 | */ 41 | template 42 | POTHOS_DEPRECATED("Replaced by call() overload without return type") 43 | Object callObject(ArgsType&&... args) const; 44 | 45 | /*! 46 | * Call a bound method/function with a void return and variable args 47 | * \deprecated use call overload without return type 48 | */ 49 | template 50 | POTHOS_DEPRECATED("Replaced by call() overload without return type") 51 | void callVoid(ArgsType&&... args) const; 52 | 53 | protected: 54 | /*! 55 | * Call into the function/method with opaque input and return types. 56 | * For a void return type of call, the returned Object will be null. 57 | * \param inputArgs an array of call arguments of type Object 58 | * \param numArgs the number of arguments in inputArgs 59 | * \return the return value of the call as type Object 60 | */ 61 | virtual Object opaqueCall(const Object *inputArgs, const size_t numArgs) const = 0; 62 | }; 63 | 64 | } //namespace Pothos 65 | -------------------------------------------------------------------------------- /include/Pothos/Callable/CallInterfaceImpl.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Callable/CallInterfaceImpl.hpp 3 | /// 4 | /// Template implementation details for CallInterface. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2013-2017 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include //std::forward 17 | #include 18 | 19 | namespace Pothos { 20 | 21 | template 22 | ReturnType CallInterface::call(ArgsType&&... args) const 23 | { 24 | Object r = this->call(std::forward(args)...); 25 | try 26 | { 27 | return r.convert(); 28 | } 29 | catch(const Exception &ex) 30 | { 31 | throw CallableReturnError("Pothos::Callable::call()", ex); 32 | } 33 | } 34 | 35 | template 36 | Object CallInterface::call(ArgsType&&... args) const 37 | { 38 | const std::array objArgs{{Object(std::forward(args))...}}; 39 | return this->opaqueCall(objArgs.data(), sizeof...(args)); 40 | } 41 | 42 | template 43 | Object CallInterface::callObject(ArgsType&&... args) const 44 | { 45 | return this->call(std::forward(args)...); 46 | } 47 | 48 | template 49 | void CallInterface::callVoid(ArgsType&&... args) const 50 | { 51 | this->call(std::forward(args)...); 52 | } 53 | 54 | } //namespace Pothos 55 | -------------------------------------------------------------------------------- /include/Pothos/Callable/CallRegistry.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Callable/CallRegistry.hpp 3 | /// 4 | /// CallRegistry is an interface for registering class methods. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2014-2016 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include 15 | 16 | namespace Pothos { 17 | 18 | /*! 19 | * CallRegistry is an interface for registering class methods. 20 | */ 21 | class POTHOS_API CallRegistry 22 | { 23 | public: 24 | 25 | //! Virtual destructor for subclassing 26 | virtual ~CallRegistry(void); 27 | 28 | /*! 29 | * Register a class method with the given name. 30 | * Usage: this->registerCall(this, "foo", &MyClass::foo); 31 | */ 32 | template 33 | void registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(ArgsType...)); 34 | 35 | /*! 36 | * Register a class method with the given name. 37 | * Usage: this->registerCall(this, "foo", &MyClass::foo); 38 | */ 39 | template 40 | void registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(ArgsType...) const); 41 | 42 | /*! 43 | * Register a bound call with the given name. 44 | * The first argument of the call should have the class instance bound. 45 | */ 46 | virtual void registerCallable(const std::string &name, const Callable &call) = 0; 47 | }; 48 | 49 | } //namespace Pothos 50 | -------------------------------------------------------------------------------- /include/Pothos/Callable/CallRegistryImpl.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Callable/CallRegistryImpl.hpp 3 | /// 4 | /// Template method implementations for CallRegistry. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2014-2016 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include 15 | #include //std::ref 16 | 17 | namespace Pothos { 18 | 19 | template 20 | void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(ArgsType...)) 21 | { 22 | Callable call(method); 23 | call.bind(std::ref(*static_cast(instance)), 0); 24 | this->registerCallable(name, call); 25 | } 26 | 27 | template 28 | void CallRegistry::registerCall(InstanceType *instance, const std::string &name, ReturnType(ClassType::*method)(ArgsType...) const) 29 | { 30 | Callable call(method); 31 | call.bind(std::ref(*static_cast(instance)), 0); 32 | this->registerCallable(name, call); 33 | } 34 | 35 | } //namespace Pothos 36 | -------------------------------------------------------------------------------- /include/Pothos/Callable/Exception.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Callable/Exception.hpp 3 | /// 4 | /// Exceptions thrown by the Callable methods. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2013-2014 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | 15 | namespace Pothos { 16 | 17 | /*! 18 | * A CallableArgumentError is thrown when invalid arguments are used. 19 | */ 20 | POTHOS_DECLARE_EXCEPTION(POTHOS_API, CallableArgumentError, InvalidArgumentException) 21 | 22 | /*! 23 | * A CallableReturnError is thrown when return can't be converted. 24 | */ 25 | POTHOS_DECLARE_EXCEPTION(POTHOS_API, CallableReturnError, NotImplementedException) 26 | 27 | /*! 28 | * A CallableNullError is thrown when a call is made on a null Callable. 29 | */ 30 | POTHOS_DECLARE_EXCEPTION(POTHOS_API, CallableNullError, NullValueException) 31 | 32 | } //namespace Pothos 33 | -------------------------------------------------------------------------------- /include/Pothos/Framework.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Pothos/Framework.hpp 3 | /// 4 | /// Top level include wrapper for Framework classes. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2014-2016 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | -------------------------------------------------------------------------------- /include/Pothos/Framework/BlockRegistry.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Framework/BlockRegistry.hpp 3 | /// 4 | /// A BlockRegistry registers a block's factory function. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2014-2016 Josh Blum 8 | /// 2021 Nicholas Corgan 9 | /// SPDX-License-Identifier: BSL-1.0 10 | /// 11 | 12 | #pragma once 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | namespace Pothos { 19 | 20 | /*! 21 | * The BlockRegistry class registers factories for topological elements. 22 | * These elements include Blocks and sub-Topologies (hierarchies of elements). 23 | * A BlockRegistry can be created at static initialization time 24 | * so that modules providing blocks will automatically register. 25 | * Usage example (put this at the bottom of your c++ source file) 26 | * static Pothos::BlockRegistry registerMyBlock("/my/factory/path", &MyBlock::make); 27 | */ 28 | class POTHOS_API BlockRegistry 29 | { 30 | public: 31 | 32 | /*! 33 | * Register a factory function into the plugin registry. 34 | * The resulting factory path will be /blocks/path. 35 | * Example: a path of /foo/bar will register to /blocks/foo/bar. 36 | * 37 | * Because this call is used at static initialization time, 38 | * it does not throw. However, registration errors are logged, 39 | * and the block will not be available at runtime. 40 | * 41 | * The return type of the call must be Block* or Topology*. 42 | * 43 | * \param path the factory path beginning with a slash ("/") 44 | * \param factory the Callable factory function 45 | */ 46 | BlockRegistry(const std::string &path, const Callable &factory); 47 | 48 | /*! 49 | * Instantiate a block given the factory path and arguments. 50 | * \param path the factory path beginning with a slash ("/") 51 | * \param args a variable number of factory arguments 52 | * \return the newly created block instance as a Proxy 53 | */ 54 | template 55 | static Proxy make(const std::string &path, ArgsType&&... args); 56 | 57 | /*! 58 | * Checks if block is registered at a given path. 59 | * \param path the factory path beginning with a slash ("/") 60 | * \return whether a block is registered at the given path 61 | */ 62 | static bool doesBlockExist(const std::string &path); 63 | }; 64 | 65 | } //namespace Pothos 66 | -------------------------------------------------------------------------------- /include/Pothos/Framework/BlockRegistryImpl.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Framework/BlockRegistryImpl.hpp 3 | /// 4 | /// Inline member implementation for BlockRegistry class. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2016-2017 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include //std::forward 15 | 16 | template 17 | Pothos::Proxy Pothos::BlockRegistry::make(const std::string &path, ArgsType&&... args) 18 | { 19 | auto env = Pothos::ProxyEnvironment::make("managed"); 20 | auto registry = env->findProxy("Pothos/BlockRegistry"); 21 | return registry.call(path, std::forward(args)...); 22 | } 23 | -------------------------------------------------------------------------------- /include/Pothos/Framework/BufferPool.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Framework/BufferPool.hpp 3 | /// 4 | /// A simple buffer pool with re-usable buffers. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2016-2016 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include 15 | 16 | namespace Pothos { 17 | 18 | /*! 19 | * The simple buffer pool holds a collection of re-usable buffers. 20 | * When the client requests a particular buffer size from the pool, 21 | * the pool first looks for an existing and unused buffer 22 | * that matches the requested size, or allocates a new buffer. 23 | */ 24 | class POTHOS_API BufferPool 25 | { 26 | public: 27 | 28 | //! Construct an empty buffer pool 29 | BufferPool(void); 30 | 31 | /*! 32 | * Clear all existing entries in the pool. 33 | */ 34 | void clear(void); 35 | 36 | /*! 37 | * Get a buffer from the pool or make one if none available. 38 | * \param numBytes the size of the requested buffer in bytes 39 | * \return an available buffer chunk of at least numBytes size 40 | */ 41 | const Pothos::BufferChunk &get(const size_t numBytes); 42 | 43 | private: 44 | size_t _minBuffSize; 45 | std::vector _buffs; 46 | }; 47 | 48 | } //namespace Pothos 49 | -------------------------------------------------------------------------------- /include/Pothos/Framework/ConnectableImpl.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Framework/ConnectableImpl.hpp 3 | /// 4 | /// Templated implementation details for the Connectable class. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2014-2014 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include 15 | -------------------------------------------------------------------------------- /include/Pothos/Framework/Exception.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Framework/Exception.hpp 3 | /// 4 | /// Exceptions thrown by the Framework methods. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2013-2014 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | 15 | namespace Pothos { 16 | 17 | /*! 18 | * A SharedBufferError is thrown when the SharedBuffer can't allocate. 19 | */ 20 | POTHOS_DECLARE_EXCEPTION(POTHOS_API, SharedBufferError, RuntimeException) 21 | 22 | /*! 23 | * A BufferManagerFactoryError is thrown when the factory has an error. 24 | */ 25 | POTHOS_DECLARE_EXCEPTION(POTHOS_API, BufferManagerFactoryError, RuntimeException) 26 | 27 | /*! 28 | * A BufferPushError is thrown when buffers are pushed to the wrong queue. 29 | */ 30 | POTHOS_DECLARE_EXCEPTION(POTHOS_API, BufferPushError, RuntimeException) 31 | 32 | /*! 33 | * A PortAccessError is thrown when an invalid worker port identifier is used. 34 | */ 35 | POTHOS_DECLARE_EXCEPTION(POTHOS_API, PortAccessError, RangeException) 36 | 37 | /*! 38 | * A DTypeUnknownError is thrown when an unknown DType identifier is used. 39 | */ 40 | POTHOS_DECLARE_EXCEPTION(POTHOS_API, DTypeUnknownError, RuntimeException) 41 | 42 | /*! 43 | * A TopologyConnectError is thrown when a dis/connection is not possible. 44 | */ 45 | POTHOS_DECLARE_EXCEPTION(POTHOS_API, TopologyConnectError, RuntimeException) 46 | 47 | /*! 48 | * A BlockCallNotFound is thrown when a call by the given name cannot be found. 49 | */ 50 | POTHOS_DECLARE_EXCEPTION(POTHOS_API, BlockCallNotFound, RuntimeException) 51 | 52 | /*! 53 | * A PortDomainError is thrown from getInput/OutputBufferManager() for incompatible domains. 54 | */ 55 | POTHOS_DECLARE_EXCEPTION(POTHOS_API, PortDomainError, RuntimeException) 56 | 57 | /*! 58 | * A ThreadPoolError is thrown when ThreadPoolArgs are invalid. 59 | */ 60 | POTHOS_DECLARE_EXCEPTION(POTHOS_API, ThreadPoolError, RuntimeException) 61 | 62 | /*! 63 | * A BufferConvertError is thrown when a conversion is not possible. 64 | */ 65 | POTHOS_DECLARE_EXCEPTION(POTHOS_API, BufferConvertError, RuntimeException) 66 | 67 | 68 | } //namespace Pothos 69 | -------------------------------------------------------------------------------- /include/Pothos/Framework/Packet.hpp: -------------------------------------------------------------------------------- 1 | /// 2 | /// \file Framework/Packet.hpp 3 | /// 4 | /// Definition for packet type found in asynchronous messages. 5 | /// 6 | /// \copyright 7 | /// Copyright (c) 2014-2014 Josh Blum 8 | /// SPDX-License-Identifier: BSL-1.0 9 | /// 10 | 11 | #pragma once 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | namespace Pothos { 20 | 21 | /*! 22 | * The Packet type is a general-purpose structure for asynchronous messages. 23 | * A Packet contains a payload buffer with associated metadata and labels. 24 | * Ideally, the Packet structure is a suitable container for most situations. 25 | */ 26 | struct POTHOS_API Packet 27 | { 28 | //! Default constructor for Packet 29 | Packet(void); 30 | 31 | /*! 32 | * The buffer payload for this message. 33 | * The payload is just a memory buffer and a length in bytes. 34 | * Payload can contains a slice of a continuous byte stream, 35 | * a UDP datagram, a packet in a MAC layer protocol, etc... 36 | * The interpretation of this payload buffer is up to the user. 37 | */ 38 | BufferChunk payload; 39 | 40 | /*! 41 | * Arbitrary metadata for this message. 42 | * Use metadata to associate arbitrary information with the payload. 43 | * The are no specific requirements about what goes into metadata. 44 | * The metadata structure is a dictionary of key-value pairs, 45 | * where the keys for this dictionary are exclusively strings, 46 | * and the values are opaque Objects which can contain anything. 47 | */ 48 | ObjectKwargs metadata; 49 | 50 | /*! 51 | * Labels associated with the payload. 52 | * Each label index is an element-offset relative to the start of the payload. 53 | * The element size can be determined from the type of the payload buffer. 54 | */ 55 | std::vector