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

  • SEARCH
  • Home
  • 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 4027776
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:08:20+00:00 2026-05-20T11:08:20+00:00

I have the following (simplified) architecture: client(s) –> bouncer –> server The clients send

  • 0

I have the following (simplified) architecture:

client(s) –> bouncer –> server

The clients send commands to the server. The ‘bouncer’ performs sanity and other checks on the commands issued by the client, and prevents faulty commands from reaching the server. For example, the bouncer may have the following code:

bool Bouncer::someCommand(const someCommandArg& arg) {
    if (arg.x < 100) {
        return false;                              
    }

    if (arg.y > 10) {
        return false;
    }
    // more checks ...

        return server->someCommand(arg);
}

The problem with this approach is that the bouncer conditions have to be hard-coded one by one, and is not flexible enough. I’m looking for a way to define these conditions in some configuration file, which the bouncer will load when created, and will loop through all the
conditions when someCommand is called. Moreover, the test loop itself has to be fast.

Were it C#, I guess I would have used its compile-on-the-fly capabilities, and have my if clauses written in plain code in the configuration file. What do you suggest for C++?

  • 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-20T11:08:21+00:00Added an answer on May 20, 2026 at 11:08 am

    Choices include:

    • create an interpretive environment, communicate the testable aspects of the incoming message to it, and load some predicate expression/function from your config to be evaluated
      • embed a language (e.g. LUA, ruby)
      • download any of many simpler expression evaluation libraries
      • create your own (perhaps using boost Spirit)
    • have the bouncer load the predicates in the form of a shared object (.so, .dll – whatever your OS calls them) using dlopen/dlsym etc..
      • only the predicates/rules need be recompiled
      • don’t need to distribute the entire app source to users wanting to specify predicates
      • pretty fast predicate execution

    What’s best depends a lot on the complexity of useful predicates, performance requirements, deployment practices etc..

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

Sidebar

Related Questions

I have following situation (simplified, of course): MyDomain.groovy: class MyDomain { MyAnotherDomain anotherDomain //
I have the following (simplified) public enum Level { Bronze, Silver, Gold } public
I have the following simplified XML: <?xml version="1.0" encoding="UTF-8" ?> <MATMAS05> <IDOC BEGIN="1"> <E1MARAM
I have the following (simplified) database tables: Products - ProductID, int, PK - Name,
I have the following simplified XML structure: <?xml version="1.0" encoding="UTF-8" ?> <INVOIC02> <IDOC BEGIN="1">
I have no control over database schema and have the following (simplified) table structure:
I have following data structure (simplified): A giant list of the class TestClass public
I have the following table (simplified): user_id date hours 1 2012-03-01 5 2 2012-03-01
Imagine I have the following code (simplified regarding my real context of course): <div
Lets say we have the following models: (simplified) class Collection(models.Model): slug = models.SlugField() class

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.