如何在遗留代码中摆脱对 RogueWave 的使用?
我的任务是从遗留的 C++ 代码库中删除 RogueWave 组件。为此,我尝试围绕现有组件构建包装器,确保代码功能相同,然后选择不同的库(例如 boost)来粘贴到包装器中。
我遇到的问题之一是大部分代码库都需要指向 RogueWave 对象的指针。我可以创建一个指向原始 RogueWave 对象的虚拟包装对象类,但我无法弄清楚如何正确包装该 RW 对象的各个部分,例如当代码需要指向原始对象的可修改指针时的迭代器项。
对于替代方法有什么建议或建议吗? (注:我对 C++ 有点生疏)
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++)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
适配器模式
桥接模式
如果这些不起作用:
外观模式< /a>
Adapter Pattern
Bridge Pattern
If those do not work out:
Facade Pattern
大约 10 年前我有过类似的任务,结果我们使用 Roguewave 做的大部分事情都是 C++ 标准的一部分。在大多数情况下,有一个直接的 C++ 标准数据结构能够取代 Roguewave 的使用。
如果您无法直接替换并且可能使用另一个第 3 方库或您自己的库,那么 JustBoo 提到的模式将是理想的选择。
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.