Available C++ Libraries FAQ

Libraries available to download (D-L)

DynaMix - A New Take on Polymorphism in C++

DynaMix [ˈdainəˌmiks] (Dynamic Mixins) is a library that allows composition and modification of polymorphic types at run time.

The library is a means to create a project's architecture rather than achieve its purpose. It focuses on maximum performance and minimal memory overhead.

DynaMix is great for the software architecture of systems with very complex objects including, but not limited to:

  • Games (especially role-playing ones or strategies)
  • CAD systems
  • Enterprise systems
  • UI libraries

The library uses the type dynamix::object as a placeholder, whose instances can be extended with existing classes (mixins), thus providing a particular instance with the functionality of all those types. Accessing the newly formed type's interface is made through messages – stand-alone functions generated by the library, which can be thought of as methods.

Here is a small example of what your code may look like if you use the library:

    // assuming my_objects.get_ally(0); is a way to get an ally to the
    // main character in a game

    dynamix::object& obj = my_objects.get_ally(0);

    // now let's make the object think some positive thoughts about the
    // main character

    think(obj); // C++ doesn't allow us to have obj.think()
                // DynaMix's messages are standalone functions

    // type composition
    dynamix::mutate(obj)
        .add();

    // object can now respond to fly()

    fly(obj); // ...instead of obj.fly()

    // type mutation
    dynamix::mutate(obj)
        .remove()
        .add();

    think(obj); // the same object now thinks negative thoughts about the main
                // character, since it's no longer an ally, but an enemy

Key features of the library:

  • Compose types from mixins at run time
  • Physically separate interface and implementation
  • Fast polymorphic calls – comparable to std::function
  • No external dependencies other than the standard library
  • Non-intrusive mixins don't need to have a common parent or any special code inside
  • Mutate "live" objects by changing their composition at run time
  • Have multicast messages, which are handled by many mixins within an object
  • Possibility to have custom allocators to finely tune the memory and aim for cache-locality for critical parts of the code
  • Ability to have dynamic libraries that can enrich or modify objects, without modifying, or even rebuilding, the executable
  • Thread safe message calls – as thread safe as the underlying methods.

Operating Systems

  • Linux
  • PC 32-bit Windows
  • Unix
  • PC Windows

Compilers

  • Visual C++
  • GCC
  • Any Unix C++ compiler
  • Any standard C++ compiler

Added : 2017-03-10 Amended: 2017-03-10 Licensing : MIT

Add a comment
Our ads
Buy gold
Beat the credit crunch - buy gold online - quickly, safely and at low prices
www.bullionvault.com
Google
Trumphurst Home Page
C++ Usenet Newsgroup
A Web form for submissions to this list
Contact the author for permission to distribute

Copyright (c) 2024 Nikki Locke, Trumphurst Ltd.
Permission is granted to distribute over the Internet without charge. The author's permission is required (and usually given) to distribute in any other way, including on CD.