Commit ca3eb8a3 authored by claes's avatar claes

Flags in object head (not yet in dbs and db)

parent b963ac2c
......@@ -176,7 +176,7 @@ static void cmd_save_cb( void *ctx)
return;
}
if ( cmd->wb_type == wb_eType_Project)
if ( cmd->wb_type == wb_eType_Directory)
{
sts = lfu_SaveDirectoryVolume( cmd->ldhses, 0);
if ( EVEN(sts))
......
......@@ -88,6 +88,12 @@ pwr_tCid wb_cdef::cid()
return m_cdrep->cid();
}
pwr_mClassDef wb_cdef::flags()
{
check();
return m_cdrep->flags();
}
const char *wb_cdef::name() const
{
check();
......
......@@ -39,6 +39,7 @@ public:
const char *name() const;
wb_name longName();
pwr_mClassDef flags();
wb_bdef bdef(pwr_eBix bix);
wb_bdef bdef(const char *bname);
......
......@@ -621,7 +621,7 @@ bool wb_db::importVolume(wb_export &e)
bool wb_db::importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, pwr_tOid aoid, pwr_tOid foid, pwr_tOid loid,
const char *name, const char *normname,
const char *name, const char *normname, pwr_mClassDef flags,
pwr_tTime ohTime, pwr_tTime rbTime, pwr_tTime dbTime,
size_t rbSize, size_t dbSize)
{
......
......@@ -86,7 +86,7 @@ public:
bool importVolume(wb_export &e);
bool importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid boid, pwr_tOid aoid, pwr_tOid foid,
pwr_tOid loid, const char *name, const char *normname, pwr_tTime ohTime,
pwr_tOid loid, const char *name, const char *normname, pwr_mClassDef flags, pwr_tTime ohTime,
pwr_tTime rbTime, pwr_tTime dbTime, size_t rbSize, size_t dbSize);
bool importRbody(pwr_tOid oid, size_t size, void *body);
......
......@@ -198,7 +198,7 @@ wb_dbs::checkObject(sOentry *oep)
bool wb_dbs::importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, pwr_tOid aoid, pwr_tOid foid, pwr_tOid loid,
const char *name, const char *normname,
const char *name, const char *normname, pwr_mClassDef flags,
pwr_tTime time, pwr_tTime rbTime, pwr_tTime dbTime,
size_t rbSize, size_t dbSize)
{
......
......@@ -135,7 +135,7 @@ public:
virtual bool importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, pwr_tOid aoid, pwr_tOid foid, pwr_tOid loid,
const char *name, const char *normname,
const char *name, const char *normname, pwr_mClassDef flags,
pwr_tTime ohTime, pwr_tTime rbTime, pwr_tTime dbTime,
size_t rbSize, size_t dbSize);
......
......@@ -13,13 +13,3 @@ wb_destination::wb_destination(wb_object &o, ldh_eDest code) :
{
}
bool wb_destination::canAdopt( pwr_tCid cid)
{
switch ( cid) {
case pwr_cClass_MountObject:
case pwr_cClass_CreateVolume:
return false;
default:
return true;
}
}
......@@ -8,20 +8,15 @@ class wb_object;
class wb_destination
{
public:
pwr_tOid m_oid;
ldh_eDest m_code;
public:
wb_destination(wb_object &object, ldh_eDest code);
wb_destination(pwr_tOid oid, ldh_eDest code);
bool canAdopt(pwr_tCid cid);
bool canAdopt(pwr_tOid oid) {return true;} // Fix
pwr_tOid oid() { return m_oid;}
ldh_eDest code() { return m_code;}
ldh_eDest code() { return m_code;}
};
#endif
......
......@@ -14,7 +14,7 @@ public:
virtual bool importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, pwr_tOid aoid, pwr_tOid foid, pwr_tOid loid,
const char *name, const char *normname,
const char *name, const char *normname, pwr_mClassDef flags,
pwr_tTime ohTime, pwr_tTime rbTime, pwr_tTime dbTime,
size_t rbSize, size_t dbSize) = 0;
......
......@@ -851,10 +851,9 @@ ldh_IsOkCreateObject(ldh_tSession session, pwr_tCid cid, pwr_tOid oid, ldh_eDest
if (!o) return o.sts();
wb_destination d = o.destination(dest);
if (!d.canAdopt(cid)) {
return LDH__NOADOPT;
}
if ( !sp->validateDestination( d, cid))
return sp->sts();
return LDH__SUCCESS;
}
......@@ -868,9 +867,8 @@ ldh_IsOkCopyObject(ldh_tSession session, pwr_tOid oid, pwr_tOid doid, ldh_eDest
if (!o) return o.sts();
wb_destination d = d_o.destination(dest);
if (!d.canAdopt(o.cid())) {
return LDH__NOADOPT;
}
if ( !sp->validateDestination( d, o.cid()))
return sp->sts();
return LDH__SUCCESS;
}
......@@ -885,9 +883,8 @@ ldh_IsOkMoveObject(ldh_tSession session, pwr_tOid oid, pwr_tOid doid, ldh_eDest
if (!o) return o.sts();
wb_destination d = d_o.destination(dest);
if (!d.canAdopt(o)) {
return LDH__NOADOPT;
}
if ( !sp->validateDestination( d, o.cid()))
return sp->sts();
return LDH__SUCCESS;
}
......
......@@ -271,6 +271,13 @@ pwr_tTime wb_object::ohTime()
return m_orep->ohTime();
}
pwr_mClassDef wb_object::flags()
{
check();
return m_orep->flags();
}
bool wb_object::operator==(wb_object& x)
{
check();
......
......@@ -67,6 +67,8 @@ public:
pwr_tTime rbTime(); //< time when run time body of this object was last changed
pwr_tTime dbTime(); //< time when development body of this object was last changed
pwr_mClassDef flags();
size_t rbSize(); //< size of run time body
size_t dbSize(); //< size of development body
......
......@@ -41,6 +41,7 @@ public:
virtual const char * name() const = 0;
virtual wb_name longName() = 0;
virtual pwr_tTime ohTime() const = 0;
virtual pwr_mClassDef flags() const = 0;
virtual bool isOffspringOf(const wb_orep *o) const = 0;
......
......@@ -116,6 +116,13 @@ pwr_tTime wb_orepdb::ohTime() const
return m_vrep->ohTime(&sts, (wb_orep*)this);
}
pwr_mClassDef wb_orepdb::flags() const
{
pwr_tStatus sts;
return m_vrep->flags(&sts, (wb_orep*)this);
}
bool wb_orepdb::isOffspringOf(const wb_orep *o) const
{
pwr_tStatus sts;
......
......@@ -36,6 +36,7 @@ public:
virtual const char * name() const;
virtual wb_name longName();
virtual pwr_tTime ohTime() const;
virtual pwr_mClassDef flags() const;
virtual bool isOffspringOf(const wb_orep *o) const;
......
......@@ -137,6 +137,12 @@ pwr_tTime wb_orepdbs::ohTime() const
return m_o->time;
}
pwr_mClassDef wb_orepdbs::flags() const
{
pwr_mClassDef flags; flags.m = 0; // Fix !!!
return flags;
}
bool wb_orepdbs::isOffspringOf(const wb_orep *o) const
{
return false;
......
......@@ -39,6 +39,7 @@ public:
virtual const char * name() const;
virtual wb_name longName();
virtual pwr_tTime ohTime() const;
virtual pwr_mClassDef flags() const;
virtual bool isOffspringOf(const wb_orep *o) const;
......
......@@ -88,6 +88,11 @@ pwr_tTime wb_orepmem::ohTime() const
return t;
}
pwr_mClassDef wb_orepmem::flags() const
{
return m_memobject->m_flags;
}
bool wb_orepmem::isOffspringOf(const wb_orep *o) const
{
......
......@@ -35,6 +35,7 @@ public:
virtual const char * name() const;
virtual wb_name longName();
virtual pwr_tTime ohTime() const;
virtual pwr_mClassDef flags() const;
virtual bool isOffspringOf(const wb_orep *o) const;
......
......@@ -88,6 +88,11 @@ pwr_tTime wb_orepwbl::ohTime() const
}
pwr_mClassDef wb_orepwbl::flags() const
{
return m_wblnode->o->m_flags;
}
bool wb_orepwbl::isOffspringOf(const wb_orep *o) const
{
return true;
......
......@@ -35,6 +35,7 @@ public:
virtual const char * name() const;
virtual wb_name longName();
virtual pwr_tTime ohTime() const;
virtual pwr_mClassDef flags() const;
virtual bool isOffspringOf(const wb_orep *o) const;
......
......@@ -68,6 +68,9 @@ wb_object wb_session::createObject(wb_cdef cdef, wb_destination d, wb_name name)
if (isReadonly())
throw wb_error_str("ReadOnlySession");
validateDestination( d, cdef.cid());
if ( evenSts()) return wb_object();
wb_object parent;
switch ( d.code()) {
case ldh_eDest_IntoFirst:
......@@ -105,6 +108,9 @@ wb_object wb_session::copyObject(wb_object o, wb_destination d, wb_name name)
if (isReadonly())
throw wb_error_str("ReadOnlySession");
validateDestination( d, o.cid());
if ( evenSts()) return wb_object();
wb_object parent;
switch ( d.code()) {
case ldh_eDest_IntoFirst:
......@@ -141,6 +147,9 @@ bool wb_session::moveObject(wb_object o, wb_destination d)
if (isReadonly())
throw wb_error_str("ReadOnlySession");
validateDestination( d, o.cid());
if ( evenSts()) return false;
wb_object parent;
switch ( d.code()) {
case ldh_eDest_IntoFirst:
......@@ -369,6 +378,7 @@ bool wb_session::pasteOset( pwr_tOid doid, ldh_eDest dest,
throw wb_error_str("ReadOnlySession");
m_sts = LDH__SUCCESS;
wb_destination d = wb_destination( doid, dest);
wb_vrepmem *mem;
// Get last buffer
......@@ -394,6 +404,18 @@ bool wb_session::pasteOset( pwr_tOid doid, ldh_eDest dest,
return false;
}
// Check that rootobjects are valid for this destination
pwr_tStatus sts;
wb_orep *orep = mem->object( &sts);
while( ODD(sts)) {
orep->ref();
validateDestination( d, orep->cid());
if ( evenSts()) return false;
wb_orep *prev = orep;
orep = orep->after( &sts);
prev->unref();
}
// Trigg ante adopt
wb_object parent;
switch ( dest) {
......@@ -410,7 +432,6 @@ bool wb_session::pasteOset( pwr_tOid doid, ldh_eDest dest,
}
if ( parent) {
pwr_tStatus sts;
wb_orep *orep = mem->object( &sts);
while( ODD(sts)) {
orep->ref();
......@@ -421,6 +442,7 @@ bool wb_session::pasteOset( pwr_tOid doid, ldh_eDest dest,
prev->unref();
}
}
pwr_tOid *olist;
mem->exportPaste( *m_vrep, doid, dest, keepoid, &olist);
......@@ -678,19 +700,51 @@ pwr_tStatus wb_session::callMenuMethod( ldh_sMenuCall *mcp, int Index)
{
pwr_tStatus sts = LDH__SUCCESS;
wb_tMethodMenu method = (wb_tMethodMenu) mcp->ItemList[Index].Method;
// ldh_sEvent *ep;
// ep = eventStart(sp, pwr_cNObjid, ldh_eEvent_MenuMethodCalled);
ldh_sEvent *ep = m_srep->eventStart( pwr_cNOid, ldh_eEvent_MenuMethodCalled);
if (method != NULL)
sts = (*method)(mcp);
// eventSend(sp, ep);
m_srep->eventSend( ep);
return sts;
}
bool wb_session::validateDestination( wb_destination d, pwr_tCid cid)
{
wb_object o = object( d.oid());
// Get parent
wb_object parent = wb_object();
if ( o) {
switch( d.code()) {
case ldh_eDest_After:
case ldh_eDest_Before:
parent = o.parent();
break;
default:
parent = o;
}
}
if ( !parent) {
// No parent, check if valid top object (for vrepmem all objects are valid topobjects)
wb_cdef c = cdef( cid);
if ( !c.flags().b.TopObject && type() != ldh_eVolRep_Mem) {
m_sts = LDH__NOTOP;
return false;
}
}
else {
// Check if adoption is legal
if ( parent.flags().b.NoAdopt) {
m_sts = LDH__NOADOPT;
return false;
}
}
m_sts = LDH__SUCCESS;
return true;
}
......
......@@ -89,6 +89,8 @@ public:
void editorContext( void *ctx) { m_srep->editorContext( ctx);}
void sendThisSession( ldh_tSessionCb thisSessionCb) { m_srep->sendThisSession( thisSessionCb);}
void sendOtherSession( ldh_tSessionCb otherSessionCb) { m_srep->sendOtherSession( otherSessionCb);}
bool wb_session::validateDestination( wb_destination d, pwr_tCid cid);
};
......
......@@ -28,12 +28,12 @@ public:
virtual ~wb_treeimport() {}
virtual bool importTree( bool keepref) = 0;
virtual bool importTreeObject(wb_merep *merep, pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, const char *name,
size_t rbSize, size_t dbSize, void *rbody, void *dbody) = 0;
pwr_tOid boid, const char *name, pwr_mClassDef flags,
size_t rbSize, size_t dbSize, void *rbody, void *dbody) = 0;
virtual bool importPaste() = 0;
virtual bool importPasteObject(pwr_tOid destination, ldh_eDest destcode, bool keepoid,
pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, const char *name,
pwr_tOid boid, const char *name, pwr_mClassDef flags,
size_t rbSize, size_t dbSize, void *rbody, void *dbody,
pwr_tOid *roid) = 0;
bool importTranslationTableInsert( pwr_tOix from, pwr_tOix to);
......
......@@ -62,6 +62,7 @@ public:
virtual const char * objectName(pwr_tStatus *sts, const wb_orep *o) = 0;
virtual wb_name longName(pwr_tStatus *sts, const wb_orep *o) = 0;
virtual pwr_tTime ohTime(pwr_tStatus *sts, const wb_orep *o) = 0;
virtual pwr_mClassDef flags(pwr_tStatus *sts, const wb_orep *o) = 0;
virtual bool isOffspringOf(pwr_tStatus *sts, const wb_orep *child, const wb_orep *parent) = 0;
......
......@@ -506,6 +506,12 @@ pwr_tTime wb_vrepdb::ohTime(pwr_tStatus *sts, const wb_orep *orp)
}
}
pwr_mClassDef wb_vrepdb::flags(pwr_tStatus *sts, const wb_orep *orp)
{
pwr_mClassDef flags; flags.m = 0; // Fix !!
return flags;
}
pwr_tVid wb_vrepdb::vid(pwr_tStatus *sts, const wb_orep *orp)
{
*sts = LDH__SUCCESS;
......
......@@ -35,6 +35,7 @@ public:
virtual wb_vrep *next();
virtual pwr_tTime ohTime(pwr_tStatus *sts, const wb_orep *o);
virtual pwr_mClassDef flags(pwr_tStatus *sts, const wb_orep *o);
virtual pwr_tOid oid(pwr_tStatus *sts, const wb_orep *o);
virtual pwr_tVid vid(pwr_tStatus *sts, const wb_orep *o);
virtual pwr_tOix oix(pwr_tStatus *sts, const wb_orep *o);
......@@ -125,14 +126,14 @@ public:
virtual bool exportTree(wb_treeimport &i, pwr_tOid oid) { return false;}
virtual bool importTree(bool keepref) { return false;}
virtual bool importTreeObject(wb_merep *merep, pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, const char *name,
size_t rbSize, size_t dbSize, void *rbody, void *dbody)
pwr_tOid boid, const char *name, pwr_mClassDef flags,
size_t rbSize, size_t dbSize, void *rbody, void *dbody)
{ return false;}
virtual bool importPaste() { return false;}
virtual bool importPasteObject(pwr_tOid destination, ldh_eDest destcode,
bool keepoid, pwr_tOid oid,
pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, const char *name,
pwr_tOid boid, const char *name, pwr_mClassDef flags,
size_t rbSize, size_t dbSize, void *rbody, void *dbody,
pwr_tOid *roid)
{ return false;}
......
......@@ -445,10 +445,11 @@ bool wb_vrepdbs::exportHead(wb_import &i)
{
dbs_sObject *op = 0;
pwr_tStatus sts;
pwr_mClassDef flags; flags.m = 0; // Fix !!!
while ((op = dbs_NextHead(&sts, dbsenv(), op))) {
i.importHead(op->oid, op->cid, op->poid, op->boid, op->aoid, op->foid, op->loid, op->name, op->normname,
op->time, op->rbody.time, op->dbody.time, op->rbody.size, op->dbody.size);
flags, op->time, op->rbody.time, op->dbody.time, op->rbody.size, op->dbody.size);
}
return true;
......@@ -516,7 +517,8 @@ bool wb_vrepdbs::exportTreeObject(wb_treeimport &i, dbs_sObject *op, bool isRoot
if ( op->dbody.size)
dbody = dbs_Body(&sts, dbsenv(), op, pwr_eBix_dev);
i.importTreeObject( m_merep, op->oid, op->cid, parentoid, beforeoid, op->name,
pwr_mClassDef flags; flags.m = 0; // Fix !!!
i.importTreeObject( m_merep, op->oid, op->cid, parentoid, beforeoid, op->name, flags,
op->rbody.size, op->dbody.size, rbody, dbody);
if ( first)
......
......@@ -53,7 +53,7 @@ public:
virtual wb_name longName(pwr_tStatus *sts, const wb_orep *o) { return wb_name();}
virtual pwr_tTime ohTime(pwr_tStatus *sts, const wb_orep *o) { pwr_tTime t = {0, 0}; return t;}
virtual pwr_mClassDef flags(pwr_tStatus *sts, const wb_orep *o) { pwr_mClassDef f; f.m = 0; return f;}
virtual bool isOffspringOf(pwr_tStatus *sts, const wb_orep *child, const wb_orep *parent) { return false;}
......@@ -135,14 +135,14 @@ public:
bool wb_vrepdbs::exportTreeObject(wb_treeimport &i, dbs_sObject *op, bool isRoot);
virtual bool importTree(bool keepref) { return false;}
virtual bool importTreeObject(wb_merep *merep, pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, const char *name,
size_t rbSize, size_t dbSize, void *rbody, void *dbody)
pwr_tOid boid, const char *name, pwr_mClassDef flags,
size_t rbSize, size_t dbSize, void *rbody, void *dbody)
{ return false;}
virtual bool importPaste() { return false;}
virtual bool importPasteObject(pwr_tOid destination, ldh_eDest destcode,
bool keepoid, pwr_tOid oid,
pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, const char *name,
pwr_tOid boid, const char *name, pwr_mClassDef flags,
size_t rbSize, size_t dbSize, void *rbody, void *dbody,
pwr_tOid *roid)
{ return false;}
......
......@@ -594,6 +594,7 @@ wb_orep *wb_vrepmem::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination
memo->m_oid.oix = oix;
memo->m_oid.vid = m_vid;
memo->m_cid = cdef.cid();
memo->m_flags = cdef.flags();
memo->rbody_size = cdef.size( pwr_eBix_rt);
if ( memo->rbody_size) {
memo->rbody = malloc( memo->rbody_size);
......@@ -648,6 +649,8 @@ wb_orep *wb_vrepmem::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination
else if ( dest->fth)
dest->fth->fch = memo;
dest->bws = memo;
if ( dest == root_object)
root_object = memo;
break;
default:
*sts = LDH__NODEST;
......@@ -753,6 +756,8 @@ wb_orep *wb_vrepmem::copyObject(pwr_tStatus *sts, const wb_orep *orep, wb_destin
else if ( dest->fth)
dest->fth->fch = memo;
dest->bws = memo;
if ( dest == root_object)
root_object = memo;
break;
default:
*sts = LDH__NODEST;
......@@ -836,6 +841,8 @@ bool wb_vrepmem::moveObject(pwr_tStatus *sts, wb_orep *orep, wb_destination &d)
memo->fth = dest->fth;
break;
case ldh_eDest_Before:
if ( dest == root_object)
root_object = memo;
memo->bws = dest->bws;
memo->fws = dest;
memo->fth = dest->fth;
......@@ -1092,8 +1099,8 @@ bool wb_vrepmem::updateObject( wb_orep *o, bool keepref)
}
bool wb_vrepmem::importTreeObject(wb_merep *merep, pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, const char *name,
size_t rbSize, size_t dbSize, void *rbody, void *dbody)
pwr_tOid boid, const char *name, pwr_mClassDef flags,
size_t rbSize, size_t dbSize, void *rbody, void *dbody)
{
pwr_tStatus sts;
mem_object *memo = new mem_object();
......@@ -1101,6 +1108,7 @@ bool wb_vrepmem::importTreeObject(wb_merep *merep, pwr_tOid oid, pwr_tCid cid, p
memo->m_oid.oix = oid.oix;
memo->m_oid.vid = m_vid;
memo->m_cid = cid;
memo->m_flags = flags;
bool convert = false;
if ( merep && merep != m_merep) {
......@@ -1191,7 +1199,7 @@ bool wb_vrepmem::importTreeObject(wb_merep *merep, pwr_tOid oid, pwr_tCid cid, p
bool wb_vrepmem::importPasteObject(pwr_tOid destination, ldh_eDest destcode,
bool keepoid, pwr_tOid oid,
pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, const char *name,
pwr_tOid boid, const char *name, pwr_mClassDef flags,
size_t rbSize, size_t dbSize, void *rbody, void *dbody,
pwr_tOid *roid)
{
......@@ -1219,6 +1227,7 @@ bool wb_vrepmem::importPasteObject(pwr_tOid destination, ldh_eDest destcode,
memo->m_oid.vid = m_vid;
memo->m_cid = cid;
memo->m_flags = flags;
memo->rbody_size = rbSize;
if ( memo->rbody_size) {
memo->rbody = malloc( memo->rbody_size);
......
......@@ -45,7 +45,7 @@ class mem_object
pwr_tOid fthoid = (fth && !isRoot) ? fth->m_oid : pwr_cNOid;
pwr_tOid bwsoid = (bws && !isRoot) ? bws->m_oid : pwr_cNOid;
i.importTreeObject( 0, m_oid, m_cid, fthoid, bwsoid, name(),
i.importTreeObject( 0, m_oid, m_cid, fthoid, bwsoid, name(), m_flags,
rbody_size, dbody_size, rbody, dbody);
if ( fch)
......@@ -63,7 +63,7 @@ class mem_object
pwr_tOid oid;
i.importPasteObject( destination, destcode, keepoid, m_oid, m_cid, fthoid, bwsoid,
name(), rbody_size, dbody_size, rbody, dbody, &oid);
name(), m_flags, rbody_size, dbody_size, rbody, dbody, &oid);
if ( rootlist)
*rootlist++ = oid;
......@@ -190,7 +190,7 @@ public:
virtual wb_name longName(pwr_tStatus *sts, const wb_orep *o) { return wb_name();}
virtual pwr_tTime ohTime(pwr_tStatus *sts, const wb_orep *o) { pwr_tTime t = {0, 0}; return t;}
virtual pwr_mClassDef flags(pwr_tStatus *sts, const wb_orep *o) { pwr_mClassDef f; f.m = 0; return f;}
virtual bool isOffspringOf(pwr_tStatus *sts, const wb_orep *child, const wb_orep *parent) { return false;}
......@@ -260,13 +260,13 @@ public:
bool exportPaste(wb_treeimport &i, pwr_tOid destination, ldh_eDest destcode, bool keepoid,
pwr_tOid **rootlist);
virtual bool importTreeObject(wb_merep *merep, pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, const char *name,
size_t rbSize, size_t dbSize, void *rbody, void *dbody);
pwr_tOid boid, const char *name, pwr_mClassDef flags,
size_t rbSize, size_t dbSize, void *rbody, void *dbody);
virtual bool importTree( bool keepref);
virtual bool importPasteObject(pwr_tOid destination, ldh_eDest destcode,
bool keepoid, pwr_tOid oid,
pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, const char *name,
pwr_tOid boid, const char *name, pwr_mClassDef flags,
size_t rbSize, size_t dbSize, void *rbody, void *dbody,
pwr_tOid *roid);
virtual bool importPaste();
......
......@@ -259,9 +259,10 @@ int wb_vrepwbl::load( const char *fname)
// root_object->info_link( 0);
cout << "\n-- Building volume " << volume_name << endl;
if ( root_object)
if ( root_object) {
root_object->build( 1);
root_object->postBuild();
}
// info();
if ( error_cnt)
cout << "** Errors when loading volume: " << error_cnt << " errors found" << endl;
......
......@@ -119,6 +119,7 @@ public:
virtual wb_name longName(pwr_tStatus *sts, const wb_orep *o) { return wb_name();}
virtual pwr_tTime ohTime(pwr_tStatus *sts, const wb_orep *o) { pwr_tTime t = {0, 0}; return t;}
virtual pwr_mClassDef flags(pwr_tStatus *sts, const wb_orep *o) { pwr_mClassDef f; f.m = 0; return f;}
virtual bool isOffspringOf(pwr_tStatus *sts, const wb_orep *child, const wb_orep *parent) { return false;}
......@@ -188,14 +189,14 @@ public:
virtual bool exportTree(wb_treeimport &i, pwr_tOid oid);
virtual bool importTree(bool keepref) { return false;}
virtual bool importTreeObject(wb_merep *merep, pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, const char *name,
size_t rbSize, size_t dbSize, void *rbody, void *dbody)
pwr_tOid boid, const char *name, pwr_mClassDef flags,
size_t rbSize, size_t dbSize, void *rbody, void *dbody)
{ return false;}
virtual bool importPaste() { return false;}
virtual bool importPasteObject(pwr_tOid destination, ldh_eDest destcode,
bool keepoid, pwr_tOid oid,
pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, const char *name,
pwr_tOid boid, const char *name, pwr_mClassDef flags,
size_t rbSize, size_t dbSize, void *rbody, void *dbody,
pwr_tOid *roid)
{ return false;}
......
......@@ -536,9 +536,9 @@ void wb_wblnode::build( bool recursive)
else {
if( !m_vrep->registerObject( o->m_oid.oix, this)) {
// Print error message
pwr_tStatus sts;
char name[120];
char msg[180];
pwr_tStatus sts;
wb_orep *orep = m_vrep->object( &sts, o->m_oid);
m_vrep->objectName( orep, name);
......@@ -563,6 +563,23 @@ void wb_wblnode::build( bool recursive)
// o->fws->build( recursive);
}
void wb_wblnode::postBuild()
{
pwr_tStatus sts;
pwr_mClassDef flags;
m_vrep->getClassFlags( &sts, o->m_cid, &flags);
o->m_flags.m |= flags.m;
if ( EVEN(sts))
m_vrep->error( "Can't find class flags", getFileName(), line_number);
wb_wblnode *ch = o->fch;
while ( ch) {
ch->postBuild();
ch = ch->o->fws;
}
}
void wb_wblnode::buildObjBodyDef( ref_wblnode classdef)
{
o->m_oid.oix = cdh_cixToOix( classdef->o->c.cix, o->m_oid.oix, 0);
......@@ -1490,13 +1507,7 @@ void wb_wblnode::iterO->Rbody( wb_dbs *dbs)
bool wb_wblnode::exportHead(wb_import &i)
{
pwr_tStatus sts;
pwr_mClassDef flags;
m_vrep->getClassFlags( &sts, o->m_cid, &flags);
if ( EVEN(sts)) throw wb_error( sts);
o->m_flags.m |= flags.m;
ref_wblnode o_lch = get_o_lch();
pwr_tOid fthoid = o->fth ? o->fth->o->m_oid : pwr_cNOid;
pwr_tOid fwsoid = o->fws ? o->fws->o->m_oid : pwr_cNOid;
......@@ -1505,7 +1516,8 @@ bool wb_wblnode::exportHead(wb_import &i)
pwr_tOid lchoid = o_lch ? o_lch->o->m_oid : pwr_cNOid;
wb_name n = wb_name(name());
i.importHead( o->m_oid, o->m_cid, fthoid, bwsoid, fwsoid, fchoid, lchoid, name(), n.normName(cdh_mName_object),
i.importHead( o->m_oid, o->m_cid, fthoid, bwsoid, fwsoid, fchoid, lchoid, name(),
n.normName(cdh_mName_object), o->m_flags,
getFileTime(), getFileTime(), getFileTime(), o->rbody_size, o->dbody_size);
if ( o->fch)
......@@ -1548,7 +1560,7 @@ bool wb_wblnode::exportTree( wb_treeimport &i, bool isRoot)
pwr_tOid fthoid = (o->fth && !isRoot) ? o->fth->o->m_oid : pwr_cNOid;
pwr_tOid bwsoid = (o->bws && !isRoot) ? o->bws->o->m_oid : pwr_cNOid;
i.importTreeObject( m_vrep->merep(), o->m_oid, o->m_cid, fthoid, bwsoid, name(),
i.importTreeObject( m_vrep->merep(), o->m_oid, o->m_cid, fthoid, bwsoid, name(), o->m_flags,
o->rbody_size, o->dbody_size, o->rbody, o->dbody);
if ( o->fch)
......
......@@ -219,6 +219,7 @@ public:
}
void registerNode( wb_vrepwbl *vol);
void build( bool recursive);
void postBuild();
void buildObjBodyDef( ref_wblnode classdef);
void buildAttribute( ref_wblnode classdef, ref_wblnode objbodydef,
int *bindex, size_t *boffset);
......
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