Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Draft of IO streams and (De)serializers
- Loading branch information
Showing
8 changed files
with
170 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** This software is distributed under BSD 3-clause license (see LICENSE file). | ||
* | ||
* Authors: Sergey Lisitsyn | ||
*/ | ||
|
||
#include <shogun/io/serialization/Deserializer.h> | ||
|
||
using namespace shogun; | ||
|
||
CDeserializer::CDeserializer() : m_stream(nullptr) | ||
{ | ||
} | ||
|
||
CDeserializer::~CDeserializer() | ||
{ | ||
} | ||
|
||
void CDeserializer::attach(Some<CInputStream> stream) | ||
{ | ||
m_stream = stream; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** This software is distributed under BSD 3-clause license (see LICENSE file). | ||
* | ||
* Authors: Sergey Lisitsyn | ||
*/ | ||
#ifndef __DESERIALIZER_H__ | ||
#define __DESERIALIZER_H__ | ||
|
||
#include <shogun/base/SGObject.h> | ||
#include <shogun/io/stream/InputStream.h> | ||
|
||
namespace shogun | ||
{ | ||
class CDeserializer : public CSGObject | ||
{ | ||
public: | ||
CDeserializer(); | ||
virtual ~CDeserializer(); | ||
virtual void attach(Some<CInputStream> stream) = 0; | ||
virtual Some<CSGObject> read() = 0; | ||
|
||
private: | ||
Some<CInputStream> m_stream; | ||
}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** This software is distributed under BSD 3-clause license (see LICENSE file). | ||
* | ||
* Authors: Sergey Lisitsyn | ||
*/ | ||
|
||
#include <shogun/io/serialization/Serializer.h> | ||
|
||
using namespace shogun; | ||
|
||
CSerializer::CSerializer() : m_stream(nullptr) | ||
{ | ||
} | ||
|
||
CSerializer::~CSerializer() | ||
{ | ||
} | ||
|
||
void CSerializer::attach(Some<COutputStream> stream) | ||
{ | ||
m_stream = stream; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** This software is distributed under BSD 3-clause license (see LICENSE file). | ||
* | ||
* Authors: Sergey Lisitsyn | ||
*/ | ||
#ifndef __SERIALIZER_H__ | ||
#define __SERIALIZER_H__ | ||
|
||
#include <shogun/base/SGObject.h> | ||
#include <shogun/io/stream/OutputStream.h> | ||
|
||
namespace shogun | ||
{ | ||
class CSerializer : public CSGObject | ||
{ | ||
public: | ||
CSerializer(); | ||
virtual ~CSerializer(); | ||
virtual void attach(Some<COutputStream> stream); | ||
virtual void write(Some<CSGObject> object) = 0; | ||
|
||
private: | ||
Some<COutputStream> m_stream; | ||
}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** This software is distributed under BSD 3-clause license (see LICENSE file). | ||
* | ||
* Authors: Sergey Lisitsyn | ||
*/ | ||
|
||
#include <shogun/io/stream/InputStream.h> | ||
|
||
using namespace shogun; | ||
|
||
CInputStream::CInputStream() | ||
{ | ||
} | ||
|
||
CInputStream::~CInputStream() | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** This software is distributed under BSD 3-clause license (see LICENSE file). | ||
* | ||
* Authors: Sergey Lisitsyn | ||
*/ | ||
#ifndef __INPUT_STREAM_H__ | ||
#define __INPUT_STREAM_H__ | ||
|
||
#include <shogun/base/SGObject.h> | ||
|
||
namespace shogun | ||
{ | ||
class CInputStream : public CSGObject | ||
{ | ||
public: | ||
CInputStream(); | ||
virtual ~CInputStream(); | ||
|
||
virtual void read(void* buffer, size_t size) = 0; | ||
}; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** This software is distributed under BSD 3-clause license (see LICENSE file). | ||
* | ||
* Authors: Sergey Lisitsyn | ||
*/ | ||
|
||
#include <shogun/io/stream/OutputStream.h> | ||
|
||
using namespace shogun; | ||
|
||
COutputStream::COutputStream() | ||
{ | ||
} | ||
|
||
COutputStream::~COutputStream() | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** This software is distributed under BSD 3-clause license (see LICENSE file). | ||
* | ||
* Authors: Sergey Lisitsyn | ||
*/ | ||
#ifndef __OUTPUT_STREAM_H__ | ||
#define __OUTPUT_STREAM_H__ | ||
|
||
#include <shogun/base/SGObject.h> | ||
|
||
namespace shogun | ||
{ | ||
class COutputStream : public CSGObject | ||
{ | ||
public: | ||
COutputStream(); | ||
virtual ~COutputStream(); | ||
|
||
virtual void write(void* buffer, size_t size) = 0; | ||
}; | ||
} | ||
|
||
#endif |