473,386 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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.SteeringWheelPosition, convert it into a
rotation matrix and deposit it in rendererNode1.TransformationMatrix")
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...etc 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 1976
|| 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*********@gmail.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.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
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...
21
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...
4
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...
2
by: khan | last post by:
SELECT Products.Manufacturere, Products.ProductDescription, Products.SerialNumber, Products.QtyOnHand, Products.Location FROM Products WHERE (((Products.Manufacturere)=!!) AND...
5
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...
3
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. ...
2
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...
33
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...
9
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...
23
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...

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.