Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 #define and singleton issue

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
dreijer Posted - Mar 14 2008 : 10:55:11 AM
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.
7   L A T E S T    R E P L I E S    (Newest First)
dreijer Posted - Mar 23 2008 : 04:35:56 AM
Oh, much better then. Cheers!
accord Posted - Mar 22 2008 : 6:41:46 PM
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.)
dreijer Posted - Mar 22 2008 : 6:29:38 PM
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!
accord Posted - Mar 22 2008 : 6:23:20 PM
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?
feline Posted - Mar 15 2008 : 12:00:51 PM
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
dreijer Posted - Mar 14 2008 : 11:56:56 AM
Oh, I'm probably just blind then. Thanks
rhummer Posted - Mar 14 2008 : 11:54:26 AM
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

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000