jl2922 / hps Goto Github PK
View Code? Open in Web Editor NEWHigh Performance C++11 Serialization Library
License: MIT License
High Performance C++11 Serialization Library
License: MIT License
Code is compiling, but at run time, it crash with error:
terminate called after throwing an instance of "std::logic_error"
what(): Serializer not found for type 1A
(abort core dumped)
my testcase codes:
main.cpp
object.h
object.cpp
So, not sure it is an issue, it try to understand how i should use serialization from hps fr inherited class, but maybe i failed to understand well.
I can deserialize int member of a structure from a char array, but not double member (equals to 0)
If I convert the char buffer to string and then use from_string, it works!
Hi,
I failed to debug my case:
1 __GI_raise raise.c 50 0x7f19d7c23ce1
2 __GI_abort abort.c 79 0x7f19d7c0d537
3 hps::StreamInputBuffer::load stream_input_buffer.h 82 0x56165194ebcd
4 hps::StreamInputBuffer::read stream_input_buffer.h 29 0x56165194e8f5
5 CatchChallenger::MapServer::parsehps::StreamInputBuffer MapServer.hpp 151 0x561651955195
6 hps::Serializer<CatchChallenger::MapServer, hps::StreamInputBuffer, void>::parse serializer.h 16 0x561651952a3b
7 hps::StreamInputBuffer::operator>>CatchChallenger::MapServer stream_input_buffer.h 47 0x561651950b1c
8 CatchChallenger::BaseServer::preload_the_data BaseServer.cpp 354 0x56165194bdd3
9 CatchChallenger::EpollServer::preload_the_data EpollServer.cpp 202 0x561651aabd9b
10 main main-epoll.cpp 729 0x561651ac3e94
Where oldpos: 524288, where file size is 589548
Linked source:
https://pastebin.com/k243ArLF
Cheers,
hi, i have initialized a unordered_map<int, unordered_map<int, string> > and i have inserted values into it. now from the examples given i can write it to a file using 'to_stream()' like this...
std::ofstream out_file("data.log", std::ofstream::binary); //lets say data.log is the filename
hps::to_stream(data, out_file);
Now how can reconstruct the map from this file stream ????
I would be really great if you could help me with this one.
Thanks
Hi again,
I'm searching how to implement class template Serializer for embed private/protected local variable from an ancestor class ?
If i have an abstract ancestor parent class of an other one who has private variables, i not find how to access these variable for serialize/parse.
Could you provide a little example of code for i can learn how to do that with hps please ?
(happy new year also)
From boost serialize example, i see it is possible to implement class objects (intrusive method) for archive private methods. So maybe there is a way in the same intrusive code methods with hps... but i actuallt failed by use friend class hps::Serializer then implement class inside other class...
hps::to_string()
method fails to serialize a struct with enum class
member as it complain no serialize
method found inside enum class.
Is there a way to serialize/deserialize structs with enum fields ?
Source tag: 8d14036
Left open as a reminder for myself, as well as anyone interested in working on it.
We are trying to serialize a class with your great library but clang++ compiler outputs following error messages,
In file included from ./hps/src/hps.h:6:
In file included from ./hps/src/basic_type/basic_type.h:4:
In file included from ./hps/src/basic_type/float_serializer.h:6:
./hps/src/serializer.h:14:49: error: no member named 'serialize' in 'std::variant<std::vector<std::byte, std::allocator<std::byte> >, std::__cxx11::basic_string<char> >'
static void serialize(const T& t, B& buf) { t.serialize(buf); }
~ ^
./hps/src/buffer/string_output_buffer.h:46:40: note: in instantiation of member function 'hps::Serializer<std::variant<std::vector<std::byte, std::allocator<std::byte> >, std::__cxx11::basic_string<char> >, hps::StringOutputBuffer, void>::serialize' requested here
Serializer<T, StringOutputBuffer>::serialize(t, *this);
^
Here is the class,
class message
{
public:
std::string id;
int status;
std::variant<std::vector<std::byte>, std::string> body;
template <class B>
void serialize(B &buf) const
{
buf << id << status << body;
}
template <class B>
void parse(B &buf)
{
buf >> id >> status >> body;
}
};
Thanks for the hard work on building such a good library, but GPL3 makes it difficult to work with (in cases of me, I've been in a search for header only serialization libs in C++, for my own game engine specifically which I don't want to open source yet). Is it possible to provide another license such as Apache/BSD/ZLIB etc?
I compile the example offered by this repo,and it runs right. But I found that the string/file is not readable, it is messy code, so I want to know if there is a way to as data in string/file readablely. thanks
Do you know if there is a project which aim to port hps, with a common binary specification, to js, java, or other language?
Hi,
https://github.com/alphaonex86/CatchChallenger/blob/master/server/base/BaseServer.cpp#L296
Give me 65536, HPS bug? how debug?
Cheers,
Hi. it is ok
Hi, im currently working in a project in which im using your library.
Im facing some difficulty in serializing a class with has a object pointer to another seperate class.
In this example (link) geeks for geeks code, how do i serialize using the hps library ??
is there any chance we can add support for python numpy array (which is actually implemented in c)? or any hints on how to do that would be much appreciated,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.