How do I abstract away from using RogueWave in legacy code?

梦想的初衷 提交于 2019-12-12 13:28:13

问题


I have been tasked with removing RogueWave components from a legacy C++ codebase. To do so, I am attempting to build wrappers around the existing components, make sure that the code functions the same, and then choose a different library like boost to stick into the wrappers.

One of the problems I am coming against is that much of the codebase expects pointers to RogueWave objects. I can create a dummy Wrapper Object class that points to the original RogueWave object, but I cannot figure out how to correctly wrap pieces of that RW object, such as iterator items when the code expects a modifiable pointer into the original object.

Any suggestions, or advice for alternate approaches? (Note: I am a bit rusty on my C++)


回答1:


Adapter Pattern

Bridge Pattern

If those do not work out:

Facade Pattern




回答2:


I had a similar task about 10 years ago, it turned out most of the stuff we used Roguewave for was part of the standard in C++. In most instances there was a direct C++ standard data structure that was able to replace the Roguewave usage.

If you can't do a direct replacement and might use yet another 3rd party library or your own library, the patterns that JustBoo mentioned would be ideal.



来源:https://stackoverflow.com/questions/3523456/how-do-i-abstract-away-from-using-roguewave-in-legacy-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!