Skip to content

Commit

Permalink
Fixed all read functions to take stream as a template argument
Browse files Browse the repository at this point in the history
  • Loading branch information
hosseinmoein committed Feb 9, 2025
1 parent d985376 commit 518daac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
11 changes: 8 additions & 3 deletions include/DataFrame/Internals/DataFrame_private_decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,17 @@ using JoinSortingPair = std::pair<const T *, size_type>;

// ----------------------------------------------------------------------------

void read_json_(std::istream &file, bool columns_only);
void read_binary_(std::istream &file,
template<typename S>
void read_json_(S &file, bool columns_only);

template<typename S>
void read_binary_(S &file,
bool columns_only,
size_type starting_row,
size_type num_rows);
void read_csv_(std::istream &file, bool columns_only);

template<typename S>
void read_csv_(S &file, bool columns_only);

template<typename S>
void read_csv2_(S &stream,
Expand Down
9 changes: 6 additions & 3 deletions include/DataFrame/Internals/DataFrame_read.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ namespace hmdf
{

template<typename I, typename H>
void DataFrame<I, H>::read_json_(std::istream &stream, bool columns_only) {
template<typename S>
void DataFrame<I, H>::read_json_(S &stream, bool columns_only) {

char c { '\0' };
const SpinGuard guard(lock_);
Expand Down Expand Up @@ -395,7 +396,8 @@ void DataFrame<I, H>::read_json_(std::istream &stream, bool columns_only) {
// ----------------------------------------------------------------------------

template<typename I, typename H>
void DataFrame<I, H>::read_csv_(std::istream &stream, bool columns_only) {
template<typename S>
void DataFrame<I, H>::read_csv_(S &stream, bool columns_only) {

std::string col_name;
std::string value;
Expand Down Expand Up @@ -2140,8 +2142,9 @@ read_csv2_(S &stream,
// ----------------------------------------------------------------------------

template<typename I, typename H>
template<typename S>
void DataFrame<I, H>::
read_binary_(std::istream &stream,
read_binary_(S &stream,
bool columns_only,
size_type starting_row,
size_type num_rows) {
Expand Down

0 comments on commit 518daac

Please sign in to comment.