├── .gitignore ├── CMakeLists.txt ├── Doxyfile.in ├── LICENSE ├── NOTICE ├── README.markdown ├── cmake └── modules │ ├── COPYING-CMAKE-SCRIPTS │ ├── FindCppUnit.cmake │ ├── FindLibZip.cmake │ ├── FindXercesC.cmake │ ├── GetGitRevisionDescription.cmake │ ├── GetGitRevisionDescription.cmake.in │ └── UseDoxygen.cmake ├── debian ├── changelog ├── compat ├── control ├── copyright ├── libstromx-dev.install ├── libstromx.install ├── python3-stromx.install ├── rules ├── source │ └── format └── stromx-doc.install ├── doc ├── CMakeLists.txt ├── cvimgproc.xml ├── cvwrapper.vpp ├── mainpage.dox ├── parameters.xml ├── runtime.xml ├── stream.xml ├── stromx-doc.xsl ├── stromx.vpp └── stromx.xsd ├── example ├── CMakeLists.txt ├── camera │ ├── CMakeLists.txt │ ├── camera.cpp │ ├── camera.dot │ ├── camera.dox │ ├── camera.png │ ├── camera.xml │ └── lenna.jpg ├── file │ ├── CMakeLists.txt │ ├── file.cpp │ ├── file.dox │ └── file.xml ├── operator │ ├── CMakeLists.txt │ ├── math │ │ ├── Add.cpp │ │ └── Add.h │ ├── operator.cpp │ ├── operator.dot │ ├── operator.dox │ ├── operator.png │ └── operator.xml └── simple │ ├── CMakeLists.txt │ ├── simple.cpp │ ├── simple.dot │ ├── simple.dox │ └── simple.png ├── logo ├── stromx-logo-black-text.svg ├── stromx-logo-gray-text.svg ├── stromx-logo-rgb-64x64.png ├── stromx-logo-rgb-text-64x64.png ├── stromx-logo-rgb-text-69x100.png └── stromx-logo-rgb-text.svg ├── python ├── CMakeLists.txt ├── example │ ├── CMakeLists.txt │ ├── camera.py │ ├── camera.xml │ ├── file.py │ ├── file.xml │ ├── lenna.jpg │ ├── observer.py │ └── simple.py ├── stromx │ ├── CMakeLists.txt │ ├── __init__.py │ ├── cvsupport │ │ ├── CMakeLists.txt │ │ ├── Cvsupport.cpp │ │ ├── Image.cpp │ │ ├── Matrix.cpp │ │ └── __init__.py │ ├── runtime │ │ ├── AbstractFactory.cpp │ │ ├── AllowThreads.h │ │ ├── AssignThreadsAlgorithm.cpp │ │ ├── CMakeLists.txt │ │ ├── Color.cpp │ │ ├── Connector.cpp │ │ ├── ConnectorDescription.cpp │ │ ├── ConnectorObserver.cpp │ │ ├── Data.cpp │ │ ├── DataCast.h │ │ ├── DataContainer.cpp │ │ ├── Description.cpp │ │ ├── Equality.h │ │ ├── Exception.cpp │ │ ├── ExceptionObserver.cpp │ │ ├── ExportOperatorKernel.h │ │ ├── ExportVector.h │ │ ├── Factory.cpp │ │ ├── File.cpp │ │ ├── Image.cpp │ │ ├── InputProvider.cpp │ │ ├── List.cpp │ │ ├── Matrix.cpp │ │ ├── None.cpp │ │ ├── Operator.cpp │ │ ├── OperatorInfo.cpp │ │ ├── OperatorKernel.cpp │ │ ├── OutputProvider.cpp │ │ ├── Parameter.cpp │ │ ├── Position.cpp │ │ ├── Primitive.cpp │ │ ├── ReadAccess.cpp │ │ ├── Registry.cpp │ │ ├── Runtime.cpp │ │ ├── SortInputsAlgorithm.cpp │ │ ├── Stream.cpp │ │ ├── String.cpp │ │ ├── Thread.cpp │ │ ├── ThreadUtilities.h │ │ ├── Tribool.cpp │ │ ├── TriggerData.cpp │ │ ├── Variant.cpp │ │ ├── VariantHandle.cpp │ │ ├── VariantInterface.cpp │ │ ├── Version.cpp │ │ ├── Visualization.cpp │ │ ├── WriteAccess.cpp │ │ ├── XmlReader.cpp │ │ ├── XmlWriter.cpp │ │ └── __init__.py │ └── test │ │ ├── CMakeLists.txt │ │ ├── Test.cpp │ │ └── __init__.py └── test │ ├── CMakeLists.txt │ ├── data_cast.py │ ├── exceptions.py │ ├── factory.py │ ├── observer.py │ ├── providers.py │ └── tribool.py ├── rpm ├── stromx.changes └── stromx.spec ├── stromx.kdev4 ├── stromx ├── CMakeLists.txt ├── cvsupport │ ├── AdjustRgbChannels.cpp │ ├── AdjustRgbChannels.h │ ├── Buffer.cpp │ ├── Buffer.h │ ├── CMakeLists.txt │ ├── Clip.cpp │ ├── Clip.h │ ├── Config.h.in │ ├── ConstImage.cpp │ ├── ConstImage.h │ ├── ConvertPixelType.cpp │ ├── ConvertPixelType.h │ ├── Cvsupport.cpp │ ├── Cvsupport.h │ ├── DummyCamera.cpp │ ├── DummyCamera.h │ ├── Flicker.cpp │ ├── Flicker.h │ ├── Image.cpp │ ├── Image.h │ ├── Locale.h │ ├── Matrix.cpp │ ├── Matrix.h │ ├── ReadDirectory.cpp │ ├── ReadDirectory.h │ ├── Utilities.cpp │ ├── Utilities.h │ ├── cvsupport.dox │ ├── impl │ │ ├── CameraBuffer.cpp │ │ └── CameraBuffer.h │ └── test │ │ ├── AdjustRgbChannelsTest.cpp │ │ ├── AdjustRgbChannelsTest.h │ │ ├── BufferTest.cpp │ │ ├── BufferTest.h │ │ ├── CMakeLists.txt │ │ ├── CameraBufferTest.cpp │ │ ├── CameraBufferTest.h │ │ ├── ClipTest.cpp │ │ ├── ClipTest.h │ │ ├── ConstImageTest.cpp │ │ ├── ConstImageTest.h │ │ ├── ConvertPixelTypeTest.cpp │ │ ├── ConvertPixelTypeTest.h │ │ ├── CvsupportTest.cpp │ │ ├── CvsupportTest.h │ │ ├── DummyCameraTest.cpp │ │ ├── DummyCameraTest.h │ │ ├── FlickerTest.cpp │ │ ├── FlickerTest.h │ │ ├── ImageTest.cpp │ │ ├── ImageTest.h │ │ ├── MatrixTest.cpp │ │ ├── MatrixTest.h │ │ ├── ReadDirectoryTest.cpp │ │ ├── ReadDirectoryTest.h │ │ ├── SendReceiveTest.cpp │ │ ├── SendReceiveTest.h │ │ ├── UtilitiesTest.cpp │ │ ├── UtilitiesTest.h │ │ ├── double_matrix.npy │ │ ├── edges.png │ │ ├── empty_float_matrix.npy │ │ ├── lenna.jpg │ │ ├── lenna_bw.jpg │ │ ├── main.cpp │ │ └── uint16_matrix.npy ├── runtime │ ├── AbstractFactory.h │ ├── AssignThreadsAlgorithm.cpp │ ├── AssignThreadsAlgorithm.h │ ├── Block.cpp │ ├── Block.h │ ├── CMakeLists.txt │ ├── Color.cpp │ ├── Color.h │ ├── Compare.cpp │ ├── Compare.h │ ├── Config.h.in │ ├── Connector.cpp │ ├── Connector.h │ ├── ConnectorDescription.h │ ├── ConnectorObserver.h │ ├── ConstData.cpp │ ├── ConstData.h │ ├── ConstDataRef.cpp │ ├── ConstDataRef.h │ ├── Counter.cpp │ ├── Counter.h │ ├── Data.cpp │ ├── Data.h │ ├── DataContainer.cpp │ ├── DataContainer.h │ ├── DataInterface.h │ ├── DataOperatorBase.cpp │ ├── DataOperatorBase.h │ ├── DataProvider.h │ ├── DataRef.cpp │ ├── DataRef.h │ ├── Description.cpp │ ├── Description.h │ ├── DirectoryFileInput.cpp │ ├── DirectoryFileInput.h │ ├── DirectoryFileOutput.cpp │ ├── DirectoryFileOutput.h │ ├── Dump.cpp │ ├── Dump.h │ ├── Enum.cpp │ ├── Enum.h │ ├── EnumParameter.cpp │ ├── EnumParameter.h │ ├── Exception.cpp │ ├── Exception.h │ ├── ExceptionObserver.h │ ├── Factory.cpp │ ├── Factory.h │ ├── File.cpp │ ├── File.h │ ├── FileInput.h │ ├── FileOutput.h │ ├── Filter.cpp │ ├── Filter.h │ ├── Fork.cpp │ ├── Fork.h │ ├── Id2DataComposite.cpp │ ├── Id2DataComposite.h │ ├── Id2DataMapper.h │ ├── Id2DataPair.cpp │ ├── Id2DataPair.h │ ├── Image.cpp │ ├── Image.h │ ├── ImageWrapper.cpp │ ├── ImageWrapper.h │ ├── Input.h │ ├── InputConnector.h │ ├── InputProvider.h │ ├── IsEmpty.cpp │ ├── IsEmpty.h │ ├── IsNotEmpty.cpp │ ├── IsNotEmpty.h │ ├── Join.cpp │ ├── Join.h │ ├── List.cpp │ ├── List.h │ ├── Locale.cpp │ ├── Locale.h │ ├── Matrix.cpp │ ├── Matrix.h │ ├── MatrixParameter.cpp │ ├── MatrixParameter.h │ ├── MatrixPropertyBase.cpp │ ├── MatrixPropertyBase.h │ ├── MatrixWrapper.cpp │ ├── MatrixWrapper.h │ ├── Merge.cpp │ ├── Merge.h │ ├── None.cpp │ ├── None.h │ ├── NumericParameter.h │ ├── Operator.cpp │ ├── Operator.h │ ├── OperatorException.h │ ├── OperatorInfo.h │ ├── OperatorKernel.cpp │ ├── OperatorKernel.h │ ├── OperatorTester.h │ ├── Output.h │ ├── OutputConnector.h │ ├── OutputProvider.h │ ├── Parameter.cpp │ ├── Parameter.h │ ├── ParameterGroup.cpp │ ├── ParameterGroup.h │ ├── PeriodicDelay.cpp │ ├── PeriodicDelay.h │ ├── Position.h │ ├── Primitive.cpp │ ├── Primitive.h │ ├── Push.cpp │ ├── Push.h │ ├── Queue.cpp │ ├── Queue.h │ ├── ReadAccess.cpp │ ├── ReadAccess.h │ ├── Receive.cpp │ ├── Receive.h │ ├── RecycleAccess.cpp │ ├── RecycleAccess.h │ ├── Recycler.h │ ├── Registry.h │ ├── Repeat.cpp │ ├── Repeat.h │ ├── Runtime.cpp │ ├── Runtime.h │ ├── Send.cpp │ ├── Send.h │ ├── SortInputsAlgorithm.cpp │ ├── SortInputsAlgorithm.h │ ├── Split.cpp │ ├── Split.h │ ├── Stream.cpp │ ├── Stream.h │ ├── String.cpp │ ├── String.h │ ├── Thread.cpp │ ├── Thread.h │ ├── Tribool.cpp │ ├── Tribool.h │ ├── TriggerData.cpp │ ├── TriggerData.h │ ├── Try.cpp │ ├── Try.h │ ├── Variant.cpp │ ├── Variant.h │ ├── VariantComposite.cpp │ ├── VariantComposite.h │ ├── VariantHandle.cpp │ ├── VariantHandle.h │ ├── VariantInterface.cpp │ ├── VariantInterface.h │ ├── Version.cpp │ ├── Version.h │ ├── Visualization.cpp │ ├── Visualization.h │ ├── WriteAccess.cpp │ ├── WriteAccess.h │ ├── XmlReader.cpp │ ├── XmlReader.h │ ├── XmlWriter.cpp │ ├── XmlWriter.h │ ├── ZipFileInput.cpp │ ├── ZipFileInput.h │ ├── ZipFileOutput.cpp │ ├── ZipFileOutput.h │ ├── impl │ │ ├── Client.cpp │ │ ├── Client.h │ │ ├── ConnectorParameter.cpp │ │ ├── ConnectorParameter.h │ │ ├── DataContainerImpl.cpp │ │ ├── DataContainerImpl.h │ │ ├── Id2DataMap.cpp │ │ ├── Id2DataMap.h │ │ ├── InputNode.cpp │ │ ├── InputNode.h │ │ ├── MutexHandle.h │ │ ├── Network.cpp │ │ ├── Network.h │ │ ├── OutputNode.cpp │ │ ├── OutputNode.h │ │ ├── ReadAccessImpl.cpp │ │ ├── ReadAccessImpl.h │ │ ├── RecycleAccessImpl.cpp │ │ ├── RecycleAccessImpl.h │ │ ├── SerializationHeader.cpp │ │ ├── SerializationHeader.h │ │ ├── Server.cpp │ │ ├── Server.h │ │ ├── SynchronizedOperatorKernel.cpp │ │ ├── SynchronizedOperatorKernel.h │ │ ├── ThreadImpl.cpp │ │ ├── ThreadImpl.h │ │ ├── ThreadImplObserver.h │ │ ├── WriteAccessImpl.cpp │ │ ├── WriteAccessImpl.h │ │ ├── XmlReaderImpl.cpp │ │ ├── XmlReaderImpl.h │ │ ├── XmlUtilities.cpp │ │ ├── XmlUtilities.h │ │ ├── XmlWriterImpl.cpp │ │ └── XmlWriterImpl.h │ ├── runtime.dox │ └── test │ │ ├── AssignThreadsAlgorithmTest.cpp │ │ ├── AssignThreadsAlgorithmTest.h │ │ ├── BlockTest.cpp │ │ ├── BlockTest.h │ │ ├── BoolTest.cpp │ │ ├── BoolTest.h │ │ ├── CMakeLists.txt │ │ ├── ClientTest.cpp │ │ ├── ClientTest.h │ │ ├── CompareTest.cpp │ │ ├── CompareTest.h │ │ ├── ConstDataTest.cpp │ │ ├── ConstDataTest.h │ │ ├── CounterTest.cpp │ │ ├── CounterTest.h │ │ ├── DataContainerTest.cpp │ │ ├── DataContainerTest.h │ │ ├── DataRefTest.cpp │ │ ├── DataRefTest.h │ │ ├── DataTest.cpp │ │ ├── DataTest.h │ │ ├── DirectoryFileInputTest.cpp │ │ ├── DirectoryFileInputTest.h │ │ ├── DirectoryFileOutputTest.cpp │ │ ├── DirectoryFileOutputTest.h │ │ ├── DummyInput.h │ │ ├── DummyOutput.h │ │ ├── DumpTest.cpp │ │ ├── DumpTest.h │ │ ├── EnumTest.cpp │ │ ├── EnumTest.h │ │ ├── ExceptionOperator.cpp │ │ ├── ExceptionOperator.h │ │ ├── ExceptionTest.cpp │ │ ├── ExceptionTest.h │ │ ├── FactoryTest.cpp │ │ ├── FactoryTest.h │ │ ├── FileTest.cpp │ │ ├── FileTest.h │ │ ├── FilterTest.cpp │ │ ├── FilterTest.h │ │ ├── Float64Test.cpp │ │ ├── Float64Test.h │ │ ├── ForkTest.cpp │ │ ├── ForkTest.h │ │ ├── Id2DataCompositeTest.cpp │ │ ├── Id2DataCompositeTest.h │ │ ├── Id2DataMapTest.cpp │ │ ├── Id2DataMapTest.h │ │ ├── Id2DataPairTest.cpp │ │ ├── Id2DataPairTest.h │ │ ├── ImageWrapperTest.cpp │ │ ├── ImageWrapperTest.h │ │ ├── InputNodeTest.cpp │ │ ├── InputNodeTest.h │ │ ├── Int32Test.cpp │ │ ├── Int32Test.h │ │ ├── IsEmptyTest.cpp │ │ ├── IsNotEmptyTest.cpp │ │ ├── JoinTest.cpp │ │ ├── JoinTest.h │ │ ├── ListTest.cpp │ │ ├── ListTest.h │ │ ├── MatrixImpl.cpp │ │ ├── MatrixImpl.h │ │ ├── MatrixWrapperTest.cpp │ │ ├── MatrixWrapperTest.h │ │ ├── MergeTest.cpp │ │ ├── MergeTest.h │ │ ├── NetworkTest.cpp │ │ ├── NetworkTest.h │ │ ├── OperatorKernelTest.cpp │ │ ├── OperatorKernelTest.h │ │ ├── OperatorTest.cpp │ │ ├── OperatorTest.h │ │ ├── OutputNodeTest.cpp │ │ ├── OutputNodeTest.h │ │ ├── ParameterTest.cpp │ │ ├── ParameterTest.h │ │ ├── PeriodicDelayTest.cpp │ │ ├── PeriodicDelayTest.h │ │ ├── PrimitiveTest.h │ │ ├── PushTest.cpp │ │ ├── PushTest.h │ │ ├── QueueTest.cpp │ │ ├── QueueTest.h │ │ ├── ReadAccessTest.cpp │ │ ├── ReadAccessTest.h │ │ ├── RecycleAccessTest.cpp │ │ ├── RecycleAccessTest.h │ │ ├── RepeatTest.cpp │ │ ├── RepeatTest.h │ │ ├── RuntimeTest.cpp │ │ ├── RuntimeTest.h │ │ ├── SendReceiveTest.cpp │ │ ├── SendReceiveTest.h │ │ ├── ServerTest.cpp │ │ ├── ServerTest.h │ │ ├── SortInputsAlgorithmTest.cpp │ │ ├── SortInputsAlgorithmTest.h │ │ ├── SplitTest.cpp │ │ ├── SplitTest.h │ │ ├── StreamTest.cpp │ │ ├── StreamTest.h │ │ ├── StringTest.cpp │ │ ├── StringTest.h │ │ ├── SynchronizedOperatorKernelTest.cpp │ │ ├── TestData.cpp │ │ ├── TestData.h │ │ ├── TestOperator.cpp │ │ ├── TestOperator.h │ │ ├── TestUtilities.cpp │ │ ├── TestUtilities.h │ │ ├── ThreadImplTest.cpp │ │ ├── ThreadImplTest.h │ │ ├── ThreadTest.cpp │ │ ├── ThreadTest.h │ │ ├── TriboolTest.cpp │ │ ├── TriboolTest.h │ │ ├── TryTest.cpp │ │ ├── TryTest.h │ │ ├── UInt8Test.cpp │ │ ├── UInt8Test.h │ │ ├── VariantTest.cpp │ │ ├── VariantTest.h │ │ ├── VersionTest.cpp │ │ ├── VersionTest.h │ │ ├── VisualizationTest.cpp │ │ ├── VisualizationTest.h │ │ ├── WriteAccessTest.cpp │ │ ├── WriteAccessTest.h │ │ ├── XmlReaderTest.cpp │ │ ├── XmlReaderTest.h │ │ ├── XmlUtilitiesTest.cpp │ │ ├── XmlUtilitiesTest.h │ │ ├── XmlWriterTest.cpp │ │ ├── XmlWriterTest.h │ │ ├── ZipFileInputTest.cpp │ │ ├── ZipFileInputTest.h │ │ ├── ZipFileOutputTest.cpp │ │ ├── ZipFileOutputTest.h │ │ ├── archive.zip │ │ ├── data.txt │ │ ├── double_matrix.npy │ │ ├── dtd.xml │ │ ├── empty.xml │ │ ├── empty_float_matrix.npy │ │ ├── fortran_order.npy │ │ ├── invalid.xml │ │ ├── invalid.zip │ │ ├── main.cpp │ │ ├── nonsense.stromx │ │ ├── parameters.stromx │ │ ├── parameters.xml │ │ ├── parameters.zip │ │ ├── persistent_parameter.xml │ │ ├── pull_parameter.xml │ │ ├── push_parameter.xml │ │ ├── stream.stromx │ │ ├── stream.xml │ │ ├── stream.zip │ │ └── uint16_matrix.npy ├── stromx.dox └── test │ ├── CMakeLists.txt │ ├── Config.h.in │ ├── DeadlockOperator.cpp │ ├── DeadlockOperator.h │ ├── ExceptionOperator.cpp │ ├── ExceptionOperator.h │ ├── ParameterOperator.cpp │ ├── ParameterOperator.h │ ├── RandomDataOperator.cpp │ ├── RandomDataOperator.h │ ├── Test.cpp │ ├── Test.h │ ├── TestDataOperator.cpp │ └── TestDataOperator.h ├── stromxConfig.cmake.in └── util ├── archives.py ├── stream.stromx ├── stream.zip └── testdata.stromx /.gitignore: -------------------------------------------------------------------------------- 1 | .kdev4 2 | .project 3 | .pydevproject 4 | .settings 5 | *.vpp~* 6 | *.vpp.* 7 | *~ 8 | *.pyc 9 | build 10 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/NOTICE -------------------------------------------------------------------------------- /README.markdown: -------------------------------------------------------------------------------- 1 | ![Logo](https://github.com/uboot/stromx/raw/master/logo/stromx-logo-rgb-text-69x100.png)

Welcome to stromx! 2 | ================ 3 | [![Build Status](https://jenkins.stromx.org/job/stromx/badge/icon)](https://jenkins.stromx.org/job/stromx/) 4 | 5 | The stromx project provides tools for near real time processing of data with a focus on industrial imaging. 6 | Further information can be found on the project homepage. 7 | -------------------------------------------------------------------------------- /cmake/modules/COPYING-CMAKE-SCRIPTS: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without 2 | modification, are permitted provided that the following conditions 3 | are met: 4 | 5 | 1. Redistributions of source code must retain the copyright 6 | notice, this list of conditions and the following disclaimer. 7 | 2. Redistributions in binary form must reproduce the copyright 8 | notice, this list of conditions and the following disclaimer in the 9 | documentation and/or other materials provided with the distribution. 10 | 3. The name of the author may not be used to endorse or promote products 11 | derived from this software without specific prior written permission. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /cmake/modules/FindCppUnit.cmake: -------------------------------------------------------------------------------- 1 | # 2011-05-28 2 | # Copied from http://root.cern.ch/viewvc/trunk/cint/reflex/cmake/modules/FindCppUnit.cmake 3 | 4 | # - Find CppUnit 5 | # This module finds an installed CppUnit package. 6 | # 7 | # It sets the following variables: 8 | # CPPUNIT_FOUND - Set to false, or undefined, if CppUnit isn't found. 9 | # CPPUNIT_INCLUDE_DIR - The CppUnit include directory. 10 | # CPPUNIT_LIBRARY - The CppUnit library to link against. 11 | 12 | FIND_PATH(CPPUNIT_INCLUDE_DIR cppunit/Test.h) 13 | FIND_LIBRARY(CPPUNIT_LIBRARY NAMES cppunit) 14 | 15 | IF (CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARY) 16 | SET(CPPUNIT_FOUND TRUE) 17 | ENDIF (CPPUNIT_INCLUDE_DIR AND CPPUNIT_LIBRARY) 18 | 19 | IF (CPPUNIT_FOUND) 20 | 21 | # show which CppUnit was found only if not quiet 22 | IF (NOT CppUnit_FIND_QUIETLY) 23 | MESSAGE(STATUS "Found CppUnit: ${CPPUNIT_LIBRARY}") 24 | ENDIF (NOT CppUnit_FIND_QUIETLY) 25 | 26 | ELSE (CPPUNIT_FOUND) 27 | 28 | # fatal error if CppUnit is required but not found 29 | IF (CppUnit_FIND_REQUIRED) 30 | MESSAGE(FATAL_ERROR "Could not find CppUnit") 31 | ENDIF (CppUnit_FIND_REQUIRED) 32 | 33 | ENDIF (CPPUNIT_FOUND) 34 | -------------------------------------------------------------------------------- /cmake/modules/FindLibZip.cmake: -------------------------------------------------------------------------------- 1 | # Sets the following variables: 2 | # LIBZIP_FOUND - Set to false, or undefined, if libzip isn't found. 3 | # LIBZIP_INCLUDE_DIR - The libzip include directory. 4 | # LIBZIP_LIBRARY - The libzip library to link against. 5 | 6 | 7 | find_path(LIBZIP_INCLUDE_DIR 8 | NAMES zip.h 9 | ) 10 | 11 | find_library(LIBZIP_LIBRARY 12 | NAMES zip 13 | ) 14 | 15 | 16 | if (LIBZIP_INCLUDE_DIR AND LIBZIP_LIBRARY) 17 | set(LIBZIP_FOUND TRUE) 18 | endif (LIBZIP_INCLUDE_DIR AND LIBZIP_LIBRARY) 19 | 20 | if (LIBZIP_FOUND) 21 | if (NOT libzip_FIND_QUIETLY) 22 | message(STATUS "Found libzip: ${LIBZIP_LIBRARY}") 23 | endif (NOT libzip_FIND_QUIETLY) 24 | else (LIBZIP_FOUND) 25 | if (libzip_FIND_REQUIRED) 26 | message(FATAL_ERROR "Could not find libzip") 27 | endif (libzip_FIND_REQUIRED) 28 | endif (LIBZIP_FOUND) 29 | -------------------------------------------------------------------------------- /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 | else() 27 | configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) 28 | file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) 29 | if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") 30 | set(HEAD_HASH "${CMAKE_MATCH_1}") 31 | endif() 32 | endif() 33 | else() 34 | # detached HEAD 35 | configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) 36 | endif() 37 | 38 | if(NOT HEAD_HASH) 39 | file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) 40 | string(STRIP "${HEAD_HASH}" HEAD_HASH) 41 | endif() 42 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | stromx (0.8.0) unstable; urgency=low 2 | 3 | * Update to version 0.8.0 4 | 5 | -- Matthias Fuchs Sat, 14 May 2016 21:00:00 +0100 6 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: stromx 2 | Priority: extra 3 | Maintainer: Matthias Fuchs 4 | Build-Depends: debhelper (>= 7.0.50~), cmake, cdbs, libboost-all-dev, doxygen, python-dev, libzip-dev, libxerces-c-dev, libopencv-dev, libcppunit-dev 5 | Standards-Version: 3.9.1 6 | Section: libs 7 | Homepage: http://www.stromx.org 8 | 9 | Package: libstromx-dev 10 | Section: libdevel 11 | Architecture: any 12 | Depends: ${misc:Depends}, ${shlibs:Depends}, libstromx (= ${binary:Version}) 13 | Description: Development files for stromx 14 | 15 | Package: libstromx 16 | Section: libs 17 | Architecture: any 18 | Depends: ${shlibs:Depends}, ${misc:Depends} 19 | Description: Library for near real-time, parallel processing of data 20 | 21 | Package: python3-stromx 22 | Section: python 23 | Architecture: any 24 | Depends: ${python3:Depends}, ${shlibs:Depends}, ${misc:Depends}, libstromx (= ${binary:Version}) 25 | Description: Python bindings for stromx 26 | 27 | Package: stromx-doc 28 | Section: doc 29 | Architecture: any 30 | Depends: ${shlibs:Depends}, ${misc:Depends}, 31 | Description: Documentation and examples for stromx 32 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://dep.debian.net/deps/dep5 2 | Upstream-Name: stromx 3 | Source: 4 | 5 | Files: * 6 | Copyright: 7 | 8 | License: 9 | 10 | 11 | . 12 | 13 | 14 | # If you want to use GPL v2 or later for the /debian/* files use 15 | # the following clauses, or change it to suit. Delete these two lines 16 | Files: debian/* 17 | Copyright: 2012 roter_oktober 18 | License: GPL-2+ 19 | This package is free software; you can redistribute it and/or modify 20 | it under the terms of the GNU General Public License as published by 21 | the Free Software Foundation; either version 2 of the License, or 22 | (at your option) any later version. 23 | . 24 | This package is distributed in the hope that it will be useful, 25 | but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27 | GNU General Public License for more details. 28 | . 29 | You should have received a copy of the GNU General Public License 30 | along with this program. If not, see 31 | . 32 | On Debian systems, the complete text of the GNU General 33 | Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". 34 | 35 | # Please also look if there are files or directories which have a 36 | # different copyright/license attached and list them here. 37 | -------------------------------------------------------------------------------- /debian/libstromx-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/* 2 | usr/lib/lib*.so 3 | usr/share/stromx/stromxConfig.cmake 4 | 5 | -------------------------------------------------------------------------------- /debian/libstromx.install: -------------------------------------------------------------------------------- 1 | usr/lib/*.so.* -------------------------------------------------------------------------------- /debian/python3-stromx.install: -------------------------------------------------------------------------------- 1 | usr/lib/python3/dist-packages/stromx 2 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | DEB_CMAKE_EXTRA_FLAGS = \ 4 | -DPYTHON_INSTALL_DIR=lib/python3/dist-packages \ 5 | -DPYTHON_EXECUTABLE=/usr/bin/python3 \ 6 | -DDOC_INSTALL_DIR=share/doc 7 | 8 | include /usr/share/cdbs/1/rules/debhelper.mk 9 | include /usr/share/cdbs/1/class/cmake.mk 10 | 11 | build/libstromx:: 12 | cd $(DEB_BUILDDIR) && $(MAKE) test ARGS="-V" 13 | 14 | build/stromx-doc:: 15 | cd $(DEB_BUILDDIR) && $(MAKE) doc 16 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /debian/stromx-doc.install: -------------------------------------------------------------------------------- 1 | usr/share/doc/stromx -------------------------------------------------------------------------------- /doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(DOXYGEN_FOUND AND DOC_INSTALL_DIR) 2 | install(DIRECTORY "${PROJECT_BINARY_DIR}/doc/html" 3 | DESTINATION "${DOC_INSTALL_DIR}/stromx" 4 | ) 5 | endif() 6 | -------------------------------------------------------------------------------- /doc/cvwrapper.vpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/doc/cvwrapper.vpp -------------------------------------------------------------------------------- /doc/mainpage.dox: -------------------------------------------------------------------------------- 1 | /** \mainpage Welcome to stromx! 2 | 3 | \image html logo/stromx-logo-rgb-text-69x100.png 4 | 5 | \section tutorial Tutorials 6 | 7 | The main concepts of \em stromx are illustrated in four examples. \em Simple shows how to build and operate a stream using only library functions. In \em file instead of assembling the stream with multiple function calls in the code it is loaded from an XML file. The example \em operator shows how to implement and use a proprietary \em stromx operator. A slightly more real-world example is \em camera which shows how to process images orginating from a simulated camera. 8 | 9 | - \subpage simple 10 | - \subpage file 11 | - \subpage operator 12 | - \subpage camera 13 | */ 14 | -------------------------------------------------------------------------------- /doc/stromx.vpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/doc/stromx.vpp -------------------------------------------------------------------------------- /example/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(EXAMPLE_ENVIRONMENT "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}") 2 | 3 | add_subdirectory(simple) 4 | add_subdirectory(file) 5 | add_subdirectory(operator) 6 | add_subdirectory(camera) 7 | -------------------------------------------------------------------------------- /example/camera/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | ${CMAKE_SOURCE_DIR} 3 | ${CMAKE_BINARY_DIR} 4 | ) 5 | 6 | add_executable(camera 7 | camera.cpp 8 | ) 9 | 10 | set_target_properties(camera PROPERTIES FOLDER "example") 11 | 12 | target_link_libraries(camera 13 | stromx_runtime 14 | stromx_cvsupport 15 | ) 16 | 17 | add_test(NAME example_camera COMMAND camera) 18 | set_tests_properties(example_camera PROPERTIES ENVIRONMENT "${EXAMPLE_ENVIRONMENT}") 19 | 20 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/camera.xml ${CMAKE_CURRENT_BINARY_DIR}/camera.xml COPYONLY) 21 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lenna.jpg ${CMAKE_CURRENT_BINARY_DIR}/lenna.jpg COPYONLY) -------------------------------------------------------------------------------- /example/camera/camera.dot: -------------------------------------------------------------------------------- 1 | # dot camera.dot -Tpng -ocamera.png 2 | 3 | digraph stream 4 | { 5 | node [shape = box, fontname = Helvetica, style = "rounded"] "Camera" "ConvertPixelType" "BufferArray" 6 | node [shape=plaintext] 7 | "Camera" -> "ConvertPixelType" [headlabel = "SOURCE", taillabel = "OUTPUT", labelfontname = Helvetica, labelfontsize = "10pt"] 8 | "Camera" -> "" [taillabel = "INDEX", labelfontname = Helvetica, labelfontsize = "10pt"] 9 | "BufferArray" -> "ConvertPixelType" [headlabel = "DESTINATION", taillabel = "OUTPUT", labelfontname = Helvetica, labelfontsize = "10pt"] 10 | "ConvertPixelType" -> "" [taillabel = "OUTPUT", labelfontname = Helvetica, labelfontsize = "10pt"] 11 | } -------------------------------------------------------------------------------- /example/camera/camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/example/camera/camera.png -------------------------------------------------------------------------------- /example/camera/lenna.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/example/camera/lenna.jpg -------------------------------------------------------------------------------- /example/file/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | ${CMAKE_SOURCE_DIR} 3 | ${CMAKE_BINARY_DIR} 4 | ) 5 | 6 | add_executable(file 7 | file.cpp 8 | ) 9 | 10 | set_target_properties(file PROPERTIES FOLDER "example") 11 | 12 | target_link_libraries(file 13 | stromx_runtime 14 | ) 15 | 16 | add_test(NAME example_file COMMAND file) 17 | set_tests_properties(example_file PROPERTIES ENVIRONMENT "${EXAMPLE_ENVIRONMENT}") 18 | 19 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/file.xml ${CMAKE_CURRENT_BINARY_DIR}/file.xml COPYONLY) 20 | -------------------------------------------------------------------------------- /example/file/file.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include 26 | 27 | using namespace stromx; 28 | 29 | int main (int, char**) 30 | { 31 | runtime::Factory factory; 32 | 33 | stromxRegisterRuntime(&factory); 34 | 35 | runtime::Stream* stream = runtime::XmlReader().readStream("file.xml", &factory); 36 | 37 | stream->start(); 38 | 39 | runtime::Operator* timer = stream->operators()[1]; 40 | 41 | for(unsigned int i = 0; i < 5; ++i) 42 | { 43 | runtime::DataContainer data = timer->getOutputData(1); 44 | runtime::ReadAccess count(data); 45 | std::cout << "Received " 46 | << (unsigned int)(count.get()) 47 | << std::endl; 48 | 49 | timer->clearOutputData(1); 50 | } 51 | 52 | stream->stop(); 53 | stream->join(); 54 | 55 | delete stream; 56 | } -------------------------------------------------------------------------------- /example/file/file.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 1000 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /example/operator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | ${CMAKE_SOURCE_DIR} 3 | ${CMAKE_BINARY_DIR} 4 | ) 5 | 6 | add_executable(operator 7 | operator.cpp 8 | math/Add.cpp 9 | ) 10 | 11 | set_target_properties(operator PROPERTIES FOLDER "example") 12 | 13 | target_link_libraries(operator 14 | stromx_runtime 15 | ) 16 | 17 | add_test(NAME example_operator COMMAND operator) 18 | set_tests_properties(example_operator PROPERTIES ENVIRONMENT "${EXAMPLE_ENVIRONMENT}") 19 | 20 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/operator.xml ${CMAKE_CURRENT_BINARY_DIR}/operator.xml COPYONLY) 21 | -------------------------------------------------------------------------------- /example/operator/operator.dot: -------------------------------------------------------------------------------- 1 | # dot operator.dot -Tpng -ooperator.png 2 | 3 | digraph strom 4 | { 5 | node [shape = box, fontname = Helvetica, style = "rounded"] "Counter" "Add" "PeriodicDelay" 6 | node [shape=plaintext] 7 | "Counter" -> "Add" -> "PeriodicDelay" [headlabel = "INPUT", taillabel = "OUTPUT", labelfontname = Helvetica, labelfontsize = "10pt"] 8 | "PeriodicDelay" -> "" [taillabel = "OUTPUT", labelfontname = Helvetica, labelfontsize = "10pt"] 9 | } -------------------------------------------------------------------------------- /example/operator/operator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/example/operator/operator.png -------------------------------------------------------------------------------- /example/operator/operator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 2 9 | 10 | 11 | 12 | 13 | 14 | 1000 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /example/simple/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | ${CMAKE_SOURCE_DIR} 3 | ${CMAKE_BINARY_DIR} 4 | ) 5 | 6 | add_executable(simple 7 | simple.cpp 8 | ) 9 | 10 | set_target_properties(simple PROPERTIES FOLDER "example") 11 | 12 | target_link_libraries(simple 13 | stromx_runtime 14 | ) 15 | 16 | add_test(NAME example_simple COMMAND simple) 17 | set_tests_properties(example_simple PROPERTIES ENVIRONMENT "${EXAMPLE_ENVIRONMENT}") -------------------------------------------------------------------------------- /example/simple/simple.dot: -------------------------------------------------------------------------------- 1 | # dot simple.dot -Tpng -osimple.png 2 | 3 | digraph stream 4 | { 5 | node [shape = box, fontname = Helvetica, style = "rounded"] "Counter" "PeriodicDelay" 6 | node [shape=plaintext] 7 | "Counter" -> "PeriodicDelay" [headlabel = "INPUT", taillabel = "OUTPUT", labelfontname = Helvetica, labelfontsize = "10pt"] 8 | "PeriodicDelay" -> "" [taillabel = "OUTPUT", labelfontname = Helvetica, labelfontsize = "10pt"] 9 | } 10 | -------------------------------------------------------------------------------- /example/simple/simple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/example/simple/simple.png -------------------------------------------------------------------------------- /logo/stromx-logo-rgb-64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/logo/stromx-logo-rgb-64x64.png -------------------------------------------------------------------------------- /logo/stromx-logo-rgb-text-64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/logo/stromx-logo-rgb-text-64x64.png -------------------------------------------------------------------------------- /logo/stromx-logo-rgb-text-69x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/logo/stromx-logo-rgb-text-69x100.png -------------------------------------------------------------------------------- /python/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(MSVC) 2 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4172") 3 | endif(MSVC) 4 | 5 | add_definitions(-DBOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY) 6 | 7 | set(PYTHONPATH "${CMAKE_BINARY_DIR}/python") 8 | set(PYTHON_TEST_ENVIRONMENT "PYTHONPATH=${PYTHONPATH};LD_LIBRARY_PATH=${LD_LIBRARY_PATH}") 9 | 10 | add_subdirectory(stromx) 11 | add_subdirectory(example) 12 | add_subdirectory(test) 13 | -------------------------------------------------------------------------------- /python/example/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/camera.py ${CMAKE_CURRENT_BINARY_DIR}/camera.py COPYONLY) 2 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/camera.xml ${CMAKE_CURRENT_BINARY_DIR}/camera.xml COPYONLY) 3 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/file.py ${CMAKE_CURRENT_BINARY_DIR}/file.py COPYONLY) 4 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/file.xml ${CMAKE_CURRENT_BINARY_DIR}/file.xml COPYONLY) 5 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lenna.jpg ${CMAKE_CURRENT_BINARY_DIR}/lenna.jpg COPYONLY) 6 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/observer.py ${CMAKE_CURRENT_BINARY_DIR}/observer.py COPYONLY) 7 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simple.py ${CMAKE_CURRENT_BINARY_DIR}/simple.py COPYONLY) 8 | 9 | add_test(NAME python_example_camera COMMAND ${PYTHON_EXECUTABLE} camera.py) 10 | add_test(NAME python_example_file COMMAND ${PYTHON_EXECUTABLE} file.py) 11 | add_test(NAME python_example_observer COMMAND ${PYTHON_EXECUTABLE} observer.py) 12 | add_test(NAME python_example_simple COMMAND ${PYTHON_EXECUTABLE} simple.py) 13 | 14 | set_tests_properties(python_example_camera PROPERTIES ENVIRONMENT "${PYTHON_TEST_ENVIRONMENT}") 15 | set_tests_properties(python_example_file PROPERTIES ENVIRONMENT "${PYTHON_TEST_ENVIRONMENT}") 16 | set_tests_properties(python_example_observer PROPERTIES ENVIRONMENT "${PYTHON_TEST_ENVIRONMENT}") 17 | set_tests_properties(python_example_simple PROPERTIES ENVIRONMENT "${PYTHON_TEST_ENVIRONMENT}") 18 | -------------------------------------------------------------------------------- /python/example/camera.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # 4 | # Copyright 2011 Matthias Fuchs 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | from stromx import register, runtime, cvsupport 20 | 21 | factory = runtime.Factory() 22 | register("libstromx_runtime.so", factory) 23 | register("libstromx_cvsupport.so", factory) 24 | 25 | stream = runtime.XmlReader().readStream("camera.xml", factory) 26 | 27 | stream.start() 28 | 29 | camera = stream.operators()[0] 30 | convertPixelType = stream.operators()[2] 31 | 32 | for i in range(5): 33 | with convertPixelType.getOutputData(2) as data, runtime.ReadAccess(data) as image: 34 | print("Received image {0}x{1}, {2}".format( 35 | image.get().width(), 36 | image.get().height(), 37 | image.get().variant().title())) 38 | 39 | convertPixelType.clearOutputData(2) 40 | camera.clearOutputData(1) 41 | 42 | stream.stop() 43 | stream.join() 44 | -------------------------------------------------------------------------------- /python/example/file.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # 4 | # Copyright 2011 Matthias Fuchs 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | from stromx import register, runtime 20 | 21 | factory = runtime.Factory() 22 | register("libstromx_runtime.so", factory) 23 | 24 | stream = runtime.XmlReader().readStream("file.xml", factory) 25 | 26 | stream.start() 27 | 28 | timer = stream.operators()[1] 29 | 30 | for i in range(5): 31 | data = timer.getOutputData(1) 32 | count = runtime.ReadAccess(data) 33 | with runtime.ReadAccess(data) as count: 34 | print("Received {0}".format(count.get().get())) 35 | 36 | timer.clearOutputData(1) 37 | 38 | stream.stop() 39 | stream.join() 40 | -------------------------------------------------------------------------------- /python/example/file.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 1000 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /python/example/lenna.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/python/example/lenna.jpg -------------------------------------------------------------------------------- /python/example/simple.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Copyright 2011 Matthias Fuchs 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | from stromx import runtime 19 | 20 | stream = runtime.Stream() 21 | 22 | source = stream.addOperator(runtime.Counter()) 23 | stream.initializeOperator(source) 24 | 25 | timer = stream.addOperator(runtime.PeriodicDelay()) 26 | stream.initializeOperator(timer) 27 | 28 | timer.setParameter(2, runtime.UInt32(1000)) 29 | 30 | stream.connect(source, 0, timer, 0) 31 | 32 | thread = stream.addThread() 33 | thread.addInput(timer, 0) 34 | 35 | stream.start() 36 | 37 | for i in range(5): 38 | data = timer.getOutputData(1) 39 | with runtime.ReadAccess(data) as count: 40 | print("Received {0}".format(count.get().get())) 41 | 42 | timer.clearOutputData(1) 43 | 44 | stream.stop() 45 | stream.join() 46 | -------------------------------------------------------------------------------- /python/stromx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(runtime) 2 | 3 | if(BUILD_OPENCV_WRAPPER) 4 | add_subdirectory(cvsupport) 5 | add_subdirectory(test) 6 | endif() 7 | 8 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_BINARY_DIR}/__init__.py COPYONLY) 9 | 10 | if(PYTHON_INSTALL_DIR) 11 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/__init__.py 12 | DESTINATION ${PYTHON_INSTALL_DIR}/stromx 13 | ) 14 | endif() -------------------------------------------------------------------------------- /python/stromx/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # 4 | # Copyright 2011 Matthias Fuchs 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | import ctypes 20 | import re 21 | 22 | def register(packageLib, factory): 23 | match = re.match('lib?stromx_(.+)\.(so.*|dll)', packageLib); 24 | if not match: 25 | print('Failed to derive package name from "{0}"'.format(packageLib)) 26 | package = match.group(1) 27 | 28 | try: 29 | lib = ctypes.CDLL(packageLib) 30 | except OSError: 31 | print('Failed to load {0}'.format(packageLib)) 32 | return 1 33 | 34 | functionName = 'stromxRegister{0}'.format(package.capitalize()) 35 | try: 36 | function = lib[functionName] 37 | except AttributeError: 38 | print('{0}() is not defined'.format(functionName)) 39 | return 1 40 | 41 | if function(ctypes.c_void_p(factory._this())): 42 | print('Failed to call {0}'.format(functionName)) 43 | return 1 44 | 45 | return 0 46 | 47 | -------------------------------------------------------------------------------- /python/stromx/cvsupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(SOURCES 2 | Cvsupport.cpp 3 | Image.cpp 4 | Matrix.cpp 5 | ) 6 | 7 | add_library(cvsupport SHARED ${SOURCES}) 8 | 9 | set_target_properties(cvsupport PROPERTIES FOLDER "python") 10 | 11 | include_directories( 12 | ${CMAKE_SOURCE_DIR} 13 | ${CMAKE_BINARY_DIR} 14 | ${Boost_INCLUDE_DIRS} 15 | ${OpenCV2_INCLUDE_DIR} 16 | ${PYTHON_INCLUDE_DIRS} 17 | ) 18 | 19 | target_link_libraries(cvsupport 20 | ${Boost_LIBRARIES} 21 | ${PYTHON_LIBRARY} 22 | stromx_runtime 23 | stromx_cvsupport 24 | ) 25 | 26 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/__init__.py ${CMAKE_CURRENT_BINARY_DIR}/__init__.py COPYONLY) 27 | 28 | if(PYTHON_INSTALL_DIR) 29 | install(DIRECTORY . 30 | DESTINATION ${PYTHON_INSTALL_DIR}/stromx/cvsupport 31 | FILES_MATCHING PATTERN "*.py" 32 | ) 33 | install(TARGETS cvsupport 34 | DESTINATION ${PYTHON_INSTALL_DIR}/stromx/cvsupport 35 | ) 36 | endif() 37 | -------------------------------------------------------------------------------- /python/stromx/cvsupport/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # 4 | # Copyright 2011 Matthias Fuchs 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | import stromx.runtime 20 | 21 | from stromx.cvsupport.libcvsupport import * 22 | -------------------------------------------------------------------------------- /python/stromx/runtime/AllowThreads.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_PYTHON_ALLOWTHREADS_H 18 | #define STROMX_PYTHON_ALLOWTHREADS_H 19 | 20 | #include 21 | 22 | using namespace boost::python; 23 | 24 | namespace stromx 25 | { 26 | namespace python 27 | { 28 | class AllowThreads 29 | { 30 | public: 31 | AllowThreads() : m_save(PyEval_SaveThread()) {} 32 | ~AllowThreads() { PyEval_RestoreThread(m_save); } 33 | private: 34 | PyThreadState *m_save; 35 | }; 36 | } 37 | } 38 | 39 | #endif // STROMX_PYTHON_ALLOWTHREADS_H 40 | -------------------------------------------------------------------------------- /python/stromx/runtime/AssignThreadsAlgorithm.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | using namespace boost::python; 23 | using namespace stromx::runtime; 24 | 25 | void exportAssignThreadsAlgorithm() 26 | { 27 | class_("AssignThreadsAlgorithm") 28 | .def("apply", &AssignThreadsAlgorithm::apply) 29 | ; 30 | } -------------------------------------------------------------------------------- /python/stromx/runtime/Color.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | 21 | #include "Equality.h" 22 | 23 | using namespace boost::python; 24 | using namespace stromx::runtime; 25 | 26 | void exportColor() 27 | { 28 | class_("Color", init()) 29 | .def("r", &Color::r) 30 | .def("g", &Color::g) 31 | .def("b", &Color::b) 32 | .def(self == self) 33 | ; 34 | } -------------------------------------------------------------------------------- /python/stromx/runtime/ConnectorDescription.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | using namespace boost::python; 23 | using namespace stromx::runtime; 24 | 25 | void exportDescription() 26 | { 27 | class_ >("ConnectorDescription", no_init) 28 | .def("operatorThread", &ConnectorDescription::operatorThread) 29 | .def("defaultType", &ConnectorDescription::defaultType) 30 | ; 31 | 32 | class_ >("Input", no_init) 33 | ; 34 | 35 | class_ >("Output", no_init) 36 | ; 37 | } 38 | -------------------------------------------------------------------------------- /python/stromx/runtime/DataCast.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_PYTHON_DATACAST_H 18 | #define STROMX_PYTHON_DATACAST_H 19 | 20 | #include 21 | 22 | #include 23 | 24 | void exportImage(); 25 | 26 | using namespace stromx::runtime; 27 | using namespace boost::python; 28 | 29 | namespace stromx 30 | { 31 | namespace python 32 | { 33 | template 34 | data_t* data_cast(Data* data) 35 | { 36 | return runtime::data_cast(data); 37 | } 38 | } 39 | } 40 | 41 | #endif // STROMX_PYTHON_DATACAST_H -------------------------------------------------------------------------------- /python/stromx/runtime/DataContainer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | using namespace boost::python; 24 | using namespace stromx::runtime; 25 | 26 | namespace 27 | { 28 | DataContainer* allocate() 29 | { 30 | return new DataContainer(); 31 | } 32 | 33 | DataContainer* allocateFromData(const boost::shared_ptr & data) 34 | { 35 | return new DataContainer(data.get()); 36 | } 37 | 38 | DataContainer* allocateFromDataWithReadOnlyOption(const boost::shared_ptr & data, const bool isReadOnly) 39 | { 40 | return new DataContainer(data.get(), isReadOnly); 41 | } 42 | } 43 | 44 | void exportDataContainer() 45 | { 46 | class_("DataContainer", no_init) 47 | .def("__init__", make_constructor(&allocate)) 48 | .def("__init__", make_constructor(&allocateFromData)) 49 | .def("__init__", make_constructor(&allocateFromDataWithReadOnlyOption)) 50 | .def("empty", &DataContainer::empty) 51 | .def("release", &DataContainer::release) 52 | ; 53 | } 54 | -------------------------------------------------------------------------------- /python/stromx/runtime/Equality.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_PYTHON_EQUALITY_H 18 | #define STROMX_PYTHON_EQUALITY_H 19 | 20 | #include 21 | 22 | using namespace boost::python; 23 | 24 | namespace stromx 25 | { 26 | namespace python 27 | { 28 | template 29 | bool eq(T* lhs, T* rhs) 30 | { 31 | return lhs == rhs; 32 | } 33 | 34 | template 35 | bool ne(T* lhs, T* rhs) 36 | { 37 | return lhs != rhs; 38 | } 39 | } 40 | } 41 | 42 | #endif // STROMX_PYTHON_ALLOWTHREADS_H 43 | -------------------------------------------------------------------------------- /python/stromx/runtime/ExportOperatorKernel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_PYTHON_EXPORTOPERATORKERNEL_H 18 | #define STROMX_PYTHON_EXPORTOPERATORKERNEL_H 19 | 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | using namespace stromx::runtime; 26 | using namespace boost::python; 27 | 28 | namespace stromx 29 | { 30 | namespace python 31 | { 32 | template 33 | boost::shared_ptr allocate() 34 | { 35 | return boost::shared_ptr(new operator_t, boost::lambda::_1); 36 | } 37 | 38 | template 39 | void exportOperatorKernel(const char* const name) 40 | { 41 | class_, boost::shared_ptr, boost::noncopyable>(name, no_init) 42 | .def("__init__", make_constructor(&allocate)) 43 | ; 44 | } 45 | } 46 | } 47 | 48 | #endif // STROMX_PYTHON_EXPORTOPERATORKERNEL_H -------------------------------------------------------------------------------- /python/stromx/runtime/ExportVector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_PYTHON_EXPORTVECTOR_H 18 | #define STROMX_PYTHON_EXPORTVECTOR_H 19 | 20 | #include 21 | #include 22 | 23 | using namespace boost::python; 24 | 25 | 26 | namespace 27 | { 28 | template 29 | T & getVectorItem(std::vector & v, const typename std::vector::size_type index) 30 | { 31 | return v.at(index); 32 | } 33 | } 34 | 35 | namespace stromx 36 | { 37 | namespace python 38 | { 39 | 40 | template 41 | void exportVector(const char* const name) 42 | { 43 | class_< std::vector >(name, no_init) 44 | .def("__len__", &std::vector::size) 45 | .def("__getitem__", &getVectorItem, return_internal_reference<>()) 46 | .def("__iter__", iterator< std::vector, return_internal_reference<> >()) 47 | ; 48 | } 49 | } 50 | } 51 | 52 | #endif // STROMX_PYTHON_EXPORTVECTOR_H 53 | -------------------------------------------------------------------------------- /python/stromx/runtime/List.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "ExportVector.h" 18 | 19 | #include 20 | #include 21 | #include 22 | #include "DataCast.h" 23 | 24 | using namespace boost::python; 25 | using namespace stromx::runtime; 26 | 27 | 28 | namespace 29 | { 30 | boost::shared_ptr allocate() 31 | { 32 | return boost::shared_ptr(new List(), boost::lambda::_1); 33 | } 34 | } 35 | 36 | void exportList() 37 | { 38 | stromx::python::exportVector("DataVector"); 39 | 40 | class_, boost::shared_ptr >("List", no_init) 41 | .def("__init__", make_constructor(&allocate)) 42 | .def & (List::*)()>("content", &List::content, return_internal_reference<>()) 43 | .def("data_cast", &stromx::python::data_cast, return_internal_reference<1>()) 44 | .staticmethod("data_cast") 45 | ; 46 | } -------------------------------------------------------------------------------- /python/stromx/runtime/None.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | 21 | using namespace boost::python; 22 | using namespace stromx::runtime; 23 | 24 | void exportNone() 25 | { 26 | class_, boost::noncopyable>("None") 27 | ; 28 | } -------------------------------------------------------------------------------- /python/stromx/runtime/OperatorKernel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "ExportVector.h" 18 | 19 | #include 20 | #include 21 | 22 | #include 23 | 24 | using namespace boost::python; 25 | using namespace stromx::runtime; 26 | 27 | namespace 28 | { 29 | struct OperatorKernelWrap : public OperatorKernel, wrapper 30 | { 31 | virtual OperatorKernel* clone() const 32 | { 33 | return this->get_override("clone")(); 34 | } 35 | 36 | virtual void execute(DataProvider& provider) 37 | { 38 | this->get_override("execute")(provider); 39 | } 40 | }; 41 | } 42 | 43 | void exportOperatorKernel() 44 | { 45 | class_, bases, boost::noncopyable>("OperatorKernel", no_init) 46 | ; 47 | 48 | register_ptr_to_python< boost::shared_ptr >(); 49 | } 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /python/stromx/runtime/Parameter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | using namespace boost::python; 21 | using namespace stromx::runtime; 22 | 23 | void exportParameter() 24 | { 25 | scope in_Parameter = 26 | class_ >("Parameter", no_init) 27 | .def("accessMode", &Parameter::accessMode) 28 | .def("updateBehavior", &Parameter::updateBehavior) 29 | .def("group", reinterpret_cast(&Parameter::group), return_internal_reference<>()) 30 | .def("members", &Parameter::members, return_internal_reference<>()) 31 | ; 32 | 33 | enum_("AccessMode") 34 | .value("NO_ACCESS", Parameter::NO_ACCESS) 35 | .value("NONE_READ", Parameter::NONE_READ) 36 | .value("NONE_WRITE", Parameter::NONE_WRITE) 37 | .value("INITIALIZED_READ", Parameter::INITIALIZED_READ) 38 | .value("INITIALIZED_WRITE", Parameter::INITIALIZED_WRITE) 39 | .value("ACTIVATED_WRITE", Parameter::ACTIVATED_WRITE) 40 | ; 41 | } 42 | -------------------------------------------------------------------------------- /python/stromx/runtime/Position.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | 21 | using namespace boost::python; 22 | using namespace stromx::runtime; 23 | 24 | void exportPosition() 25 | { 26 | class_("Position", init()) 27 | .def("x", &Position::x) 28 | .def("y", &Position::y) 29 | .def("setX", &Position::setX) 30 | .def("setY", &Position::setY) 31 | ; 32 | } -------------------------------------------------------------------------------- /python/stromx/runtime/Registry.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | using namespace boost::python; 24 | using namespace stromx::runtime; 25 | 26 | namespace 27 | { 28 | struct RegistryWrap : Registry, wrapper 29 | { 30 | void registerOperator(const OperatorKernel* const op) 31 | { 32 | this->get_override("registerOperator")(op); 33 | } 34 | 35 | void registerData(const Data* data) 36 | { 37 | this->get_override("registerData")(data); 38 | } 39 | }; 40 | 41 | intptr_t _this(Registry& registry) 42 | { 43 | return reinterpret_cast(®istry); 44 | } 45 | } 46 | 47 | void exportRegistry() 48 | { 49 | class_("Registry", no_init) 50 | .def("registerOperator", pure_virtual(&Registry::registerOperator)) 51 | .def("registerData", pure_virtual(&Registry::registerData)) 52 | .def("_this", &_this) 53 | ; 54 | } 55 | -------------------------------------------------------------------------------- /python/stromx/runtime/SortInputsAlgorithm.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | using namespace boost::python; 23 | using namespace stromx::runtime; 24 | 25 | void exportSortInputsAlgorithm() 26 | { 27 | class_("SortInputsAlgorithm") 28 | .def("apply", &SortInputsAlgorithm::apply) 29 | ; 30 | } -------------------------------------------------------------------------------- /python/stromx/runtime/String.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | using namespace boost::python; 23 | using namespace stromx::runtime; 24 | 25 | namespace 26 | { 27 | boost::shared_ptr allocateFromString(const std::string & value) 28 | { 29 | return boost::shared_ptr(new String(value), boost::lambda::_1); 30 | } 31 | 32 | boost::shared_ptr allocate() 33 | { 34 | return boost::shared_ptr(new String(), boost::lambda::_1); 35 | } 36 | } 37 | 38 | void exportString() 39 | { 40 | class_, boost::shared_ptr >("String", no_init) 41 | .def("__init__", make_constructor(&allocate)) 42 | .def("__init__", make_constructor(&allocateFromString)) 43 | .def("get", &String::get, return_value_policy()) 44 | .def(self == self) 45 | .def(self != self) 46 | ; 47 | } -------------------------------------------------------------------------------- /python/stromx/runtime/ThreadUtilities.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_PYTHON_THREADUTILITIES_H 18 | #define STROMX_PYTHON_THREADUTILITIES_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace python 26 | { 27 | class ThreadUtilities 28 | { 29 | public: 30 | static bool interruptedFlag(const stromx::runtime::Thread* thread) 31 | { 32 | BOOST_ASSERT(thread); 33 | return thread->interruptedFlag(); 34 | } 35 | 36 | static void setInterruptedFlag(stromx::runtime::Thread* thread, const bool value) 37 | { 38 | BOOST_ASSERT(thread); 39 | thread->setInterruptedFlag(value); 40 | } 41 | }; 42 | } 43 | } 44 | 45 | #endif // STROMX_PYTHON_THREADUTILITIES_H -------------------------------------------------------------------------------- /python/stromx/runtime/Tribool.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | using namespace boost::python; 23 | using namespace stromx::runtime; 24 | 25 | namespace 26 | { 27 | boost::shared_ptr allocateFromBool(const bool value) 28 | { 29 | return boost::shared_ptr(new Tribool(value)); 30 | } 31 | 32 | boost::shared_ptr allocate() 33 | { 34 | return boost::shared_ptr(new Tribool(), boost::lambda::_1); 35 | } 36 | } 37 | 38 | void exportTribool() 39 | { 40 | class_, boost::shared_ptr >("Tribool", no_init) 41 | .def("__init__", make_constructor(&allocate)) 42 | .def("__init__", make_constructor(&allocateFromBool)) 43 | .def("__nonzero__", &Tribool::operator bool) 44 | .def("__bool__", &Tribool::operator bool) 45 | .def("undefined", &Tribool::undefined) 46 | .def(self == self) 47 | .def(self != self) 48 | ; 49 | } 50 | -------------------------------------------------------------------------------- /python/stromx/runtime/TriggerData.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | 21 | using namespace boost::python; 22 | using namespace stromx::runtime; 23 | 24 | void exportTriggerData() 25 | { 26 | class_, boost::noncopyable>("TriggerData") 27 | ; 28 | } -------------------------------------------------------------------------------- /python/stromx/runtime/VariantHandle.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | using namespace boost::python; 23 | using namespace stromx::runtime; 24 | 25 | void exportVariantHandle() 26 | { 27 | class_ >("VariantHandle", no_init) 28 | .def("__and__", &operator&&) 29 | .def("__or__", &operator||) 30 | ; 31 | } 32 | -------------------------------------------------------------------------------- /python/stromx/runtime/Version.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #undef major 19 | #undef minor 20 | 21 | #include 22 | 23 | 24 | using namespace boost::python; 25 | using namespace stromx::runtime; 26 | 27 | void exportVersion() 28 | { 29 | class_("Version", no_init) 30 | .def("major", &Version::major) 31 | .def("minor", &Version::minor) 32 | .def("revision", &Version::revision) 33 | ; 34 | } -------------------------------------------------------------------------------- /python/stromx/runtime/Visualization.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | #include 20 | 21 | using namespace boost::python; 22 | using namespace stromx::runtime; 23 | 24 | void exportVisualizationVariant() 25 | { 26 | scope in_Variant = 27 | class_("Visualization", no_init); 28 | 29 | in_Variant.attr("POINT") = Visualization::POINT; 30 | in_Variant.attr("LINE") = Visualization::LINE; 31 | in_Variant.attr("LINE_SEGMENT") = Visualization::LINE_SEGMENT; 32 | in_Variant.attr("POLYGON") = Visualization::POLYGON; 33 | in_Variant.attr("POLYLINE") = Visualization::POLYLINE; 34 | in_Variant.attr("RECTANGLE") = Visualization::RECTANGLE; 35 | in_Variant.attr("ROTATED_RECTANGLE") = Visualization::ROTATED_RECTANGLE; 36 | in_Variant.attr("ELLIPSE") = Visualization::ELLIPSE; 37 | in_Variant.attr("CIRCLE") = Visualization::CIRCLE; 38 | in_Variant.attr("HISTOGRAM") = Visualization::HISTOGRAM; 39 | } 40 | -------------------------------------------------------------------------------- /python/stromx/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set (SOURCES 2 | Test.cpp 3 | ) 4 | 5 | add_library (test_package SHARED ${SOURCES}) 6 | 7 | set_target_properties (test_package PROPERTIES FOLDER "python") 8 | set_target_properties (test_package PROPERTIES OUTPUT_NAME "test") 9 | 10 | include_directories ( 11 | ${CMAKE_SOURCE_DIR} 12 | ${CMAKE_BINARY_DIR} 13 | ${Boost_INCLUDE_DIRS} 14 | ${OpenCV2_INCLUDE_DIR} 15 | ${PYTHON_INCLUDE_DIRS} 16 | ) 17 | 18 | target_link_libraries (test_package 19 | ${Boost_LIBRARIES} 20 | ${PYTHON_LIBRARY} 21 | stromx_runtime 22 | stromx_cvsupport 23 | stromx_test 24 | ) 25 | 26 | file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/__init__.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) 27 | 28 | if(PYTHON_INSTALL_DIR) 29 | install(DIRECTORY . 30 | DESTINATION ${PYTHON_INSTALL_DIR}/stromx/test 31 | FILES_MATCHING PATTERN "*.py" 32 | ) 33 | install(TARGETS test_package 34 | DESTINATION ${PYTHON_INSTALL_DIR}/stromx/test 35 | ) 36 | endif() 37 | -------------------------------------------------------------------------------- /python/stromx/test/Test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | using namespace boost::python; 12 | using namespace stromx::test; 13 | 14 | BOOST_PYTHON_MODULE(libtest) 15 | { 16 | stromx::python::exportOperatorKernel("DeadlockOperator"); 17 | stromx::python::exportOperatorKernel("ExceptionOperator"); 18 | stromx::python::exportOperatorKernel("ParameterOperator"); 19 | stromx::python::exportOperatorKernel("RandomDataOperator"); 20 | stromx::python::exportOperatorKernel("TestDataOperator"); 21 | } 22 | -------------------------------------------------------------------------------- /python/stromx/test/__init__.py: -------------------------------------------------------------------------------- 1 | import stromx.runtime 2 | 3 | from stromx.test.libtest import * 4 | -------------------------------------------------------------------------------- /python/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_test(NAME python_test_exceptions COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/exceptions.py) 2 | add_test(NAME python_test_factory COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/factory.py) 3 | add_test(NAME python_test_data_cast COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/data_cast.py) 4 | add_test(NAME python_test_providers COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/providers.py) 5 | add_test(NAME python_test_observer COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/observer.py) 6 | add_test(NAME python_test_tribool COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tribool.py) 7 | 8 | set(TEST_PYTHONPATH "${CMAKE_BINARY_DIR}/python") 9 | set_tests_properties(python_test_exceptions PROPERTIES ENVIRONMENT "${PYTHON_TEST_ENVIRONMENT}") 10 | set_tests_properties(python_test_factory PROPERTIES ENVIRONMENT "${PYTHON_TEST_ENVIRONMENT}") 11 | set_tests_properties(python_test_data_cast PROPERTIES ENVIRONMENT "${PYTHON_TEST_ENVIRONMENT}") 12 | set_tests_properties(python_test_providers PROPERTIES ENVIRONMENT "${PYTHON_TEST_ENVIRONMENT}") 13 | set_tests_properties(python_test_observer PROPERTIES ENVIRONMENT "${PYTHON_TEST_ENVIRONMENT}") 14 | set_tests_properties(python_test_tribool PROPERTIES ENVIRONMENT "${PYTHON_TEST_ENVIRONMENT}") 15 | -------------------------------------------------------------------------------- /python/test/data_cast.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import stromx.runtime 4 | import stromx.cvsupport 5 | 6 | # stromx.runtime.Image 7 | image = stromx.cvsupport.Image(20, 10, stromx.runtime.Image.PixelType.MONO_8) 8 | casted = stromx.runtime.Image.data_cast(image) 9 | print(casted.width()) 10 | 11 | container = stromx.runtime.DataContainer(image) 12 | with stromx.runtime.ReadAccess(container) as access: 13 | casted = stromx.runtime.Image.data_cast(access.get()) 14 | print(casted.width()) 15 | 16 | primitive = stromx.runtime.UInt32(5) 17 | casted = stromx.runtime.Image.data_cast(primitive) 18 | assert(casted == None) 19 | 20 | # stromx.runtime.Matrix 21 | matrix = stromx.cvsupport.Matrix(20, 10, stromx.runtime.Matrix.ValueType.INT_32) 22 | casted = stromx.runtime.Matrix.data_cast(matrix) 23 | print(casted.cols()) 24 | 25 | container = stromx.runtime.DataContainer(matrix) 26 | with stromx.runtime.ReadAccess(container) as access: 27 | casted = stromx.runtime.Matrix.data_cast(access.get()) 28 | print(casted.cols()) 29 | 30 | primitive = stromx.runtime.UInt32(5) 31 | casted = stromx.runtime.Matrix.data_cast(primitive) 32 | assert(casted == None) 33 | -------------------------------------------------------------------------------- /python/test/factory.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # 4 | # Copyright 2011 Matthias Fuchs 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | from stromx import register, runtime 20 | 21 | factory = runtime.Factory() 22 | register("libstromx_runtime.so", factory) 23 | print(runtime.versionString()) 24 | 25 | stream = runtime.Stream() 26 | kernel = factory.newOperator("runtime", "Counter") 27 | op1 = stream.addOperator(kernel) 28 | stream.hideOperator(op1) 29 | 30 | op2 = runtime.Operator(runtime.Receive()) 31 | try: 32 | stream.hideOperator(op2) 33 | except runtime.WrongArgument as e: 34 | print(e) 35 | 36 | -------------------------------------------------------------------------------- /python/test/providers.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import stromx.runtime as sr 4 | 5 | stream = sr.Stream() 6 | stream.setName("My stream") 7 | data = "dfdsfdsds\nkljkljkfldsjf" 8 | factory = sr.Factory() 9 | 10 | with sr.ZipFileOutput("provider_test.zip") as out: 11 | out.initialize("filename") 12 | out.openFile(".txt", sr.OutputProvider.OpenMode.TEXT) 13 | out.file().write(data) 14 | sr.XmlWriter().writeStream(out, "stream", stream) 15 | 16 | with sr.ZipFileInput("provider_test.zip") as inp: 17 | inp.initialize("", "filename.txt") 18 | inp.openFile(sr.InputProvider.OpenMode.TEXT) 19 | data = inp.file().read() 20 | stream = sr.XmlReader().readStream(inp, "stream.xml", factory) 21 | 22 | print(stream.name()) 23 | print(data) 24 | -------------------------------------------------------------------------------- /python/test/tribool.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from stromx.runtime import Tribool 4 | import unittest 5 | 6 | class TriboolTest(unittest.TestCase): 7 | def testTrue(self): 8 | t = Tribool(True) 9 | self.assertEqual(Tribool(True), t) 10 | self.assertFalse(t.undefined()) 11 | self.assertTrue(bool(t)) 12 | 13 | def testFalse(self): 14 | t = Tribool(False) 15 | self.assertEqual(Tribool(False), t) 16 | self.assertFalse(t.undefined()) 17 | self.assertFalse(bool(t)) 18 | 19 | def testUndefined(self): 20 | t = Tribool() 21 | self.assertEqual(Tribool(), t) 22 | self.assertTrue(t.undefined()) 23 | self.assertFalse(bool(t)) 24 | 25 | if __name__ == '__main__': 26 | unittest.main() 27 | -------------------------------------------------------------------------------- /rpm/stromx.changes: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------- 2 | Sat May 14 21:00:00 UTC 2016 - matz.fuchs@gmx.at 3 | - Update to version 0.7.0 4 | 5 | ------------------------------------------------------------------- 6 | Sat Dec 26 21:00:00 UTC 2015 - matz.fuchs@gmx.at 7 | - Update to version 0.6.0 8 | 9 | ------------------------------------------------------------------- 10 | Sun Nov 18 21:00:00 UTC 2014 - matz.fuchs@gmx.at 11 | - Update to version 0.5.0 12 | 13 | ------------------------------------------------------------------- 14 | Sun Nov 18 21:00:00 UTC 2014 - matz.fuchs@gmx.at 15 | - Update to version 0.4.0 16 | 17 | ------------------------------------------------------------------- 18 | Sun Mar 23 20:00:00 UTC 2014 - matz.fuchs@gmx.at 19 | - Update to version 0.3.0 20 | 21 | ------------------------------------------------------------------- 22 | Sat Nov 17 20:00:00 UTC 2013 - matz.fuchs@gmx.at 23 | - Update to version 0.2.0 24 | 25 | ------------------------------------------------------------------- 26 | Sun Feb 19 15:03:36 UTC 2012 - matz.fuchs@gmx.at 27 | - Initial release 28 | -------------------------------------------------------------------------------- /stromx.kdev4: -------------------------------------------------------------------------------- 1 | [Project] 2 | Manager=KDevCMakeManager 3 | Name=stromx 4 | -------------------------------------------------------------------------------- /stromx/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(TEST_ENVIRONMENT "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}") 2 | 3 | add_subdirectory(runtime) 4 | 5 | if(BUILD_OPENCV_WRAPPER) 6 | add_subdirectory(cvsupport) 7 | add_subdirectory(test) 8 | endif() 9 | 10 | -------------------------------------------------------------------------------- /stromx/cvsupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | configure_file ( 2 | ${CMAKE_CURRENT_SOURCE_DIR}/Config.h.in 3 | ${CMAKE_CURRENT_BINARY_DIR}/Config.h 4 | ) 5 | 6 | if(BUILD_TESTS) 7 | add_subdirectory(test) 8 | endif() 9 | 10 | include_directories( 11 | ${CMAKE_SOURCE_DIR} 12 | ${CMAKE_BINARY_DIR} 13 | ${Boost_INCLUDE_DIRS} 14 | ) 15 | 16 | set(SOURCES 17 | AdjustRgbChannels.cpp 18 | Buffer.cpp 19 | Clip.cpp 20 | ConvertPixelType.cpp 21 | ConstImage.cpp 22 | DummyCamera.cpp 23 | Flicker.cpp 24 | Image.cpp 25 | Cvsupport.cpp 26 | Matrix.cpp 27 | Utilities.cpp 28 | ReadDirectory.cpp 29 | impl/CameraBuffer.cpp 30 | ) 31 | 32 | add_library(stromx_cvsupport SHARED ${SOURCES}) 33 | 34 | set(VERSION_STRING "${STROMX_VERSION_MAJOR}.${STROMX_VERSION_MINOR}.${STROMX_VERSION_PATCH}") 35 | 36 | set_target_properties(stromx_cvsupport PROPERTIES 37 | VERSION ${VERSION_STRING} 38 | SOVERSION ${VERSION_STRING} 39 | FOLDER "library" 40 | ) 41 | 42 | target_link_libraries(stromx_cvsupport 43 | ${OpenCV_LIBS} 44 | stromx_runtime 45 | ) 46 | 47 | if(WIN32) 48 | install (TARGETS stromx_cvsupport 49 | RUNTIME DESTINATION . 50 | LIBRARY DESTINATION ${LIB_DIR} 51 | ARCHIVE DESTINATION ${LIB_DIR} 52 | ) 53 | 54 | else(WIN32) 55 | install (TARGETS stromx_cvsupport 56 | RUNTIME DESTINATION bin 57 | LIBRARY DESTINATION ${LIB_DIR} 58 | ARCHIVE DESTINATION ${LIB_DIR} 59 | ) 60 | endif(WIN32) 61 | 62 | install(DIRECTORY ${CMAKE_SOURCE_DIR}/stromx/cvsupport 63 | DESTINATION include/stromx 64 | FILES_MATCHING PATTERN "*.h" 65 | PATTERN "impl" EXCLUDE 66 | PATTERN "test" EXCLUDE 67 | ) 68 | 69 | install(FILES ${CMAKE_BINARY_DIR}/stromx/cvsupport/Config.h 70 | DESTINATION include/stromx/cvsupport 71 | ) 72 | -------------------------------------------------------------------------------- /stromx/cvsupport/Cvsupport.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_CVSUPPORT_H 18 | #define STROMX_CVSUPPORT_H 19 | 20 | #include 21 | 22 | #include "stromx/cvsupport/Config.h" 23 | 24 | namespace stromx 25 | { 26 | namespace runtime 27 | { 28 | class Registry; 29 | } 30 | 31 | namespace cvsupport 32 | { 33 | extern std::locale locale; 34 | } 35 | } 36 | 37 | extern "C" 38 | { 39 | STROMX_CVSUPPORT_API int stromxRegisterCvsupport(stromx::runtime::Registry* registry); 40 | } 41 | 42 | #endif // STROMX_CVSUPPORT_H 43 | -------------------------------------------------------------------------------- /stromx/cvsupport/Locale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_CVSUPPORT_LOCALE_H 18 | #define STROMX_CVSUPPORT_LOCALE_H 19 | 20 | #include 21 | 22 | namespace stromx 23 | { 24 | namespace cvsupport 25 | { 26 | extern std::locale locale; 27 | } 28 | } 29 | 30 | #endif // STROMX_CVSUPPORT_LOCALE_H 31 | -------------------------------------------------------------------------------- /stromx/cvsupport/cvsupport.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \namespace stromx::cvsupport 3 | \brief %Image utility types and functions 4 | */ -------------------------------------------------------------------------------- /stromx/cvsupport/test/AdjustRgbChannelsTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_CVSUPPORT_ADJUSTRGBCHANNELSTEST_H 18 | #define STROMX_CVSUPPORT_ADJUSTRGBCHANNELSTEST_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace stromx 25 | { 26 | namespace runtime 27 | { 28 | class OperatorTester; 29 | } 30 | 31 | namespace cvsupport 32 | { 33 | class AdjustRgbChannelsTest : public CPPUNIT_NS :: TestFixture 34 | { 35 | CPPUNIT_TEST_SUITE (AdjustRgbChannelsTest); 36 | CPPUNIT_TEST (testExecute); 37 | CPPUNIT_TEST_SUITE_END (); 38 | 39 | public: 40 | AdjustRgbChannelsTest() : m_operator(0) {} 41 | 42 | void setUp(); 43 | void tearDown(); 44 | 45 | protected: 46 | void testExecute(); 47 | 48 | private: 49 | runtime::OperatorTester* m_operator; 50 | }; 51 | } 52 | } 53 | 54 | #endif // STROMX_CVSUPPORT_ADJUSTRGBCHANNELSTEST_H -------------------------------------------------------------------------------- /stromx/cvsupport/test/BufferTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_CVSUPPORT_BUFFERTEST_H 18 | #define STROMX_CVSUPPORT_BUFFERTEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class OperatorTester; 28 | } 29 | 30 | namespace cvsupport 31 | { 32 | class BufferTest : public CPPUNIT_NS :: TestFixture 33 | { 34 | CPPUNIT_TEST_SUITE (BufferTest); 35 | CPPUNIT_TEST(testExecute); 36 | CPPUNIT_TEST(testSetNoBuffers); 37 | CPPUNIT_TEST_SUITE_END (); 38 | 39 | public: 40 | BufferTest() : m_operator(0) {} 41 | 42 | void setUp(); 43 | void tearDown(); 44 | 45 | protected: 46 | void testExecute(); 47 | void testSetNoBuffers(); 48 | 49 | private: 50 | runtime::OperatorTester* m_operator; 51 | }; 52 | } 53 | } 54 | 55 | #endif // STROMX_CVSUPPORT_BUFFERTEST_H -------------------------------------------------------------------------------- /stromx/cvsupport/test/CameraBufferTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_CVSUPPORT_CAMERABUFFERTEST_H 18 | #define STROMX_CVSUPPORT_CAMERABUFFERTEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class OperatorTester; 28 | } 29 | 30 | namespace cvsupport 31 | { 32 | class CameraBufferTest : public CPPUNIT_NS :: TestFixture 33 | { 34 | CPPUNIT_TEST_SUITE (CameraBufferTest); 35 | CPPUNIT_TEST(testExecute); 36 | CPPUNIT_TEST_SUITE_END (); 37 | 38 | public: 39 | CameraBufferTest() : m_operator(0) {} 40 | 41 | void setUp(); 42 | void tearDown(); 43 | 44 | protected: 45 | void testExecute(); 46 | 47 | private: 48 | runtime::OperatorTester* m_operator; 49 | }; 50 | } 51 | } 52 | 53 | #endif // STROMX_CVSUPPORT_CAMERABUFFERTEST_H -------------------------------------------------------------------------------- /stromx/cvsupport/test/ClipTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_CVSUPPORT_CLIPTEST_H 18 | #define STROMX_CVSUPPORT_CLIPTEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class OperatorTester; 28 | } 29 | 30 | namespace cvsupport 31 | { 32 | class ClipTest : public CPPUNIT_NS :: TestFixture 33 | { 34 | CPPUNIT_TEST_SUITE (ClipTest); 35 | CPPUNIT_TEST (testExecute); 36 | CPPUNIT_TEST (testAdjustClipRegion1); 37 | CPPUNIT_TEST (testAdjustClipRegion2); 38 | CPPUNIT_TEST_SUITE_END (); 39 | 40 | public: 41 | ClipTest() : m_operator(0) {} 42 | 43 | void setUp(); 44 | void tearDown(); 45 | 46 | protected: 47 | void testExecute(); 48 | void testAdjustClipRegion1(); 49 | void testAdjustClipRegion2(); 50 | 51 | private: 52 | runtime::OperatorTester* m_operator; 53 | }; 54 | } 55 | } 56 | 57 | #endif // STROMX_CVSUPPORT_CLIPTEST_H -------------------------------------------------------------------------------- /stromx/cvsupport/test/ConstImageTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_CVSUPPORT_CONSTIMAGETEST_H 18 | #define STROMX_CVSUPPORT_CONSTIMAGETEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class OperatorTester; 28 | } 29 | 30 | namespace cvsupport 31 | { 32 | class ConstImageTest : public CPPUNIT_NS :: TestFixture 33 | { 34 | CPPUNIT_TEST_SUITE (ConstImageTest); 35 | CPPUNIT_TEST (testExecute); 36 | CPPUNIT_TEST_SUITE_END (); 37 | 38 | public: 39 | ConstImageTest() : m_operator(0) {} 40 | 41 | void setUp(); 42 | void tearDown(); 43 | 44 | protected: 45 | void testExecute(); 46 | 47 | private: 48 | runtime::OperatorTester* m_operator; 49 | }; 50 | } 51 | } 52 | 53 | #endif // STROMX_CVSUPPORT_CONSTIMAGETEST_H -------------------------------------------------------------------------------- /stromx/cvsupport/test/CvsupportTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_CVSUPPORT_EXAMPLETEST_H 18 | #define STROMX_CVSUPPORT_EXAMPLETEST_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace stromx 25 | { 26 | namespace runtime 27 | { 28 | class Factory; 29 | } 30 | 31 | namespace cvsupport 32 | { 33 | class Image; 34 | 35 | class CvsupportTest : public CPPUNIT_NS :: TestFixture 36 | { 37 | CPPUNIT_TEST_SUITE (CvsupportTest); 38 | CPPUNIT_TEST (testRegisterCvsupport); 39 | CPPUNIT_TEST_SUITE_END (); 40 | 41 | public: 42 | CvsupportTest() : m_factory(0) {} 43 | 44 | void setUp(); 45 | void tearDown(); 46 | 47 | protected: 48 | void testRegisterCvsupport(); 49 | 50 | private: 51 | runtime::Factory* m_factory; 52 | }; 53 | } 54 | } 55 | 56 | #endif // STROMX_CVSUPPORT_EXAMPLETEST_H -------------------------------------------------------------------------------- /stromx/cvsupport/test/FlickerTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_CVSUPPORT_FLICKERTEST_H 18 | #define STROMX_CVSUPPORT_FLICKERTEST_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace stromx 25 | { 26 | namespace runtime 27 | { 28 | class OperatorTester; 29 | } 30 | 31 | namespace cvsupport 32 | { 33 | class FlickerTest : public CPPUNIT_NS :: TestFixture 34 | { 35 | CPPUNIT_TEST_SUITE (FlickerTest); 36 | CPPUNIT_TEST (testExecute); 37 | CPPUNIT_TEST_SUITE_END (); 38 | 39 | public: 40 | FlickerTest() : m_operator(0) {} 41 | 42 | void setUp(); 43 | void tearDown(); 44 | 45 | protected: 46 | void testExecute(); 47 | 48 | private: 49 | runtime::OperatorTester* m_operator; 50 | }; 51 | } 52 | } 53 | 54 | #endif // STROMX_CVSUPPORT_FLICKERTEST_H -------------------------------------------------------------------------------- /stromx/cvsupport/test/double_matrix.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/stromx/cvsupport/test/double_matrix.npy -------------------------------------------------------------------------------- /stromx/cvsupport/test/edges.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/stromx/cvsupport/test/edges.png -------------------------------------------------------------------------------- /stromx/cvsupport/test/empty_float_matrix.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/stromx/cvsupport/test/empty_float_matrix.npy -------------------------------------------------------------------------------- /stromx/cvsupport/test/lenna.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/stromx/cvsupport/test/lenna.jpg -------------------------------------------------------------------------------- /stromx/cvsupport/test/lenna_bw.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/stromx/cvsupport/test/lenna_bw.jpg -------------------------------------------------------------------------------- /stromx/cvsupport/test/uint16_matrix.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/stromx/cvsupport/test/uint16_matrix.npy -------------------------------------------------------------------------------- /stromx/runtime/AssignThreadsAlgorithm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_ASSIGNTHREADSALGORITHM_H 18 | #define STROMX_RUNTIME_ASSIGNTHREADSALGORITHM_H 19 | 20 | #include "stromx/runtime/Config.h" 21 | 22 | namespace stromx 23 | { 24 | namespace runtime 25 | { 26 | class Stream; 27 | 28 | /** \brief Algorithm which assigns threads to the stream. */ 29 | class STROMX_RUNTIME_API AssignThreadsAlgorithm 30 | { 31 | public: 32 | /** Constructs a thread assigning algorithm. */ 33 | AssignThreadsAlgorithm() {} 34 | 35 | /** 36 | * Creates threads and assigns the connected inputs of the stream to 37 | * them such that connectors with different operator threads are 38 | * never part of the same thread. 39 | */ 40 | void apply(Stream & stream); 41 | }; 42 | } 43 | } 44 | 45 | #endif // STROMX_RUNTIME_ASSIGNTHREADSALGORITHM_H 46 | -------------------------------------------------------------------------------- /stromx/runtime/Connector.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/Connector.h" 18 | 19 | namespace stromx 20 | { 21 | namespace runtime 22 | { 23 | bool operator==(const Connector & lhs, const Connector & rhs) 24 | { 25 | return lhs.m_type == rhs.m_type && lhs.m_op == rhs.m_op && lhs.m_id == rhs.m_id; 26 | } 27 | } 28 | } 29 | 30 | -------------------------------------------------------------------------------- /stromx/runtime/ConnectorObserver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_CONNECTOROBSERVER_H 18 | #define STROMX_RUNTIME_CONNECTOROBSERVER_H 19 | 20 | 21 | namespace stromx 22 | { 23 | namespace runtime 24 | { 25 | class Connector; 26 | class DataContainer; 27 | class Thread; 28 | 29 | /** \brief Abstract base class of observers of operator connectors. */ 30 | class ConnectorObserver 31 | { 32 | public: 33 | /** Informs the observer that \c connector was set to \c data. */ 34 | virtual void observe(const Connector & connector, const DataContainer & oldData, const DataContainer & newData, const Thread* const thread) const = 0; 35 | }; 36 | } 37 | } 38 | 39 | #endif // STROMX_RUNTIME_CONNECTOROBSERVER_H 40 | -------------------------------------------------------------------------------- /stromx/runtime/Data.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/Data.h" 18 | #include "stromx/runtime/DataRef.h" 19 | #include "stromx/runtime/Variant.h" 20 | 21 | namespace stromx 22 | { 23 | namespace runtime 24 | { 25 | void Data::serialize(OutputProvider &) const 26 | { 27 | throw Exception("This data type does not support serialization."); 28 | } 29 | 30 | void Data::deserialize(InputProvider &, const Version &) 31 | { 32 | throw Exception("This data type does not support deserialization."); 33 | } 34 | 35 | const VariantHandle & data_traits::variant() 36 | { 37 | return Variant::DATA; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /stromx/runtime/Description.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/Description.h" 18 | #include "stromx/runtime/Exception.h" 19 | #include "stromx/runtime/Variant.h" 20 | 21 | namespace stromx 22 | { 23 | namespace runtime 24 | { 25 | const std::vector Description::NO_DESCRIPTIONS = std::vector(); 26 | const None Description::NONE = None(); 27 | 28 | Description::Description(const unsigned int id, const VariantHandle& variant) 29 | : m_id(id), 30 | m_variant(variant), 31 | m_visualization(Variant::NONE) 32 | {} 33 | 34 | void Description::setVisualization(const VariantHandle & visualization) 35 | { 36 | if (! visualization.isValid()) 37 | throw WrongArgument("Visualization of a description must be a valid variant."); 38 | 39 | m_visualization = visualization; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /stromx/runtime/Enum.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/Enum.h" 18 | 19 | #include "stromx/runtime/Variant.h" 20 | 21 | namespace stromx 22 | { 23 | namespace runtime 24 | { 25 | const std::string Enum::TYPE = "Enum"; 26 | 27 | const VariantHandle & Enum::variant() const { return Variant::ENUM; } 28 | const VariantHandle & data_traits::variant() { return Variant::ENUM; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /stromx/runtime/FileInput.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_FILEINPUT_H 18 | #define STROMX_RUNTIME_FILEINPUT_H 19 | 20 | #include "stromx/runtime/InputProvider.h" 21 | 22 | namespace stromx 23 | { 24 | namespace runtime 25 | { 26 | /** \brief Provides functions to initialize an input provider. */ 27 | class FileInput : public InputProvider 28 | { 29 | public: 30 | /** 31 | * Initializes the file input to text and file data. 32 | * \param text The text data. 33 | * \param filename The name of the file which contains the file data. Pass an empty 34 | * string if no file should be provided. 35 | */ 36 | virtual void initialize(const std::string & text, const std::string & filename = "") = 0; 37 | 38 | /** 39 | * Closes the file input. If this functions is not called the input is closed 40 | * by the destructor. 41 | */ 42 | virtual void close() = 0; 43 | 44 | virtual ~FileInput() {} 45 | }; 46 | } 47 | } 48 | 49 | #endif // STROMX_RUNTIME_FILEINPUT_H 50 | -------------------------------------------------------------------------------- /stromx/runtime/Id2DataMapper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_ID2DATAMAPPER_H 18 | #define STROMX_RUNTIME_ID2DATAMAPPER_H 19 | 20 | namespace stromx 21 | { 22 | namespace runtime 23 | { 24 | namespace impl 25 | { 26 | class Id2DataMap; 27 | } 28 | 29 | /** \brief Abstract base class of ID-to-data mappers. */ 30 | class Id2DataMapper 31 | { 32 | public: 33 | virtual ~Id2DataMapper() {} 34 | 35 | virtual bool trySet(const impl::Id2DataMap& id2DataMap) const = 0; 36 | virtual bool tryGet(const impl::Id2DataMap& id2DataMap) const = 0; 37 | virtual void get(impl::Id2DataMap& id2DataMap) const = 0; 38 | virtual void set(impl::Id2DataMap& id2DataMap) const = 0; 39 | }; 40 | } 41 | } 42 | 43 | #endif // STROMX_RUNTIME_ID2DATAMAPPER_H -------------------------------------------------------------------------------- /stromx/runtime/Input.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_INPUT_H 18 | #define STROMX_RUNTIME_INPUT_H 19 | 20 | #include "stromx/runtime/ConnectorDescription.h" 21 | 22 | namespace stromx 23 | { 24 | namespace runtime 25 | { 26 | 27 | /** \brief %Description of an input. */ 28 | class STROMX_RUNTIME_API Input : public ConnectorDescription 29 | { 30 | public: 31 | /** Constructs a description. */ 32 | Input(const unsigned int id, const VariantHandle& variant) 33 | : ConnectorDescription(id, variant, INPUT) 34 | {} 35 | 36 | virtual Type originalType() const { return INPUT; } 37 | virtual Type currentType() const { return INPUT; } 38 | 39 | private: 40 | unsigned int m_operatorThread; 41 | Type m_defaultType; 42 | }; 43 | } 44 | } 45 | 46 | #endif // STROMX_RUNTIME_INPUT_H -------------------------------------------------------------------------------- /stromx/runtime/InputConnector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_INPUTCONNECTOR_H 18 | #define STROMX_RUNTIME_INPUTCONNECTOR_H 19 | 20 | #include "stromx/runtime/Connector.h" 21 | 22 | namespace stromx 23 | { 24 | namespace runtime 25 | { 26 | /** \brief Identifier of an input connector of an operator. */ 27 | class InputConnector : public Connector 28 | { 29 | public: 30 | /** 31 | * Constructs an input connector which points to the input 32 | * \c id of the operator \c op. 33 | */ 34 | InputConnector(const Operator* const op, const unsigned int id) 35 | : Connector(Connector::INPUT, op, id) 36 | {} 37 | 38 | /** Constructs an invalid input connector. */ 39 | InputConnector() 40 | : Connector(Connector::INPUT, 0, 0) 41 | {} 42 | }; 43 | } 44 | } 45 | 46 | #endif // STROMX_RUNTIME_INPUTCONNECTOR_H 47 | -------------------------------------------------------------------------------- /stromx/runtime/IsEmpty.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/IsEmpty.h" 18 | 19 | #include "stromx/runtime/Locale.h" 20 | #include "stromx/runtime/Matrix.h" 21 | #include "stromx/runtime/Variant.h" 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | const std::string IsEmpty::TITLE("IsEmpty"); 28 | 29 | IsEmpty::IsEmpty() 30 | : MatrixPropertyBase(TITLE) 31 | { 32 | } 33 | 34 | Data* IsEmpty::getProperty(const Matrix & matrix) 35 | { 36 | return new Bool(matrix.rows() == 0 || matrix.cols() == 0); 37 | } 38 | 39 | Output* IsEmpty::createOutput() 40 | { 41 | Output* output = new Output(PROPERTY, Variant::BOOL); 42 | output->setTitle(L_("Is empty")); 43 | return output; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /stromx/runtime/IsEmpty.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_ISEMPTY_H 18 | #define STROMX_RUNTIME_ISEMPTY_H 19 | 20 | #include "stromx/runtime/Config.h" 21 | #include "stromx/runtime/MatrixPropertyBase.h" 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class Matrix; 28 | 29 | class STROMX_RUNTIME_API IsEmpty : public MatrixPropertyBase 30 | { 31 | public: 32 | IsEmpty(); 33 | virtual OperatorKernel* clone() const { return new IsEmpty; } 34 | 35 | protected: 36 | virtual Data* getProperty(const Matrix & matrix); 37 | virtual Output* createOutput(); 38 | 39 | private: 40 | static const std::string TITLE; 41 | }; 42 | } 43 | } 44 | 45 | #endif // STROMX_RUNTIME_ISEMPTY_H 46 | -------------------------------------------------------------------------------- /stromx/runtime/IsNotEmpty.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/IsNotEmpty.h" 18 | 19 | #include "stromx/runtime/Locale.h" 20 | #include "stromx/runtime/Matrix.h" 21 | #include "stromx/runtime/Variant.h" 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | const std::string IsNotEmpty::TITLE("IsNotEmpty"); 28 | 29 | IsNotEmpty::IsNotEmpty() 30 | : MatrixPropertyBase(TITLE) 31 | { 32 | } 33 | 34 | Data* IsNotEmpty::getProperty(const Matrix & matrix) 35 | { 36 | return new Bool(matrix.rows() != 0 && matrix.cols() != 0); 37 | } 38 | 39 | Output* IsNotEmpty::createOutput() 40 | { 41 | Output* output = new Output(PROPERTY, Variant::BOOL); 42 | output->setTitle(L_("Is not empty")); 43 | return output; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /stromx/runtime/IsNotEmpty.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_ISNOTEMPTY_H 18 | #define STROMX_RUNTIME_ISNOTEMPTY_H 19 | 20 | #include "stromx/runtime/Config.h" 21 | #include "stromx/runtime/MatrixPropertyBase.h" 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class Matrix; 28 | 29 | class STROMX_RUNTIME_API IsNotEmpty : public MatrixPropertyBase 30 | { 31 | public: 32 | IsNotEmpty(); 33 | virtual OperatorKernel* clone() const { return new IsNotEmpty; } 34 | 35 | protected: 36 | virtual Data* getProperty(const Matrix & matrix); 37 | virtual Output* createOutput(); 38 | 39 | private: 40 | static const std::string TITLE; 41 | }; 42 | } 43 | } 44 | 45 | #endif // STROMX_RUNTIME_ISNOTEMPTY_H 46 | -------------------------------------------------------------------------------- /stromx/runtime/Locale.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/Locale.h" 18 | 19 | #include 20 | 21 | namespace stromx 22 | { 23 | namespace runtime 24 | { 25 | std::string Locale::gettext(const char* const id, const std::locale & locale) 26 | { 27 | return boost::locale::gettext(id, locale); 28 | } 29 | 30 | std::locale Locale::generate(const char* const path, const char* const domain) 31 | { 32 | boost::locale::generator gen; 33 | gen.add_messages_path(path); 34 | gen.add_messages_domain(domain); 35 | return gen.generate(""); 36 | } 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /stromx/runtime/Locale.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_LOCALE_H 18 | #define STROMX_RUNTIME_LOCALE_H 19 | 20 | #include 21 | #include "stromx/runtime/Config.h" 22 | 23 | #define L_(id) stromx::runtime::Locale::gettext(id, locale) 24 | 25 | namespace stromx 26 | { 27 | namespace runtime 28 | { 29 | extern std::locale locale; 30 | 31 | class STROMX_RUNTIME_API Locale 32 | { 33 | public: 34 | static std::string gettext(const char* const id, const std::locale & locale); 35 | static std::locale generate(const char* const path, const char* const domain); 36 | }; 37 | } 38 | } 39 | 40 | #endif // STROMX_RUNTIME_LOCALE_H 41 | -------------------------------------------------------------------------------- /stromx/runtime/MatrixParameter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/MatrixParameter.h" 18 | 19 | #include "stromx/runtime/Exception.h" 20 | #include "stromx/runtime/Variant.h" 21 | 22 | namespace stromx 23 | { 24 | namespace runtime 25 | { 26 | MatrixParameter::MatrixParameter(const unsigned int id, const VariantHandle& variant, ParameterGroup* const group) 27 | : Parameter(id, variant, group), 28 | m_rows(0), 29 | m_cols(0) 30 | { 31 | if(! variant.isVariant(Variant::MATRIX)) 32 | throw WrongArgument("The variant of a matrix parameter must be a matrix variant."); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /stromx/runtime/None.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/Config.h" 18 | #include "stromx/runtime/None.h" 19 | #include "stromx/runtime/Variant.h" 20 | #include "stromx/runtime/Version.h" 21 | 22 | namespace stromx 23 | { 24 | namespace runtime 25 | { 26 | const std::string None::TYPE = "None"; 27 | const std::string None::PACKAGE = STROMX_RUNTIME_PACKAGE_NAME; 28 | const Version None::VERSION = Version(STROMX_RUNTIME_VERSION_MAJOR, STROMX_RUNTIME_VERSION_MINOR, STROMX_RUNTIME_VERSION_PATCH); 29 | 30 | const VariantHandle & data_traits::variant() 31 | { 32 | return Variant::NONE; 33 | } 34 | 35 | const VariantHandle & None::variant() const 36 | { 37 | return Variant::NONE; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /stromx/runtime/Output.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_OUTPUT_H 18 | #define STROMX_RUNTIME_OUTPUT_H 19 | 20 | #include "stromx/runtime/ConnectorDescription.h" 21 | 22 | namespace stromx 23 | { 24 | namespace runtime 25 | { 26 | 27 | /** \brief %Description of an input. */ 28 | class STROMX_RUNTIME_API Output : public ConnectorDescription 29 | { 30 | public: 31 | /** Constructs a description. */ 32 | Output(const unsigned int id, const VariantHandle& variant) 33 | : ConnectorDescription(id, variant, OUTPUT) 34 | {} 35 | 36 | virtual Type originalType() const { return OUTPUT; } 37 | virtual Type currentType() const { return OUTPUT; } 38 | 39 | private: 40 | unsigned int m_operatorThread; 41 | Type m_defaultType; 42 | }; 43 | } 44 | } 45 | 46 | #endif // STROMX_RUNTIME_OUTPUT_H -------------------------------------------------------------------------------- /stromx/runtime/OutputConnector.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_OUTPUTCONNECTOR_H 18 | #define STROMX_RUNTIME_OUTPUTCONNECTOR_H 19 | 20 | #include "stromx/runtime/Connector.h" 21 | 22 | namespace stromx 23 | { 24 | namespace runtime 25 | { 26 | /** \brief Identifier of an output of an operator. */ 27 | class OutputConnector : public Connector 28 | { 29 | public: 30 | /** 31 | * Constructs an output connector which points to the output 32 | * \c id of the operator \c op. 33 | */ 34 | OutputConnector(const Operator* const op, const unsigned int id) 35 | : Connector(Connector::OUTPUT, op, id) 36 | {} 37 | 38 | /** Constructs an invalid output connector. */ 39 | OutputConnector() 40 | : Connector(Connector::OUTPUT, 0, 0) 41 | {} 42 | }; 43 | } 44 | } 45 | 46 | #endif // STROMX_RUNTIME_OUTPUTCONNECTOR_H 47 | -------------------------------------------------------------------------------- /stromx/runtime/Parameter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/Parameter.h" 18 | #include "stromx/runtime/ParameterGroup.h" 19 | 20 | namespace stromx 21 | { 22 | namespace runtime 23 | { 24 | const std::vector Parameter::NO_MEMBERS = std::vector(); 25 | 26 | Parameter::Parameter(const unsigned int id, const stromx::runtime::VariantHandle& variant, 27 | ParameterGroup* const group) 28 | : Description(id, variant), 29 | m_access(NO_ACCESS), 30 | m_behavior(PERSISTENT), 31 | m_group(group) 32 | { 33 | if(group) 34 | group->addMember(this); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /stromx/runtime/ParameterGroup.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/ParameterGroup.h" 18 | 19 | #include 20 | #include 21 | 22 | #include "stromx/runtime/Exception.h" 23 | #include "stromx/runtime/Variant.h" 24 | 25 | namespace stromx 26 | { 27 | namespace runtime 28 | { 29 | ParameterGroup::ParameterGroup(const unsigned int id, ParameterGroup*const group) 30 | : Parameter(id, Variant::NONE, group) 31 | { 32 | setAccessMode(NO_ACCESS); 33 | } 34 | 35 | void ParameterGroup::addMember(const stromx::runtime::Parameter*const member) 36 | { 37 | std::vector::const_iterator iter = 38 | std::find(m_members.begin(), m_members.end(), member); 39 | 40 | if (iter != m_members.end()) 41 | throw WrongArgument("Parameter has already been added to parameter group."); 42 | 43 | m_members.push_back(member); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /stromx/runtime/ParameterGroup.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_PARAMETERGROUP_H 18 | #define STROMX_RUNTIME_PARAMETERGROUP_H 19 | 20 | #include "stromx/runtime/Config.h" 21 | #include "stromx/runtime/Parameter.h" 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | /** \brief A group of parameters */ 28 | class STROMX_RUNTIME_API ParameterGroup : public Parameter 29 | { 30 | friend class Parameter; 31 | 32 | public: 33 | /** Constructs an enumeration parameter. */ 34 | ParameterGroup(const unsigned int id, ParameterGroup* const group = 0); 35 | 36 | virtual const std::vector & members() const { return m_members; } 37 | 38 | private: 39 | void addMember(const Parameter* const member); 40 | 41 | std::vector m_members; 42 | }; 43 | } 44 | } 45 | 46 | #endif // STROMX_RUNTIME_PARAMETERGROUP_H 47 | -------------------------------------------------------------------------------- /stromx/runtime/ReadAccess.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/ReadAccess.h" 18 | #include "stromx/runtime/impl/ReadAccessImpl.h" 19 | 20 | namespace stromx 21 | { 22 | namespace runtime 23 | { 24 | 25 | ReadAccess::ReadAccess(const DataContainer & data) 26 | : m_impl(new impl::ReadAccessImpl(data, false)) 27 | { 28 | } 29 | 30 | ReadAccess::ReadAccess(const DataContainer & data, const unsigned int timeout) 31 | : m_impl(new impl::ReadAccessImpl(data, true, timeout)) 32 | { 33 | } 34 | 35 | const Data & ReadAccess::get() const 36 | { 37 | if(empty()) 38 | throw AccessEmpty(); 39 | 40 | return m_impl->get(); 41 | } 42 | 43 | void ReadAccess::release() 44 | { 45 | m_impl.reset(); 46 | } 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /stromx/runtime/Recycler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_RECYCLER_H 18 | #define STROMX_RUNTIME_RECYCLER_H 19 | 20 | #include "stromx/runtime/Config.h" 21 | 22 | namespace stromx 23 | { 24 | namespace runtime 25 | { 26 | namespace impl 27 | { 28 | class DataContainerImpl; 29 | } 30 | 31 | /** \brief Abstract receiver of recycled objects. */ 32 | class STROMX_RUNTIME_API Recycler 33 | { 34 | public: 35 | virtual void recycle(impl::DataContainerImpl* const container) = 0; 36 | }; 37 | } 38 | } 39 | 40 | #endif // STROMX_RUNTIME_RECYCLER_H 41 | -------------------------------------------------------------------------------- /stromx/runtime/Registry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_REGISTRY_H 18 | #define STROMX_RUNTIME_REGISTRY_H 19 | 20 | #include "stromx/runtime/Config.h" 21 | 22 | namespace stromx 23 | { 24 | namespace runtime 25 | { 26 | class Data; 27 | class OperatorKernel; 28 | 29 | /** \brief Abstract registry of operator and data objects. */ 30 | class Registry 31 | { 32 | public: 33 | /** Registers an operator kernel with the registry. The registry assumes 34 | * ownership of \c op. */ 35 | virtual void registerOperator(const OperatorKernel* const op) = 0; 36 | 37 | /** Registers a data object with the registry. The registry assumes 38 | * ownership of \c data. */ 39 | virtual void registerData(const Data* data) = 0; 40 | }; 41 | } 42 | } 43 | 44 | #endif // STROMX_RUNTIME_REGISTRY_H 45 | -------------------------------------------------------------------------------- /stromx/runtime/Runtime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_RUNTIME_H 18 | #define STROMX_RUNTIME_RUNTIME_H 19 | 20 | #include "stromx/runtime/Config.h" 21 | #include "stromx/runtime/Version.h" 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class Registry; 28 | 29 | /** 30 | * \brief Returns the version of the stromx runtime library. 31 | * 32 | * \since 0.2 33 | */ 34 | STROMX_RUNTIME_API const Version & version(); 35 | 36 | 37 | /** 38 | * \brief Returns the version string (including the git SHA) of the stromx runtime library. 39 | * 40 | * \since 0.8 41 | */ 42 | STROMX_RUNTIME_API const std::string & versionString(); 43 | } 44 | } 45 | 46 | extern "C" 47 | { 48 | STROMX_RUNTIME_API int stromxRegisterRuntime(stromx::runtime::Registry* registry); 49 | } 50 | 51 | #endif // STROMX_RUNTIME_RUNTIME_H 52 | -------------------------------------------------------------------------------- /stromx/runtime/SortInputsAlgorithm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_SORTINPUTSALGORITHM_H 18 | #define STROMX_RUNTIME_SORTINPUTSALGORITHM_H 19 | 20 | #include "stromx/runtime/Config.h" 21 | 22 | namespace stromx 23 | { 24 | namespace runtime 25 | { 26 | class Stream; 27 | 28 | /** \brief Algorithm which sorts the input sequence of stream threads */ 29 | class STROMX_RUNTIME_API SortInputsAlgorithm 30 | { 31 | public: 32 | /** Constructs a sorting algorithm. */ 33 | SortInputsAlgorithm() {} 34 | 35 | /** 36 | * Sorts the inputs of each thread in \c stream according to the topology 37 | * of the stream. If a connection \em from an operator \em to another operator exists 38 | * the inputs of the first operator will be moved in front of the inputs 39 | * of the second operator. 40 | */ 41 | void apply(Stream & stream); 42 | }; 43 | } 44 | } 45 | 46 | #endif // STROMX_RUNTIME_SORTINPUTSALGORITHM_H 47 | -------------------------------------------------------------------------------- /stromx/runtime/TriggerData.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/TriggerData.h" 18 | 19 | #include "stromx/runtime/Config.h" 20 | #include "stromx/runtime/Version.h" 21 | #include "stromx/runtime/Variant.h" 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | const std::string TriggerData::TYPE = "Trigger"; 28 | const std::string TriggerData::PACKAGE = STROMX_RUNTIME_PACKAGE_NAME; 29 | const Version TriggerData::VERSION = Version(STROMX_RUNTIME_VERSION_MAJOR, STROMX_RUNTIME_VERSION_MINOR, STROMX_RUNTIME_VERSION_PATCH); 30 | 31 | const VariantHandle & data_traits::variant() 32 | { 33 | return Variant::TRIGGER; 34 | } 35 | 36 | const VariantHandle & TriggerData::variant() const 37 | { 38 | return Variant::TRIGGER; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /stromx/runtime/Try.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include "stromx/runtime/Try.h" 19 | 20 | namespace stromx 21 | { 22 | namespace runtime 23 | { 24 | bool Try::trySet(const runtime::impl::Id2DataMap&) const 25 | { 26 | return true; 27 | } 28 | 29 | bool Try::tryGet(const runtime::impl::Id2DataMap&) const 30 | { 31 | return true; 32 | } 33 | 34 | void Try::set(impl::Id2DataMap& id2DataMap) const 35 | { 36 | if(m_mapper.trySet(id2DataMap)) 37 | m_mapper.set(id2DataMap); 38 | } 39 | 40 | void Try::get(impl::Id2DataMap& id2DataMap) const 41 | { 42 | if(m_mapper.tryGet(id2DataMap)) 43 | m_mapper.get(id2DataMap); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /stromx/runtime/Try.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_TRY_H 18 | #define STROMX_RUNTIME_TRY_H 19 | 20 | #include "stromx/runtime/Config.h" 21 | #include "stromx/runtime/Id2DataMapper.h" 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | /** \brief %Operator which renders ID-to-data maps optional. */ 28 | class STROMX_RUNTIME_API Try : public Id2DataMapper 29 | { 30 | public: 31 | explicit Try(const Id2DataMapper& mapper) 32 | : m_mapper(mapper) 33 | {} 34 | 35 | virtual bool trySet(const impl::Id2DataMap& id2DataMap) const; 36 | virtual bool tryGet(const impl::Id2DataMap& id2DataMap) const; 37 | virtual void get(impl::Id2DataMap& id2DataMap) const; 38 | virtual void set(impl::Id2DataMap& id2DataMap) const; 39 | 40 | private: 41 | const Id2DataMapper& m_mapper; 42 | }; 43 | } 44 | } 45 | 46 | #endif // STROMX_RUNTIME_TRY_H -------------------------------------------------------------------------------- /stromx/runtime/VariantInterface.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permisVariantsions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/VariantInterface.h" 18 | #include "stromx/runtime/VariantHandle.h" 19 | 20 | namespace stromx 21 | { 22 | namespace runtime 23 | { 24 | const VariantHandle VariantInterface::lhs() const 25 | { 26 | return VariantHandle(); 27 | } 28 | 29 | const VariantHandle VariantInterface::rhs() const 30 | { 31 | return VariantHandle(); 32 | } 33 | 34 | bool operator==(const VariantInterface & lhs, const VariantInterface & rhs) 35 | { 36 | return lhs.id() == rhs.id() && lhs.package() == rhs.package(); 37 | } 38 | 39 | std::ostream& operator<<(std::ostream& out, const VariantInterface& variant) 40 | { 41 | out << variant.package() << ", " << variant.id(); 42 | return out; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /stromx/runtime/WriteAccess.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/WriteAccess.h" 18 | #include "stromx/runtime/impl/WriteAccessImpl.h" 19 | 20 | namespace stromx 21 | { 22 | namespace runtime 23 | { 24 | WriteAccess::WriteAccess(const DataContainer & data) 25 | : m_impl(new impl::WriteAccessImpl(data, false)) 26 | { 27 | } 28 | 29 | WriteAccess::WriteAccess(const DataContainer & data, const unsigned int timeout) 30 | : m_impl(new impl::WriteAccessImpl(data, true, timeout)) 31 | { 32 | } 33 | 34 | Data & WriteAccess::get() const 35 | { 36 | if(empty()) 37 | throw AccessEmpty(); 38 | 39 | return m_impl->get(); 40 | } 41 | 42 | void WriteAccess::release() 43 | { 44 | m_impl.reset(); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /stromx/runtime/impl/MutexHandle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | namespace stromx 20 | { 21 | namespace runtime 22 | { 23 | namespace impl 24 | { 25 | /** \cond */ 26 | class MutexHandle 27 | { 28 | public: 29 | boost::mutex & mutex() { return m_mutex; } 30 | private: 31 | boost::mutex m_mutex; 32 | }; 33 | /** \endcond */ 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /stromx/runtime/impl/ReadAccessImpl.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/DataContainer.h" 18 | #include "stromx/runtime/Exception.h" 19 | #include "stromx/runtime/impl/DataContainerImpl.h" 20 | #include "stromx/runtime/impl/ReadAccessImpl.h" 21 | 22 | namespace stromx 23 | { 24 | namespace runtime 25 | { 26 | namespace impl 27 | { 28 | ReadAccessImpl::ReadAccessImpl(const DataContainer& data, const bool waitWithTimeout, const unsigned int timeout) 29 | : m_data(data) 30 | { 31 | if(data.empty()) 32 | throw WrongArgument("Data container is empty."); 33 | 34 | m_data.m_impl->getReadAccess(waitWithTimeout, timeout); 35 | } 36 | 37 | const Data & ReadAccessImpl::get() const 38 | { 39 | return *m_data.m_impl->data(); 40 | } 41 | 42 | ReadAccessImpl::~ReadAccessImpl() 43 | { 44 | m_data.m_impl->returnReadAccess(); 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /stromx/runtime/impl/ReadAccessImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_IMPL_READACCESSIMPL_H 18 | #define STROMX_RUNTIME_IMPL_READACCESSIMPL_H 19 | 20 | #include "stromx/runtime/DataContainer.h" 21 | #include "stromx/runtime/Runtime.h" 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class Data; 28 | 29 | namespace impl 30 | { 31 | class ReadAccessImpl 32 | { 33 | public: 34 | ReadAccessImpl(const DataContainer& data, const bool waitWithTimeout, const unsigned int timeout = 0); 35 | 36 | ~ReadAccessImpl(); 37 | 38 | const Data & get() const; 39 | 40 | private: 41 | DataContainer m_data; 42 | }; 43 | } 44 | } 45 | } 46 | 47 | #endif // STROMX_RUNTIME_IMPL_READACCESSIMPL_H 48 | -------------------------------------------------------------------------------- /stromx/runtime/impl/SerializationHeader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/impl/SerializationHeader.h" 18 | 19 | namespace stromx 20 | { 21 | namespace runtime 22 | { 23 | namespace impl 24 | { 25 | bool operator==(const SerializationHeader & lhs, const SerializationHeader & rhs) 26 | { 27 | return (lhs.serverVersion == rhs.serverVersion) && 28 | (lhs.package == rhs.package) && 29 | (lhs.type == rhs.type) && 30 | (lhs.version == rhs.version); 31 | } 32 | 33 | std::ostream & operator<<(std::ostream & out, const SerializationHeader & header) 34 | { 35 | out << header.serverVersion << " "; 36 | out << header.package << " "; 37 | out << header.type << " "; 38 | out << header.version; 39 | 40 | return out; 41 | } 42 | } 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /stromx/runtime/impl/ThreadImplObserver.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_IMPL_THREADIMPLOBSERVER_H 18 | #define STROMX_RUNTIME_IMPL_THREADIMPLOBSERVER_H 19 | 20 | namespace stromx 21 | { 22 | namespace runtime 23 | { 24 | class OperatorError; 25 | 26 | namespace impl 27 | { 28 | class ThreadImplObserver 29 | { 30 | public: 31 | virtual void observe(const OperatorError & ex) const = 0; 32 | 33 | virtual ~ThreadImplObserver() {} 34 | }; 35 | } 36 | } 37 | } 38 | 39 | #endif // STROMX_RUNTIME_IMPL_THREADIMPLOBSERVER_H 40 | -------------------------------------------------------------------------------- /stromx/runtime/impl/WriteAccessImpl.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/DataContainer.h" 18 | #include "stromx/runtime/Exception.h" 19 | #include "stromx/runtime/impl/DataContainerImpl.h" 20 | #include "stromx/runtime/impl/WriteAccessImpl.h" 21 | 22 | namespace stromx 23 | { 24 | namespace runtime 25 | { 26 | namespace impl 27 | { 28 | WriteAccessImpl::WriteAccessImpl(const DataContainer& data, const bool waitWithTimeout, const unsigned int timeout) 29 | : m_data(data) 30 | { 31 | if(data.empty()) 32 | throw WrongArgument("Data container is empty."); 33 | 34 | m_data.m_impl->getWriteAccess(waitWithTimeout, timeout); 35 | } 36 | 37 | Data& WriteAccessImpl::get() const 38 | { 39 | return *m_data.m_impl->data(); 40 | } 41 | 42 | WriteAccessImpl::~WriteAccessImpl() 43 | { 44 | m_data.m_impl->returnWriteAccess(); 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /stromx/runtime/impl/WriteAccessImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_IMPL_WRITEACCESSIMPL_H 18 | #define STROMX_RUNTIME_IMPL_WRITEACCESSIMPL_H 19 | 20 | #include "stromx/runtime/DataContainer.h" 21 | #include "stromx/runtime/Runtime.h" 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class Data; 28 | 29 | namespace impl 30 | { 31 | class WriteAccessImpl 32 | { 33 | public: 34 | WriteAccessImpl(const DataContainer & data, const bool waitWithTimeout, const unsigned int timeout = 0); 35 | ~WriteAccessImpl(); 36 | 37 | Data& get() const; 38 | 39 | private: 40 | DataContainer m_data; 41 | }; 42 | } 43 | } 44 | } 45 | 46 | #endif // STROMX_RUNTIME_IMPL_WRITEACCESSIMPL_H 47 | -------------------------------------------------------------------------------- /stromx/runtime/runtime.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \namespace stromx::runtime 3 | \brief Runtime library 4 | */ -------------------------------------------------------------------------------- /stromx/runtime/test/BoolTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/test/BoolTest.h" 18 | 19 | CPPUNIT_TEST_SUITE_REGISTRATION (stromx::runtime::BoolTest); -------------------------------------------------------------------------------- /stromx/runtime/test/BoolTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_BOOLTEST_H 18 | #define STROMX_RUNTIME_BOOLTEST_H 19 | 20 | #include "stromx/runtime/test/PrimitiveTest.h" 21 | 22 | namespace stromx 23 | { 24 | namespace runtime 25 | { 26 | class BoolTest : public PrimitiveTest 27 | { 28 | CPPUNIT_TEST_SUITE (BoolTest); 29 | CPPUNIT_TEST (testDefaultConstructor); 30 | CPPUNIT_TEST (testConstructor); 31 | CPPUNIT_TEST (testCopyConstructor); 32 | CPPUNIT_TEST (testAssignment); 33 | CPPUNIT_TEST (testSerialize); 34 | CPPUNIT_TEST (testDeserialize); 35 | CPPUNIT_TEST (testIsVariant); 36 | CPPUNIT_TEST (testPtrCast); 37 | CPPUNIT_TEST (testRefCast); 38 | CPPUNIT_TEST_SUITE_END (); 39 | 40 | protected: 41 | virtual bool value() const { return true; } 42 | virtual std::string str() const { return "1"; } 43 | virtual const VariantInterface & variant() const { return Variant::BOOL; } 44 | }; 45 | } 46 | } 47 | 48 | #endif // STROMX_RUNTIME_BOOLTEST_H -------------------------------------------------------------------------------- /stromx/runtime/test/CounterTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_COUNTERTEST_H 18 | #define STROMX_RUNTIME_COUNTERTEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class OperatorTester; 28 | 29 | class CounterTest : public CPPUNIT_NS :: TestFixture 30 | { 31 | CPPUNIT_TEST_SUITE (CounterTest); 32 | CPPUNIT_TEST(testExecute); 33 | CPPUNIT_TEST_SUITE_END (); 34 | 35 | public: 36 | CounterTest() : m_operator(0) {} 37 | 38 | void setUp(); 39 | void tearDown(); 40 | 41 | protected: 42 | void testExecute(); 43 | 44 | private: 45 | runtime::OperatorTester* m_operator; 46 | }; 47 | } 48 | } 49 | 50 | #endif // STROMX_RUNTIME_COUNTERTEST_H -------------------------------------------------------------------------------- /stromx/runtime/test/DataRefTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_DATAREFTEST_H 18 | #define STROMX_RUNTIME_DATAREFTEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class Data; 28 | 29 | class DataRefTest : public CPPUNIT_NS :: TestFixture 30 | { 31 | CPPUNIT_TEST_SUITE (DataRefTest); 32 | CPPUNIT_TEST(testDataRef); 33 | CPPUNIT_TEST(testConstDataRef); 34 | CPPUNIT_TEST(testIsNull); 35 | CPPUNIT_TEST_SUITE_END (); 36 | 37 | public: 38 | DataRefTest() {} 39 | 40 | void setUp() {} 41 | void tearDown() {} 42 | 43 | private: 44 | void dataFunction(const Data &) {} 45 | 46 | protected: 47 | void testDataRef(); 48 | void testConstDataRef(); 49 | void testIsNull(); 50 | }; 51 | } 52 | } 53 | 54 | #endif // STROMX_RUNTIME_DATAREFTEST_H 55 | -------------------------------------------------------------------------------- /stromx/runtime/test/DataTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_DATATEST_H 18 | #define STROMX_RUNTIME_DATATEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class DataTest : public CPPUNIT_NS :: TestFixture 28 | { 29 | CPPUNIT_TEST_SUITE (DataTest); 30 | CPPUNIT_TEST(testCastReference); 31 | CPPUNIT_TEST(testInvalidCastReference); 32 | CPPUNIT_TEST(testCastPointer); 33 | CPPUNIT_TEST(testInvalidCastPointer); 34 | CPPUNIT_TEST(testCastNullPointer); 35 | CPPUNIT_TEST_SUITE_END (); 36 | 37 | public: 38 | DataTest() {} 39 | 40 | void setUp() {} 41 | void tearDown() {} 42 | 43 | protected: 44 | void testCastReference(); 45 | void testInvalidCastReference(); 46 | void testCastPointer(); 47 | void testInvalidCastPointer(); 48 | void testCastNullPointer(); 49 | }; 50 | } 51 | } 52 | 53 | #endif // STROMX_RUNTIME_DATATEST_H -------------------------------------------------------------------------------- /stromx/runtime/test/DirectoryFileInputTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_DIRECTORYFILEINPUTTEST_H 18 | #define STROMX_RUNTIME_DIRECTORYFILEINPUTTEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class DirectoryFileInput; 28 | 29 | class DirectoryFileInputTest : public CPPUNIT_NS :: TestFixture 30 | { 31 | CPPUNIT_TEST_SUITE (DirectoryFileInputTest); 32 | CPPUNIT_TEST(testText); 33 | CPPUNIT_TEST(testFile); 34 | CPPUNIT_TEST(testHasFile); 35 | CPPUNIT_TEST_SUITE_END (); 36 | 37 | public: 38 | DirectoryFileInputTest() : m_input(0) {} 39 | 40 | void setUp(); 41 | void tearDown(); 42 | 43 | protected: 44 | void testText(); 45 | void testFile(); 46 | void testHasFile(); 47 | 48 | private: 49 | DirectoryFileInput* m_input; 50 | }; 51 | } 52 | } 53 | 54 | #endif // STROMX_RUNTIME_DIRECTORYFILEINPUTTEST_H -------------------------------------------------------------------------------- /stromx/runtime/test/DummyInput.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_DUMMYINPUT_H 18 | #define STROMX_RUNTIME_DUMMYINPUT_H 19 | 20 | #include "stromx/runtime/InputProvider.h" 21 | 22 | namespace stromx 23 | { 24 | namespace runtime 25 | { 26 | class DummyInput : public InputProvider 27 | { 28 | public: 29 | explicit DummyInput(const std::string & text) 30 | : m_text(text), 31 | m_file("") 32 | {} 33 | 34 | std::istream & text() { return m_text; } 35 | std::istream & openFile(const OpenMode) { return m_file; } 36 | bool hasFile() const { return true; } 37 | std::istream & file() { return m_file; } 38 | 39 | private: 40 | std::istringstream m_text; 41 | std::istringstream m_file; 42 | }; 43 | } 44 | } 45 | 46 | #endif // STROMX_RUNTIME_DUMMYINPUT_H 47 | -------------------------------------------------------------------------------- /stromx/runtime/test/DummyOutput.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_DUMMYOUTPUT_H 18 | #define STROMX_RUNTIME_DUMMYOUTPUT_H 19 | 20 | #include "stromx/runtime/OutputProvider.h" 21 | 22 | namespace stromx 23 | { 24 | namespace runtime 25 | { 26 | class DummyOutput : public OutputProvider 27 | { 28 | public: 29 | std::ostream & text() { return m_text; } 30 | std::ostream & openFile(const std::string &, const OpenMode) { return m_file; } 31 | std::ostream & file() { return m_file; } 32 | 33 | const std::string value() const { return m_text.str(); } 34 | 35 | private: 36 | std::ostringstream m_text; 37 | std::ostringstream m_file; 38 | }; 39 | } 40 | } 41 | 42 | #endif // STROMX_RUNTIME_DUMMYOUTPUT_H 43 | -------------------------------------------------------------------------------- /stromx/runtime/test/DumpTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include "stromx/runtime/DataContainer.h" 19 | #include "stromx/runtime/Dump.h" 20 | #include "stromx/runtime/OperatorTester.h" 21 | #include "stromx/runtime/ReadAccess.h" 22 | #include "stromx/runtime/test/DumpTest.h" 23 | #include "stromx/runtime/test/TestData.h" 24 | 25 | CPPUNIT_TEST_SUITE_REGISTRATION (stromx::runtime::DumpTest); 26 | 27 | namespace stromx 28 | { 29 | using namespace runtime; 30 | 31 | namespace runtime 32 | { 33 | void DumpTest::setUp ( void ) 34 | { 35 | m_operator = new runtime::OperatorTester(new Dump()); 36 | m_operator->initialize(); 37 | m_operator->activate(); 38 | } 39 | 40 | void DumpTest::testExecute() 41 | { 42 | for(unsigned i = 0; i < 5; ++i) 43 | { 44 | DataContainer data(new TestData); 45 | 46 | m_operator->setInputData(Dump::INPUT, data); 47 | } 48 | } 49 | 50 | void DumpTest::tearDown ( void ) 51 | { 52 | delete m_operator; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /stromx/runtime/test/DumpTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_DUMPTEST_H 18 | #define STROMX_RUNTIME_DUMPTEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class OperatorTester; 28 | 29 | class DumpTest : public CPPUNIT_NS :: TestFixture 30 | { 31 | CPPUNIT_TEST_SUITE (DumpTest); 32 | CPPUNIT_TEST (testExecute); 33 | CPPUNIT_TEST_SUITE_END (); 34 | 35 | public: 36 | DumpTest() : m_operator(0) {} 37 | 38 | void setUp(); 39 | void tearDown(); 40 | 41 | protected: 42 | void testExecute(); 43 | 44 | private: 45 | runtime::OperatorTester* m_operator; 46 | }; 47 | } 48 | } 49 | 50 | #endif // STROMX_RUNTIME_DUMPTEST_H -------------------------------------------------------------------------------- /stromx/runtime/test/EnumTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/test/EnumTest.h" 18 | 19 | CPPUNIT_TEST_SUITE_REGISTRATION (stromx::runtime::EnumTest); -------------------------------------------------------------------------------- /stromx/runtime/test/ExceptionTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include "stromx/runtime/Exception.h" 19 | #include "stromx/runtime/test/ExceptionTest.h" 20 | 21 | CPPUNIT_TEST_SUITE_REGISTRATION (stromx::runtime::ExceptionTest); 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | void ExceptionTest::testCallStack() 28 | { 29 | Exception e(""); 30 | CPPUNIT_ASSERT_NO_THROW(e.callStack()); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /stromx/runtime/test/ExceptionTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_EXCEPTIONTEST_H 18 | #define STROMX_RUNTIME_EXCEPTIONTEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class ExceptionTest : public CPPUNIT_NS :: TestFixture 28 | { 29 | CPPUNIT_TEST_SUITE (ExceptionTest); 30 | CPPUNIT_TEST(testCallStack); 31 | CPPUNIT_TEST_SUITE_END (); 32 | 33 | public: 34 | ExceptionTest() {} 35 | 36 | void setUp() {} 37 | void tearDown() {} 38 | 39 | protected: 40 | void testCallStack(); 41 | 42 | private: 43 | }; 44 | } 45 | } 46 | 47 | #endif // STROMX_RUNTIME_EXCEPTIONTEST_H -------------------------------------------------------------------------------- /stromx/runtime/test/FilterTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_FILTERTEST_H 18 | #define STROMX_RUNTIME_FILTERTEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class OperatorTester; 28 | } 29 | 30 | namespace runtime 31 | { 32 | class FilterTest : public CPPUNIT_NS :: TestFixture 33 | { 34 | CPPUNIT_TEST_SUITE (FilterTest); 35 | CPPUNIT_TEST (testExecuteRemove); 36 | CPPUNIT_TEST (testExecutePreserve); 37 | CPPUNIT_TEST_SUITE_END (); 38 | 39 | public: 40 | FilterTest() : m_operator(0) {} 41 | 42 | void setUp(); 43 | void tearDown(); 44 | 45 | protected: 46 | void testExecuteRemove(); 47 | void testExecutePreserve(); 48 | 49 | private: 50 | runtime::OperatorTester* m_operator; 51 | }; 52 | } 53 | } 54 | 55 | #endif // STROMX_RUNTIME_FILTERTEST_H -------------------------------------------------------------------------------- /stromx/runtime/test/Float64Test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/test/Float64Test.h" 18 | 19 | CPPUNIT_TEST_SUITE_REGISTRATION (stromx::runtime::Float64Test); 20 | 21 | namespace stromx 22 | { 23 | namespace runtime 24 | { 25 | void Float64Test::testIsFloatVariant() 26 | { 27 | CPPUNIT_ASSERT(variant().isVariant(Variant::FLOAT)); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /stromx/runtime/test/ForkTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_FORKTEST_H 18 | #define STROMX_RUNTIME_FORKTEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class OperatorTester; 28 | 29 | class ForkTest : public CPPUNIT_NS :: TestFixture 30 | { 31 | CPPUNIT_TEST_SUITE (ForkTest); 32 | CPPUNIT_TEST (testExecute); 33 | CPPUNIT_TEST_SUITE_END (); 34 | 35 | public: 36 | ForkTest() : m_operator(0) {} 37 | 38 | void setUp(); 39 | void tearDown(); 40 | 41 | protected: 42 | void testExecute(); 43 | 44 | private: 45 | runtime::OperatorTester* m_operator; 46 | }; 47 | } 48 | } 49 | 50 | #endif // STROMX_RUNTIME_FORKTEST_H -------------------------------------------------------------------------------- /stromx/runtime/test/ImageWrapperTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_IMAGEWRAPPERTEST_H 18 | #define STROMX_RUNTIME_IMAGEWRAPPERTEST_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace stromx 25 | { 26 | namespace runtime 27 | { 28 | class ImageWrapper; 29 | 30 | class ImageWrapperTest : public CPPUNIT_NS :: TestFixture 31 | { 32 | CPPUNIT_TEST_SUITE (ImageWrapperTest); 33 | CPPUNIT_TEST (testResizeDimension); 34 | CPPUNIT_TEST (testResizeLength); 35 | CPPUNIT_TEST_SUITE_END (); 36 | 37 | public: 38 | ImageWrapperTest() : m_image(0) {} 39 | 40 | void setUp(); 41 | void tearDown(); 42 | 43 | protected: 44 | void testResizeDimension(); 45 | void testResizeLength(); 46 | 47 | private: 48 | ImageWrapper* m_image; 49 | }; 50 | } 51 | } 52 | 53 | #endif // STROMX_RUNTIME_IMAGEWRAPPERTEST_H -------------------------------------------------------------------------------- /stromx/runtime/test/Int32Test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/test/Int32Test.h" 18 | 19 | CPPUNIT_TEST_SUITE_REGISTRATION (stromx::runtime::Int32Test); -------------------------------------------------------------------------------- /stromx/runtime/test/JoinTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_JOINTEST_H 18 | #define STROMX_RUNTIME_JOINTEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class OperatorTester; 28 | 29 | class JoinTest : public CPPUNIT_NS :: TestFixture 30 | { 31 | CPPUNIT_TEST_SUITE (JoinTest); 32 | CPPUNIT_TEST (testExecute); 33 | CPPUNIT_TEST_SUITE_END (); 34 | 35 | public: 36 | JoinTest() : m_operator(0) {} 37 | 38 | void setUp(); 39 | void tearDown(); 40 | 41 | protected: 42 | void testExecute(); 43 | 44 | private: 45 | runtime::OperatorTester* m_operator; 46 | }; 47 | } 48 | } 49 | 50 | #endif // STROMX_RUNTIME_JOINTEST_H -------------------------------------------------------------------------------- /stromx/runtime/test/MatrixImpl.cpp: -------------------------------------------------------------------------------- 1 | #include "stromx/runtime/test/MatrixImpl.h" 2 | 3 | #include "stromx/runtime/Version.h" 4 | 5 | namespace stromx 6 | { 7 | namespace runtime 8 | { 9 | const std::string MatrixImpl::TYPE = "MatrixImpl"; 10 | const std::string MatrixImpl::PACKAGE = "Test"; 11 | const Version MatrixImpl::VERSION = Version(STROMX_RUNTIME_VERSION_MAJOR, STROMX_RUNTIME_VERSION_MINOR, STROMX_RUNTIME_VERSION_PATCH); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /stromx/runtime/test/MatrixImpl.h: -------------------------------------------------------------------------------- 1 | #include "stromx/runtime/MatrixWrapper.h" 2 | 3 | namespace stromx 4 | { 5 | namespace runtime 6 | { 7 | class MatrixImpl : public stromx::runtime::MatrixWrapper 8 | { 9 | public: 10 | MatrixImpl() : m_data(0) {} 11 | 12 | MatrixImpl(const unsigned int rows, const unsigned int cols, const ValueType valueType) 13 | : m_data(0) 14 | { 15 | allocate(rows, cols, valueType); 16 | } 17 | const Version & version() const { return VERSION; } 18 | const std::string & type() const { return TYPE; } 19 | const std::string & package() const { return PACKAGE; } 20 | 21 | Data* clone() const { return new MatrixImpl(); } 22 | 23 | protected: 24 | void allocate(const unsigned int rows, const unsigned int cols, const ValueType valueType) 25 | { 26 | if(m_data) 27 | { 28 | delete [] m_data; 29 | m_data = 0; 30 | } 31 | 32 | unsigned int valueSize = Matrix::valueSize(valueType); 33 | unsigned int bufferSize = rows * cols * valueSize; 34 | m_data = new uint8_t[bufferSize]; 35 | 36 | setBuffer(m_data, bufferSize); 37 | initializeMatrix(rows, cols, cols * valueSize, m_data, valueType); 38 | } 39 | 40 | private: 41 | static const std::string TYPE; 42 | static const std::string PACKAGE; 43 | static const Version VERSION; 44 | uint8_t* m_data; 45 | }; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /stromx/runtime/test/ParameterTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/test/ParameterTest.h" 18 | 19 | #include "stromx/runtime/ParameterGroup.h" 20 | #include "stromx/runtime/Variant.h" 21 | 22 | CPPUNIT_TEST_SUITE_REGISTRATION (stromx::runtime::ParameterTest); 23 | 24 | namespace stromx 25 | { 26 | namespace runtime 27 | { 28 | void ParameterTest::testParameterGroup() 29 | { 30 | ParameterGroup group(0); 31 | 32 | CPPUNIT_ASSERT_EQUAL((const Parameter*)(0), group.group()); 33 | CPPUNIT_ASSERT_EQUAL(0, int(group.members().size())); 34 | 35 | Parameter param(1, Variant::BOOL, &group); 36 | 37 | CPPUNIT_ASSERT_EQUAL((const Parameter*)(&group), param.group()); 38 | CPPUNIT_ASSERT_EQUAL(1, int(group.members().size())); 39 | CPPUNIT_ASSERT_EQUAL((const Parameter*)(¶m), group.members()[0]); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /stromx/runtime/test/ParameterTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_PARAMETERTEST_H 18 | #define STROMX_RUNTIME_PARAMETERTEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class DataContainer; 28 | 29 | class ParameterTest : public CPPUNIT_NS :: TestFixture 30 | { 31 | CPPUNIT_TEST_SUITE (ParameterTest); 32 | CPPUNIT_TEST (testParameterGroup); 33 | CPPUNIT_TEST_SUITE_END (); 34 | 35 | public: 36 | ParameterTest() {} 37 | 38 | void setUp() {} 39 | void tearDown() {} 40 | 41 | protected: 42 | void testParameterGroup(); 43 | }; 44 | } 45 | } 46 | 47 | #endif // STROMX_RUNTIME_PARAMETERTEST_H -------------------------------------------------------------------------------- /stromx/runtime/test/QueueTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_EXAMPLE_QUEUETEST_H 18 | #define STROMX_EXAMPLE_QUEUETEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class OperatorTester; 28 | class DataContainer; 29 | } 30 | 31 | namespace runtime 32 | { 33 | class QueueTest : public CPPUNIT_NS :: TestFixture 34 | { 35 | CPPUNIT_TEST_SUITE (QueueTest); 36 | CPPUNIT_TEST (testExecute); 37 | CPPUNIT_TEST_SUITE_END (); 38 | 39 | public: 40 | QueueTest() : m_operator(0) {} 41 | 42 | void setUp(); 43 | void tearDown(); 44 | 45 | protected: 46 | void testExecute(); 47 | 48 | private: 49 | runtime::OperatorTester* m_operator; 50 | }; 51 | } 52 | } 53 | 54 | #endif // STROMX_EXAMPLE_QUEUETEST_H -------------------------------------------------------------------------------- /stromx/runtime/test/RepeatTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_REPEATTEST_H 18 | #define STROMX_RUNTIME_REPEATTEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class OperatorTester; 28 | } 29 | 30 | namespace runtime 31 | { 32 | class RepeatTest : public CPPUNIT_NS :: TestFixture 33 | { 34 | CPPUNIT_TEST_SUITE (RepeatTest); 35 | CPPUNIT_TEST (testExecute); 36 | CPPUNIT_TEST (testExecuteTwice); 37 | CPPUNIT_TEST (testExecuteNoIteration); 38 | CPPUNIT_TEST_SUITE_END (); 39 | 40 | public: 41 | RepeatTest() : m_operator(0) {} 42 | 43 | void setUp(); 44 | void tearDown(); 45 | 46 | protected: 47 | void testExecute(); 48 | void testExecuteTwice(); 49 | void testExecuteNoIteration(); 50 | 51 | private: 52 | runtime::OperatorTester* m_operator; 53 | }; 54 | } 55 | } 56 | 57 | #endif // STROMX_RUNTIME_REPEATTEST_H -------------------------------------------------------------------------------- /stromx/runtime/test/RuntimeTest.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include "stromx/runtime/Data.h" 19 | #include "stromx/runtime/Factory.h" 20 | #include "stromx/runtime/Operator.h" 21 | #include "stromx/runtime/Runtime.h" 22 | #include "stromx/runtime/test/RuntimeTest.h" 23 | 24 | CPPUNIT_TEST_SUITE_REGISTRATION (stromx::runtime::RuntimeTest); 25 | 26 | namespace stromx 27 | { 28 | namespace runtime 29 | { 30 | void RuntimeTest::setUp ( void ) 31 | { 32 | m_factory = new runtime::Factory; 33 | } 34 | 35 | void RuntimeTest::testregister() 36 | { 37 | CPPUNIT_ASSERT_NO_THROW(stromxRegisterRuntime(m_factory)); 38 | 39 | runtime::Data* data = 0; 40 | CPPUNIT_ASSERT_NO_THROW(data = m_factory->newData("runtime", "UInt32")); 41 | CPPUNIT_ASSERT(data); 42 | delete data; 43 | } 44 | 45 | void RuntimeTest::tearDown ( void ) 46 | { 47 | delete m_factory; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /stromx/runtime/test/RuntimeTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_STROMTEST_H 18 | #define STROMX_RUNTIME_STROMTEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class Factory; 28 | 29 | class RuntimeTest : public CPPUNIT_NS :: TestFixture 30 | { 31 | CPPUNIT_TEST_SUITE (RuntimeTest); 32 | CPPUNIT_TEST(testregister); 33 | CPPUNIT_TEST_SUITE_END (); 34 | 35 | public: 36 | RuntimeTest() : m_factory(0) {} 37 | 38 | void setUp(); 39 | void tearDown(); 40 | 41 | protected: 42 | void testregister(); 43 | 44 | private: 45 | runtime::Factory* m_factory; 46 | }; 47 | } 48 | } 49 | 50 | #endif // STROMX_RUNTIME_STROMTEST_H -------------------------------------------------------------------------------- /stromx/runtime/test/SplitTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2015 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_SPLITTEST_H 18 | #define STROMX_RUNTIME_SPLITTEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class OperatorTester; 28 | 29 | class SplitTest : public CPPUNIT_NS :: TestFixture 30 | { 31 | CPPUNIT_TEST_SUITE (SplitTest); 32 | CPPUNIT_TEST (testExecute); 33 | CPPUNIT_TEST (testExecuteEmptyList); 34 | CPPUNIT_TEST_SUITE_END (); 35 | 36 | public: 37 | SplitTest() : m_operator(0) {} 38 | 39 | void setUp(); 40 | void tearDown(); 41 | 42 | protected: 43 | void testExecute(); 44 | void testExecuteEmptyList(); 45 | 46 | private: 47 | runtime::OperatorTester* m_operator; 48 | }; 49 | } 50 | } 51 | 52 | #endif // STROMX_RUNTIME_SPLITTEST_H -------------------------------------------------------------------------------- /stromx/runtime/test/TestUtilities.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Thomas Fidler 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_TESTUTILITIES_H 18 | #define STROMX_RUNTIME_TESTUTILITIES_H 19 | 20 | 21 | namespace stromx 22 | { 23 | namespace runtime 24 | { 25 | class Stream; 26 | 27 | class TestUtilities 28 | { 29 | public: 30 | static Stream* buildTestStream(); 31 | }; 32 | 33 | } 34 | } 35 | 36 | #endif // STROMX_RUNTIME_TESTUTILITIES_H -------------------------------------------------------------------------------- /stromx/runtime/test/UInt8Test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "stromx/runtime/test/UInt8Test.h" 18 | 19 | CPPUNIT_TEST_SUITE_REGISTRATION (stromx::runtime::UInt8Test); -------------------------------------------------------------------------------- /stromx/runtime/test/VersionTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_VERSIONTEST_H 18 | #define STROMX_RUNTIME_VERSIONTEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class VersionTest : public CPPUNIT_NS :: TestFixture 28 | { 29 | CPPUNIT_TEST_SUITE (VersionTest); 30 | CPPUNIT_TEST (testStreamIn); 31 | CPPUNIT_TEST (testStreamOut); 32 | CPPUNIT_TEST (testComparision); 33 | CPPUNIT_TEST_SUITE_END (); 34 | 35 | protected: 36 | void testStreamIn(); 37 | void testStreamOut(); 38 | void testComparision(); 39 | }; 40 | } 41 | } 42 | 43 | #endif // STROMX_RUNTIME_VERSIONTEST_H -------------------------------------------------------------------------------- /stromx/runtime/test/XmlUtilitiesTest.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_RUNTIME_XMLUTILITIESTEST_H 18 | #define STROMX_RUNTIME_XMLUTILITIESTEST_H 19 | 20 | #include 21 | #include 22 | 23 | namespace stromx 24 | { 25 | namespace runtime 26 | { 27 | class XmlUtilitiesTest : public CPPUNIT_NS :: TestFixture 28 | { 29 | CPPUNIT_TEST_SUITE (XmlUtilitiesTest); 30 | CPPUNIT_TEST(testComputePath); 31 | CPPUNIT_TEST(testComputeName); 32 | CPPUNIT_TEST(testStripExtension); 33 | CPPUNIT_TEST(testComputeExtension); 34 | CPPUNIT_TEST_SUITE_END (); 35 | 36 | public: 37 | 38 | void setUp() {} 39 | void tearDown() {} 40 | 41 | protected: 42 | void testComputePath(); 43 | void testComputeName(); 44 | void testStripExtension(); 45 | void testComputeExtension(); 46 | }; 47 | } 48 | } 49 | 50 | #endif // STROMX_RUNTIME_XMLUTILITIESTEST_H -------------------------------------------------------------------------------- /stromx/runtime/test/archive.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/stromx/runtime/test/archive.zip -------------------------------------------------------------------------------- /stromx/runtime/test/data.txt: -------------------------------------------------------------------------------- 1 | 191079 -------------------------------------------------------------------------------- /stromx/runtime/test/double_matrix.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/stromx/runtime/test/double_matrix.npy -------------------------------------------------------------------------------- /stromx/runtime/test/empty.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /stromx/runtime/test/empty_float_matrix.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/stromx/runtime/test/empty_float_matrix.npy -------------------------------------------------------------------------------- /stromx/runtime/test/fortran_order.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/stromx/runtime/test/fortran_order.npy -------------------------------------------------------------------------------- /stromx/runtime/test/invalid.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /stromx/runtime/test/invalid.zip: -------------------------------------------------------------------------------- 1 | nonsense -------------------------------------------------------------------------------- /stromx/runtime/test/nonsense.stromx: -------------------------------------------------------------------------------- 1 | nonsense -------------------------------------------------------------------------------- /stromx/runtime/test/parameters.stromx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/stromx/runtime/test/parameters.stromx -------------------------------------------------------------------------------- /stromx/runtime/test/parameters.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 2000 8 | 9 | 10 | 100 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 3000 19 | 20 | 21 | 150 22 | 23 | 24 | 25 | 26 | 4000 27 | 28 | 29 | 200 30 | 31 | 32 | 33 | 34 | 5000 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /stromx/runtime/test/parameters.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/stromx/runtime/test/parameters.zip -------------------------------------------------------------------------------- /stromx/runtime/test/persistent_parameter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /stromx/runtime/test/pull_parameter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /stromx/runtime/test/push_parameter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /stromx/runtime/test/stream.stromx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/stromx/runtime/test/stream.stromx -------------------------------------------------------------------------------- /stromx/runtime/test/stream.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/stromx/runtime/test/stream.zip -------------------------------------------------------------------------------- /stromx/runtime/test/uint16_matrix.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/stromx/runtime/test/uint16_matrix.npy -------------------------------------------------------------------------------- /stromx/stromx.dox: -------------------------------------------------------------------------------- 1 | /** 2 | \namespace stromx 3 | \brief The %stromx class library 4 | */ -------------------------------------------------------------------------------- /stromx/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | configure_file ( 2 | ${CMAKE_CURRENT_SOURCE_DIR}/Config.h.in 3 | ${CMAKE_CURRENT_BINARY_DIR}/Config.h 4 | ) 5 | 6 | include_directories ( 7 | ${CMAKE_SOURCE_DIR} 8 | ${CMAKE_BINARY_DIR} 9 | ) 10 | 11 | set (SOURCES 12 | DeadlockOperator.cpp 13 | ExceptionOperator.cpp 14 | ParameterOperator.cpp 15 | RandomDataOperator.cpp 16 | Test.cpp 17 | TestDataOperator.cpp 18 | ) 19 | 20 | add_library (stromx_test SHARED ${SOURCES}) 21 | 22 | set(VERSION_STRING "${STROMX_VERSION_MAJOR}.${STROMX_VERSION_MINOR}.${STROMX_VERSION_PATCH}") 23 | 24 | set_target_properties (stromx_test PROPERTIES 25 | VERSION ${VERSION_STRING} 26 | SOVERSION ${VERSION_STRING} 27 | FOLDER "library" 28 | ) 29 | 30 | target_link_libraries (stromx_test 31 | stromx_runtime 32 | stromx_cvsupport 33 | ) 34 | 35 | if(WIN32) 36 | install (TARGETS stromx_test 37 | RUNTIME DESTINATION . 38 | LIBRARY DESTINATION ${LIB_DIR} 39 | ARCHIVE DESTINATION ${LIB_DIR} 40 | ) 41 | else(WIN32) 42 | install (TARGETS stromx_test 43 | RUNTIME DESTINATION bin 44 | LIBRARY DESTINATION ${LIB_DIR} 45 | ARCHIVE DESTINATION ${LIB_DIR} 46 | ) 47 | endif(WIN32) 48 | 49 | install(DIRECTORY ${CMAKE_SOURCE_DIR}/stromx/test 50 | DESTINATION include/stromx 51 | FILES_MATCHING PATTERN "*.h" 52 | ) 53 | 54 | install(FILES ${CMAKE_BINARY_DIR}/stromx/test/Config.h 55 | DESTINATION include/stromx/test 56 | ) -------------------------------------------------------------------------------- /stromx/test/Config.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_TEST_CONFIG_H 18 | #define STROMX_TEST_CONFIG_H 19 | 20 | #define STROMX_TEST_VERSION_MAJOR @STROMX_VERSION_MAJOR@ 21 | #define STROMX_TEST_VERSION_MINOR @STROMX_VERSION_MINOR@ 22 | #define STROMX_TEST_VERSION_PATCH @STROMX_VERSION_PATCH@ 23 | 24 | #define STROMX_TEST_PACKAGE_NAME "test" 25 | 26 | #ifdef WIN32 27 | #define STROMX_TEST_HELPER_DLL_IMPORT __declspec(dllimport) 28 | #define STROMX_TEST_HELPER_DLL_EXPORT __declspec(dllexport) 29 | #else 30 | #define STROMX_TEST_HELPER_DLL_IMPORT 31 | #define STROMX_TEST_HELPER_DLL_EXPORT __attribute__ ((visibility ("default"))) 32 | #endif // WIN32 33 | 34 | #ifdef STROMX_TEST_STATIC 35 | #define STROMX_TEST_API 36 | #else 37 | #ifdef stromx_test_EXPORTS 38 | #define STROMX_TEST_API STROMX_TEST_HELPER_DLL_EXPORT 39 | #else 40 | #define STROMX_TEST_API STROMX_TEST_HELPER_DLL_IMPORT 41 | #endif // stromx_test_EXPORTS 42 | #endif // STROMX_TEST_STATIC 43 | 44 | #endif // STROMX_TEST_CONFIG_H 45 | 46 | -------------------------------------------------------------------------------- /stromx/test/Test.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Matthias Fuchs 3 | * 4 | * This file is part of stromx-studio. 5 | * 6 | * Stromx-studio is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * Stromx-studio is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with stromx-studio. If not, see . 18 | */ 19 | 20 | #include "stromx/test/Test.h" 21 | 22 | #include 23 | 24 | #include "stromx/test/DeadlockOperator.h" 25 | #include "stromx/test/ExceptionOperator.h" 26 | #include "stromx/test/ParameterOperator.h" 27 | #include "stromx/test/RandomDataOperator.h" 28 | #include "stromx/test/TestDataOperator.h" 29 | 30 | int stromxRegisterTest(stromx::runtime::Registry* registry) 31 | { 32 | using namespace stromx::test; 33 | 34 | try 35 | { 36 | registry->registerOperator(new DeadlockOperator); 37 | registry->registerOperator(new ExceptionOperator); 38 | registry->registerOperator(new ParameterOperator); 39 | registry->registerOperator(new RandomDataOperator); 40 | registry->registerOperator(new TestDataOperator); 41 | } 42 | catch(stromx::runtime::Exception & e) 43 | { 44 | std::cerr << e.what() << std::endl; 45 | return 1; 46 | } 47 | 48 | return 0; 49 | } -------------------------------------------------------------------------------- /stromx/test/Test.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2014 Matthias Fuchs 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef STROMX_TEST_TEST_H 18 | #define STROMX_TEST_TEST_H 19 | 20 | #include "stromx/test/Config.h" 21 | 22 | namespace stromx 23 | { 24 | namespace runtime 25 | { 26 | class Registry; 27 | } 28 | } 29 | 30 | extern "C" 31 | { 32 | STROMX_TEST_API int stromxRegisterTest(stromx::runtime::Registry* registry); 33 | } 34 | 35 | #endif // STROMX_TEST_TEST_H -------------------------------------------------------------------------------- /util/stream.stromx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/util/stream.stromx -------------------------------------------------------------------------------- /util/stream.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/util/stream.zip -------------------------------------------------------------------------------- /util/testdata.stromx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/uboot/stromx/5aff42008c576ca4aa9dbb1fdd238dac1d875ece/util/testdata.stromx --------------------------------------------------------------------------------