Skip to content

Commit

Permalink
[rob] added DataLoader classes
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonRohou committed Jul 20, 2018
1 parent d30bde7 commit 365f80e
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/robotics/data/tubex_DataLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,22 @@
* ---------------------------------------------------------------------------- */

#include "tubex_DataLoader.h"
#include "tubex_Exception.h"

using namespace std;

namespace tubex
{
DataLoader::DataLoader()
DataLoader::DataLoader(const string& file_path)
{

m_datafile = new ifstream();
m_datafile->open(file_path.c_str(), std::ios_base::out);
if(!m_datafile->is_open())
throw Exception("DataLoader constructor", "unable to load data file");
}

DataLoader::~DataLoader()
{

delete m_datafile;
}
}
9 changes: 8 additions & 1 deletion src/robotics/data/tubex_DataLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,24 @@
#ifndef __TUBEX_DATALOADER_H__
#define __TUBEX_DATALOADER_H__

#include <string>
#include <fstream>
#include "tubex_TubeVector.h"

namespace tubex
{
class DataLoader
{
public:

DataLoader();
DataLoader(const std::string& file_path);
~DataLoader();

virtual bool loadData(TubeVector& x, const ibex::Interval& domain = ibex::Interval::ALL_REALS) = 0;

protected:

std::ifstream *m_datafile;
};
}

Expand Down
30 changes: 30 additions & 0 deletions src/robotics/data/tubex_DataLoader_Redermor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* ============================================================================
* tubex-lib - DataLoader_Redermor class
* ============================================================================
* Copyright : Copyright 2017 Simon Rohou
* License : This program is distributed under the terms of
* the GNU Lesser General Public License (LGPL).
*
* Author(s) : Simon Rohou
* Bug fixes : -
* Created : 2018
* ---------------------------------------------------------------------------- */

#include "tubex_DataLoader_Redermor.h"

using namespace std;
using namespace ibex;

namespace tubex
{
DataLoader_Redermor::DataLoader_Redermor(const string& file_path)
: DataLoader(file_path)
{

}

bool DataLoader_Redermor::loadData(TubeVector& x, const Interval& domain)
{

}
}
33 changes: 33 additions & 0 deletions src/robotics/data/tubex_DataLoader_Redermor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* ============================================================================
* tubex-lib - DataLoader_Redermor class
* ============================================================================
* Copyright : Copyright 2017 Simon Rohou
* License : This program is distributed under the terms of
* the GNU Lesser General Public License (LGPL).
*
* Author(s) : Simon Rohou
* Bug fixes : -
* Created : 2018
* ---------------------------------------------------------------------------- */

#ifndef __TUBEX_DATALOADER_REDERMOR_H__
#define __TUBEX_DATALOADER_REDERMOR_H__

#include "ibex_Interval.h"
#include "tubex_DataLoader.h"

namespace tubex
{
class DataLoader_Redermor : DataLoader
{
public:

DataLoader_Redermor(const std::string& file_path);
bool loadData(TubeVector& x, const ibex::Interval& domain = ibex::Interval::ALL_REALS);

protected:

};
}

#endif

0 comments on commit 365f80e

Please sign in to comment.