几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-05-06, 09:55 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】performance issue

performance issue
performance issue
hi,
iam using dwgdirect libraries to read dwg/dxf files for use in my application.
iam using exhostappservices :readfile wrapper class which first looks if the
dwg file exists in the dwgcollection defined in exhostappservices. if the
lookup fails then we read the dwg file through oddbhostappservices:
readfile method. i followed the same way to read a file as provided in the
example applications. the issue here is that when i read the file for the
first time everything is fine. but the lookup method fails to return even if we
pass the same filename. it has to return the database poionter as the file
is already once. but somehow the dwgcollection is getting destroyed.
this is a problem with smart pointer i suppose as it releazes the previous
object. so tried to use a normal ponter.
oddbdatabase* pdb = gvcs.readfile(........).get();
-> this readfile return a smart ptr.
but when tried to get model space id over this pdb it is crashing.
this is causing a performance problem if i need to read multiple dwg files.
because even if all the dwg files are read then when i need to call gvcs.readfile() again for all these, the lookup method is failing.
please do suggest sme solution ..
thanx in adv
aparna
can you show the code of your dwg cache?
vladimir
re:
oddbdatabaseptr exhostappservices::readfile(const odchar* filename,
bool ballowcpconversion, bool bpartial, oda::filesharemode shmode, const odpassword& password)
{
oddbdatabaseptr pres = m_dwgcollection.lookup(filename);
if(pres.isnull())
{
pres = oddbhostappservices::readfile(filename, ballowcpconversion, bpartial, shmode, password);
m_dwgcollection.add(pres.get());
}
return pres;
}
and this is the lookup method as given in example problem
oddbdatabase* exhostappservices:wgcollection::lookup(const odstring& keyfilename)
{
std::map<odstring, oddbdatabase*>::iterator iter = m_loadeddwgs.find(keyfilename);
if(iter!=m_loadeddwgs.end())
{
return iter->second;
}
return 0;
}
i am calling m_pmapdb = g_svcs.readfile( lpctstr(filename),
false, // ballowcpconversion
false, // bpartial
oda::ksharedenyno);
method from several places of the code.
g_vcs is defined in the code as
static odrxobjectimpl<myservices> g_svcs;
since m_pmapdb is a smart pointer it is destroying the dwgcollection.
so i tried to use a normal pointer instead of
oddbdatabase* pmapdb = g_svcs.readfile( lpctstr(filename),
false, // ballowcpconversion
false, // bpartial
oda::ksharedenyno).get();
and then if i call pmapdb->getmodelspaceid().safeopenobject()
it is crashing.
please let me know a solution for this.
thanks,
aparna
what is m_dwgcollection?
what is m_pmapdb?
as i understand, you used the code from some example? from which dd version?
anyway, m_dwgcollection should be some kind of
map: odstring->oddbdatabaseptr
in that case i don't understand why it's contents are unexpectedly destroyed. they should be explicitly destroyed at application exit, before oduninitialize().
vladimir
re:
iam using dwgdirect version 1.11. yeah you are right. dwgcollection is a map: string, oddbdatabaseptr .and this is defined in the class declaration of exhostappservices
last edited by aparna; 16th july 2007 at 07:51 amfff">.
i looked at the 1.11 exhostappservices
dwgcollection there is designed to skip opening drawing second time, but it does not keep the drawings. drawings are stored by application.
you may redesign the cache, to store smart pointers (in the example it stores raw pointers), but you will be responsible for the actual release of them, at the end of the application.
vladimir
iam not clear with what you suggested. please let me know in detail.
dwgcollection will hold the file names i suppose. but how we can store
a smart pointer.
last edited by aparna; 16th july 2007 at 09:14 pmfff">.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】odamfcapp build issue yang686526 DirectDWG 0 2009-05-06 06:56 PM
【转帖】macwindows issue yang686526 DirectDWG 0 2009-05-06 05:24 PM
【转帖】issue with huge font size yang686526 DirectDWG 0 2009-05-06 04:24 PM
【转帖】explode or explodegeometry issue with 3dsolids and bodys yang686526 DirectDWG 0 2009-05-05 10:08 AM
【转帖】circle and arc rendering issue yang686526 DirectDWG 0 2009-05-04 05:46 PM


所有的时间均为北京时间。 现在的时间是 10:24 PM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多