Lightweight C + + plug-in framework-X3 C + + pluginframework

Source: Internet
Author: User

X3 C + + pluginframework code-named X3 C + + Lightweight Universal plug-in framework platform is a general-purpose C + + Lightweight plug-in system, not using MFC, ATL, COM. Can be compiled and run under Windows and Linux. Applications can be developed quickly based on the X3 plug-in framework, and plug-ins in the X3 plug-in framework can be used individually and flexibly. The X3 plugin framework has been validated for the actual use of more than 10 systems over a 3-year period.

Currently, the X3 plug-in framework includes plug-in kernel (plug-in foundation, plug-in Manager, observer Manager plug-in, log Manager plugin) and utility plug-in (XML read-write wrapper plug-in, database operation encapsulation Plug-in, file Operation utility plug-in, Text manipulation utility plug-in, localized string table plugin, etc.).

Windows/linux compiling the running environment
This plug-in mechanism adopts C + + implementation, using the RTTI mechanism of C + + and a few Windows API functions, not using MFC, ATL, STL, not using LIB file, external dependent files, not using VC + + special compilation instructions.

The compilation environment is

1. Visual C + + 6.0/2003/2005/2008/2010,windows

2. MinGW GCC + code::blocks (IDE), Windows

3. Linux GCC + code::blocks (IDE), Windows

4. Linux GCC + Makefile

The features of the X3 plugin framework are:

A) simple and flexible interface definition
The common C + + interface, which consists of pure virtual functions, does not require special base classes, does not require macros and UUID declarations, and can use the various variable types of C + +, not constrained by COM interfaces. For example, the following interface ix_ is defined:

Interface Ix_example
{
virtual void Foo () = 0;
Virtual void* GetData (std::vector& items) = 0;
};

b) interface and implementation separation
Interface files are provided externally, using classes within the plug-in to implement one or more interfaces, without the need to export the class or expose implementation details. There is also a benefit is that only the contract interface can be multiple modules in parallel development, the module does not exist between the compiler dependency (no other plug-in Lib and other files), which can be used to test-driven development mode.

c) Multi-interface conversion, reference counting management
Using smart pointer classes to manage the interface's reference count and lifetime can be dynamically converted from one interface to another interface. new Visual Cinema 6080(internal C + + RTTI mechanism dynamic conversion), you can distinguish between the interface reference inside the plug-in and the interface reference outside the plug-in.

d) Transparent module deployment
A module only needs to use the interfaces of other modules and does not need to be concerned about which plug-in is implemented in that interface. Each implementation class can be combined or split as needed to distribute it to different plug-ins, and the interface consumer is unaffected. In addition, which directory the plug-in deploys does not affect the use of plug-in interfaces.

e) modules can be replaced, extensible
Can replace a plug-in as needed, only the plug-in implements the same interface, even if the internal functions are not the same, so that the plug-in replaceable, on-demand combination. More functionality can be extended by supporting more interfaces in the new plug-in. Some interfaces or some functions of the original plug-in can be replaced locally in the new plugin for reuse and extension.

f) Thread safety
The internal implementation file provided by this plug-in mechanism takes into account the thread safety of the single cinema , allowing multi-threaded access without conflict, while using a lightweight locking mechanism (counting atomic locking), running overhead is minimal.

g) Cross-version
Allow different versions of VC + + development of the plug-in call each other's interface, although in practice generally do not need to do so. Because there is no VC + + special compiling instructions, it is easy to transplant to other development platforms.

Lightweight C + + plug-in framework-X3 C + + pluginframework

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.