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