Open source solution
eProsima Dynamic Fast Buffers is an open source high-performance serialization library using a different approach to the traditional serialization frameworks.
In traditional serialization frameworks, such as eProsima Fast Buffers, Google Protocol Buffers or the ones embedded in products such as Apache Thrift, the user should define the Data Types to serialize in an IDL file, and later parse this file with an IDL compiler to generate the serialization code to add it to the application source files and finally compile.
In the case of eProsima Dynamic Fast Buffers the Data types are defined through a friendly API directly in your application code, and the serialization support is generated at runtime. The framework generates a (de)serialization "bytecode" very efficient and just adds around a 20% of performance overhead compared to the traditional option.
There are several cases you need this behavior:
- You want to use your existing application Data Types: Imagine you have already a working application you want to make distributed with already existing Data Types, the traditional serialization frameworks will force you to create an IDL and use the generated Data Types. eProsima Dynamic Fast Buffers allows you to use your own Data Types, saving the hassle of copying to a set of generated data types back and forth.
- The Data Type Structure is not known a priori, such as user defined data, dynamic discovery of the structure (data base managers, remote self-describing services...), serialization of an object through reflection, etc.
- You don't want to maintain a set of IDL files, for simplicity.
Main Advantages:
|
Available Documentation:
Videos | Performance Benchmarks | Manuals |
Thrift vs Protocol Buffers vs Fast Buffers
|
A quick example
Let’s use this example structure:
// Structure declaration struct Account { std::string owner_name; // Account owner's name float balance; // Total money }; // Data initialization Account acc; acc.owner_name = “Owner Name”; acc.balance = 0.0;
To serialize we have just to create the buffer we will use:
// CDR serializer eprosima::fastcdr::FastBuffer cdrBuffer; // Serialization buffer eprosima::fastcdr::FastCDR cdr(cdrBuffer); // Serialization object
And create a description of our structure, what we call Typecode
// Typecode creation using namespace DynamicFastBuffers; Typecode *tc = TypecodeAPI::createStruct( TypecodeAPI::createString(), TypecodeAPI::createFloat(), NULL );
Now, we should create the serialization support. The library will create a highly efficient serialization “bytecode”:
// Bytecode creation Bytecode *bc = BytecodeAPI::generateBytecode(tc, SERIALIZE);
Finally, we serialize the data:
// Data serialization SerializerAPI::serialize((void*) &acc, bc, &cdr);
More Information about eProsima Dynamic Fast Buffers:
For any questions please contact