[CLAM] Writing Control Data to a File in Network Editor

Uğur Güney ugurguney at gmail.com
Mon Jul 28 04:06:40 PDT 2008


> Yes you are right. The example uses dummy datatypes. In your case you should
> just get a CLAM::Fundamental input port which requires #include
> <CLAM/Fundamental.hxx>. You can remove the output port and the code that uses
> it.
>
> If you use directly the fundamental, you can just forget about controls (and
> the related wiki too).
> In the Do method:
> TData fundamentalFreq = _inPort.GetData().GetFreq(0);
> Then, write fundamentalFreq wherever you want.

# Sorry for bothering you so much.
# When I compile the code below, according your suggestions, I'm
getting this errors:

MyProcessing.hxx:34: error: passing 'const
CLAM::InPort<CLAM::Fundamental>' as 'this' argument of 'Token&
CLAM::InPort<Token>::GetData(int) [with Token = CLAM::Fundamental]'
discards qualifiers
scons: *** [MyProcessing.os] Error 1

# I looked at the documentation here:
http://clam.iua.upf.edu/doc/CLAM-devel-doxygen/classCLAM_1_1Fundamental.html
# It says that fundamental has the member function of GetFreq(). If I
try "in.GetFreq(0)", instead of "in.GetData().GetFreq(0)", I get an
error which says that Fundamental does not has got a member named
GetFreq(). Is the documentation old? Where is the best reference
source for the CLAM API (I can look, so I do not annoy you much)?
-ugur-


MyProcessing.hxx:
===========

#ifndef MyProcessing_hxx
#define MyProcessing_hxx

#include <CLAM/InPort.hxx>
#include <CLAM/OutPort.hxx>
#include <CLAM/Processing.hxx>

#include <CLAM/Fundamental.hxx>

class MyProcessing : public CLAM::Processing
{
  CLAM::InPort<CLAM::Fundamental> mIn;
public:
  const char* GetClassName() const { return "MyProcessing"; }
  MyProcessing(const Config& config = Config())
    : mIn("My Input", this)
  {
    Configure( config );
  }

  bool Do()
  {
    bool result = Do( mIn );
    // Tell the ports this is done
    mIn.Consume();
    return result;
  }

  bool Do(const CLAM::InPort<CLAM::Fundamental>& in)
  {
    // Your implementation
    in.GetData().GetFreq(0);
    return true;
  }
};

#endif // MyProcessing_hxx




More information about the clam-users mailing list