🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
What is a Wrapper?
I keep on hearing high level programmers refer to wrappers in their programs... What are they? And how do they benefit your code?
Thanks
-Cecil
A Wrapper is simply a technique of encapsulating a lot of code into a class which can be easily used afterwards with a few of the class'' functions... the benefit is that your code is easily maintainable and it looks neater... Many people create wrappers for DirectX since it''s a real mess to work with all those functions/constants and naming convention and so on...
so a wrapper for DX would be something like this..
then you can create some smaller class into CDirectX which would separate DirectDraw from DirectInput and so on.. you get the idea...
..-=ViKtOr=-..
so a wrapper for DX would be something like this..
class CDirectX{ CDirectX(){}; ~CDirectX(){}; public: // usually functions which operate on the private variables or just execute general code.. private: // all the variables that you dont want to be accessible by others};
then you can create some smaller class into CDirectX which would separate DirectDraw from DirectInput and so on.. you get the idea...
..-=ViKtOr=-..
A wrapper doesn''t have to be in a class. It might as well be a set of "normal" C-style functions.
- Muzzafarath
Mad House Software
The Field Marshals
- Muzzafarath
Mad House Software
The Field Marshals
Maybe unrelated to to your question, a wrapper can also refer to a program written to encapsulate another and serve as a sort of "layer" between it and the output/input..
A wonderful example of this was when nVidia was releasing wrappers for Glide allowing you to Glide accelerate your games on a nVidia card..
cheers,
bosco()
A wonderful example of this was when nVidia was releasing wrappers for Glide allowing you to Glide accelerate your games on a nVidia card..
cheers,
bosco()
quote:
I keep on hearing high level programmers refer to wrappers in their programs ... What are they? And how do they benefit your code?
even though C is a high level language it's not an OO langy and is not all that high anyways... it's closer to ASM... and we're talking about IN PROGRAMS wrappers...
considering that C is not OO, putting all the code into functions wouldn't make it a wrapper (well not exactly)... it would be modularity then, which is refered to putting all the functions that are part of the same device system into a single module... even though you can CALL IT a wrapper, it's not.. my own opinion.. at least i wouldn't call that a wrapper... where as encapsulating everything into classes would be more acceptable to be called a wrapper...
bosco, yes, there are programs that encapsulate other programs (usually DOS/COnsole type proggys)... just like most OO compilers do... but i think you are talking about plug-ins?!?!?!
anyways...
Edited by - Gladiator on July 6, 2000 3:11:42 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement