Skip to content

Commit

Permalink
adjust for xylib api changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wojdyr committed Feb 28, 2016
1 parent 8372a6f commit 008e5f5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
10 changes: 7 additions & 3 deletions fityk/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
using std::string;
using std::vector;

#if XYLIB_VERSION < 10500
typedef shared_ptr<const xylib::DataSet> dataset_shared_ptr;
#endif

namespace fityk {

// filename utils
Expand Down Expand Up @@ -239,7 +243,7 @@ int Data::count_blocks(const string& filename,
const string& format, const string& options)
{
try {
shared_ptr<const xylib::DataSet> xyds(xylib::cached_load_file(filename,
dataset_shared_ptr xyds(xylib::cached_load_file(filename,
format, tr_opt(options)));
return xyds->get_block_count();
} catch (const std::runtime_error& e) {
Expand All @@ -252,7 +256,7 @@ int Data::count_columns(const string& filename,
int first_block)
{
try {
shared_ptr<const xylib::DataSet> xyds(xylib::cached_load_file(filename,
dataset_shared_ptr xyds(xylib::cached_load_file(filename,
format, tr_opt(options)));
return xyds->get_block(first_block)->get_column_count();
} catch (const std::runtime_error& e) {
Expand Down Expand Up @@ -284,7 +288,7 @@ void Data::load_file(const LoadSpec& spec)
string block_name;
try {
string ds_options = tr_opt(spec.options);
shared_ptr<const xylib::DataSet> xyds(
dataset_shared_ptr xyds(
xylib::cached_load_file(spec.path, spec.format, ds_options));
verify_options(xyds.get(), ds_options);
clear(); //removing previous file
Expand Down
3 changes: 1 addition & 2 deletions wxgui/frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -993,8 +993,7 @@ void FFrame::OnDataQLoad (wxCommandEvent&)
return;
}
try {
shared_ptr<const xylib::DataSet> d =
xylib::cached_load_file(f, "", "");
dataset_shared_ptr d = xylib::cached_load_file(f, "", "");
if (d->get_block_count() > 1) {
wxArrayString choices;
for (int i = 0; i < d->get_block_count(); ++i) {
Expand Down
10 changes: 7 additions & 3 deletions wxgui/xybrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
#include <wx/splitter.h>
#include <wx/spinctrl.h>
#include "xylib/xylib.h"
#include "xylib/cache.h" // shared_ptr (we want it the same as in xylib)
#include "xylib/cache.h" // dataset_shared_ptr

#include "uplot.h"

#if XYLIB_VERSION < 10500
typedef shared_ptr<const xylib::DataSet> dataset_shared_ptr;
#endif

class PreviewPlot : public PlotWithTics
{
public:
Expand All @@ -22,11 +26,11 @@ class PreviewPlot : public PlotWithTics
virtual void draw(wxDC &dc, bool);
void load_dataset(const std::string& filename, const std::string& filetype,
const std::string& options);
shared_ptr<const xylib::DataSet> get_data() const { return data_; }
dataset_shared_ptr get_data() const { return data_; }
void make_outdated() { data_updated_ = false; }

private:
shared_ptr<const xylib::DataSet> data_;
dataset_shared_ptr data_;
bool data_updated_; // if false, draw() doesn't do anything (plot is clear)
};

Expand Down

0 comments on commit 008e5f5

Please sign in to comment.