builds now. Implements serializable base class
This commit is contained in:
1 parent
1c5ffa1dde
commit
4089e7a3cc
3 files changed
+17
-9
No files matched your search
@@ -7,12 +7,16 @@ namespace DNS {
|
|||||||
|
|
||||||
|
|
||||||
Record::Record(const uint16_t id) : _id(id) {
|
Record::Record(const uint16_t id) : _id(id) {
|
||||||
_os = ostream(_sb);
|
_os = new ostream(&_sb);
|
||||||
_os << "NOT IMPLEMENTED";
|
*_os << "NOT IMPLEMENTED";
|
||||||
}
|
}
|
||||||
|
|
||||||
ostream& Record::operator>>(Serializable& record) {
|
Record::~Record() {
|
||||||
return _os;
|
delete _os;
|
||||||
|
}
|
||||||
|
|
||||||
|
ostream& Record::serialze() {
|
||||||
|
return *_os;
|
||||||
}
|
}
|
||||||
|
|
||||||
ARecord::ARecord() : Record(1) {}
|
ARecord::ARecord() : Record(1) {}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "Resource.hpp"
|
#include "Resource.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace Plains {
|
namespace Plains {
|
||||||
namespace Core {
|
namespace Core {
|
||||||
@@ -12,13 +13,15 @@ namespace DNS {
|
|||||||
using std::ostream;
|
using std::ostream;
|
||||||
using std::stringbuf;
|
using std::stringbuf;
|
||||||
|
|
||||||
|
|
||||||
// Provides an abstract class for dns records that may be stored in the database
|
// Provides an abstract class for dns records that may be stored in the database
|
||||||
class Record : public Resource
|
class Record : public Resource
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const uint16_t _id;
|
const uint16_t _id;
|
||||||
ostream& operator>>(Serializable& object);
|
ostream& serialze();
|
||||||
Record(const uint16_t id);
|
Record(const uint16_t id);
|
||||||
|
~Record();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
stringbuf _sb;
|
stringbuf _sb;
|
||||||
|
|||||||
@@ -2,19 +2,20 @@
|
|||||||
#define SERIALIZABLE_HPP
|
#define SERIALIZABLE_HPP
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace Plains {
|
namespace Plains {
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
|
|
||||||
using std::ostream;
|
using std::ostream;
|
||||||
|
using std::shared_ptr;
|
||||||
class Serializable {
|
class Serializable {
|
||||||
public:
|
public:
|
||||||
// Serialize
|
// Serialize
|
||||||
virtual ostream& operator>>(Serializable& object);
|
virtual ostream& serialze() = 0;
|
||||||
// Deserialize
|
// Deserialize
|
||||||
//virtual Serializable& operator<<(ostream& os);
|
template <typename objT> static shared_ptr<objT> deserialize(ostream& os);
|
||||||
};
|
};
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in new issue
Block a user