Skip to content
Snippets Groups Projects
Commit c5d5e02f authored by Thibault Allenet's avatar Thibault Allenet
Browse files

Generic abstract database class

parent 968b2bda
No related branches found
No related tags found
2 merge requests!105version 0.2.0,!4Dataloader
...@@ -2,40 +2,38 @@ ...@@ -2,40 +2,38 @@
#define Database_H_ #define Database_H_
#include <cstring> #include <cstring>
#include <memory>
#include <vector>
#include <tuple>
#include "aidge/data/Tensor.hpp" #include "aidge/data/Tensor.hpp"
namespace Aidge{ namespace Aidge {
/** /**
* @brief Database. An abstract class representing a database. All databases should inherit from this class. All subclasses should overwrite :cpp:function:`Database::get_item` to fetch data from a given index. * @brief Database. An abstract class representing a map from a key to data. All databases should inherit from this class. All subclasses should overwrite :cpp:function:`Database::getItem` to fetch data from a given index.
* @todo Make the dataset generic. Always ground truth.
*/ */
class Database { class Database {
public: public:
Database() = default;
virtual ~Database() = default; virtual ~Database() = default;
/** /**
* @brief Fetch a data sample and its corresponding ground_truth * @brief Fetch an item of the database.
* @param index index of the pair (```data```, ```ground truth```) to fetch from the database * @param index index of the item.
* @return A pair of pointers to the data (first) and its corresping ground truth (second) * @return vector of data mapped to index.
*/ */
virtual std::pair<std::shared_ptr<Tensor>,std::shared_ptr<Tensor>> get_item(unsigned int index) = 0; virtual std::vector<std::shared_ptr<Tensor>> getItem(std::size_t index) = 0;
/** /**
* @return The number of data samples in the database. * @brief Get the number of items in the database
*
* @return std::size_t
*/ */
virtual unsigned int get_len() = 0; virtual std::size_t getLen() = 0;
protected:
std::vector<std::shared_ptr<Tensor>> mData;
std::vector<std::shared_ptr<Tensor>> mLabel;
}; };
} // namespace Aidge
}
#endif /* Database_H_ */ #endif /* Database_H_ */
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment