Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F5333323
expressionserializer.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Nov 21, 3:58 AM
Size
1 KB
Mime Type
text/x-c++
Expires
Mon, Nov 23, 3:58 AM (1 d, 12 h)
Engine
blob
Format
Raw Data
Handle
315899
Attached To
rXR Xreate
expressionserializer.h
View Options
/*
* expressionserializer.h
*
* Created on: Jan 4, 2016
* Author: pgess
*/
#ifndef SRC_EXPRESSIONSERIALIZER_H_
#define SRC_EXPRESSIONSERIALIZER_H_
#include "ast.h"
#include <string>
#include <boost/optional.hpp>
namespace xreate {
struct PackedExpression{
PackedExpression(){};
PackedExpression(PackedExpression&& other);
~PackedExpression();
void operator<< (const std::pair<size_t, size_t>& value);
char* operator*(){return __storage;}
bool operator==(const PackedExpression& other) const;
bool operator!=(const PackedExpression& other) const;
bool operator<(const PackedExpression& other) const;
private:
PackedExpression (const PackedExpression&)=delete;
PackedExpression& operator=(const PackedExpression&)=delete;
PackedExpression& operator=(PackedExpression&&)=delete;
char* __storage = nullptr;
size_t size =0;
unsigned char countRemainedBits =0;
};
typedef boost::optional<PackedExpression> OptionalPackedExpression;
class ExpressionSerializerPrivate;
class ExpressionSerializer {
public:
ExpressionSerializer();
~ExpressionSerializer();
ExpressionSerializer(ExpressionSerializer&& other)
: strategy(other.strategy), registry(std::move(other.registry)) {}
void registerExpression(const Expression&e);
PackedExpression pack(const Expression& e);
OptionalPackedExpression packOptional(const Expression& e) const;
private:
ExpressionSerializerPrivate* strategy;
std::map<PackedExpression, size_t> registry;
};
} /* namespace xreate */
#endif /* SRC_EXPRESSIONSERIALIZER_H_ */
Event Timeline
Log In to Comment