Commit 7fe4ec0a authored by lw's avatar lw

*** empty log message ***

parent f8e7fa87
......@@ -398,7 +398,7 @@ dbs_Map(pwr_tStatus *sts, dbs_sEnv *ep, const char *filename)
struct stat sb;
int ret;
int fd;
//#define DBS_DEBUG 1
#define DBS_DEBUG 1
#if DBS_DEBUG
int i;
dbs_sFile *fp;
......
#include "wb_ldh_msg.h"
#include "wb_adef.h"
#include "wb_adrep.h"
#include "wb_name.h"
wb_adef::wb_adef() : wb_status(LDH__NOSUCHATTR), m_adrep(0)
{
......
#ifndef wb_adef_h
#define wb_adef_h
#include "wb_adrep.h"
#include "pwr.h"
#include "wb_orep.h"
#include "wb_name.h"
#include "wb_status.h"
#include "wb_ldh.h"
#include "wb_cdef.h"
#include "wb_bdef.h"
class wb_orep;
class wb_adrep;
class wb_bdef;
class wb_cdef;
class wb_name;
class wb_adef : public wb_status
{
......@@ -52,7 +52,7 @@ public:
wb_name longName();
void *body( void *p = 0);
private:
private:
void check();
};
......
#include "wb_adrep.h"
#include "wb_bdrep.h"
#include "wb_vrep.h"
#include "wb_cdef.h"
#include "wb_cdrep.h"
#include "wb_orepdbs.h"
void wb_adrep::unref()
......
#ifndef wb_adrep_h
#define wb_adrep_h
#include "pwr.h"
#include "pwr_class.h"
#include "co_cdh.h"
#include "wb_name.h"
class wb_bdrep;
class wb_cdrep;
class wb_orepdbs;
class wb_vrep;
class wb_bdrep;
class wb_name;
class wb_adrep
{
......@@ -30,7 +32,7 @@ class wb_adrep
friend class wb_bdrep;
friend class wb_cdrep;
public:
public:
wb_adrep(wb_orepdbs& );
~wb_adrep();
......
......@@ -4,9 +4,8 @@
#include "wb_attrname.h"
#include "pwr.h"
wb_attribute::wb_attribute() : wb_status(LDH__NOSUCHATTR), m_orep(0), m_adrep(0),
wb_attribute::wb_attribute() :
wb_status(LDH__NOSUCHATTR), m_orep(0), m_adrep(0),
m_size(0), m_offset(0), m_tid(0), m_elements(0),
m_type(pwr_eType_), m_flags(0), m_bix(pwr_eBix__)
{
......
......@@ -102,7 +102,7 @@ public:
pwr_tStatus sts() { return m_sts;}
private:
private:
void check() const;
void init();
};
......
#include <string.h>
#include "wb_attrname.h"
......
#include "wb_bdef.h"
#include "wb_adef.h"
#include "wb_bdrep.h"
wb_bdef::wb_bdef() : wb_status(LDH__NOSUCHBODY), m_bdrep(0)
{
......@@ -90,10 +91,4 @@ wb_adef wb_bdef::adef( const char *aname)
wb_adrep *adrep = m_bdrep->adrep( &sts, aname);
wb_adef a = wb_adef( adrep);
return a;
}
]
......@@ -2,12 +2,13 @@
#define wb_bdef_h
#include "pwr.h"
#include "wb_bdrep.h"
#include "wb_name.h"
#include "wb_ldh.h"
#include "wb_status.h"
class wb_orep;
class wb_bdrep;
class wb_adef;
class wb_name;
class wb_bdef : public wb_status
{
......
#include "wb_cdef.h"
#include "wb_adef.h"
#include "wb_bdef.h"
#include "wb_cdef.h"
#include "wb_cdrep.h"
#include "wb_object.h"
wb_cdef::wb_cdef() : wb_status(LDH__NOCLASS), m_cdrep(0)
......
......@@ -3,23 +3,20 @@
#include "pwr.h"
#include "pwr_class.h"
#include "wb_bdef.h"
#include "wb_orep.h"
#include "wb_cdrep.h"
#include "wb_name.h"
class wb_bdef;
class wb_adef;
class wb_cdrep;
class wb_mvrep;
class wb_object;
class wb_orep;
class wb_cdef : public wb_status
{
public:
public:
wb_cdrep *m_cdrep;
wb_cdef();
......@@ -48,7 +45,7 @@ class wb_cdef : public wb_status
wb_object classBody( const char *bname);
private:
private:
void check() const;
};
......
extern "C" {
#include "co_cdh.h"
}
#include "wb_cdrep.h"
#include "wb_merep.h"
#include "wb_ldh_msg.h"
......
......@@ -18,7 +18,7 @@ class wb_cdrep
wb_orepdbs *m_orep;
pwr_tStatus m_sts;
public:
public:
wb_cdrep();
wb_cdrep(wb_adrep *); // x = other_object
wb_cdrep(const wb_orep&); // x = other orep
......
/* wb_ldhdbs.c -- <short description>
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
This module contains functions to create database snapshot files. */
This module contains functions to create database snapshot files. */
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#ifdef OS_VMS
#include <descrip.h>
#include <lib$routines.h>
#endif
#include <X11/Intrinsic.h>
#include <assert.h>
#include "pwr.h"
#include "pwr_class.h"
#include "co_cdh.h"
#include "co_time.h"
#include "co_dcli.h"
#include "co_tree.h"
#include "co_platform.h"
#include "co_pdr.h"
#include "co_dbs.h"
#include "pwr_class.h"
#include "wb_dbs.h"
#include "wb_ldh_msg.h"
#include "wb_ldhld.h"
#include "wb_ldh.h"
#include "rt_dlinux.h"
#include "wb_object.h"
#include "wb_volume.h"
#include "wb_error.h"
#include "wb_vrep.h"
static int comp_dbs_name(tree_sTable *tp, tree_sNode *x, tree_sNode *y);
......@@ -75,13 +61,12 @@ wb_dbs::~wb_dbs()
{
pwr_tStatus sts;
printf("m_nObjects: %d\n", m_nObjects);
printf("m_nTreeObjects: %d\n", m_nTreeObjects);
printf("m_nClassObjects: %d\n", m_nClassObjects);
printf("m_nNameObjects: %d\n", m_nNameObjects);
printf("m_nRbodyObjects: %d\n", m_nRbodyObjects);
printf("m_nDbodyObjects: %d\n", m_nDbodyObjects);
printf("-- m_nObjects: %d\n", m_nObjects);
printf("-- m_nTreeObjects: %d\n", m_nTreeObjects);
printf("-- m_nClassObjects: %d\n", m_nClassObjects);
printf("-- m_nNameObjects: %d\n", m_nNameObjects);
printf("-- m_nRbodyObjects: %d\n", m_nRbodyObjects);
printf("-- m_nDbodyObjects: %d\n", m_nDbodyObjects);
tree_DeleteTable(&sts, m_oid_th);
tree_DeleteTable(&sts, m_name_th);
......@@ -109,15 +94,18 @@ comp_dbs_name(tree_sTable *tp, tree_sNode *x, tree_sNode *y)
return comp;
}
void
wb_dbs::buildFile()
bool
wb_dbs::importVolume(wb_export &e)
{
m_v->iterObject(this);
e.exportHead(*this);
buildSectName();
checkObject(m_oep);
buildSectOid();
buildSectClass();
createFile();
return true;
}
void
......@@ -134,7 +122,7 @@ wb_dbs::checkObject(sOentry *oep)
// Check object
if (!oep->flags.b.exist) {
printf("Object does not exist!\n");
printf("** Object does not exist!\n");
}
m_nTreeObjects++;
......@@ -152,7 +140,7 @@ wb_dbs::checkObject(sOentry *oep)
sib_lh = sib_ll = &oep->o.sib_lh;
for (sep = oep->foep; sep != 0; sep = sep->aoep) {
if (sep->poep != oep) {
printf("Object not linked to right parent!\n");
printf("** Object not linked to right parent!\n");
}
checkObject(sep);
......@@ -181,8 +169,8 @@ wb_dbs::checkObject(sOentry *oep)
oep->o.name_bt.rsize = dbs_dAlign(sizeof(dbs_sName));
}
pwr_tStatus
wb_dbs::installObject(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid aoid, pwr_tOid boid, pwr_tOid foid,
bool
wb_dbs::importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid aoid, pwr_tOid boid, pwr_tOid foid,
pwr_tOid loid, pwr_tObjName name, pwr_tObjName normname, pwr_tTime time,
pwr_tTime rbTime, pwr_tTime dbTime, size_t rbSize, size_t dbSize)
{
......@@ -191,14 +179,14 @@ wb_dbs::installObject(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid aoid,
pwr_tStatus sts;
if (cdh_ObjidIsNull(oid))
printf("Error: object is null!\n");
printf("** Error: object is null!\n");
//printf("install: %s o:%d.%d p:%d.%d b:%d.%d a:%d.%d f:%d.%d l:%d.%d \n", name, oid.vid, oid.oix, poid.vid, poid.oix, boid.vid, boid.oix, aoid.vid, aoid.oix, foid.vid, foid.oix, loid.vid, loid.oix);
oep = (sOentry *)tree_Insert(&sts, m_oid_th, &oid);
if (sts == TREE__INSERTED) {
} else if (oep->flags.b.exist) {
printf("*** Error: object is already inserted!\n");
printf("** Error: object is already inserted!\n");
}
if (oid.oix == pwr_cNOix) {
......@@ -266,7 +254,7 @@ wb_dbs::installObject(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid aoid,
oep->dbody.size = dbs_dAlign(oep->o.dbody.size);
}
return LDH__SUCCESS;
return true;
}
......@@ -646,7 +634,7 @@ wb_dbs::writeSectOid()
}
static pwr_tStatus
writeTree(sOentry *oep, FILE *fp)
writeTree(wb_dbs::sOentry *oep, FILE *fp)
{
pwr_tStatus sts;
......@@ -686,8 +674,8 @@ wb_dbs::writeSectObject()
}
pwr_tStatus
wb_dbs::installDbody(pwr_tOid oid, void *body)
bool
wb_dbs::importDbody(pwr_tOid oid, size_t size, void *body)
{
pwr_tStatus sts;
sOentry *oep;
......@@ -703,7 +691,7 @@ wb_dbs::installDbody(pwr_tOid oid, void *body)
if (oep->dbody.size == 0) {
if (body != 0) printf("error body size\n");
return 1;
return true;
}
oep->o.dbody.ref = dbs_dMakeRef(dbs_eSect_dbody, m_sect[dbs_eSect_dbody].size + dbs_dAlign(sizeof(dbs_sBody)));
......@@ -712,14 +700,14 @@ wb_dbs::installDbody(pwr_tOid oid, void *body)
memcpy(b, &oep->dbody, sizeof(oep->dbody));
if (fwrite(b, sizeof(b), 1, m_fp) < 1)
return LDH__FILEWRITE;
return false;
/* @todo!!! objdid_self */
if (fwrite(body, oep->dbody.size, 1, m_fp) < 1)
return LDH__FILEWRITE;
return false;
return sts;
return true;
}
......@@ -730,7 +718,7 @@ wb_dbs::writeSectDbody()
if (fseek(m_fp, m_sect[dbs_eSect_dbody].offset, SEEK_SET) != 0)
return LDH__FILEPOS;
m_v->iterDbody(this);
m_v->exportDbody(*this);
assert(ftell(m_fp) == (long)(m_sect[dbs_eSect_dbody].offset + m_sect[dbs_eSect_dbody].size));
......@@ -738,8 +726,8 @@ wb_dbs::writeSectDbody()
}
pwr_tStatus
wb_dbs::installRbody(pwr_tOid oid, void *body)
bool
wb_dbs::importRbody(pwr_tOid oid, size_t size, void *body)
{
pwr_tStatus sts;
sOentry *oep;
......@@ -757,7 +745,7 @@ wb_dbs::installRbody(pwr_tOid oid, void *body)
if (oep->rbody.size == 0) {
if (body != 0) printf("error body size\n");
return 1;
return true;
}
oep->o.rbody.ref = dbs_dMakeRef(dbs_eSect_rbody, m_sect[dbs_eSect_rbody].size + sizeof(b));
......@@ -766,16 +754,16 @@ wb_dbs::installRbody(pwr_tOid oid, void *body)
memcpy(b, &oep->rbody, sizeof(oep->rbody));
if (fwrite(b, sizeof(b), 1, m_fp) < 1)
return LDH__FILEWRITE;
return false;
//printf(" 2 install Rbody %s, bsize: %d, ssize: %d\n", oep->o.name, oep->rbody.size, m_sect[dbs_eSect_rbody].size);
/* @todo!!! objdid_self */
if (fwrite(body, oep->rbody.size, 1, m_fp) < 1)
return LDH__FILEWRITE;
return false;
//printf(" 3 install Rbody %s, bsize: %d, ssize: %d\n", oep->o.name, oep->rbody.size, m_sect[dbs_eSect_rbody].size);
return sts;
return true;
}
......@@ -786,7 +774,7 @@ wb_dbs::writeSectRbody()
if (fseek(m_fp, m_sect[dbs_eSect_rbody].offset, SEEK_SET) != 0)
return LDH__FILEPOS;
m_v->iterRbody(this);
m_v->exportRbody(*this);
assert(ftell(m_fp) == (long)(m_sect[dbs_eSect_rbody].offset + m_sect[dbs_eSect_rbody].size));
......@@ -950,3 +938,9 @@ wb_dbs::classInsert(sOentry *oep)
cep->o_lt = oep;
}
}
bool
wb_dbs::importMeta(dbs_sEnv *ep)
{
return true;
}
......@@ -7,8 +7,16 @@
#include "co_tree.h"
#include "wb_status.h"
#include "wb_ldh.h"
#include "wb_import.h"
typedef union {
class wb_vrep;
class wb_dbs : public wb_status, public wb_import
{
public:
typedef union {
struct {
pwr_tBit devOnly : 1;
pwr_tBit exist : 1;
......@@ -18,13 +26,13 @@ typedef union {
#define mOentry_devOnly 1
#define mOentry_exist 2
} mOentry;
} mOentry;
typedef struct sOentry sOentry;
typedef struct sNentry sNentry;
typedef struct sCentry sCentry;
struct sOentry;
struct sNentry;
struct sCentry;
struct sOentry {
struct sOentry {
tree_sNode node;
dbs_sObject o;
dbs_sBody rbody;
......@@ -40,34 +48,28 @@ struct sOentry {
sOentry *loep;
sOentry *o_ll;
};
};
/* Name entry, used in name table. */
/* Name entry, used in name table. */
struct sNentry {
struct sNentry {
tree_sNode node;
dbs_sName n;
dbs_tRef ref;
sOentry *oep;
};
};
struct sCentry {
struct sCentry {
tree_sNode node;
dbs_sClass c;
dbs_tRef ref;
sOentry *o_lh; // Header of object list
sOentry *o_lt; // Tail of object list
};
class wb_vrep;
class wb_dbs : public wb_status
{
public:
};
FILE *m_fp; /**< file pointer */
char m_name[100]; /**< name of load file */
// wb_object *m_o; /* Volume object header. */
// wb_object *m_o; /* Volume object header. */
wb_vrep *m_v;
dbs_sVolume m_volume;
pwr_tOid m_oid;
......@@ -100,15 +102,15 @@ public:
bool operator==(wb_dbs&);
void buildFile();
// void buildFile();
void buildSectName();
void buildSectOid();
void buildSectClass();
void checkObject(sOentry *oep);
pwr_tStatus closeFile(pwr_tBoolean doDelete);
pwr_tBoolean createFile();
// ldhi_sObjHead *getAliasServer(sLCB *lcbp, ldhi_sObjHead *o, pwr_tOid *soid);
// pwr_tStatus getMountServer(sLCB *lcbp, ldhi_sObjHead *o, pwr_tOid *soid);
// ldhi_sObjHead *getAliasServer(sLCB *lcbp, ldhi_sObjHead *o, pwr_tOid *soid);
// pwr_tStatus getMountServer(sLCB *lcbp, ldhi_sObjHead *o, pwr_tOid *soid);
pwr_tStatus installObject(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid boid, pwr_tOid aoid, pwr_tOid foid,
pwr_tOid loid, pwr_tObjName name, pwr_tObjName normname, pwr_tTime ohTime,
......@@ -129,6 +131,20 @@ public:
pwr_tStatus writeSectDbody();
virtual bool importVolume(wb_export &e);
virtual bool importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, pwr_tOid aoid, pwr_tOid foid, pwr_tOid loid,
pwr_tObjName name, pwr_tObjName normname,
pwr_tTime ohTime, pwr_tTime rbTime, pwr_tTime dbTime,
size_t rbSize, size_t dbSize);
virtual bool importRbody(pwr_tOid oid, size_t size, void *body);
virtual bool importDbody(pwr_tOid oid, size_t size, void *body);
virtual bool importMeta(dbs_sEnv *ep);
private:
};
......
#include "wb_destination.h"
#include "wb_object.h"
wb_destination::wb_destination(wb_object &parent, wb_object &before, wb_object &after)
wb_destination::wb_destination(pwr_tOid oid, ldh_eDest code) :
m_oid(oid), m_code(code)
{
//m_parent = parent;
}
wb_destination::wb_destination(wb_object &o, ldh_eDest dest)
wb_destination::wb_destination(wb_object &o, ldh_eDest code) :
m_oid(o.oid()), m_code(code)
{
m_dest = dest;
switch (m_dest) {
case ldh_eDest_Before:
//m_parent = o.parent();
//m_after = o;
//m_before = o.before();
break;
case ldh_eDest_After:
//m_parent = object.parent;
//m_after = object.after;
//m_before = object;
break;
case ldh_eDest_IntoFirst:
//m_parent = object;
//m_before = object;
//m_after = object.first;
break;
case ldh_eDest_IntoLast:
//m_parent = object;
//m_after = object;
//m_before = object.last;
default:
break;
}
}
/*
wb_destination::adopt(wb_object o)
{
wb_object parent;
wb_object before;
wb_object after;
switch (m_dest) {
case first:
o.before(m_o);
if (m_o == m_o.first()) {
if (m_before == m_parent) {
m_parent.first(o);
} else {
m_before.after(o);
}
if (m_after == m_parent) {
m_parent.last(o);
} else {
m_after.before(o);
}
o.parent(parent);
o.before(before);
o.after(after);
}
*/
......@@ -4,33 +4,23 @@
#include "pwr.h"
#include "wb_ldh.h"
class wb_orep;
class wb_object;
class wb_destination
{
public:
wb_orep *m_parent;
wb_orep *m_before;
wb_orep *m_after;
ldh_eDest m_dest;
pwr_tOid m_oid;
ldh_eDest m_code;
/*
Used as intention:
wb_destination(wb_object &object, ldh_eDest code);
wb_destination(pwr_tOid oid, ldh_eDest code);
wb_Position(0, 0, after) => the position just before the object with oid = 'after'
wb_Position(0, before, 0) => the position just after the object with oid = 'before'
wb_Position(parent, 0, parent) => the position as last child of the object with oid = 'parent'
wb_Position(parent, parent, 0) => the position as first child of the object with oid = 'parent'
*/
wb_destination(wb_object &parent, wb_object &before, wb_object &after);
wb_destination(wb_object &object, ldh_eDest dest);
bool canAdopt(pwr_tCid cid) {return true;} // Fix
bool canAdopt(pwr_tOid oid) {return true;} // Fix
pwr_tOid oid() { return m_oid;}
ldh_eDest code() { return m_code;}
};
......
#ifndef wb_erep_h
#define wb_erep_h
#include "wb_vrep.h"
#include <map>
using namespace std;
......
#if 1
/* wb_ldh.c -- local data handler
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
This module contains the API-routines to the Local Data Handler, LDH. */
This module contains the API-routines to the Local Data Handler, LDH. */
#include <string.h>
#include <stdlib.h>
......@@ -1053,12 +1053,12 @@ ldh_AttrRefToName(ldh_tSession session, pwr_sAttrRef *arp, ldh_eName nametype, c
/* Convert a volume identity to a corresponding name.
If the name of the volume is not available, the name
is given in an alphanumerical form:
If the name of the volume is not available, the name
is given in an alphanumerical form:
_V0.123.34.63
_V0.123.34.63
*/
*/
pwr_tStatus
ldh_VolumeIdToName(ldh_tWorkbench workbench, pwr_tVid vid, char *name, int maxsize, int *size)
......@@ -1392,5 +1392,3 @@ ldh_CreateLoadFile(ldh_tSession session)
return LDH__NYI;
}
#endif
......@@ -20,10 +20,11 @@ class wb_merep {
typedef map<pwr_tVid, wb_mvrep*>::iterator mvrep_iterator;
public:
public:
wb_merep( wb_erep *erep, wb_vrep *vrep = 0) : m_erep(erep), m_vrep(vrep) {}
wb_mvrep *volume(pwr_tStatus *sts);
wb_mvrep *volume(pwr_tStatus *sts, pwr_tVid vid);
void addDbs( pwr_tStatus *sts, wb_mvrep *mvrep);
void removeDbs( pwr_tStatus *sts, wb_mvrep *mvrep);
......
......@@ -10,7 +10,7 @@ class wb_tdrep;
class wb_mvrep : public wb_vrep {
public:
public:
wb_cdrep *cdrep( const wb_orep& o);
wb_cdrep *cdrep( pwr_tCid cid);
wb_tdrep *tdrep( const wb_adrep& a);
......
......@@ -89,7 +89,7 @@
1 0 0 0 0 0 0 0 0 * Root Strict //Avol
1 0 0 0 0 0 0 0 1 * Root Strict //Avol/
*/
*/
class wb_nrep;
......@@ -154,7 +154,7 @@ public:
static char *unatName( char *name) { return wb_nrep::unatName( name);}
static bool checkObjectName( const char *name) { return wb_nrep::checkObjectName( name);}
private:
private:
void check() const { if ( evenSts()) throw wb_error(m_sts);}
};
......
......@@ -50,15 +50,15 @@ char wb_nrep::unatname_tab[] = \
#define nameDiff( s1, s2) ((long)(s1) - (long)(s2))
wb_nrep::wb_nrep() : m_nRef(0), num_seg(0), num_attr(0), vol_len(0),
seg(0), attr(0)
wb_nrep::wb_nrep() :
m_nRef(0), num_seg(0), num_attr(0), vol_len(0), seg(0), attr(0)
{
strcpy( oname,"");
}
wb_nrep::wb_nrep( const char *n) throw (wb_error) : num_seg(0), num_attr(0), vol_len(0),
vol_offs(0), b_size(0), b_offset(0),
seg(0), attr(0)
wb_nrep::wb_nrep( const char *n) throw (wb_error) :
num_seg(0), num_attr(0), vol_len(0),
vol_offs(0), b_size(0), b_offset(0), seg(0), attr(0)
{
const char *s;
int seg_cnt = 1;
......
......@@ -2,6 +2,7 @@
#include "wb_object.h"
#include "wb_location.h"
#include "wb_error.h"
#include "wb_bdef.h"
bool wb_object::check( string str)
{
......
#include "wb_orepdb.h"
#include "wb_vrepdb.h"
wb_orepdb::~wb_orepdb()
{
}
//
// Operations declared in wb_Orep
// Operations declared in wb_orep
//
pwr_tOid wb_orepdb::oid() const
{
return m_ohead.oid;
pwr_tStatus sts;
return m_vrep->oid(&sts, (wb_orep*)this);
}
pwr_tVid wb_orepdb::vid() const
{
return m_ohead.oid.vid;
pwr_tStatus sts;
return m_vrep->vid(&sts, (wb_orep*)this);
}
pwr_tOix wb_orepdb::oix() const
{
return m_ohead.oid.oix;
pwr_tStatus sts;
return m_vrep->oix(&sts, (wb_orep*)this);
}
pwr_tOid wb_orepdb::poid() const
{
return m_ohead.poid;
pwr_tStatus sts;
return m_vrep->poid(&sts, (wb_orep*)this);
}
pwr_tOid wb_orepdb::foid() const
{
return m_ohead.foid;
pwr_tStatus sts;
return m_vrep->foid(&sts, (wb_orep*)this);
}
pwr_tOid wb_orepdb::loid() const
{
return m_ohead.loid;
pwr_tStatus sts;
return m_vrep->loid(&sts, (wb_orep*)this);
}
pwr_tOid wb_orepdb::boid() const
{
return m_ohead.boid;
pwr_tStatus sts;
return m_vrep->boid(&sts, (wb_orep*)this);
}
pwr_tOid wb_orepdb::aoid() const
{
return m_ohead.aoid;
pwr_tStatus sts;
return m_vrep->aoid(&sts, (wb_orep*)this);
}
const char * wb_orepdb::name() const
{
return m_ohead.name;
pwr_tStatus sts;
return m_vrep->objectName(&sts, (wb_orep*)this);
}
pwr_tTime wb_orepdb::ohTime() const
{
return m_ohead.time;
}
pwr_tStatus sts;
return m_vrep->ohTime(&sts, (wb_orep*)this);
}
bool wb_orepdb::isOffspringOf(const wb_orep *o) const
{
return true;
pwr_tStatus sts;
return m_vrep->isOffspringOf(&sts, (wb_orep*)this, o);
}
wb_orep *wb_orepdb::ancestor(pwr_tStatus *sts) const
......@@ -86,7 +98,7 @@ wb_orep *wb_orepdb::before(pwr_tStatus *sts) const
return m_vrep->before(sts, (wb_orep*)this);
}
wb_orep *wb_orepdb::first(pwr_tStatus *sts) const
wb_orep* wb_orepdb::first(pwr_tStatus *sts) const
{
return m_vrep->first(sts, (wb_orep*)this);
}
......@@ -111,7 +123,6 @@ wb_orep *wb_orepdb::previous(pwr_tStatus *sts) const
return m_vrep->previous(sts, (wb_orep*)this);
}
wb_position wb_orepdb::position()
{
wb_position pos;
......@@ -124,7 +135,6 @@ wb_position wb_orepdb::position(ldh_eDest dest)
return pos;
}
wb_adrep *wb_orepdb::attribute(pwr_tStatus*, const char *aname)
{
return 0;
......@@ -134,4 +144,3 @@ wb_adrep *wb_orepdb::attribute(pwr_tStatus*)
{
return 0;
}
......@@ -4,44 +4,19 @@
#include "pwr.h"
#include "wb_orep.h"
#include "pwr_class.h"
typedef struct {
pwr_tTime time;
pwr_tUInt32 size;
} ldh_sBodyRef;
typedef struct {
} LdhDbBody;
typedef struct {
pwr_tOid oid; /**< object identifier */
pwr_tCid cid; /**< class identifier */
pwr_tOid poid; /**< object identifier of parent */
pwr_tObjName name; /**< name of object */
pwr_tObjName normname; /**< normalized object name. */
pwr_tTime time; /**< time of last change in object header */
pwr_tOid soid; /**< object identifier of server object. */
pwr_tOid boid; /**< object before this object. */
pwr_tOid aoid; /**< object after this object. */
pwr_tOid foid; /**< first child object. */
pwr_tOid loid; /**< last child object. */
pwr_mClassDef flags;
ldh_sBodyRef body[2]; /**< runtime body */
//dbs_sBodyRef dbody; /**< development body */
} ldh_sOhead;
#include "wb_db.h"
class wb_orepdb : wb_orep
{
friend class wb_vrepdb;
db_sObject *m_o;
pwr_tOid m_oid;
public:
ldh_sOhead m_ohead;
wb_orepdb();
wb_orepdb(pwr_tOid oid);
wb_orepdb(db_sObject *o);
~wb_orepdb();
virtual pwr_tOid oid() const;
......
......@@ -31,17 +31,17 @@ wb_orepdbs::~wb_orepdbs()
#endif
/*
wb_orepdbs *wb_orepdbs::ref()
{
wb_orepdbs *wb_orepdbs::ref()
{
m_refCount++;
return this;
}
}
void wb_orepdbs::unref()
{
void wb_orepdbs::unref()
{
if (--m_refCount == 0)
delete this;
}
}
*/
pwr_tOid wb_orepdbs::oid() const
......@@ -198,16 +198,14 @@ wb_adrep *wb_orepdbs::attribute(pwr_tStatus *sts, const char *name)
return 0;//m_vrep->attribute(sts, cid(), name);
}
wb_position
wb_orepdbs::position()
wb_position wb_orepdbs::position()
{
wb_position pos;
return pos;
}
wb_position
wb_orepdbs::position(ldh_eDest dest)
wb_position wb_orepdbs::position(ldh_eDest dest)
{
wb_position pos;
......
......@@ -136,7 +136,7 @@ wb_orep *wb_orepwbl::next(pwr_tStatus *sts) const
wb_orep *wb_orepwbl::previous(pwr_tStatus *sts) const
{
return m_vrep->previous(sts, (wb_orep *)this);
return m_vrep->previous(sts, (wb_orep *)this); //
}
......
/* wb_session.h -- work bench database session
PROVIEW/R
Copyright (C) 2002 by Stiftelsen Proview.
PROVIEW/R
Copyright (C) 2002 by Stiftelsen Proview.
. */
. */
#ifndef wb_session_h
#define wb_session_h
......
......@@ -33,7 +33,7 @@ public:
const char *name() const;
wb_name longName();
private:
private:
void check() const;
};
......
......@@ -42,7 +42,7 @@ public:
pwr_tStatus sts() { return m_sts;}
private:
private:
void init();
};
......
......@@ -9,6 +9,7 @@
#include "wb_name.h"
#include "wb_cdef.h"
#include "wb_destination.h"
#include "wb_export.h"
#include <map>
class wb_erep;
......@@ -18,7 +19,7 @@ class wb_cdef;
class wb_destination;
class wb_dbs;
class wb_vrep
class wb_vrep : public wb_export
{
protected:
char m_name[80];
......@@ -33,6 +34,23 @@ public:
virtual wb_vrep *next() const = 0;
virtual pwr_tOid oid(pwr_tStatus *sts, wb_orep *o) const = 0;
virtual pwr_tVid vid(pwr_tStatus *sts, wb_orep *o) const = 0;
virtual pwr_tOix oix(pwr_tStatus *sts, wb_orep *o) const = 0;
virtual pwr_tCid cid(pwr_tStatus *sts, wb_orep *o) const = 0;
virtual pwr_tOid poid(pwr_tStatus *sts, wb_orep *o) const = 0;
virtual pwr_tOid foid(pwr_tStatus *sts, wb_orep *o) const = 0;
virtual pwr_tOid loid(pwr_tStatus *sts, wb_orep *o) const = 0;
virtual pwr_tOid boid(pwr_tStatus *sts, wb_orep *o) const = 0;
virtual pwr_tOid aoid(pwr_tStatus *sts, wb_orep *o) const = 0;
virtual const char * objectName(pwr_tStatus *sts, wb_orep *o) const = 0;
virtual wb_name longName(pwr_tStatus *sts, wb_orep *o) = 0;
virtual pwr_tTime ohTime(pwr_tStatus *sts, wb_orep *o) const = 0;
virtual bool isOffspringOf(pwr_tStatus *sts, const wb_orep *child, const wb_orep *parent) const = 0;
virtual wb_orep *object(pwr_tStatus *sts) = 0;
virtual wb_orep *object(pwr_tStatus *sts, pwr_tOid oid) = 0;
virtual wb_orep *object(pwr_tStatus *sts, wb_name name) = 0;
......@@ -55,13 +73,13 @@ public:
virtual bool commit(pwr_tStatus *sts) = 0;
virtual bool abort(pwr_tStatus *sts) = 0;
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p) = 0;
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p) = 0;
virtual void *readAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p) = 0;
virtual void *readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p) = 0;
virtual void *readBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p) = 0;
virtual void *readBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p) = 0;
virtual bool writeBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p) = 0;
virtual bool writeBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p) = 0;
virtual wb_orep *ancestor(pwr_tStatus *sts, wb_orep *o) = 0;
......@@ -92,9 +110,6 @@ public:
virtual bool createSnapshot(const char *fileName) = 0;
virtual void iterObject(wb_dbs *) = 0;
virtual void iterRbody(wb_dbs *) = 0;
virtual void iterDbody(wb_dbs *) = 0;
virtual void objectName(wb_orep *o, char *str) = 0;
virtual bool isCommonMeta() const { return false;}
virtual bool isMeta() const { return false;}
......
This diff is collapsed.
......@@ -3,9 +3,10 @@
#include "wb_vrep.h"
#include "wb_orepdb.h"
#include "wb_db.h"
#include "db_cxx.h"
class wb_vrepdb : public wb_vrep , public DbEnv
class wb_vrepdb : public wb_vrep
{
protected:
pwr_tVid m_vid;
......@@ -16,103 +17,121 @@ protected:
unsigned int m_nSession;
unsigned int m_nRef;
Db *m_db_ohead;
Db *m_db_obody;
Db *m_db_clist;
Db *m_db_name;
Db *m_db_info;
#if 0
DbEnv *m_dbenv;
Db *m_t_ohead;
Db *m_t_obody;
Db *m_t_class;
Db *m_t_name;
Db *m_t_info;
DbTxn *m_txn;
class oh_k : public Dbt
class db_ohead
{
pwr_tOix m_oix;
public:
oh_k();
oh_k(wb_orepdb *o);
oh_k(pwr_tOix Oix);
db_sObject m_o;
Dbt m_key;
Dbt m_data;
Db *m_t_ohead;
db_ohead(Db *t_ohead);
db_ohead(Db *t_ohead, pwr_tOid oid);
db_ohead(Db *t_ohead, DbTxn *txn, pwr_tOid oid);
db_ohead(Db *t_ohead, DbTxn *txn, wb_orep *orp);
db_ohead &get(DbTxn *txn);
db_ohead &get(DbTxn *txn, wb_orep *o);
db_ohead &get(DbTxn *txn, pwr_tOid oid);
void put(DbTxn *txn);
void del(DbTxn *txn);
pwr_tOid oid() { return m_o.oid;}
pwr_tCid cid() { return m_o.cid;}
pwr_tOid poid() { return m_o.poid;}
pwr_tOid foid() { return m_o.foid;}
pwr_tOid loid() { return m_o.loid;}
pwr_tOid boid() { return m_o.boid;}
pwr_tOid aoid() { return m_o.aoid;}
char *name();
void name(wb_name &name);
void poid(pwr_tOid oid) { m_o.poid = oid;}
void foid(pwr_tOid oid) { m_o.foid = oid;}
void loid(pwr_tOid oid) { m_o.loid = oid;}
void boid(pwr_tOid oid) { m_o.boid = oid;}
void aoid(pwr_tOid oid) { m_o.aoid = oid;}
void clear();
};
class oh_d : public Dbt
class db_name
{
wb_orepdb *m_orep;
public:
oh_d();
oh_d(wb_orepdb *o);
oh_d(pwr_tOix Oix);
};
class ob_k : public Dbt
struct
{
public:
pwr_tOid poid;
pwr_tObjName normname;
} m_k;
struct
{
pwr_tOid oid;
//pwr_tCid cid; // saved here to optimize tree traversal
//pwr_mClassDef flags; // saved here to optimize tree traversal
} m_d;
struct {
pwr_tOix oix;
pwr_eBix bix;
} m_data;
Dbt m_key;
Dbt m_data;
Db *m_t_name;
ob_k();
ob_k(wb_orepdb *o);
ob_k(wb_orepdb *o, pwr_eBix bix);
ob_k(pwr_tOix oix);
ob_k(pwr_tOix oix, pwr_eBix bix);
};
db_name(Db *t_name, DbTxn *txn);
db_name(Db *t_name, db_ohead &o);
db_name(Db *t_name, pwr_tOid, char *name);
db_name(Db *t_name, DbTxn *txn, pwr_tOid poid, const char *name);
db_name(Db *t_name, DbTxn *txn, pwr_tOid poid, wb_name name);
class na_k : public Dbt
{
public:
void get(DbTxn *txn);
void put(DbTxn *txn);
void del(DbTxn *txn);
struct {
pwr_tOix poix;
//pwr_tName name;
char name[32];
} m_key;
na_k();
na_k(wb_orepdb *o);
na_k(wb_orepdb *o, const char *name);
na_k(pwr_tOix poix);
na_k(pwr_tOix poix, const char *name);
na_k(pwr_tOix poix, wb_name name);
void name(wb_name &name);
pwr_tOid oid() { return m_d.oid;}
};
class na_d : public Dbt
class db_class
{
public:
pwr_tOix m_oix;
na_d();
na_d(wb_orepdb *o);
na_d(pwr_tOix oix);
struct
{
pwr_tCid cid;
pwr_tOid oid;
} m_k;
pwr_tOix oix();
};
Dbt m_key;
Db *m_t_class;
Dbc *m_dbc;
#if 0
int wb_vrepdb::get_ohead(DbTxn *txn, wb_orepdb *o);
int wb_vrepdb::get_ohead(wb_orep **orep, DbTxn *txn, pwr_tOid oid);
int wb_vrepdb::get_ohead(wb_orep **orep, DbTxn *txn, wb_orepdb *o, const char *name);
db_class(Db *t_class, pwr_tCid cid);
db_class(Db *t_class, db_ohead &o);
db_class(Db *t_class, DbTxn *txn, pwr_tCid cid);
~db_class();
int wb_vrepdb::put_ohead(DbTxn *txn, wb_orepdb *o, u_int32_t flags);
bool succ(DbTxn *txn, pwr_tOid oid);
bool pred(DbTxn *txn, pwr_tOid oid);
void put(DbTxn *txn);
void del(DbTxn *txn);
int wb_vrepdb::del_ohead(DbTxn *txn, wb_orepdb *o);
pwr_tCid cid() { return m_k.cid;}
pwr_tOid oid() { return m_k.oid;}
int wb_vrepdb::get_clist(DbTxn *txn, wb_orepdb *o);
int wb_vrepdb::put_clist(DbTxn *txn, wb_orepdb *o, u_int32_t flags);
int wb_vrepdb::del_clist(DbTxn *txn, wb_orepdb *o);
};
int wb_vrepdb::get_name(DbTxn *txn, wb_orepdb *o);
int wb_vrepdb::put_name(DbTxn *txn, wb_orepdb *o, u_int32_t flags);
int wb_vrepdb::del_name(DbTxn *txn, wb_orepdb *o);
wb_db::db_ohead m_ohead;
pwr_tOix wb_vrepdb::new_oix(DbTxn *txn);
int wb_vrepdb::del_family(DbTxn *txn, Dbc *cp, pwr_tOix poix);
......@@ -120,6 +139,10 @@ protected:
public:
wb_db *m_db;
wb_db_txn *m_txn;
wb_db_ohead m_ohead;
wb_vrepdb();
~wb_vrepdb();
......@@ -128,6 +151,27 @@ public:
virtual wb_erep *erep();
pwr_tTime ohTime(pwr_tStatus *sts, const wb_orep * const o);
pwr_tOid oid(pwr_tStatus *sts, const wb_orep * const o);
pwr_tVid vid(pwr_tStatus *sts, const wb_orep * const o);
pwr_tOix oix(pwr_tStatus *sts, const wb_orep * const o);
pwr_tCid cid(pwr_tStatus *sts, const wb_orep * const o);
pwr_tOid poid(pwr_tStatus *sts, const wb_orep * const o);
pwr_tOid foid(pwr_tStatus *sts, const wb_orep * const o);
pwr_tOid loid(pwr_tStatus *sts, const wb_orep * const o);
pwr_tOid boid(pwr_tStatus *sts, const wb_orep * const o);
pwr_tOid aoid(pwr_tStatus *sts, const wb_orep * const o);
virtual const char * objectName(pwr_tStatus *sts, wb_orep *o) const;
virtual wb_name longName(pwr_tStatus *sts, wb_orep *o);
virtual pwr_tTime ohTime(pwr_tStatus *sts, wb_orep *o) const;
virtual bool isOffspringOf(pwr_tStatus *sts, const wb_orep *child, const wb_orep *parent) const;
virtual wb_orep *object(pwr_tStatus *sts);
virtual wb_orep *object(pwr_tStatus *sts, pwr_tOid oid);
virtual wb_orep *object(pwr_tStatus *sts, const char *name);
virtual wb_orep *object(pwr_tStatus *sts, wb_orep *parent, wb_name name);
......@@ -149,37 +193,56 @@ public:
virtual bool commit(pwr_tStatus *sts);
virtual bool abort(pwr_tStatus *sts);
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p);
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p);
virtual void *readAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p);
virtual void *readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p);
virtual void *readBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p);
virtual void *readBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p);
virtual bool writeBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p);
virtual bool writeBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p);
virtual wb_orep *ancestor(pwr_tStatus *sts, wb_orep *o) const;
virtual wb_orep *ancestor(pwr_tStatus *sts, wb_orep *o);
virtual wb_orep *parent(pwr_tStatus *sts, wb_orep *o) const;
virtual wb_orep *parent(pwr_tStatus *sts, wb_orep *o);
virtual wb_orep *after(pwr_tStatus *sts, wb_orep *o) const;
virtual wb_orep *after(pwr_tStatus *sts, wb_orep *o);
virtual wb_orep *before(pwr_tStatus *sts, wb_orep *o) const;
virtual wb_orep *before(pwr_tStatus *sts, wb_orep *o);
virtual wb_orep *first(pwr_tStatus *sts, wb_orep *o) const;
virtual wb_orep *first(pwr_tStatus *sts, wb_orep *o);
virtual wb_orep *child(pwr_tStatus *sts, wb_orep *o, const char *name) const;
virtual wb_orep *child(pwr_tStatus *sts, wb_orep *o, const char *name);
virtual wb_orep *last(pwr_tStatus *sts, wb_orep *o) const;
virtual wb_orep *last(pwr_tStatus *sts, wb_orep *o);
virtual wb_orep *next(pwr_tStatus *sts, wb_orep *o) const;
virtual wb_orep *next(pwr_tStatus *sts, wb_orep *o);
virtual wb_orep *previous(pwr_tStatus *sts, wb_orep *o) const;
virtual wb_orep *previous(pwr_tStatus *sts, wb_orep *o);
virtual wb_srep *newSession();
virtual bool isLocal(wb_orep *o) const;
virtual pwr_tVid vid() const;
virtual void objectName(wb_orep *o, const char *str);
void load(char *name);
virtual bool exportVolume(wb_import &e);
virtual bool exportHead(wb_import &e);
virtual bool exportRbody(wb_import &e);
virtual bool exportDbody(wb_import &e);
virtual bool exportMeta(wb_import &e);
//pwr_tOid new_oid(DbTxn *txn);
#if 0
int del_family(DbTxn *txn, Dbc *cp, pwr_tOid poid);
#endif
void unadopt(wb_db_txn *txn, wb_db_ohead &o);
void adopt(wb_db_txn *txn, wb_db_ohead &o, wb_destination &dest);
};
#endif
......@@ -25,8 +25,7 @@ wb_vrepdbs::wb_vrepdbs(wb_erep *erep, const char *fileName) : m_erep(erep)
m_merep = new wb_merep(m_erep, (wb_mvrep *)this);
}
dbs_sEnv *
wb_vrepdbs::dbsenv()
dbs_sEnv *wb_vrepdbs::dbsenv()
{
dbs_sEnv *ep;
pwr_tStatus sts;
......@@ -47,8 +46,7 @@ wb_vrepdbs::dbsenv()
return ep;
}
bool
wb_vrepdbs::load()
bool wb_vrepdbs::load()
{
pwr_tStatus sts;
bool rsts = ( dbsenv() != 0);
......@@ -60,8 +58,7 @@ wb_vrepdbs::load()
}
wb_orep *
wb_vrepdbs::object(pwr_tStatus *sts, pwr_tOid oid)
wb_orep *wb_vrepdbs::object(pwr_tStatus *sts, pwr_tOid oid)
{
*sts = LDH__SUCCESS;
......@@ -72,8 +69,7 @@ wb_vrepdbs::object(pwr_tStatus *sts, pwr_tOid oid)
return new (this) wb_orepdbs(op);
}
wb_orep *
wb_vrepdbs::object(pwr_tStatus *sts, wb_name name)
wb_orep *wb_vrepdbs::object(pwr_tStatus *sts, wb_name name)
{
*sts = LDH__SUCCESS;
......@@ -91,8 +87,7 @@ wb_vrepdbs::object(pwr_tStatus *sts, wb_name name)
return new (this) wb_orepdbs(op);
}
wb_orep *
wb_vrepdbs::object(pwr_tStatus *sts, wb_orep *parent, wb_name name)
wb_orep *wb_vrepdbs::object(pwr_tStatus *sts, wb_orep *parent, wb_name name)
{
*sts = LDH__SUCCESS;
......@@ -106,92 +101,77 @@ wb_vrepdbs::object(pwr_tStatus *sts, wb_orep *parent, wb_name name)
}
wb_orep *
wb_vrepdbs::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination d, wb_name name)
wb_orep *wb_vrepdbs::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination d, wb_name name)
{
*sts = LDH__NYI;
return 0;
}
wb_orep *
wb_vrepdbs::copyObject(pwr_tStatus *sts, wb_orep *orep, wb_destination d, wb_name name)
wb_orep *wb_vrepdbs::copyObject(pwr_tStatus *sts, wb_orep *orep, wb_destination d, wb_name name)
{
*sts = LDH__NYI;
return 0;
}
bool
wb_vrepdbs::copyOset(pwr_tStatus *sts, wb_oset *oset, wb_destination d)
bool wb_vrepdbs::copyOset(pwr_tStatus *sts, wb_oset *oset, wb_destination d)
{
*sts = LDH__NYI;
return false;
}
bool
wb_vrepdbs::moveObject(pwr_tStatus *sts, wb_orep *orep, wb_destination d)
bool wb_vrepdbs::moveObject(pwr_tStatus *sts, wb_orep *orep, wb_destination d)
{
*sts = LDH__NYI;
return false;
}
bool
wb_vrepdbs::deleteObject(pwr_tStatus *sts, wb_orep *orep)
bool wb_vrepdbs::deleteObject(pwr_tStatus *sts, wb_orep *orep)
{
*sts = LDH__NYI;
return false;
}
bool
wb_vrepdbs::deleteFamily(pwr_tStatus *sts, wb_orep *orep)
bool wb_vrepdbs::deleteFamily(pwr_tStatus *sts, wb_orep *orep)
{
*sts = LDH__NYI;
return false;
}
bool
wb_vrepdbs::deleteOset(pwr_tStatus *sts, wb_oset *oset)
bool wb_vrepdbs::deleteOset(pwr_tStatus *sts, wb_oset *oset)
{
*sts = LDH__NYI;
return false;
}
bool
wb_vrepdbs::renameObject(pwr_tStatus *sts, wb_orep *orep, wb_name name)
bool wb_vrepdbs::renameObject(pwr_tStatus *sts, wb_orep *orep, wb_name name)
{
*sts = LDH__NYI;
return false;
}
bool
wb_vrepdbs::commit(pwr_tStatus *sts)
bool wb_vrepdbs::commit(pwr_tStatus *sts)
{
*sts = LDH__SUCCESS;
return true;
}
bool
wb_vrepdbs::abort(pwr_tStatus *sts)
bool wb_vrepdbs::abort(pwr_tStatus *sts)
{
*sts = LDH__SUCCESS;
return true;
}
bool
wb_vrepdbs::writeAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p)
bool wb_vrepdbs::writeAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p)
{
*sts = LDH__NYI;
return false;
}
void *
wb_vrepdbs::readAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p)
{
void *wb_vrepdbs::readAttribute(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, unsigned int offset, unsigned int size, void *p)
{// note! must be compensated for offset !
*sts = LDH__SUCCESS;
dbs_sObject *op = ((wb_orepdbs *)o)->o();
......@@ -220,9 +200,7 @@ wb_vrepdbs::readAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned i
return (void *)((char *)bp + offset);
}
void *
wb_vrepdbs::readBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p)
void *wb_vrepdbs::readBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p)
{
*sts = LDH__SUCCESS;
......@@ -252,17 +230,13 @@ wb_vrepdbs::readBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p)
return bp;
}
bool
wb_vrepdbs::writeBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p)
bool wb_vrepdbs::writeBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p)
{
*sts = LDH__NYI;
return false;
}
wb_orep *
wb_vrepdbs::ancestor(pwr_tStatus *sts, wb_orep *o)
wb_orep *wb_vrepdbs::ancestor(pwr_tStatus *sts, wb_orep *o)
{
*sts = LDH__SUCCESS;
......@@ -275,9 +249,7 @@ wb_vrepdbs::ancestor(pwr_tStatus *sts, wb_orep *o)
return new (this) wb_orepdbs(op);
}
wb_orep *
wb_vrepdbs::parent(pwr_tStatus *sts, wb_orep *o)
wb_orep *wb_vrepdbs::parent(pwr_tStatus *sts, wb_orep *o)
{
*sts = LDH__SUCCESS;
......@@ -290,8 +262,7 @@ wb_vrepdbs::parent(pwr_tStatus *sts, wb_orep *o)
return new (this) wb_orepdbs(op);
}
wb_orep *
wb_vrepdbs::after(pwr_tStatus *sts, wb_orep *o)
wb_orep *wb_vrepdbs::after(pwr_tStatus *sts, wb_orep *o)
{
*sts = LDH__SUCCESS;
......@@ -304,8 +275,7 @@ wb_vrepdbs::after(pwr_tStatus *sts, wb_orep *o)
return new (this) wb_orepdbs(op);
}
wb_orep *
wb_vrepdbs::before(pwr_tStatus *sts, wb_orep *o)
wb_orep *wb_vrepdbs::before(pwr_tStatus *sts, wb_orep *o)
{
*sts = LDH__SUCCESS;
......@@ -318,9 +288,7 @@ wb_vrepdbs::before(pwr_tStatus *sts, wb_orep *o)
return new (this) wb_orepdbs(op);
}
wb_orep *
wb_vrepdbs::first(pwr_tStatus *sts, wb_orep *o)
wb_orep *wb_vrepdbs::first(pwr_tStatus *sts, wb_orep *o)
{
*sts = LDH__SUCCESS;
......@@ -333,9 +301,7 @@ wb_vrepdbs::first(pwr_tStatus *sts, wb_orep *o)
return new (this) wb_orepdbs(op);
}
wb_orep *
wb_vrepdbs::child(pwr_tStatus *sts, wb_orep *o, wb_name name)
wb_orep *wb_vrepdbs::child(pwr_tStatus *sts, wb_orep *o, wb_name name)
{
*sts = LDH__SUCCESS;
......@@ -348,9 +314,7 @@ wb_vrepdbs::child(pwr_tStatus *sts, wb_orep *o, wb_name name)
return new (this) wb_orepdbs(op);
}
wb_orep *
wb_vrepdbs::last(pwr_tStatus *sts, wb_orep *o)
wb_orep *wb_vrepdbs::last(pwr_tStatus *sts, wb_orep *o)
{
*sts = LDH__SUCCESS;
......@@ -364,8 +328,7 @@ wb_vrepdbs::last(pwr_tStatus *sts, wb_orep *o)
}
wb_orep *
wb_vrepdbs::next(pwr_tStatus *sts, wb_orep *o)
wb_orep *wb_vrepdbs::next(pwr_tStatus *sts, wb_orep *o)
{
*sts = LDH__SUCCESS;
......@@ -378,8 +341,7 @@ wb_vrepdbs::next(pwr_tStatus *sts, wb_orep *o)
return new (this) wb_orepdbs(op);
}
wb_orep *
wb_vrepdbs::previous(pwr_tStatus *sts, wb_orep *o)
wb_orep *wb_vrepdbs::previous(pwr_tStatus *sts, wb_orep *o)
{
*sts = LDH__SUCCESS;
......@@ -392,18 +354,14 @@ wb_vrepdbs::previous(pwr_tStatus *sts, wb_orep *o)
return new (this) wb_orepdbs(op);
}
wb_srep *
wb_vrepdbs::newSession()
wb_srep *wb_vrepdbs::newSession()
{
// *sts = LDH__SUCCESS;
return (wb_srep*)0;
}
wb_orep *
wb_vrepdbs::object(pwr_tStatus *sts)
wb_orep *wb_vrepdbs::object(pwr_tStatus *sts)
{
*sts = LDH__SUCCESS;
......@@ -416,82 +374,57 @@ wb_vrepdbs::object(pwr_tStatus *sts)
return new (this) wb_orepdbs(op);
}
bool
wb_vrepdbs::isLocal(wb_orep *) const
bool wb_vrepdbs::isLocal(wb_orep *) const
{
//*sts = LDH__NYI;
return false;
}
pwr_tCid
wb_vrepdbs::cid() const
pwr_tCid wb_vrepdbs::cid() const
{
return m_dbsenv.vp->cid;;
}
pwr_tVid
wb_vrepdbs::vid() const
pwr_tVid wb_vrepdbs::vid() const
{
return m_vid;
}
wb_erep *
wb_vrepdbs::erep() const
wb_erep *wb_vrepdbs::erep() const
{
return m_erep;
}
wb_vrep *
wb_vrepdbs::next () const
wb_vrep *wb_vrepdbs::next () const
{
pwr_tStatus sts;
return m_erep->nextVolume( &sts, vid());
}
wb_merep *
wb_vrepdbs::merep() const
wb_merep *wb_vrepdbs::merep() const
{
return m_merep;
}
bool
wb_vrepdbs::createSnapshot(const char *)
bool wb_vrepdbs::createSnapshot(const char *)
{
return false;
}
void
wb_vrepdbs::iterObject(wb_dbs *)
{
}
void
wb_vrepdbs::iterRbody(wb_dbs *)
{
}
void
wb_vrepdbs::iterDbody(wb_dbs *)
{
}
wb_orepdbs *
wb_vrepdbs::new_wb_orepdbs(size_t size)
wb_orepdbs *wb_vrepdbs::new_wb_orepdbs(size_t size)
{
wb_orepdbs *o = (wb_orepdbs *) calloc(1, size);
o->m_vrep = this;
return o;
}
void
wb_vrepdbs::delete_wb_orepdbs(void *p)
void wb_vrepdbs::delete_wb_orepdbs(void *p)
{
free(p);
}
void
wb_vrepdbs::objectName(wb_orep *o, char *str)
void wb_vrepdbs::objectName(wb_orep *o, char *str)
{
pwr_tStatus sts;
......@@ -499,4 +432,3 @@ wb_vrepdbs::objectName(wb_orep *o, char *str)
dbs_ObjectToName(&sts, dbsenv(), ((wb_orepdbs *)o)->o(), str);
}
......@@ -36,6 +36,31 @@ public:
virtual wb_erep *erep() const;
virtual pwr_tOid oid(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNOid;}
virtual pwr_tVid vid(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNVid;}
virtual pwr_tOix oix(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNOix;}
virtual pwr_tCid cid(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNCid;}
virtual pwr_tOid poid(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNOid;}
virtual pwr_tOid foid(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNOid;}
virtual pwr_tOid loid(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNOid;}
virtual pwr_tOid boid(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNOid;}
virtual pwr_tOid aoid(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNOid;}
virtual const char * objectName(pwr_tStatus *sts, wb_orep *o) const { return "";}
virtual wb_name longName(pwr_tStatus *sts, wb_orep *o) { return wb_name();}
virtual pwr_tTime ohTime(pwr_tStatus *sts, wb_orep *o) const { pwr_tTime t = {0, 0}; return t;}
virtual bool isOffspringOf(pwr_tStatus *sts, const wb_orep *child, const wb_orep *parent) const { return false;}
virtual wb_orep *object(pwr_tStatus *sts, pwr_tOid oid);
virtual wb_orep *object(pwr_tStatus *sts, wb_name name);
virtual wb_orep *object(pwr_tStatus *sts, wb_orep *parent, wb_name name);
......@@ -98,11 +123,17 @@ public:
virtual pwr_tCid cid () const;
virtual wb_merep *merep () const;
virtual bool createSnapshot (const char *);
virtual void iterObject (wb_dbs *);
virtual void iterRbody (wb_dbs *);
virtual void iterDbody (wb_dbs *);
virtual bool isCommonMeta() const { return true;}
virtual bool isMeta() const { return (cid() == pwr_eClass_ClassVolume);}
virtual bool exportVolume(wb_import &e) { return false;}
virtual bool exportHead(wb_import &e) { return false;}
virtual bool exportRbody(wb_import &e) { return false;}
virtual bool exportDbody(wb_import &e) { return false;}
virtual bool exportMeta(wb_import &e) { return false;}
};
......
......@@ -105,7 +105,7 @@ wb_vrepwbl::createSnapshot(const char *fileName)
try {
wb_dbs dbs(this);
dbs.buildFile();
dbs.importVolume(*this);
return true;
} catch (wb_error& e) {
......@@ -113,6 +113,7 @@ wb_vrepwbl::createSnapshot(const char *fileName)
}
}
#if 0
void wb_vrepwbl::iterObject( wb_dbs *dbs)
{
if ( root_object)
......@@ -130,6 +131,48 @@ void wb_vrepwbl::iterRbody( wb_dbs *dbs)
if ( root_object)
root_object->iterRbody( dbs);
}
#endif
bool
wb_vrepwbl::exportVolume(wb_import &i)
{
try {
i.importVolume(*this);
return true;
} catch (wb_error& e) {
return false;
}
}
bool wb_vrepwbl::exportHead(wb_import &i)
{
if ( root_object)
return root_object->exportHead(i);
else
return false;
}
bool wb_vrepwbl::exportDbody(wb_import &i)
{
if ( root_object)
return root_object->exportDbody(i);
else
return false;
}
bool wb_vrepwbl::exportRbody(wb_import &i)
{
if ( root_object)
return root_object->exportRbody(i);
else
return false;
}
bool wb_vrepwbl::exportMeta(wb_import &i)
{
return false;
}
int wb_vrepwbl::load( const char *fname)
{
......
......@@ -4,7 +4,6 @@
#include <string>
#include "wb_vrep.h"
#include "wb_orepdb.h"
#include "antlr/AST.hpp"
#include "wb_wbllexer.hpp"
#include "wb_wblparser.hpp"
......@@ -43,11 +42,10 @@ class wb_vrepwbl : public wb_vrep
public:
wb_vrepwbl( wb_erep *erep) :
m_erep(erep), m_merep(erep->merep()), root_object(0), error_cnt(0),
file_cnt(0), next_oix(0), volume_node(0) {}
m_erep(erep), m_merep(erep->merep()), root_object(0), error_cnt(0), file_cnt(0), next_oix(0), volume_node(0) {}
wb_vrepwbl( wb_erep *erep, pwr_tVid vid) :
m_vid(vid), m_erep(erep), m_merep(erep->merep()), root_object(0),
error_cnt(0), file_cnt(0), next_oix(0), volume_node(0) {}
m_vid(vid), m_erep(erep), m_merep(erep->merep()), root_object(0),error_cnt(0), file_cnt(0), next_oix(0), volume_node(0) {}
~wb_vrepwbl();
pwr_tVid vid() const { return m_vid;}
......@@ -57,9 +55,6 @@ public:
virtual bool createSnapshot(const char *fileName);
virtual void iterObject(wb_dbs *);
virtual void iterRbody(wb_dbs *);
virtual void iterDbody(wb_dbs *);
#if 0
void iterObject( void *udata,
pwr_tStatus (*bc)(void *,pwr_tOid, pwr_tCid, pwr_tOid, pwr_tOid,
......@@ -113,39 +108,61 @@ public:
virtual void unref();
virtual wb_vrep *ref();
wb_erep *erep() const {return m_erep;};
wb_erep *erep() const {return m_erep;}
wb_merep *merep() const { return m_merep;}
virtual pwr_tOid oid(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNOid;}
virtual pwr_tVid vid(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNVid;}
virtual pwr_tOix oix(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNOix;}
virtual pwr_tCid cid(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNCid;}
virtual pwr_tOid poid(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNOid;}
virtual pwr_tOid foid(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNOid;}
virtual pwr_tOid loid(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNOid;}
virtual pwr_tOid boid(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNOid;}
virtual pwr_tOid aoid(pwr_tStatus *sts, wb_orep *o) const { return pwr_cNOid;}
virtual const char * objectName(pwr_tStatus *sts, wb_orep *o) const { return "";}
virtual wb_name longName(pwr_tStatus *sts, wb_orep *o) { return wb_name();}
virtual pwr_tTime ohTime(pwr_tStatus *sts, wb_orep *o) const { pwr_tTime t = {0, 0}; return t;}
virtual bool isOffspringOf(pwr_tStatus *sts, const wb_orep *child, const wb_orep *parent) const { return false;}
wb_orep *object(pwr_tStatus *sts);
wb_orep *object(pwr_tStatus *sts, pwr_tOid oid);
wb_orep *object(pwr_tStatus *sts, wb_name name);
wb_orep *object(pwr_tStatus *sts, wb_orep *parent, wb_name name)
{return 0;};
wb_orep *object(pwr_tStatus *sts, wb_orep *parent, wb_name name) {return 0;}
wb_orep *createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination d, wb_name name) {return 0;};
wb_orep *createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination d, wb_name name) {return 0;}
wb_orep *copyObject(pwr_tStatus *sts, wb_orep *orep, wb_destination d, wb_name name) {return 0;};
bool copyOset(pwr_tStatus *sts, wb_oset *oset, wb_destination d)
{return false;};
wb_orep *copyObject(pwr_tStatus *sts, wb_orep *orep, wb_destination d, wb_name name) {return 0;}
bool copyOset(pwr_tStatus *sts, wb_oset *oset, wb_destination d) {return false;}
bool moveObject(pwr_tStatus *sts, wb_orep *orep, wb_destination d)
{return false;};
bool moveObject(pwr_tStatus *sts, wb_orep *orep, wb_destination d) {return false;}
bool deleteObject(pwr_tStatus *sts, wb_orep *orep) {return false;};
bool deleteFamily(pwr_tStatus *sts, wb_orep *orep) {return false;};
bool deleteOset(pwr_tStatus *sts, wb_oset *oset) {return false;};
bool deleteObject(pwr_tStatus *sts, wb_orep *orep) {return false;}
bool deleteFamily(pwr_tStatus *sts, wb_orep *orep) {return false;}
bool deleteOset(pwr_tStatus *sts, wb_oset *oset) {return false;}
bool renameObject(pwr_tStatus *sts, wb_orep *orep, wb_name name)
{return false;};
bool renameObject(pwr_tStatus *sts, wb_orep *orep, wb_name name) { return false;}
bool commit(pwr_tStatus *sts) {return false;};
bool abort(pwr_tStatus *sts) {return false;};
bool commit(pwr_tStatus *sts) {return false;}
bool abort(pwr_tStatus *sts) {return false;}
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p) {return false;};
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p) {return false;}
virtual void *readAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, unsigned int offset, unsigned int size, void *p);
virtual void *readBody(pwr_tStatus *sts, wb_orep *o, cdh_eBix bix, void *p) {return 0;}
virtual void *readBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p);
virtual bool writeBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p) {return false;};
......@@ -169,24 +186,17 @@ public:
wb_orep *previous(pwr_tStatus *sts, wb_orep *o);
wb_srep *newSession() {return 0;};
wb_srep *newSession() {return 0;}
bool isLocal(wb_orep *o) const {return false;};
bool isLocal(wb_orep *o) const {return false;}
void objectName(wb_orep *o, char *str);
virtual bool exportVolume(wb_import &i);
virtual bool exportHead(wb_import &i);
virtual bool exportRbody(wb_import &i);
virtual bool exportDbody(wb_import &i);
virtual bool exportMeta(wb_import &i);
};
#endif
......@@ -12,7 +12,7 @@ class wb_wbllexer;
class wb_wblnode;
class wb_wblfile {
public:
public:
wb_wbllexer *lexer;
wb_wblparser *parser;
wb_wblnode *rootAST;
......
......@@ -1374,6 +1374,7 @@ void wb_wblnode::registerNode( wb_vrepwbl *vol)
}
#if 0
void wb_wblnode::iterObject( wb_dbs *dbs)
{
ref_wblnode o_lch = get_o_lch();
......@@ -1416,6 +1417,55 @@ void wb_wblnode::iterRbody( wb_dbs *dbs)
if ( o_fws)
o_fws->iterRbody( dbs);
}
#endif
bool wb_wblnode::exportHead(wb_import &i)
{
ref_wblnode o_lch = get_o_lch();
pwr_tOid fthoid = o_fth ? o_fth->m_oid : pwr_cNOid;
pwr_tOid fwsoid = o_fws ? o_fws->m_oid : pwr_cNOid;
pwr_tOid bwsoid = o_bws ? o_bws->m_oid : pwr_cNOid;
pwr_tOid fchoid = o_fch ? o_fch->m_oid : pwr_cNOid;
pwr_tOid lchoid = o_lch ? o_lch->m_oid : pwr_cNOid;
wb_name n = wb_name(name);
i.importHead( m_oid, m_cid, fthoid, fwsoid, bwsoid, fchoid, lchoid, name, n.normName(cdh_mName_object),
getFileTime(), getFileTime(), getFileTime(), rbody_size, dbody_size);
if ( o_fch)
o_fch->exportHead( i);
if ( o_fws)
o_fws->exportHead( i);
return true;
}
bool wb_wblnode::exportDbody( wb_import &i)
{
i.importDbody( m_oid, dbody_size, dbody);
if ( o_fch)
o_fch->exportDbody( i);
if ( o_fws)
o_fws->exportDbody( i);
return true;
}
bool wb_wblnode::exportRbody( wb_import &i)
{
i.importRbody( m_oid, rbody_size, rbody);
if ( o_fch)
o_fch->exportRbody( i);
if ( o_fws)
o_fws->exportRbody( i);
return true;
}
void wb_wblnode::setFile( wb_wblfile *f)
{
......
......@@ -13,7 +13,9 @@ ANTLR_USING_NAMESPACE(antlr)
class wb_wblnode;
class wb_vrepwbl;
class wb_vrep;
class wb_dbs;
class wb_import;
typedef enum {
wbl_eNodeType_No,
......@@ -182,6 +184,11 @@ public:
pwr_tCid Cid() { return c_cid;}
int attrStringToValue( int type_id, char *value_str,
void *buffer_ptr, int buff_size, int attr_size);
bool exportHead(wb_import &i);
bool exportDbody(wb_import &i);
bool exportRbody(wb_import &i);
void iterObject(wb_dbs *);
void iterRbody(wb_dbs *);
void iterDbody(wb_dbs *);
......
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