Binary Library Variant Type Any-Data Parameter Support
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing binary libraries in C and C++ template technology can only accept a single type of data parameter, limiting their functionality and intellectual property protection, as they cannot accept any type of data parameters like source code.
Innovation Solution
A method is developed to generate a binary library that supports parameters of any type by instantiating source code modules of function templates or class templates into a Variant type without modifying the source code, and exporting this Variant type as a binary library.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Adaptability or versatility
If source code is shared to maintain template functionality with any type parameters, then the binary library can accept any type of data parameters, but the intellectual property rights are lost
Solution Approach 1:
The patent introduces a Variant type as an intermediary layer between the binary library and users. The Variant type acts as a universal container that can represent any data type through type tags and union structures. Users interact with the Variant type instead of direct type parameters, allowing the binary library to maintain type flexibility while protecting its implementation details. This mediator enables any-type functionality without exposing source code.
Solution Approach 2:
The patent transforms the traditional template parameter approach by changing the parameter type system. Instead of using generic type parameters T that require source code compilation, the patent uses a concrete Variant type with explicit type tags (int, float, string, etc.) and a union structure that can hold different data types. This parameter transformation allows the binary library to accept any type at runtime without requiring source code sharing.
2Loss of information
If a binary library is generated to protect intellectual property rights, then source code is hidden, but the library can only accept a single type of data parameter
Solution Approach 1:
The Variant type is designed as a universal data structure that can represent multiple data types (int, float, string, and user-defined classes) within a single binary library interface. The type tag system and union structure enable the same binary library to handle different data types without requiring separate compilations or source code exposure, achieving multi-functionality while protecting intellectual property.
3Loss of information
If traditional binary libraries are used to protect source code, then intellectual property is protected, but backward compatibility cannot be maintained when new data types are introduced
Solution Approach 1:
The Variant type introduces dynamic type handling through type tags and runtime type identification. The binary library can dynamically determine and handle the appropriate data type based on the type tag, allowing it to accommodate new user-defined classes without modification. This dynamic approach ensures backward compatibility while maintaining intellectual property protection, as the library adapts to new types through the existing Variant interface.
Data Source
AI summary
The present disclosure relates to a field of software technology, specifically relates to a method for generating a binary library with function templates or class templates that support parameters of any type. For the above purpose, this disclosure has designed the Variant class: having the capability to represent any type data and also supports new-defined class data. It supports various operations. For source code of function or class template, just instantiated it as Variant type, and the source code can generate a binary library that supports any data type without any modifications. The binary library supports any type data and also support new-defined classes without modification. When using the binary library, ordinary data is converted into Variant objects, then passed to the binary library. The results is equivalent to those obtained from using ordinary data directly. Conversion between ordinary data and Variant objects requires only a single assignment statement.


