Commit 5ff20a88 authored by Claes Sjofors's avatar Claes Sjofors

Bugfix in loading wbload file with objects containing object attributes

parent fb001fc8
......@@ -135,3 +135,4 @@
090518 cs wb Advanced user set as default in wb.
090630 cs wb Directory database changed from BerkeleyDb to wb_load format.
090701 cs plc Env variable PWR_EXT_INC added to plc compile command. Replaces pwrp_cmn.
090803 cs wb Bugfix in loading wbload file with objects containing object attributes.
\ No newline at end of file
......@@ -37,12 +37,12 @@ wb_bdrep *wb_bdrep::ref()
return this;
}
wb_bdrep::wb_bdrep(wb_orep& o) : m_nRef(0), m_orep(&o), m_sts(LDH__SUCCESS)
wb_bdrep::wb_bdrep(wb_orep& o) : m_nRef(0), m_orep(&o), m_sts(LDH__SUCCESS), m_merep(0)
{
m_orep->ref();
}
wb_bdrep::wb_bdrep( wb_adrep *adrep) : m_nRef(0)
wb_bdrep::wb_bdrep( wb_adrep *adrep) : m_nRef(0), m_merep(0)
{
pwr_tStatus sts;
m_orep = adrep->m_orep->parent( &sts);
......@@ -196,7 +196,11 @@ wb_adrep *wb_bdrep::adrep( pwr_tStatus *sts, const char *aname)
}
if ( (i != n.attributes() - 1) && adrep->isClass()) {
wb_cdrep *cd = m_orep->vrep()->merep()->cdrep( sts, adrep->subClass());
wb_cdrep *cd;
if ( m_merep)
cd = m_merep->cdrep( sts, adrep->subClass());
else
cd = m_orep->vrep()->merep()->cdrep( sts, adrep->subClass());
if ( EVEN(*sts)) return 0;
if ( bd != this)
......
......@@ -26,6 +26,7 @@
class wb_adrep;
class wb_orep;
class wb_merep;
class wb_bdrep
{
......@@ -33,6 +34,7 @@ class wb_bdrep
wb_orep *m_orep;
pwr_tStatus m_sts;
pwr_tObjName m_structname;
wb_merep *m_merep;
public:
wb_bdrep();
......@@ -62,6 +64,7 @@ public:
pwr_tStatus sts() { return m_sts;}
pwr_tTime modTime();
char *structName();
void merep( wb_merep *me) { m_merep = me;}
};
......
......@@ -64,7 +64,7 @@ wb_cdrep *wb_cdrep::ref()
return this;
}
wb_cdrep::wb_cdrep() : m_nRef(0), m_orep(0), m_sts(LDH__NOCLASS)
wb_cdrep::wb_cdrep() : m_nRef(0), m_orep(0), m_sts(LDH__NOCLASS), m_merep(0)
{
}
......@@ -74,7 +74,7 @@ wb_cdrep::~wb_cdrep()
m_orep->unref();
}
wb_cdrep::wb_cdrep( wb_mvrep *mvrep, pwr_tCid cid) : m_nRef(0), m_orep(0)
wb_cdrep::wb_cdrep( wb_mvrep *mvrep, pwr_tCid cid) : m_nRef(0), m_orep(0), m_merep(0)
{
pwr_tOid oid = cdh_ClassIdToObjid( cid);
m_orep = mvrep->object( &m_sts, oid);
......@@ -84,7 +84,7 @@ wb_cdrep::wb_cdrep( wb_mvrep *mvrep, pwr_tCid cid) : m_nRef(0), m_orep(0)
m_sts = LDH__SUCCESS;
}
wb_cdrep::wb_cdrep( wb_mvrep *mvrep, wb_name name) : m_nRef(0), m_orep(0)
wb_cdrep::wb_cdrep( wb_mvrep *mvrep, wb_name name) : m_nRef(0), m_orep(0), m_merep(0)
{
char str[80];
strcpy( str, "Class-");
......@@ -97,7 +97,7 @@ wb_cdrep::wb_cdrep( wb_mvrep *mvrep, wb_name name) : m_nRef(0), m_orep(0)
m_sts = LDH__SUCCESS;
}
wb_cdrep::wb_cdrep( wb_mvrep *mvrep, const wb_orep& o) : m_nRef(0), m_orep(0)
wb_cdrep::wb_cdrep( wb_mvrep *mvrep, const wb_orep& o) : m_nRef(0), m_orep(0), m_merep(0)
{
pwr_tOid oid = cdh_ClassIdToObjid( o.cid());
m_orep = mvrep->object( &m_sts, oid);
......@@ -107,7 +107,7 @@ wb_cdrep::wb_cdrep( wb_mvrep *mvrep, const wb_orep& o) : m_nRef(0), m_orep(0)
m_sts = LDH__SUCCESS;
}
wb_cdrep::wb_cdrep( const wb_orep& o) : m_nRef(0), m_orep(0)
wb_cdrep::wb_cdrep( const wb_orep& o) : m_nRef(0), m_orep(0), m_merep(0)
{
pwr_tStatus sts;
......@@ -120,7 +120,7 @@ wb_cdrep::wb_cdrep( const wb_orep& o) : m_nRef(0), m_orep(0)
}
}
wb_cdrep::wb_cdrep( wb_adrep *adrep) : m_nRef(0)
wb_cdrep::wb_cdrep( wb_adrep *adrep) : m_nRef(0), m_merep(0)
{
pwr_tStatus sts;
wb_orep *orep = adrep->m_orep->parent( &sts);
......@@ -140,6 +140,7 @@ wb_bdrep *wb_cdrep::bdrep( pwr_tStatus *sts, const char *bname)
if ( EVEN(*sts))
return 0;
wb_bdrep *bdrep = new wb_bdrep( *orep);
bdrep->merep( m_merep);
return bdrep;
}
......@@ -151,6 +152,7 @@ wb_bdrep *wb_cdrep::bdrep( pwr_tStatus *sts, pwr_eBix bix)
if ( orep->cid() == pwr_eClass_ObjBodyDef &&
cdh_oixToBix( orep->oid().oix) == bix) {
wb_bdrep *bdrep = new wb_bdrep( *orep);
bdrep->merep( m_merep);
return bdrep;
}
old = orep;
......@@ -874,7 +876,11 @@ void wb_cdrep::updateTemplateSubClass( wb_adrep *subattr, char *body, pwr_tOid o
{
pwr_tStatus sts;
pwr_tCid cid = subattr->subClass();
wb_cdrep *cdrep = m_orep->vrep()->merep()->cdrep( &sts, cid);
wb_cdrep *cdrep;
if ( m_merep)
cdrep = m_merep->cdrep( &sts, cid);
else
cdrep = m_orep->vrep()->merep()->cdrep( &sts, cid);
if ( EVEN(sts)) throw wb_error(sts);
wb_bdrep *bdrep = cdrep->bdrep( &sts, pwr_eBix_rt);
if ( EVEN(sts)) throw wb_error(sts);
......
......@@ -38,6 +38,7 @@ class wb_cdrep
int m_nRef;
wb_orep *m_orep;
pwr_tStatus m_sts;
wb_merep *m_merep;
public:
wb_cdrep();
......@@ -92,6 +93,7 @@ public:
pwr_tStatus sts() { return m_sts;}
ldh_eVolRep vtype() const;
bool renameClass( pwr_tStatus *sts, wb_name &name);
void merep( wb_merep *me) { m_merep = me;}
};
#endif
......
......@@ -310,7 +310,9 @@ wb_cdrep *wb_merep::cdrep( pwr_tStatus *sts, const wb_orep& o)
return 0;
}
*sts = LDH__SUCCESS;
return it->second->cdrep( o);
wb_cdrep *cd = it->second->cdrep( o);
cd->merep( this);
return cd;
}
wb_cdrep *wb_merep::cdrep( pwr_tStatus *sts, pwr_tCid cid)
......@@ -322,7 +324,9 @@ wb_cdrep *wb_merep::cdrep( pwr_tStatus *sts, pwr_tCid cid)
}
try {
*sts = LDH__SUCCESS;
return it->second->cdrep( cid);
wb_cdrep *cd = it->second->cdrep( cid);
cd->merep( this);
return cd;
}
catch ( wb_error& e) {
*sts = e.sts();
......@@ -339,6 +343,7 @@ wb_cdrep *wb_merep::cdrep( pwr_tStatus *sts, wb_name name)
if ( EVEN( *sts)) return 0;
try {
cdrep = new wb_cdrep( mvrep, name);
cdrep->merep( this);
*sts = LDH__SUCCESS;
return cdrep;
}
......@@ -351,6 +356,7 @@ wb_cdrep *wb_merep::cdrep( pwr_tStatus *sts, wb_name name)
for ( mvrep_iterator it = m_mvrepdbs.begin(); it != m_mvrepdbs.end(); it++) {
try {
cdrep = new wb_cdrep( it->second, name);
cdrep->merep( this);
*sts = LDH__SUCCESS;
return cdrep;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment