36 return (*(
char*)&i) == 0;
43 std::reverse(p, p+
sizeof(T));
49 void bewrite(std::ofstream& out,
const T& value) {
52 out.write((
char*)&becopy,
sizeof(becopy));
56 void bewrite(std::ofstream& out,
const std::string& str) {
58 out.write(str.c_str(), (
int)str.size());
62 void bewrite(std::ofstream& out,
const std::vector<std::string>& v) {
65 for (
int i=0; i<size; i++)
bewrite(out, v[i]);
71 void beread(std::ifstream& in, T& value) {
72 in.read((
char*)&value,
sizeof(value));
77 void beread(std::ifstream& in, std::string& str) {
81 in.read(&str[0], size);
85 void beread(std::ifstream& in, std::vector<std::string>& v) {
89 for (
int i=0; i<size; i++)
beread(in, v[i]);
Definition: algorithm.h:28
void beread(std::ifstream &in, T &value)
Definition: betools.h:71
void removeEndianness(T &x)
Definition: betools.h:40
void bewrite(std::ofstream &out, const T &value)
Definition: betools.h:49
bool isBigEndian()
Definition: betools.h:34
int32_t sint32
Definition: types.h:46