Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 #define and singleton issue
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dreijer
Ketchup Master

62 Posts

Posted - Mar 14 2008 :  10:55:11 AM  Show Profile  Reply with Quote
I have implemented a singleton class which is accessed through a method named Instance(). For example:
SomeSingletonClass::Instance().DoSomething();

For convenience, I have written the following macro:
#define g_singletonClass SomeSingletonClass::Instance()

This allows me to access the singleton simply by writing:
g_singletonClass.DoSomething();

However, VA seems to be having some problems parsing the macro. At least it doesn't show a list box with methods once I type . after g_singletonClass. If I don't use the macro, everything works fine.

rhummer
Tomato Guru

USA
527 Posts

Posted - Mar 14 2008 :  11:54:26 AM  Show Profile  Reply with Quote
This has been brought up before.

Read this reply by support for info on this:

http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=4253

Tools Engineer - Raven Software
VS2005 SP2/VS2008 SP1 - VAX <LATEST> - Win 7 x64

Go to Top of Page

dreijer
Ketchup Master

62 Posts

Posted - Mar 14 2008 :  11:56:56 AM  Show Profile  Reply with Quote
Oh, I'm probably just blind then. Thanks
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19020 Posts

Posted - Mar 15 2008 :  12:00:51 PM  Show Profile  Reply with Quote
You could try editing VA's stdafx.h file, and adding:

#define g_singletonClass SomeSingletonClass::Instance()

I have not tried this here, so I am not sure if it will work or not, but it might.

Editing VA's "StdAfx.h" file is explained in this FAQ entry:

http://docs.wholetomato.com?W302

This file is used to help VA's parser with difficult code, and can be used to work around odd effects. After modifying this file you need to rebuild the VA symbol database for the changes to take effect:

VA Options -> Performance -> General -> Rebuild symbol databases

zen is the art of being at one with the two'ness
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Mar 22 2008 :  6:23:20 PM  Show Profile  Reply with Quote
When I want to force VAX to use a type I am using an ugly but working trick:

#define g_singletonClass dynamic_cast<cSingleton*, x>

Certainly you have to replace cSingleton with the type of your current class (the returning type of Instance())
Unfortunately you have to do it for all your singleton #define, but you don't use a lot of singletons, do you?
Go to Top of Page

dreijer
Ketchup Master

62 Posts

Posted - Mar 22 2008 :  6:29:38 PM  Show Profile  Reply with Quote
Thanks for the trick, accord. Unfortunately, I'm not interested in causing a run-time overhead by using RTTI just to make VA work. Then I'd rather just work around it

Thanks for the tip though!
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Mar 22 2008 :  6:41:46 PM  Show Profile  Reply with Quote
Sorry, I was ambiguous.
You should place this piece of code into VAX's own stdafx.h
This file is only parsed by VAX, and certainly you don't have to change your original #define.

Editing VA's "StdAfx.h" file is explained in this FAQ entry:

http://docs.wholetomato.com?W302

So, this won't affect your run-time performance, because the compiler do not see this file.

("x" is only used for valid syntax, VAX will not miss this symbol.)

Edited by - accord on Mar 22 2008 7:02:24 PM
Go to Top of Page

dreijer
Ketchup Master

62 Posts

Posted - Mar 23 2008 :  04:35:56 AM  Show Profile  Reply with Quote
Oh, much better then. Cheers!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000