T
tjumail
I modify my code into following sample code.
CTest is a class only constructed once when the device power on.
CTest::ExecuteRunState is a function entered periodically.
Do you think whether it is necessary to put the local variables into
class private members?
Otherwise, each time entering the ExecuteRunState(), those local
variables will be decleared and initionalized one time. It's a waste
of cpu resource.
class CTest
{
public:
CTest();
~CTest();
private:
void CTest(const CTest & m_CTest);
void ExecuteRunState(); //This function will entered periodically
};
void CTest::ExecuteRunState()
{
tMV measurement = 0;
tMVq quality = 0;
tMVt timeStamp = 0;
//Here those three variables will gain the newest values.
pData->GetNewestValue(&measurement, &quality, &timeStamp);
CalFreq(&measurement);
}
CTest is a class only constructed once when the device power on.
CTest::ExecuteRunState is a function entered periodically.
Do you think whether it is necessary to put the local variables into
class private members?
Otherwise, each time entering the ExecuteRunState(), those local
variables will be decleared and initionalized one time. It's a waste
of cpu resource.
class CTest
{
public:
CTest();
~CTest();
private:
void CTest(const CTest & m_CTest);
void ExecuteRunState(); //This function will entered periodically
};
void CTest::ExecuteRunState()
{
tMV measurement = 0;
tMVq quality = 0;
tMVt timeStamp = 0;
//Here those three variables will gain the newest values.
pData->GetNewestValue(&measurement, &quality, &timeStamp);
CalFreq(&measurement);
}