一堂课的设计建议 [英] design suggestions for a class

查看:95
本文介绍了一堂课的设计建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的项目中,我们有一个表,其中包含有关A,B,C的信息(例如,假设),它们每个都与一个地址相关联.这些地址与正确的地址不一致.我需要从表中获取正确的地址并在第一个表中进行更新.数据确实非常庞大,将近600万.计划是编写一个c ++代码,该代码每天晚上更新20000条记录.需要以优化和面向对象的方式进行.

需要设计一个可以保存地址并具有可以更新数据的功能的类.类和函数必须非常通用.
以前从未设计过课程.

随时获得帮助将不胜感激.

Hi,

In my project we have a table which is having information of regarding A , B ,C (for example assume) each of them is associated with a address. Those address are not in syn with right address. I need to get right address from table and update in first table. Data is really huge nearly 6 million. Plan is to write a c++ code which update 20000 record daily at night. Need to do it in optimize and object oriented way.

Need to design a class which can hold address and having function which can update data. Class and function need to be very generic.
Never design a class previously.

Any time of help will be appreciated.

推荐答案

在没有更多有关如何存储数据的信息的情况下,很难给出如何做的想法. br/>
通常,您可以设计一个类来逐表匹配表中的一行.添加一个比较函数,如果地址匹配或您要加入的任何对象,则返回true.

然后创建另一个可以读取和写入所需格式的数据的类. (这是文件还是其他存储空间?)

其余的工作将很简单.如果需要优化的代码,则应查看哈希表或映射以存储类的实例.此外,如果将数据存储在文件中,则可能需要查看内存映射的文件.
It''s really hard to give an idea of what to do without more information on how the data is stored.

In general you could design a class to match a row in the table, field by field. Add a comparison function which returns true if the addresses match, or whatever you want to join on.

Then create another class that can read and write data to the desired format. (Is that a file or some other storage?)

The rest will be rather straight-forward to make work. If you need optimized code, you should look into a hash table or map to store your instances of the class in. Also, if you have the data stored in a file, you might want to look into memory mapped files.


这篇关于一堂课的设计建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆