/usr/include/OpenCTL/Program.h is in opengtl-dev 0.9.16-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | /*
* Copyright (c) 2008 Cyrille Berger <cberger@cberger.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* either version 2, or (at your option) any later version of the License.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _OPENCTL_APPLICATOR_H_
#define _OPENCTL_APPLICATOR_H_
#include <list>
#include <GTLCore/ChannelsFlags.h>
#include <GTLCore/String.h>
#include <OpenCTL/Export.h>
namespace GTLCore {
class Buffer;
class PixelDescription;
class String;
class Value;
class AbstractImage;
class ProgressReport;
}
namespace OpenCTL {
class Module;
/**
* CTL Programs are functions that are applied to a buffer a pixels, one at a time.
*
* Example:
* @code
* OpenCTL::Module p("testCall");
* p.setSource( " \
* void testCall(int a, output int b) \n\
* { \n\
* b = a + 1; \n\
* return; \n\
* }");
* p.compile();
* OpenCTL::Program Program( "testCall2", &p, GTLCore::PixelDescription( GTLCore::Type::Integer8, 1));
* GTLCore::Array arr( 4 );
* arr.data()[0] = 10;
* arr.data()[1] = 30;
* arr.data()[2] = 50;
* arr.data()[3] = 60;
* Program.apply(arr, arr);
* @endcode
* @ingroup OpenCTL
*/
class OPENCTL_EXPORT Program {
GTL_NO_COPY(Program);
public:
/**
* @param functionName the name of the function to call on each pixel, it must be able to
* take as input the pixel of pixelDescription and as output.
* For instance if your pixel is an integer and float (int,float)
* the function must have the following signature:
* void function(int, float, output int, output float);
* @param module the module with the function
* @param pixelDescription an object holding the information aobut the pixel
*/
Program(const GTLCore::String& functionName, const Module* module, const GTLCore::PixelDescription& pixelDescription);
/**
* @param functionName the name of the function to call on each pixel, it must be able to
* take as input the pixel of pixelDescription and as output.
* For instance if your pixel is an integer and float (int,float)
* the function must have the following signature:
* void function(int, float, output int, output float);
* @param module the module with the function
* @param srcPixelDescription an object holding the information aobut the source pixel
* @param dstPixelDescription an object holding the information aobut the destination pixel
*/
Program(const GTLCore::String& functionName, const Module* module, const GTLCore::PixelDescription& srcPixelDescription, const GTLCore::PixelDescription& dstPixelDescription );
/**
* @param functionName the name of the function to call on each pixel, it must be able to
* take as input the pixel of pixelDescription and as output.
* For instance if your pixel is an integer and float (int,float)
* the function must have the following signature:
* void function(int, float, output int, output float);
* @param module the module with the function
* @param srcPixelDescription an object holding the information aobut the different source pixel
* @param dstPixelDescription an object holding the information aobut the destination pixel
*/
Program(const GTLCore::String& functionName, const Module* module, const std::list<GTLCore::PixelDescription>& srcPixelDescriptions, const GTLCore::PixelDescription& dstPixelDescription );
~Program();
/**
* @return true if the program was correctly initialised
*/
bool isInitialised() const;
void apply(const GTLCore::Buffer& input, GTLCore::Buffer& output, GTLCore::ProgressReport* report = 0, const GTLCore::ChannelsFlags& flags = GTLCore::ChannelsFlags()) const;
void apply(const std::list<GTLCore::Buffer*>& inputs, GTLCore::Buffer& output, GTLCore::ProgressReport* report = 0, const GTLCore::ChannelsFlags& flags = GTLCore::ChannelsFlags()) const;
void apply(const GTLCore::AbstractImage& input, GTLCore::AbstractImage& output, GTLCore::ProgressReport* report = 0, const GTLCore::ChannelsFlags& flags = GTLCore::ChannelsFlags()) const;
/**
* Set a varying argument of the function used by the program.
* For instance the following CTL code gives access to exposure as a <em>varying</em>
* argument.
*
*/
void setVarying( const GTLCore::String& _name, const GTLCore::Value& _value );
/**
* Set a varying argument of the function used by the program.
* For instance the following CTL code gives access to exposure as a <em>varying</em>
* argument.
*
*/
void setVarying( std::size_t _id, const GTLCore::Value& _value );
/**
* @return a varying argument of a function.
*/
GTLCore::Value varying( const GTLCore::String& _name ) const;
/**
* @return a varying argument of a function.
*/
GTLCore::Value varying( std::size_t _id ) const;
/**
* @return the id varying argument of a function. To be used with setVarying and varying
*/
std::size_t varyingId( const GTLCore::String& _name ) const;
/**
* @return the list of varying parameters for this program
*/
const std::list<GTLCore::String>& varyings() const;
private:
/**
* Init the program
*/
void init(const GTLCore::String& functionName, const Module* module);
private:
struct Private;
Private* const d;
};
}
#endif
|