The ByteMapper library offers a powerful toolset for developers working with Protobuf data structures, enabling the generation of metadata from .proto files. This capability allows users to craft custom Protobuf parsers tailored for specific optimization goals, unlocking new levels of efficiency and performance in data handling and processing.
-
Metadata Generation: ByteMapper reads .proto files and extracts the data structure, transforming it into rich metadata. This metadata serves as the foundation upon which users can build specialized parsers, offering a pathway to optimizations that are not readily achievable with generic parsing solutions.
-
Custom Parser Development: Armed with the generated metadata, developers have the flexibility to design and implement Protobuf parsers that are optimized for their specific use cases. Whether the focus is on reducing memory usage, increasing parsing speed, or enhancing data validation, ByteMapper provides the necessary groundwork.
-
C++ Source File Generation: As an additional feature (currently in development), ByteMapper aims to provide simple C++ source file generation. This will further ease the process of integrating optimized Protobuf parsing into existing C++ projects, bridging the gap between Protobuf schemas and performant, type-safe code.
-
High-Performance Applications: Ideal for scenarios where processing speed and efficiency are paramount, such as in high-frequency trading platforms, real-time data analytics, and game development.
-
Resource-Constrained Environments: Enables optimizations that reduce memory footprint and CPU usage, perfect for embedded systems, IoT devices, and mobile applications where resources are limited.
-
Custom Data Processing Pipelines: Facilitates the creation of bespoke data processing and validation pipelines that are finely tuned to the specific requirements of complex projects.
go get github.com/TedGillXD/ByteMapper
-
To generate metadata of protobuf data struct
compiler := Compiler.NewCompiler(sourceCode, Compiler.PROTOBUF) // The struct of protobufObj is defined in Compiler/Protobuf/dataStructure.go protobufObj := compiler.ParseProtobuf()
To cpp source file from metadata
generator := TargetGenerator.NewTargetGenerator(protobufObj) // get source and header in string source, header := generator.GetCppFile()
To change the template
// In TargetGenerator/Templates/cppTemplates.go const CppHeaderTemplate = `change the template to whatever you want!` const CppHeaderMessageTemplate = `change the template to whatever you want!` const CppHeaderEnumTemplate = `change the template to whatever you want!`
targetGenerator.go
will fill the template based on thoes three templates, the metadata will be provided by the structures shows below:type CppEnum struct { Name string EnumValues []CppEnumValue } type CppEnumValue struct { Name string Value string } type CppMessage struct { Name string NestedMessagesAndEnums []string MessageFields []CppMessageField } type CppMessageField struct { Name string Type string IsRepeatable bool } type CppHeader struct { HeaderGuard string Package string Includes []string MessagesAndEnums []string }
This program use
text/template
for parsing. So your template will work well if you follow the instruction of thetext/template
module.bytemapper's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.