I have three classes.
Trial
Robot
WriteToFile
Trial is holding a pointer to a WriteToFile object and for a Robot object.
Trial is calling Robot method to return a string and passes it to his WriteToFile.
Robot is containing a private
I initialized it usingCode:vector<int> samplesRobotToKalmanFilter;
And the return methodCode:samplesRobotToKalmanFilter.clear();
Inside this method I can see that samplesRobotToKalmanFilter is emptyCode:const vector<int>& Robot::GetSamplesReadUsingRobot() const { if(samplesRobotToKalmanFilter.empty()) cout<<"empty\n"; //INDEED EMPTY return samplesRobotToKalmanFilter; }
WriteToFile has the following method
I call this last method from Trial instance:Code:void WriteToExternalFile::WriteValuesToVector(const vector<int>& samplesvec, const vector<double>& valuesXY) { if(samplesvec.empty()) cout<<"empty\n"; //NOT SHOWING EMPTY }
Code:writeinput->WriteValuesToVector(robot->GetSamplesReadUsingRobot() , robot->GetinputForKalmanFilter());
The problem: inside this last method samplesvec is no longer considered empty...



LinkBack URL
About LinkBacks



