473,503 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[Fwd: perl AUTOLOADER vs c++]



-------- Original Message --------
Subject: perl AUTOLOADER vs c++
Date: Fri, 15 Oct 2004 13:28:18 -0500
From: Billy N. Patton <b-******@ti.com>
Organization: Texas Instruments
Newsgroups: alt.comp.lang.learn.c-c++

Assume I have a perl class/module called Ui.

The need for this is to have ALL io the exact same.

If I need a new switch my command line parser will just add it to the
hash of the blessed class. I don't have to export the method to get to
the data I can simple call the class with the proper name and the
autoload will take care of the rest, With a little coding in the auto
loader.
Ex:
if I pass in -abc some_value.
the command line parser will set in my hash 'abc' => 'some_value'

With out the autoloader I have no access unless I've exported the hash
But with the autoloader I can do
$val = $ui->abc();
I've created a Ui class in C++. All the variables are declared as
static. I only want one copy of each variable.
Currently, I'm having to do a get and a set type method for each
variable in my private section.

Does c++ have something similar to perls autoloader?
THis would greatly increase the functionality of my Ui class.
Dynamic switches and methods :)

--
___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/
Texas Instruments ASIC Circuit Design Methodlogy Group
Dallas, Texas, 214-480-4455, b-******@ti.com

--
___ _ ____ ___ __ __
/ _ )(_) / /_ __ / _ \___ _/ /_/ /____ ___
/ _ / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/ \_,_/\__/\__/\___/_//_/
/___/
Texas Instruments ASIC Circuit Design Methodlogy Group
Dallas, Texas, 214-480-4455, b-******@ti.com
Jul 22 '05 #1
1 1599
"Billy N. Patton" <b-******@ti.com> wrote in message
news:ck**********@home.itg.ti.com...


-------- Original Message --------
Subject: perl AUTOLOADER vs c++
Date: Fri, 15 Oct 2004 13:28:18 -0500
From: Billy N. Patton <b-******@ti.com>
Organization: Texas Instruments
Newsgroups: alt.comp.lang.learn.c-c++

Assume I have a perl class/module called Ui.

The need for this is to have ALL io the exact same.

If I need a new switch my command line parser will just add it to the
hash of the blessed class. I don't have to export the method to get to
the data I can simple call the class with the proper name and the
autoload will take care of the rest, With a little coding in the auto
loader.
Ex:
if I pass in -abc some_value.
the command line parser will set in my hash 'abc' => 'some_value'

With out the autoloader I have no access unless I've exported the hash
But with the autoloader I can do
$val = $ui->abc();
I've created a Ui class in C++. All the variables are declared as
static. I only want one copy of each variable.
Currently, I'm having to do a get and a set type method for each
variable in my private section.

Does c++ have something similar to perls autoloader?
THis would greatly increase the functionality of my Ui class.
Dynamic switches and methods :)


Perl and C++ are very different languages. C++ doesn't have Perl's AUTOLOAD
feature or AutoLoader module (which presumably depends on the AUTOLOAD
feature). Functions must be declared before they are used, and you can't
depend on a "magic" function "finding" the function's definition for you at
runtime (at least, not on any implementation I've ever seen). I see a few
options. You can either write getters/setters by hand, make the data
members public (blech), or instead use an associative container like a
std::map<std::string,SomeType> to map a string key to its value. Then you
could just write

SomeType GetSomeType( const std::string& key ) {
// may want to throw an exception if key is not in map
return container[key];
}

I'd probably just write the getter and setter for each member unless there
are a lot of members, in which case I might consider using the associative
container.

--
David Hilsee
Jul 22 '05 #2

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

Similar topics

8
6617
by: Ralph Freshour | last post by:
Is it possible to inhibit the browser Back/Fwd buttons via PHP? Thanks...
0
2024
by: MrTulley | last post by:
UDB V8 FP4 AIX 5.1 I am receiving the following error message while using the autoloader to load a pipe delimited file into a partitioned table: SQL3004N The filetype parameter is not valid....
0
9734
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
13
6194
by: James | last post by:
Hello, I'm a newbie to Python & wondering someone can help me with this... I have this code: -------------------------- #! /usr/bin/python import sys
0
1359
by: rrp83 | last post by:
Hi All Can anyone fwd me the code for converting a string to bytes similar to the GetBytes function in C# and viceversa?? Regards, RRP83
0
1876
by: 2Barter.net | last post by:
Fwd: A Blessing found for Daytona Beach Florida Hello This is Craig Oral Somerford and I've been using Gmail and thought you might like to try it out. Here's an invitation to create an...
21
34322
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
1
1850
by: jake77.lucas | last post by:
I'm using 2005.Net C++ compiler. I have a base class in namespace A (call it Class1). I derive another class from it, (call it Class2) defined in namespace B. This derived class contains as a...
1
2271
by: pitjpz | last post by:
We have moved our Database to another server. The server it was on used SQL 4 and the new one its on now uses SQL5 the only problem we can find is that when you attempt to delete a record from...
0
7204
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,...
0
7091
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
7282
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,...
0
7342
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...
1
6998
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...
0
7464
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...
0
5586
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5018
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...
0
3162
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.