12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- #include <iostream>
- #include "Quantization.h"
- using namespace NICE;
- Quantization::Quantization( )
- {
- this->ui_numBins = 1;
- }
- Quantization::Quantization( uint _numBins,
- NICE::Vector * v_upperBounds
- )
- {
- }
- Quantization::~Quantization()
- {
- }
- uint Quantization::getNumberOfBins() const
- {
- return this->ui_numBins;
- }
-
- void Quantization::restore ( std::istream & _is,
- int _format
- )
- {
- if ( _is.good() )
- {
- std::string tmp;
- bool b_endOfBlock ( false ) ;
-
- while ( !b_endOfBlock )
- {
- _is >> tmp;
-
- if ( this->isEndTag( tmp, "Quantization" ) )
- {
- b_endOfBlock = true;
- continue;
- }
-
- tmp = this->removeStartTag ( tmp );
-
- if ( tmp.compare("ui_numBins") == 0 )
- {
- _is >> this->ui_numBins;
- }
- else
- {
- std::cerr << "WARNING -- unexpected Quantization object -- " << tmp << " -- for restoration... aborting" << std::endl;
- throw;
- }
-
- _is >> tmp;
- tmp = this->removeEndTag ( tmp );
- }
- }
- else
- {
- std::cerr << "Quantization::restore -- InStream not initialized - restoring not possible!" << std::endl;
- }
- }
- void Quantization::store ( std::ostream & _os,
- int _format
- ) const
- {
-
- _os << this->createStartTag( "Quantization" ) << std::endl;
-
- _os << this->createStartTag( "ui_numBins" ) << std::endl;
- _os << this->ui_numBins << std::endl;
- _os << this->createEndTag( "ui_numBins" ) << std::endl;
-
-
- _os << this->createEndTag( "Quantization" ) << std::endl;
- }
|