add output_binary

This commit is contained in:
David Rose 2003-10-15 18:25:30 +00:00
parent 7e14f2577d
commit 6552771a5f
2 changed files with 35 additions and 1 deletions

View File

@ -41,7 +41,7 @@ output_hex(ostream &out) const {
}
////////////////////////////////////////////////////////////////////
// Function: HashVal::input
// Function: HashVal::input_hex
// Access: Published
// Description: Inputs the HashVal as a 32-digit hexadecimal number.
////////////////////////////////////////////////////////////////////
@ -77,6 +77,38 @@ input_hex(istream &in) {
decode_hex(buffer + 24, _hv[3]);
}
////////////////////////////////////////////////////////////////////
// Function: HashVal::output_binary
// Access: Published
// Description: Outputs the HashVal as a binary stream of bytes in
// order. This is not the same order generated by
// write_stream().
////////////////////////////////////////////////////////////////////
void HashVal::
output_binary(ostream &out) const {
StreamWriter writer(out);
writer.add_be_uint32(_hv[0]);
writer.add_be_uint32(_hv[1]);
writer.add_be_uint32(_hv[2]);
writer.add_be_uint32(_hv[3]);
}
////////////////////////////////////////////////////////////////////
// Function: HashVal::input_binary
// Access: Published
// Description: Inputs the HashVal as a binary stream of bytes in
// order. This is not the same order expected by
// read_stream().
////////////////////////////////////////////////////////////////////
void HashVal::
input_binary(istream &in) {
StreamReader reader(in);
_hv[0] = reader.get_be_uint32();
_hv[1] = reader.get_be_uint32();
_hv[2] = reader.get_be_uint32();
_hv[3] = reader.get_be_uint32();
}
////////////////////////////////////////////////////////////////////
// Function: HashVal::as_dec
// Access: Published

View File

@ -50,6 +50,8 @@ PUBLISHED:
INLINE void input_dec(istream &in);
void output_hex(ostream &out) const;
void input_hex(istream &in);
void output_binary(ostream &out) const;
void input_binary(istream &in);
INLINE void output(ostream &out) const;