Commit 9e1757fc authored by claes's avatar claes

*** empty log message ***

parent 1b55cb29
......@@ -112,3 +112,8 @@ wb_name wb_cdrep::name()
wb_name n = wb_name( m_orep->name());
return n;
}
pwr_tCid wb_cdrep::cid()
{
return cdh_ClassObjidToId( m_orep->oid());
}
......@@ -33,7 +33,7 @@ class wb_cdrep
//wb_object& operator=(const wb_orep&);
size_t size() { return 0;} // Fix get objects runtime body size
pwr_tCid cid() { return 0;} // Fix
pwr_tCid cid();
wb_name name(); // get class name
......
......@@ -896,7 +896,10 @@ pwr_tStatus
ldh_NameToObjid(ldh_tSession session, pwr_tOid *oid, char *name)
{
wb_session *sp = (wb_session *)session;
wb_object o = sp->object(name);
wb_name n = wb_name(name);
if ( n.evenSts()) return n.sts();
wb_object o = sp->object(n);
if (!o) return o.sts();
*oid = o.oid();
......
......@@ -58,7 +58,8 @@ wb_cdrep *wb_merep::cdrep( pwr_tStatus *sts, const wb_orep& o)
// Fetch from other meta environment
return m_erep->cdrep( sts, o);
mvrep_iterator it = m_mvrepdbs.find( cdh_CidToVid(o.cid()));
pwr_tVid vid = cdh_CidToVid(o.cid());
mvrep_iterator it = m_mvrepdbs.find( vid);
if ( it == m_mvrepdbs.end()) {
*sts = LDH__NOSUCHVOL;
return 0;
......@@ -128,3 +129,24 @@ wb_tdrep *wb_merep::tdrep( pwr_tStatus *sts, pwr_tTid tid)
}
return it->second->tdrep( tid);
}
wb_tdrep *wb_merep::tdrep( pwr_tStatus *sts, wb_name name)
{
wb_tdrep *tdrep;
for ( mvrep_iterator it = m_mvrepdbs.begin(); it != m_mvrepdbs.end(); it++) {
try {
tdrep = new wb_tdrep( it->second, name);
*sts = LDH__SUCCESS;
return tdrep;
}
catch ( wb_error& e) {
// Not found in this volume, try next
}
}
// Not found
*sts = LDH__NOTYPE;
return 0;
}
......@@ -31,6 +31,7 @@ class wb_merep {
wb_cdrep *cdrep( pwr_tStatus *sts, wb_name name);
wb_tdrep *tdrep( pwr_tStatus *sts, const wb_adrep& a);
wb_tdrep *tdrep( pwr_tStatus *sts, pwr_tTid tid);
wb_tdrep *tdrep( pwr_tStatus *sts, wb_name name);
};
#endif
......@@ -34,6 +34,18 @@ wb_tdrep::wb_tdrep( wb_mvrep *mvrep, pwr_tTid tid) : m_nRef(0)
m_sts = LDH__SUCCESS;
}
wb_tdrep::wb_tdrep( wb_mvrep *mvrep, wb_name name) : m_nRef(0)
{
char str[80];
strcpy( str, "Type-");
strcat( str, name.object());
m_orep = (wb_orepdbs *) mvrep->object( &m_sts, str);
if ( EVEN(m_sts)) throw wb_error( m_sts);
m_orep->ref();
m_sts = LDH__SUCCESS;
}
wb_tdrep::wb_tdrep( wb_mvrep *mvrep, const wb_adrep& a) : m_nRef(0)
{
pwr_tOid oid = cdh_TypeIdToObjid( a.type());
......@@ -54,3 +66,8 @@ wb_tdrep::wb_tdrep( const wb_adrep& a) : m_nRef(0)
m_orep->ref();
delete tdrep;
}
pwr_tTid wb_tdrep::tid()
{
return cdh_TypeObjidToId( m_orep->oid());
}
......@@ -18,15 +18,17 @@ class wb_tdrep
public:
wb_tdrep();
wb_tdrep(wb_mvrep *, pwr_tTid);
wb_tdrep( wb_mvrep *mvrep, wb_name name);
wb_tdrep( const wb_adrep& a);
wb_tdrep(wb_mvrep *, const wb_adrep&);
wb_tdrep(wb_mvrep *, pwr_tTid);
void unref();
wb_tdrep *ref();
size_t size() { return 0;} // Fix // get objects runtime body size
pwr_tTid tid() { return 0;} // Fix
pwr_tTid tid();
pwr_eType type() { return (pwr_eType)0;} // Fix
int nElement() { return 0;} // Fix
wb_name name() { wb_name n; return n;} // Fix // get type name
......
#include "wb_vrepdbs.h"
#include "wb_orepdbs.h"
#include "wb_erep.h"
#include "wb_merep.h"
void wb_vrepdbs::unref()
......@@ -16,10 +17,7 @@ wb_vrep *wb_vrepdbs::ref()
wb_vrepdbs::wb_vrepdbs(wb_erep *erep, const char *fileName) : m_erep(erep)
{
pwr_tStatus sts;
m_merep = new wb_merep(m_erep, (wb_mvrep *)this);
m_merep->addDbs(&sts, (wb_mvrep *)this); // only if i am a class volume
strcpy(m_fileName, fileName);
m_isDbsenvLoaded = false;
}
......@@ -49,7 +47,10 @@ wb_vrepdbs::dbsenv()
bool
wb_vrepdbs::load()
{
return dbsenv() != 0;
pwr_tStatus sts;
bool rsts = ( dbsenv() != 0);
m_merep->addDbs(&sts, (wb_mvrep *)this); // only if i am a class volume
return rsts;
}
......@@ -364,7 +365,9 @@ wb_vrepdbs::erep() const
wb_vrep *
wb_vrepdbs::next () const
{
return 0;
pwr_tStatus sts;
return m_erep->nextVolume( &sts, vid());
}
wb_merep *
......
......@@ -12,6 +12,8 @@
#include "wb_ldh_msg.h"
#include "wb_dbs.h"
#include "wb_erep.h"
#include "wb_merep.h"
#include "wb_tdrep.h"
#include "wb_ldh_msg.h"
extern "C" {
......@@ -43,9 +45,9 @@ wb_orep *wb_vrepwbl::object(pwr_tStatus *sts, pwr_tOid oid)
return new wb_orepwbl( this, n);
}
wb_orep *wb_vrepwbl::object(pwr_tStatus *sts, char *name)
wb_orep *wb_vrepwbl::object(pwr_tStatus *sts, wb_name name)
{
ref_wblnode n = find( name);
ref_wblnode n = find( name.name());
if ( !n) {
*sts = LDH__NOSUCHOBJ;
return 0;
......@@ -313,7 +315,16 @@ int wb_vrepwbl::getTypeInfo( char *name, pwr_tTid *tid, pwr_eType *type, int *si
}
}
if ( type_extern) {
return 0; // TODO...
pwr_tStatus sts;
wb_tdrep *tdrep = m_merep->tdrep( &sts, wname);
if ( EVEN(sts)) return 0;
*tid = tdrep->tid();
*type = tdrep->type();
*size = tdrep->size();
*elements = tdrep->nElement();
return 1;
}
return 1;
}
......
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