renamed function 'print' -> 'ToHexString'; this func returns std::string now

This commit is contained in:
Anatoly Myachev committed 2019-05-15 17:41:12 +03:00
1 parent 7d945eb554
commit 7af18471e2
4 files changed
+11 -8

No files matched your search

+7 -4
View File
@@ -18,7 +18,8 @@
#include "arrow/buffer.h"
#include <cstdint>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <utility>
#include "arrow/memory_pool.h"
@@ -48,13 +49,15 @@ Status Buffer::Copy(const int64_t start, const int64_t nbytes,
return Copy(start, nbytes, default_memory_pool(), out);
}
void Buffer::print() {
std::string Buffer::ToHexString() {
const uint8_t* _data = is_mutable() ? mutable_data() : data();
std::stringstream ss;
for (int64_t i = 0; i < size(); ++i) {
std::cout << std::hex << static_cast<unsigned int>(_data[i]);
ss << std::setfill('0') << std::setw(2) <<
std::hex << static_cast<unsigned int>(_data[i]);
}
std::cout << std::endl;
return ss.str();
}
bool Buffer::Equals(const Buffer& other, const int64_t nbytes) const {
+1 -1
View File
@@ -89,7 +89,7 @@ class ARROW_EXPORT Buffer {
bool is_mutable() const { return is_mutable_; }
void print();
std::string ToHexString();
/// Return true if both buffers are the same size and contain the same bytes
/// up to the number of compared bytes
+1 -1
View File
@@ -208,7 +208,7 @@ cdef extern from "arrow/api.h" namespace "arrow" nogil:
int64_t size()
shared_ptr[CBuffer] parent()
c_bool is_mutable() const
void print()
c_string ToHexString()
c_bool Equals(const CBuffer& other)
shared_ptr[CBuffer] SliceBuffer(const shared_ptr[CBuffer]& buffer,
+2 -2
View File
@@ -868,8 +868,8 @@ cdef class Buffer:
"""
return <uintptr_t> self.buffer.get().data()
def print(self):
self.buffer.get().print()
def ToHexString(self):
return self.buffer.get().ToHexString()
@property
def is_mutable(self):