Tutorial: Creating a Unit that Publishes Data
namespace tutorials {
class FloatProducer :
public Unit {
public:
FloatProducer();
template<typename Reflector>
{
}
protected:
virtual void initialize();
virtual void process(
const Timer& timer);
private:
float mValue;
};
{
}
void FloatProducer::initialize()
{
mFloatChannel = publish<float>("FloatChannel");
mValue = 0.0f;
}
void FloatProducer::process(
const Timer& timer)
{
mValue += 1.0f;
mFloatChannel.post(mValue);
std::cout << "FloatProducer: " << mValue << std::endl;
}
}