Search code examples
kurento

Kurento : custom module error while adding "properties"


I'm trying to add "properties" in my custom module by using the following code

In my *.kdm.json file:

"properties": [
{
  "name": "params",
  "doc": "set params",
  "type": "String"
}
]

Im my .hpp file

virtual std::string getParams();
virtual void setParams (std::string params);

In my .cpp file

void myCustomFilterImpl::setParams (std::string params)
{
    //code here
}

std::string myCustomFilterImpl::getParams ()
{
  return params.c_str();
}

I'm getting following error while running debuild

 error: cannot allocate an object of abstract type ‘kurento::module::mycustomfilter::myCustomFilterImpl’ return new myCustomFilterImpl (conf, mediaPipeline);

..... note:   because the following virtual functions are pure within ‘kurento::module::mycustomfilter::myCustomFilterImpl’:   class myCustomFilterImpl:public FilterImpl, public virtual myCustomFilter
         ^
.... note:  virtual void kurento::module::mycustomfilter::myCustomFilter::setParams(const string&)
   virtual void setParams (const std::string &params) = 0;
                ^
... error: control reaches end of non-void function [-Werror=return-type]
       }
       ^

Is there anything that I'm missing here to add in my custom module code ?

properties is working fine for my other custom module but I don't know how I'm getting this error in this custom module.


Solution

  • The problem is that the method is declared like this by the template:

    virtual void setParams (const std::string &params);
    

    But you are implementing it like this:

    virtual void setParams (std::string params);
    

    Note the difference in params declararion (& and const)