[Clam-devel] The simplest processing (Processing base refactoring finished)
Pau Arumi
parumi at iua.upf.edu
Thu May 17 05:22:35 PDT 2007
After last commits, this is how it looks the simplest processing
(at examples/WritingProcessings.cxx)
Note that ConcreteConfigure is not mandatory to implement.
But you need to call Configure( Config() ); in the constructor:
typedef float MyInputDataType;
typedef float MyOutputDataType;
class MyProcessing : public CLAM::Processing
{
CLAM::InPort<MyInputDataType> mIn;
CLAM::OutPort<MyOutputDataType> mOut;
public:
const char* GetClassName() const { return "MyProcessing"; }
MyProcessing()
: mIn("My Input", this)
, mOut("My Output", this)
{
Configure( Config() );
}
bool Do()
{
bool result = Do(mIn.GetData(), mOut.GetData());
// Tell the ports this is done
mIn.Consume();
mOut.Produce();
return result;
}
bool Do(const MyInputDataType& in, MyOutputDataType& out)
{
// Your implementation
}
};
int main()
{
MyProcessing proc;
std::cout << "State: "<< proc.GetExecStateString() << std::endl;
// writes: "Ready"
return 0;
}
More information about the clam-devel
mailing list