21 #define GRT_DLL_EXPORTS 29 totalNumSamplesViewed = 0;
38 this->trackData = rhs.trackData;
39 this->numDimensions = rhs.numDimensions;
40 this->totalNumSamplesViewed = rhs.totalNumSamplesViewed;
41 this->ranges = rhs.ranges;
47 totalNumSamplesViewed = 0;
49 if( numDimensions > 0 )
50 ranges.
resize(numDimensions,
MinMax(BIG_POSITIVE_VALUE,BIG_NEGATIVE_VALUE));
55 if( numDimensions > 0 ){
57 this->numDimensions = numDimensions;
68 if( sample.size() != numDimensions )
return false;
70 if( !trackData )
return true;
72 totalNumSamplesViewed++;
73 for(UINT j=0; j<numDimensions; j++){
74 if( sample[j] < ranges[j].minValue ){ ranges[j].minValue = sample[j]; }
75 else if( sample[j] > ranges[j].maxValue ){ ranges[j].maxValue = sample[j]; }
84 file.open(filename.c_str(), std::ios::out);
86 if( !file.is_open() ){
90 file <<
"GRT_RANGE_TRACKER_DATA_FILE_V1.0\n";
91 file <<
"NumDimensions: " << numDimensions << std::endl;
92 file <<
"TotalNumSamplesViewed: " << totalNumSamplesViewed << std::endl;
93 file <<
"Ranges: " << std::endl;
95 for(UINT i=0; i<ranges.
getSize(); i++){
96 file << ranges[i].minValue <<
"\t" << ranges[i].maxValue << std::endl;
106 file.open(filename.c_str(), std::ios::in);
109 if( !file.is_open() ){
110 std::cout <<
"FILE NOT FOUND\n";
118 if(word !=
"GRT_RANGE_TRACKER_DATA_FILE_V1.0"){
125 if(word !=
"NumDimensions:"){
129 file >> numDimensions;
133 if(word !=
"TotalNumSamplesViewed:"){
137 file >> totalNumSamplesViewed;
142 if(word !=
"Ranges:"){
147 ranges.
resize(numDimensions);
148 for(UINT i=0; i<ranges.size(); i++){
149 file >> ranges[i].minValue;
150 file >> ranges[i].maxValue;
virtual bool resize(const unsigned int size)
bool saveRangeDataToFile(std::string filename)
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()