class CMyAutomat : public Dapfor::Common::CAutomat
{
public:
CMyAutomat(const std::string& name);
};
CMyAutomat::CMyAutomat(const std::string& name) : CAutomat(name)
{
}
class CPrintJob : public Dapfor::Common::CJob
{
public:
CPrintJob(int count);
protected:
virtual void ProcessJob(Dapfor::Common::CAutomat* automat);
private:
int m_Count;
};
CPrintJob::CPrintJob(int count) : m_Count(count)
{
}
void CPrintJob::ProcessJob(Dapfor::Common::CAutomat* automat)
{
for(int i = 0; i < m_Count; ++i)
{
std::cout << automat->GetThreadName() << ": value = " << i << std::endl;
Sleep(100);
}
}
...
CMyAutomat automat("Automat");
automat.Start();
automat.PushJob(new CPrintJob(10));
Sleep(2000);
automat.Stop();
automat.Wait();