Dear List,
Can anyone explain me how and where the memory for the result of
applying a scripting operator is allocated? In Operators.cpp I can see
for instance
DataSourceBase* OperatorRepository::applyBinary(const std::string& op, DataSourceBase* a, DataSourceBase* b )
return a ptr to a datasource, but where is this allocated? In other
words, how does Orocos scripting manage to store the result of an
Operator application in its preallocate datasource?
Thanks!
Markus
How does Operators.cpp apply_* methods allocate result memory?
On Thu, May 19, 2011 at 3:00 PM, Markus Klotzbuecher
<markus [dot] klotzbuecher [..] ...> wrote:
> Dear List,
>
> Can anyone explain me how and where the memory for the result of
> applying a scripting operator is allocated? In Operators.cpp I can see
> for instance
>
> DataSourceBase* OperatorRepository::applyBinary(const std::string& op, DataSourceBase* a, DataSourceBase* b )
>
> return a ptr to a datasource, but where is this allocated? In other
> words, how does Orocos scripting manage to store the result of an
> Operator application in its preallocate datasource?
Because the DataSourceBase::evaluate() function is used to do the
operation on a and b. applyBinary is misleading, Nothing is applied
yet, only prepared for the operator. So it's a factory function (using
'new') that returns a functor wrapped in a data source.
Peter
How does Operators.cpp apply_* methods allocate result memory?
On Thu, May 19, 2011 at 10:16:24PM +0200, Peter Soetens wrote:
> On Thu, May 19, 2011 at 3:00 PM, Markus Klotzbuecher
> <markus [dot] klotzbuecher [..] ...> wrote:
> > Dear List,
> >
> > Can anyone explain me how and where the memory for the result of
> > applying a scripting operator is allocated? In Operators.cpp I can see
> > for instance
> >
> > DataSourceBase* OperatorRepository::applyBinary(const std::string& op, DataSourceBase* a, DataSourceBase* b )
> >
> > return a ptr to a datasource, but where is this allocated? In other
> > words, how does Orocos scripting manage to store the result of an
> > Operator application in its preallocate datasource?
>
> Because the DataSourceBase::evaluate() function is used to do the
> operation on a and b. applyBinary is misleading, Nothing is applied
> yet, only prepared for the operator. So it's a factory function (using
> 'new') that returns a functor wrapped in a data source.
I see, in OROCOS scripting this is done at parse time again. Do you
see a non-intrusive way to get a "real" applyBinary which takes a
result DSB as an argument?
Thanks!
Markus