473,779 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Doing run-time binding/introspection/reflection in C++ non-intrusively

Hi,

I'm in the process of building a complex system using a sort of "system
services" model. I'm looking at putting together various services like
serialization, networking, 2D/3D rendering, debugger-like class
inspection and other assorted stuff, but I need a way to bind them to
other people's C++ code at runtime using external scripting.

In particular I need a way to be able to access members of a class at
runtime by name, and I need the system to work in a non-intrusive way.
The classes being accessed are pre-existing (user code, toolkit
libraries...etc ) and I can't add any code to the classes being accessed
or force them to inherit from a common base. In other words, the
dictionary information and code that does the introspection needs to be
completely outboard of the classes being inspected.

I've been searching the net awhile and have found a number of systems
for doing this, but most are very intrusive or compiler-specific. Can
anyone put up some pointers to systems/approaches they think might fit
the bill?

It's ok if some manual work is needed to generate the dictionary of
class members, it doesn't have to be totally automatic.

Specifically, the sort of things I want to use this for are:

1. A service that can be given a pointer to an object, then pull member
values out of that object and display them in an auto-generated GUI.
2. A service that can be given a pointer to an object, pull specific
member values out of the object and send them over a network link to a
"mirror" version of the object on another computer.
3. A service that can be given a pointer to a class and
serialize/deserialize select members to disk/xml.
4. Allowing scripts to bind to values in running objects ie: allowing a
script to push values into a class (such as a script that puts the
appropriate color, model...etc into an instance of "Car") or a script
that creates bindings between classes (ie: something that says "every
1/60th of a second grab car1.SteeringWh eelPosition, convert it into a
rotation matrix and deposit it in rendererNode1.T ransformationMa trix")
5. Allowing a 2d/3d renderer to be given a pointer to an object, look
up information on its class and connect to specific members containing
details about the type of the object, position, orentation...et c so it
can be rendered.

The main goal is to allow users to write their classes independent of
any specific application framework, then use this introspection
information and scripts to sort of "wire up" the system at runtime
(connect classes to each other and to the system services).

Any help/suggestions would be appreciated!

Dec 14 '05 #1
2 2006
|| Specifically, the sort of things I want to use this for are:

Item 1, 3 and 5, intrigues me but all five of 'things' are quite
interesting to say the least.
I'm of no help but I'm curious to know what you find out.

|| Allowing scripts to bind to values in running objects ...
Very interesting..

Dec 14 '05 #2
<gr*********@gm ail.com> wrote in message
news:11******** *************@g 44g2000cwa.goog legroups.com...

I need a way to bind them to
other people's C++ code at runtime using external scripting.

In particular I need a way to be able to access members of a class at
runtime by name, and I need the system to work in a non-intrusive way.
The classes being accessed are pre-existing (user code, toolkit
libraries...etc ) and I can't add any code to the classes being accessed
or force them to inherit from a common base. In other words, the
dictionary information and code that does the introspection needs to be
completely outboard of the classes being inspected.

I've been searching the net awhile and have found a number of systems
for doing this, but most are very intrusive or compiler-specific. Can
anyone put up some pointers to systems/approaches they think might fit
the bill?


You fundamentally can't get information at runtime about structures
and types in C++. In essence, you have to get it from the source code.
This means you need to parse the source code and extract the
name and type information, and generate setters/getters for the
fields of interest.

This information can be extracted from the GNU compilers with
considerable effort, all you have to do is hack the source
code to extract what you want :-{ And, of course,
it is GNU specific.

We offer a full C++ front end with name/type
resolution (e.g., it determines everything a compiler's symbol table
has) and APIs to allow access to the parsed C++ source tree,
and all this name/type information, so that you could generate
the information you need. See
http://www.semanticdesigns.com/Produ...pFrontEnd.html.
Our front end handles ANSI, GNU, and all the Microsoft Dialects
of C++.
--
Ira D. Baxter, Ph.D., CTO 512-250-1018
Semantic Designs, Inc. www.semdesigns.com
Dec 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3781
by: Sean Shanny | last post by:
To all, The facts: PostgreSQL 7.4.0 running on BSD 5.1 on Dell 2650 with 4GB RAM, 5 SCSI drives in hardware RAID 0 configuration. Database size with indexes is currently 122GB. Schema for the table in question is at the end of this email. The DB has been vacuumed full and analyzed. Between 8 and 12 million records are added to the table in question each night. An analyze on the entire DB is done after the data has been loaded...
21
6017
by: Colleyville Alan | last post by:
I am now using the Execute command to run SQL for action queries. When I had them as saved queries, I would use DoCmd.SetWarnings False to allow the queries to overwrite existing tables. when I use this code: CurrentDb().Execute strMySql', dbFailOnError I still get warnings that the table already exists. Is there another command that I am supposed to use?
4
1296
by: Stefan Kowalski | last post by:
I recently posted a question which was answered by Allen Browne and gave me some tips to structure the tables. However, when it comes to searching the database, performance is unacceptably slow and I am now thinking of doing the unthinkable with my tables and wonder whether anyone has used (or still uses) this sort of approach. The database stores libraries and classifies the types of book they keep. So I have the classic 3-table...
2
1257
by: khan | last post by:
SELECT Products.Manufacturere, Products.ProductDescription, Products.SerialNumber, Products.QtyOnHand, Products.Location FROM Products WHERE (((Products.Manufacturere)=!!) AND ((Products.SerialNumber)=!!)); cboSerial and cboManufacturer are combobox on my frmProducts I want when user select values in both combo box then he should be able to run query in the base of both combo box vale. but its not doing any thing.
5
2410
by: Franco, Gustavo | last post by:
Hi, I have a question, and please I need a answer. How can I finalize a thread running with Application.Run (I need the message loop!!!) without call Thread.Abort?. I want to call Application.ExitThread in the same thread that it is running.
3
1141
by: M O J O | last post by:
Hi, I have a little test project. I spin up a thread, lets it sleep for a second and then the thread makes a button visible ... or at least should make it visible, which it doesn't do. --------------------------------------------------------------------------- Here's my thread class:
2
14652
by: UJ | last post by:
Is there a way with a asp:checkbox to run a JavaScript to display/hide text/input on the screen without doing a postback? I also need to be able to access the stuff at the server so I need to have run=server with it. TIA - Jeff.
33
2007
by: bonk | last post by:
I have an application that needs to perform some background work, i.e. Logging, wich must not block the main thread. How would I basically design such a scenario? It is obvious that I should do that on an extra thread but I think it is a bad idea to spawn a new thread everytime a log-message is written and let it die once the message was written. But how do I keep a thread alive and trigger the log-messages and pass the string to that...
9
1954
by: VB Programmer | last post by:
I am an ASP.NET (VB.NET) web developer, using MS Visual Studio. I'm thinking of switching over to MAC. I was wondering if anyone is using Visual Studio 2005 or 2008 beta in a XP or Vista environment on their Mac? If so, any wierd issues, or does it run smoothly (even with Mac OS running)? Also, is it really a TRUE Windows environment?
23
9389
by: Maarten | last post by:
Howdy, Recently I switched from a Windows PC to Mac OS-X 10.5 (php v5.2.6) and I have a little problem with one function within my cd-management script. For extracting a bit of info from my cd's I have an executable which I execute with exec(): $discOutput = exec('./discid /dev/rdisk2');
0
9636
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10306
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10139
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10075
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9931
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7485
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6727
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.