Hi,
I'm having a look at using the refreshCommand of the Property interface.
I'm not sure if it still exists or if it will remain in the current RTT
development. Anyway here is a piece of code from Proprty.h
virtual CommandInterface* refreshCommand( const PropertyBase*
other)
{
if ( !_value )
return 0;
// refresh is just an update of the datasource.
DataSourceBase::shared_ptr sourcebase =
other->getDataSource();
return _value->updateCommand( sourcebase.get() );
}
Here you see the refreshCommand is forwarded to the update command.
Witch eventually updates the property. Is this intentional? Update and
refresh have a different meaning. I'm not interested in update(), since
it also updates the description (which leads to memory allocation during
the string copy).
Sander.
refreshCommand
On Fri, Jun 12, 2009 at 15:00, Vandenbroucke
Sander<Sander [dot] Vandenbroucke [..] ...> wrote:
> Hi,
>
> I'm having a look at using the refreshCommand of the Property interface.
> I'm not sure if it still exists or if it will remain in the current RTT
> development. Anyway here is a piece of code from Proprty.h
>
> virtual CommandInterface* refreshCommand( const PropertyBase*
> other)
> {
> if ( !_value )
> return 0;
> // refresh is just an update of the datasource.
> DataSourceBase::shared_ptr sourcebase =
> other->getDataSource();
> return _value->updateCommand( sourcebase.get() );
> }
>
> Here you see the refreshCommand is forwarded to the update command.
> Witch eventually updates the property. Is this intentional? Update and
> refresh have a different meaning. I'm not interested in update(), since
> it also updates the description (which leads to memory allocation during
> the string copy).
it is forwarded to updateCommand of the DataSourceBase class, which is
different from updateCommand in the PropertyBase class. The former updates
the value (there is no description in a DataSource), the latter the
value and the description.
So the code is correct. I'm not sure yet what the future is of these family
of functions. That will be discussed in a few months, when we're through the
data flow refactoring.
Peter
refreshCommand
> > Hi,
> >
> > I'm having a look at using the refreshCommand of the Property interface.
> > I'm not sure if it still exists or if it will remain in the current RTT
> > development. Anyway here is a piece of code from Proprty.h
> >
> > virtual CommandInterface* refreshCommand( const PropertyBase*
> > other)
> > {
> > if ( !_value )
> > return 0;
> > // refresh is just an update of the datasource.
> > DataSourceBase::shared_ptr sourcebase =
> > other->getDataSource();
> > return _value->updateCommand( sourcebase.get() );
> > }
> >
> > Here you see the refreshCommand is forwarded to the update command.
> > Witch eventually updates the property. Is this intentional? Update and
> > refresh have a different meaning. I'm not interested in update(), since
> > it also updates the description (which leads to memory allocation during
> > the string copy).
>
> it is forwarded to updateCommand of the DataSourceBase class, which is
> different from updateCommand in the PropertyBase class. The former updates
> the value (there is no description in a DataSource), the latter the
> value and the description.
>
Ok, I overlooked the DataSource. But to be of any use I prefer the use of the Properties refreshCommand because I override the Property::refresh() method.
> So the code is correct. I'm not sure yet what the future is of these
> family
> of functions. That will be discussed in a few months, when we're through
> the
> data flow refactoring.
>
I think they are valuable in some use cases. We already use a command based update of properties.
Sander.