1
0
Fork 0

operators for floating point types

This commit is contained in:
Kevin Matz 2023-04-23 11:36:17 -04:00
parent 42ca307c4d
commit 45a8c673f0
2 changed files with 54 additions and 0 deletions

View File

@ -273,6 +273,54 @@ bufferstream& bufferstream::operator<< (const uint64_t& val)
}
/**
* @brief bufferstream::operator >>
* @param val
* @return
*/
bufferstream& bufferstream::operator>> (float& val)
{
val = readType<float>();
return *this;
};
/**
* @brief bufferstream::operator >>
* @param val
* @return
*/
bufferstream& bufferstream::operator>> (double& val)
{
val = readType<double>();
return *this;
};
/**
* @brief bufferstream::operator <<
* @param val
* @return
*/
bufferstream& bufferstream::operator<< (const float& val)
{
writeType<float>(val);
return *this;
}
/**
* @brief bufferstream::operator <<
* @param val
* @return
*/
bufferstream& bufferstream::operator<< (const double& val)
{
writeType<double>(val);
return *this;
}
/**
* @brief bufferstream::operator >>
* @param obj

View File

@ -74,6 +74,12 @@ public:
bufferstream& operator<< (const int32_t& val);
bufferstream& operator<< (const int64_t& val);
// floating point
bufferstream& operator>> (float& val);
bufferstream& operator>> (double& val);
bufferstream& operator<< (const float& val);
bufferstream& operator<< (const double& val);
// stream objects
bufferstream& operator>> (streamable& obj);
bufferstream& operator<< (const streamable& obj);