Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 536237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:48:02+00:00 2026-05-13T09:48:02+00:00

A C++ rules engine defines rules in XML where each rule boils down to

  • 0

A C++ rules engine defines rules in XML where each rule boils down to “if X, then Y” where X is a set of tests and Y a set of actions.
In C++ code, ‘functions’ usable in tests/actions are created as a class for each ‘function’, each having a “run(args)” method… each takes its own set of parameters.

This works fine.

But, a separate tool is wanted to save users hand-crafting XML; the rules engine is aimed at non-programmers. The tool needs to know all the ‘functions’ available, as well as their required input parameters. What’s the best way to consider doing this? I considered a couple of possibilities:

  1. A config file describes the ‘functions’ and their parameters, and is read by the tool. This is pretty easy, and the actual C++ code can use it to perform argument validation, but still the C++ and XML are not guaranteed to be in sync – a programmer could modify C++ and forget to update the XML leading to validation bugs
  2. Each ‘function’ class has methods which describe it. Somehow the tool loads the C++ classes… this would be easy in a language supporting reflection but messier in C++, probably you’d have to build a special DLL with all ‘functions’ or something. Which means extra overhead.

What makes sense given the nature of C++ specifically?

EDIT: is the title descriptive? I can’t think of a better one.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:48:03+00:00Added an answer on May 13, 2026 at 9:48 am

    There’s a 3rd way – IDL.

    Imagine you have a client-server app, and you have a code generator that produces wrapper classes that you can deploy on client and server so the user can write an app using the client API and the processing occurs on the server… this is a typical RPC scenario and is used in DCE-RPC, ONC-RPC, CORBA, COM and others.

    The trick here is to define the signatures of the methods the client can call, which is done in an Interface Definition Language. This doesn’t have to be difficult, but it is the source for the client/server API, you run it through a generator and it produces the C++ classes that you compile up for the client to use.

    In your case, it sounds like the XML is the IDL. so you can create a tool that takes the XML and produces the C++ headers describing the functions that your code exposes. You don’t really have to generate the cpp files (you could) but its easier to just generate the headers, so the programmer who adds a new function/parameter cannot forget to update the implementation – it just won’t compile once the headers have been re-generated.

    You can generate a header that is #included into the existing c++ headers if there is more there than just the function definitions.

    So – that’s my suggestion, #3: generate the definitions from your definitive XML signatures.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 376k
  • Answers 376k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer What are your key requirements? Does your input have to… May 14, 2026 at 8:33 pm
  • Editorial Team
    Editorial Team added an answer It cannot be done directly using lex. Lex is a… May 14, 2026 at 8:33 pm
  • Editorial Team
    Editorial Team added an answer I typically go with the first option there. Given your… May 14, 2026 at 8:33 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.