Re: Properties Shared Amongst Objects



"Leslie Sanford" <jabberdabber@xxxxxxxxxxxxxxxxx> wrote:

My approach was to factor out properties into classes of their own.
Instances of the property classes are passed to component objects. In the
case of the "smoothed" properties, the smoothing takes place in one property
object and the results shared amongst a group of components.

class SmoothProperty
{
public:
void Render(int count)
{
// Smooth parameter changes...
}

const float *GetOutput() const
{
// Return the results of smoothing property changes.
return buffer;
}

float GetValue() const
{
return value;
}

void SetValue(float value)
{
this->value = value;

// Do stuff to calibrate property smoothing...
}
};

SmoothParameter param;
Component c1(param);
Component c2(param);

param.SetValue(1000);
param.Render(1024);

I'm looking for comments or insights into the above approach. Also, are
there any sources that describe an approach similar to the above?

It sounds like the Strategy pattern to me.
.