28 totalNumSamplesViewed = 0;
37 this->trackData = rhs.trackData;
38 this->numDimensions = rhs.numDimensions;
39 this->totalNumSamplesViewed = rhs.totalNumSamplesViewed;
40 this->ranges = rhs.ranges;
46 totalNumSamplesViewed = 0;
48 if( numDimensions > 0 )
49 ranges.
resize(numDimensions,
MinMax(BIG_POSITIVE_VALUE,BIG_NEGATIVE_VALUE));
54 if( numDimensions > 0 ){
56 this->numDimensions = numDimensions;
67 if( sample.size() != numDimensions )
return false;
69 if( !trackData )
return true;
71 totalNumSamplesViewed++;
72 for(UINT j=0; j<numDimensions; j++){
73 if( sample[j] < ranges[j].minValue ){ ranges[j].minValue = sample[j]; }
74 else if( sample[j] > ranges[j].maxValue ){ ranges[j].maxValue = sample[j]; }
83 file.open(filename.c_str(), std::ios::out);
85 if( !file.is_open() ){
89 file <<
"GRT_RANGE_TRACKER_DATA_FILE_V1.0\n";
90 file <<
"NumDimensions: " << numDimensions << std::endl;
91 file <<
"TotalNumSamplesViewed: " << totalNumSamplesViewed << std::endl;
92 file <<
"Ranges: " << std::endl;
94 for(UINT i=0; i<ranges.
getSize(); i++){
95 file << ranges[i].minValue <<
"\t" << ranges[i].maxValue << std::endl;
105 file.open(filename.c_str(), std::ios::in);
108 if( !file.is_open() ){
109 std::cout <<
"FILE NOT FOUND\n";
117 if(word !=
"GRT_RANGE_TRACKER_DATA_FILE_V1.0"){
124 if(word !=
"NumDimensions:"){
128 file >> numDimensions;
132 if(word !=
"TotalNumSamplesViewed:"){
136 file >> totalNumSamplesViewed;
141 if(word !=
"Ranges:"){
146 ranges.
resize(numDimensions);
147 for(UINT i=0; i<ranges.size(); i++){
148 file >> ranges[i].minValue;
149 file >> ranges[i].maxValue;
virtual bool resize(const unsigned int size)
bool saveRangeDataToFile(std::string filename)
unsigned int getSize() const
bool update(VectorFloat sample)
bool loadRangeDataFromFile(std::string filename)
bool setNumDimensions(UINT numDimensions)
The RangeTracker can be used to keep track of the expected ranges that might occur in a dataset...
Vector< MinMax > getRanges()