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

Home Posts Topics Members FAQ

wrappers?

84 New Member
I looked up the net and some books but I didn't find nowhere something just explaining what wrappers are, can anyone explain this or give a link?
The problem arises from this piece of code:

Expand|Select|Wrap|Line Numbers
  1. static void spline(double*, double*, const int, const double, const double, double*); //! Generates interpolating coefficients for subsequent interpolation with splint Nrecipes
  2.  static void spline(double* x, double* y, const int n, double *yp1, double* ypn, double* y2) { spline(x,y,n,*yp1,*ypn,y2); } //!< wrapper
  3.  
To me it just seems a double (non in C++, but in the usual english sense) declaration of the same function, once giving a name to the variables and once not.
By the way what is the difference between declaring a function with names of its variables and only with the type of variables?
Thank you very much in advance
Mar 22 '07 #1
7 1433
sicarie
4,677 Recognized Expert Moderator Specialist
I looked up the net and some books but I didn't find nowhere something just explaining what wrappers are, can anyone explain this or give a link?
The problem arises from this piece of code:

Expand|Select|Wrap|Line Numbers
  1. static void spline(double*, double*, const int, const double, const double, double*); //! Generates interpolating coefficients for subsequent interpolation with splint Nrecipes
  2.  static void spline(double* x, double* y, const int n, double *yp1, double* ypn, double* y2) { spline(x,y,n,*yp1,*ypn,y2); } //!< wrapper
  3.  
To me it just seems a double (non in C++, but in the usual english sense) declaration of the same function, once giving a name to the variables and once not.
By the way what is the difference between declaring a function with names of its variables and only with the type of variables?
Thank you very much in advance
This was returned with a google search of 'programming wrappers'. Does it help?

http://en.wikipedia.org/wiki/Wrapper
Mar 22 '07 #2
Banfa
9,065 Recognized Expert Moderator Expert
To me it just seems a double (non in C++, but in the usual english sense) declaration of the same function, once giving a name to the variables and once not.
No look more closely at the parameter types of the declaration and definition.
Mar 22 '07 #3
Roonie
99 New Member
yeah, it looks to me like you have a function prototype, and then the definition of that function . . . (or attempted definition - if you want to be recursively doing nothing forever) . . . right?
Mar 22 '07 #4
Banfa
9,065 Recognized Expert Moderator Expert
yeah, it looks to me like you have a function prototype, and then the definition of that function . . . (or attempted definition - if you want to be recursively doing nothing forever) . . . right?
Wrong, it's C++ (I assume) remember.
Mar 22 '07 #5
sanctus
84 New Member
Yes the link helps but I have to ponder it a bit further before being able to say I really understand it. And yes, it is C++.
Thanks
Mar 23 '07 #6
sanctus
84 New Member
Further in the program there are some lines which are good example how the programmer uses wrappers, that explained it completely to me.
Expand|Select|Wrap|Line Numbers
  1.  
  2. void set(const double, const double); //!< new data point (x,y) for a spline that
  3.  owns its xdata
  4.   void set(const double); //!< new data point (y) for a spline that shares the 
  5. xdata with mother and sisters
  6.   /*! Wrapper for set() that depending on wether
  7.     the spline owns the xdata or not, calls the
  8.     two possible set() functions */
  9.   void setForce(double x, double y ) {  
  10.     if (own) set(x,y); else set(y); 
  11.   }
  12.  
Mar 25 '07 #7
weaknessforcats
9,208 Recognized Expert Moderator Expert
A wrapper is a term given to a function that makes two incompatible functions compatible. For example, assume there is a requirement to manage an array of x-y data pairs:

struct Point
{
int x-value;
int y-value;
};

The function used might be:

void Change(Point* thePoint, Point* newValue);

In order to call this function you need the address of a Point variable with the new value.

A wrapper function can be used to avoid having the calling function create the Point variable with the new value:

void Change(Point* thePoint, int x, int y)
{
Point data;
data.x-value = x;
data.y-value = y;
Change(thePoint, &data);
}

Here you can see how the void Change(Point* thePoint, int x, int y)
"wraps-around" the void Change(Point* thePoint, Point* newValue) function.

What the user sees is:

Point array[5];
Change(&array[0], 4,6);

Wrappers often occur when the original function is third-party and cannot be easily revised for your requirements.

Check out the Adapter design pattern.
Mar 25 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
1784
by: Paul Rudin | last post by:
I'm having a problem with the python wrappers generated from a type library. The symptom is that I get failures to find connections points inside the wrappers when called from DispatchWithEvents...
18
3486
by: Adrian B. | last post by:
Does anyone know of a framework or library that will enable me to use publish/subscribe comms? I want to create a server (using Python) running on a Unix box that will accept client connections...
7
4521
by: Harlin Seritt | last post by:
I was looking at the Tcl/Tk sourceforge page and found that there were a couple of new widgets being produced for Tcl 8.5. Does anyone know if there are any Tkinter wrappers somewhere? thanks, ...
1
2934
by: Catherine Lynn Smith | last post by:
OK, I am looking for advice or tips and suggestions. I have overcome a lot of the obstructions I had to building the page design my customer was asking for. I am looking now at ways to deliver...
0
842
by: imm | last post by:
where to find them? my search couldn't go farther than this link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/perfmon/base/system_monitor_automation_interface.asp ...
2
1308
by: John Smith | last post by:
Hey folks, Is it possible to create Type Wrappers in C#? If so, how do you do it? For those not sure of what I mean, here's a quick link on Type Wrappers in Java:...
8
1372
by: mirek | last post by:
Hi, Is it safe to put my objects that are managed c++ wrappers to the session? I want to pass them from one page to the other in the session object but I noticed strange (maybe it is ok)...
1
6862
by: TC | last post by:
Every time I open my project, I get a warning which says "There are updated custom wrappers available for the following referenced components: Office." When I double-click on the warning, I get...
1
1900
by: pauldepstein | last post by:
Hi All, First, perhaps some would be kind enough to help me, once I state my approximate background I have written a moderately complex c++ program consisting of 11 files, all Bloodshed Dev. ...
0
1678
by: Justin Ezequiel | last post by:
Found a couple of papers that mention Python wrappers for UDT have been written but Google fails me. Do any of you know of such wrappers? Have downloaded UDT SDK but source is in C++. ...
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
7339
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...
0
7463
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
4678
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3157
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1515
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
738
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
389
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.