Verification Guild
A Community of Verification Professionals

 Create an AccountHome | Calendar | Downloads | FAQ | Links | Site Admin | Your Account  

Login
Nickname

Password

Security Code: Security Code
Type Security Code
BACKWARD

Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Modules
· Home
· Downloads
· FAQ
· Feedback
· Recommend Us
· Web Links
· Your Account

Advertising

Who's Online
There are currently, 36 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here

  
Verification Guild: Forums

 Forum FAQForum FAQ   SearchSearch   UsergroupsUsergroups   ProfileProfile  ProfileDigest    Log inLog in 

Vera tip: emulating class-level enumerals

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Verification Guild Forum Index -> Miscellaneous
View previous topic :: View next topic  
Author Message
Newsletter
Original Contribution


Joined: Dec 08, 2003
Posts: 1107

PostPosted: Fri Jan 21, 2000 12:00 am    Post subject: Vera tip: emulating class-level enumerals Reply with quote

(Originally from Issue 1.1, Item 4.0)

From: Janick Bergeron Send e-mail

In Vera, enumerals cannot be overloaded as in VHDL. This means that
if I use "RESET" in my enumerated type, you can't! Furthermode,
Vera predefines a bunch of them in the file
which cannot be used either (and they are popular ones that *I*
would like to use, e.g. "ALL", "ANY", etc...).

C++ as the concept of class-level enumerated type. e.g.:

class myClass {
enum {Symbol1, Symbol2, Symbol3};
}

As long as these enumerated types are in different classes, the
symbols used for the enumerals can be overloaded. Each symbols is
accessed using the syntax classname::enumaral (e.g.: myClass::Symbol2).

You can emulate the same thing using public static data members in Vera.
For example:

class myClass {
static integer ANY := 0;
static integer ALL := 1;

task myTask(integer arg = 0 /* ANY */);
}

Notice how I'm now able to use these symbols since they are in a different
scope than enumerals. Unfortunately, they can be accidentally changed
(there is no concept of a "constant" in Vera) and must be referenced
trough an object instance. That is why I cannot use "ANY" as the default
input value for the "arg" argument in myClass::myTask. Once I have
an instance, I can use the following:

myClass obj = new;

obj.myTask(obj.ANY);

Added to my wish-list for Vera:
- Class-level enumerals
- "const" objects
- class-level reference to static data members (e.g. classname::member)

Janick Bergeron
Qualis Design Corp.
Back to top
View user's profile
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Verification Guild Forum Index -> Miscellaneous All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Verification Guild © 2006 Janick Bergeron
Web site engine's code is Copyright © 2003 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.104 Seconds