2014-06-04 07:02:41 +02:00
|
|
|
#pragma once
|
|
|
|
#ifndef _DATALOADER_HPP_
|
|
|
|
#define _DATALOADER_HPP_
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
2014-06-04 12:53:11 +02:00
|
|
|
class WorkContext;
|
2014-06-04 07:02:41 +02:00
|
|
|
|
|
|
|
class DataLoader
|
|
|
|
{
|
2014-06-04 12:53:11 +02:00
|
|
|
WorkContext* _context;
|
2014-06-04 07:02:41 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2014-06-04 12:53:11 +02:00
|
|
|
DataLoader(WorkContext* context)
|
2014-06-04 07:02:41 +02:00
|
|
|
: _context(context) {}
|
|
|
|
|
|
|
|
virtual ~DataLoader() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief getContext
|
|
|
|
* @return The loading context for this Loader
|
|
|
|
*/
|
2014-06-04 12:53:11 +02:00
|
|
|
WorkContext* getContext() const { return _context; }
|
2014-06-04 07:02:41 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief load the data contained in a set of bytes
|
|
|
|
* @param data The bytes from which to load data.
|
|
|
|
* @param size The number of bytes.
|
|
|
|
* @return true if the data was valid and loaded, false otherwise.
|
|
|
|
*/
|
|
|
|
virtual bool load( const char* data, size_t size ) = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief create perform any after-load activitiy that is required.
|
|
|
|
*/
|
|
|
|
virtual void create() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|