Commit a3f49c08 authored by claes's avatar claes

Db classeditor step 1

parent 3900af6b
/*
* Proview $Id: wb_db.cpp,v 1.39 2007-11-22 15:10:23 claes Exp $
* Proview $Id: wb_db.cpp,v 1.40 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -497,7 +497,7 @@ void wb_db_ohead::name(pwr_tOid &oid)
{
memset(m_o.name, 0, sizeof(m_o.name));
memset(m_o.normname, 0, sizeof(m_o.normname));
sprintf(m_o.name, "O%d", oid.oix);
sprintf(m_o.name, "O%u", oid.oix);
strcpy(m_o.normname, m_o.name);
}
......@@ -1137,6 +1137,7 @@ pwr_tOid wb_db::new_oid(wb_db_txn *txn, pwr_tOid oid)
try {
wb_db_ohead o(this, txn, woid);
return pwr_cNOid;
} catch (DbException &e) {
pwr_tOix nextoix;
int rc = 0;
......@@ -1155,8 +1156,6 @@ pwr_tOid wb_db::new_oid(wb_db_txn *txn, pwr_tOid oid)
}
return woid;
}
cout << " Old oix found, force new " << woid.oix << " !\n";
return new_oid(txn);
}
int wb_db::del_family(wb_db_txn *txn, Dbc *cp, pwr_tOid poid)
......@@ -1207,7 +1206,10 @@ bool wb_db::commit(pwr_tStatus *sts)
if (rc)
printf("wb_db::commit, CHECK, rc %d\n", rc);
m_env->txn_begin(0, (DbTxn **)&m_txn, 0);
*sts = rc;
if ( rc)
*sts = LDH__DB;
else
*sts = LDH__SUCCESS;
printstat(m_env, "after commit");
return true;
}
......
/*
* Proview $Id: wb_dbms.cpp,v 1.3 2007-10-26 06:26:15 claes Exp $
* Proview $Id: wb_dbms.cpp,v 1.4 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -332,6 +332,7 @@ pwr_tOid wb_dbms::new_oid(wb_dbms_txn *txn, pwr_tOid oid)
try {
wb_dbms_ohead o(this, txn, woid);
return pwr_cNOid;
} catch (wb_dbms_error &e) {
pwr_tOix nextoix;
int rc = 0;
......@@ -350,8 +351,6 @@ pwr_tOid wb_dbms::new_oid(wb_dbms_txn *txn, pwr_tOid oid)
}
return woid;
}
cout << " Old oix found, force new " << woid.oix << " !\n";
return new_oid(txn);
}
int wb_dbms::del_family(wb_dbms_txn *txn, wb_dbms_cursor *cp, pwr_tOid poid)
......@@ -399,7 +398,10 @@ bool wb_dbms::commit(pwr_tStatus *sts)
printf("wb_dbms::commit, rc %d\n", rc);
m_env->txn_begin(0, (wb_dbms_txn **)&m_txn);
*sts = rc;
if ( rc)
*sts = LDH__DB;
else
*sts = LDH__SUCCESS;
return true;
}
......@@ -1371,7 +1373,7 @@ void wb_dbms_ohead::name(pwr_tOid &oid)
{
memset(m_o.name, 0, sizeof(m_o.name));
memset(m_o.normname, 0, sizeof(m_o.normname));
sprintf(m_o.name, "O%d", oid.oix);
sprintf(m_o.name, "O%u", oid.oix);
strcpy(m_o.normname, m_o.name);
}
......
/*
* Proview $Id: wb_erep.cpp,v 1.51 2007-08-24 13:39:43 claes Exp $
* Proview $Id: wb_erep.cpp,v 1.52 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -27,6 +27,7 @@
#include "wb_vrepdbs.h"
#include "wb_vrepdb.h"
//#include "wb_vrepdbms.h"
#include "wb_vrepced.h"
#include "wb_vrepref.h"
#include "wb_vrepext.h"
#include "wb_cdrep.h"
......@@ -578,8 +579,9 @@ void wb_erep::loadMeta( pwr_tStatus *status, char *db)
MsgWindow::message( 'E', "Unable to open volume", vname, e.what().c_str());
}
}
else if ( (cdh_NoCaseStrcmp( vol_array[2], "ClassVolume") == 0) ||
(strcmp( vol_array[3], "load") == 0)) {
else if ( (cdh_NoCaseStrcmp( vol_array[2], "ClassVolume") == 0 &&
strcmp( vol_array[0], "ClaesClassVolume") != 0) ||
(strcmp( vol_array[3], "load") == 0)) {
if ( nr != 4)
cout << "Syntax error in file: " << fname << endl;
......@@ -741,12 +743,26 @@ void wb_erep::loadMeta( pwr_tStatus *status, char *db)
}
}
else {
// Ced Test !!!
if ( strcmp( vol_array[0], "ClaesClassVolume") == 0) {
wb_vrepdb *vrepdb = new wb_vrepdb( this, vname);
wb_vrepced *vrepced = new wb_vrepced( this, vrepdb);
vrepced->name(vol_array[0]);
addDb( &sts, vrepced);
MsgWindow::message( 'I', "Classvolume Database opened", vname);
vol_cnt++;
}
else {
// End Ced Test !!!
// Open db
wb_vrepdb *vrepdb = new wb_vrepdb( this, vname);
vrepdb->name(vol_array[0]);
addDb( &sts, vrepdb);
MsgWindow::message( 'I', "Database opened", vname);
vol_cnt++;
}
}
}
}
......
/*
* Proview $Id: wb_ldh.cpp,v 1.62 2007-10-25 11:07:12 claes Exp $
* Proview $Id: wb_ldh.cpp,v 1.63 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -1605,7 +1605,8 @@ ldh_RevertSession(ldh_tSession session)
{
wb_session *sp = (wb_session*)session;
return sp->abort();
sp->abort();
return sp->sts();
}
/* Save all changes to objects done in the session. */
......@@ -1615,7 +1616,8 @@ ldh_SaveSession(ldh_tSession session)
{
wb_session *sp = (wb_session*)session;
return sp->commit();
sp->commit();
return sp->sts();
}
ldh_tVolume
......
/*
* Proview $Id: wb_lfu.cpp,v 1.7 2007-09-17 07:09:23 claes Exp $
* Proview $Id: wb_lfu.cpp,v 1.8 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -917,25 +917,59 @@ pwr_tStatus lfu_SaveDirectoryVolume(
break;
}
case pwr_cClass_ClassVolumeConfig : {
// Check wbload-file...
FILE *wblfile;
sprintf( fname, "$pwrp_db/%s.wb_load", volume_name);
cdh_ToLower( fname, fname);
dcli_translate_filename( fname, fname);
wblfile = fopen( fname, "r");
if ( wblfile == 0) {
wblfile = fopen( fname, "w");
if ( wblfile == 0) {
// Ced Test !!!!!!!!!!! TODO
if ( strcmp( volume_name, "ClaesClassVolume") == 0) {
/* Check if the databas is created */
sprintf( filename, "$pwrp_db/%s.db/info", volume_name);
cdh_ToLower( filename, filename);
dcli_translate_filename( filename, filename);
sts = dcli_search_file( filename, found_file, DCLI_DIR_SEARCH_INIT);
dcli_search_file( filename, found_file, DCLI_DIR_SEARCH_END);
if (EVEN(sts)) {
if ( wow) {
lfu_sCreaDb *data;
data = (lfu_sCreaDb *) calloc( 1, sizeof(*data));
strcpy( data->name, volumelist_ptr->volume_name);
data->vid = volumelist_ptr->volume_id;
data->cid = pwr_eClass_ClassVolume;
data->ldhses = ldhses;
sprintf( text, " ClassVolume '%s' is not yet created.\n \n\
Do you want to create this volume.\n",
volume_name);
wow->DisplayQuestion( NULL,
"Create Classvolume", text,
lfu_creadb_qb_yes, NULL, (void *)data);
}
}
else {
char msg[200];
sprintf( msg, "Error, unable to create file %s, ", fname);
sprintf( msg, "Error, Volume '%s' is not yet created.",
volume_name);
MsgWindow::message( 'E', msg, msgw_ePop_Default);
break;
}
}
}
else {
// Check wbload-file...
FILE *wblfile;
sprintf( fname, "$pwrp_db/%s.wb_load", volume_name);
cdh_ToLower( fname, fname);
dcli_translate_filename( fname, fname);
wblfile = fopen( fname, "r");
if ( wblfile == 0) {
wblfile = fopen( fname, "w");
if ( wblfile == 0) {
char msg[200];
sprintf( msg, "Error, unable to create file %s, ", fname);
MsgWindow::message( 'E', msg, msgw_ePop_Default);
break;
}
fprintf( wblfile, "Volume %s pwr_eClass_ClassVolume %s\nEndVolume\n",
volume_name, cdh_VolumeIdToString( 0, volumelist_ptr->volume_id, 0, 0));
fclose( wblfile);
fprintf( wblfile, "Volume %s pwr_eClass_ClassVolume %s\nEndVolume\n",
volume_name, cdh_VolumeIdToString( 0, volumelist_ptr->volume_id, 0, 0));
fclose( wblfile);
}
}
break;
}
......
/*
* Proview $Id: wb_orepced.cpp,v 1.1 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#include "wb_orepced.h"
wb_orepced::wb_orepced( wb_vrepced *v, wb_orep *n): m_vrep(v), m_orep(n)
{}
wb_orepced::~wb_orepced()
{
}
//
// Operations declared in wb_Orep
//
pwr_tOid wb_orepced::oid() const
{
return m_orep->oid();
}
pwr_tVid wb_orepced::vid() const
{
return m_orep->vid();
}
pwr_tOix wb_orepced::oix() const
{
return m_orep->oix();
}
pwr_tOix wb_orepced::cid() const
{
return m_orep->cid();
}
pwr_tOid wb_orepced::poid() const
{
return m_orep->poid();
}
pwr_tOid wb_orepced::foid() const
{
return m_orep->foid();
}
pwr_tOid wb_orepced::loid() const
{
return m_orep->loid();
}
pwr_tOid wb_orepced::boid() const
{
return m_orep->boid();
}
pwr_tOid wb_orepced::aoid() const
{
return m_orep->aoid();
}
const char * wb_orepced::name() const
{
return m_orep->name();
}
wb_name wb_orepced::longName()
{
return m_orep->longName();
}
pwr_tTime wb_orepced::ohTime() const
{
return m_orep->ohTime();
}
pwr_tTime wb_orepced::rbTime() const
{
return m_orep->rbTime();
}
pwr_tTime wb_orepced::dbTime() const
{
return m_orep->dbTime();
}
pwr_mClassDef wb_orepced::flags() const
{
return m_orep->flags();
}
bool wb_orepced::isOffspringOf(const wb_orep *o) const
{
return m_orep->isOffspringOf( o);
}
wb_orep *wb_orepced::ancestor(pwr_tStatus *sts)
{
return m_orep->ancestor( sts);
}
wb_orep *wb_orepced::parent(pwr_tStatus *sts)
{
return m_orep->parent( sts);
}
wb_orep *wb_orepced::after(pwr_tStatus *sts)
{
return m_orep->after( sts);
}
wb_orep *wb_orepced::before(pwr_tStatus *sts)
{
return m_orep->before( sts);
}
wb_orep *wb_orepced::first(pwr_tStatus *sts)
{
return m_orep->first( sts);
}
wb_orep *wb_orepced::child(pwr_tStatus *sts, wb_name &name)
{
return m_orep->child( sts, name);
}
wb_orep *wb_orepced::last(pwr_tStatus *sts)
{
return m_orep->last( sts);
}
wb_orep *wb_orepced::next(pwr_tStatus *sts)
{
return m_orep->next( sts);
}
wb_orep *wb_orepced::previous(pwr_tStatus *sts)
{
return m_orep->previous( sts);
}
wb_adrep *wb_orepced::attribute(pwr_tStatus* sts, const char *aname)
{
return m_orep->attribute( sts, aname);
}
wb_adrep *wb_orepced::attribute(pwr_tStatus* sts)
{
return m_orep->attribute( sts);
}
bool wb_orepced::docBlock( char **block, int *size) const
{
return m_orep->docBlock( block, size);
}
bool wb_orepced::docBlock( char *block)
{
return m_orep->docBlock( block);
}
/*
* Proview $Id: wb_orepced.h,v 1.1 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#ifndef wb_orepced_h
#define wb_orepced_h
#include "wb_orep.h"
#include "wb_vrepced.h"
#include "pwr.h"
class wb_orepced : public wb_orep
{
wb_vrepced *m_vrep;
unsigned int m_refCount;
wb_orep *m_orep;
public:
wb_orepced(int oix);
wb_orepced( wb_vrepced *v, wb_orep *n);
~wb_orepced();
// void* operator new(size_t size, wb_vrepced *v);
// void operator delete(void *p, size_t size, wb_vrepced *v);
virtual pwr_tOid oid() const;
virtual pwr_tVid vid() const;
virtual pwr_tOix oix() const;
virtual pwr_tCid cid() const;
virtual pwr_tOid poid() const;
virtual pwr_tOid foid() const;
virtual pwr_tOid loid() const;
virtual pwr_tOid boid() const;
virtual pwr_tOid aoid() const;
virtual const char * name() const;
virtual wb_name longName();
virtual pwr_tTime ohTime() const;
virtual pwr_tTime rbTime() const;
virtual pwr_tTime dbTime() const;
virtual pwr_mClassDef flags() const;
virtual bool isOffspringOf(const wb_orep *o) const;
// Navigational operations
wb_orep *ancestor(pwr_tStatus *sts); //< get object at top of hierarchy
wb_orep *parent(pwr_tStatus *sts);
wb_orep *after(pwr_tStatus *sts); //< get next sibling
wb_orep *before(pwr_tStatus *sts); //< get previous sibling
wb_orep *first(pwr_tStatus *sts); //< get first child
wb_orep *child(pwr_tStatus *sts, wb_name &name); //< get named child
wb_orep *last(pwr_tStatus *sts); //< get last child
wb_orep *next(pwr_tStatus *sts); //< get next in list of objects of same class in one volume
wb_orep *previous(pwr_tStatus *sts); //< get previous in list of objects of same class in one volume
virtual wb_adrep *attribute(pwr_tStatus*, const char *name);
virtual wb_adrep *attribute(pwr_tStatus*);
wb_erep *erep() const { return m_vrep->erep();}
wb_vrep *vrep() const { return m_vrep;}
virtual ldh_eVolRep vtype() const { return ldh_eVolRep_Ced;}
virtual bool docBlock( char **block, int *size) const;
virtual bool docBlock( char *block);
};
#endif
/*
* Proview $Id: wb_vrep.h,v 1.27 2006-06-08 13:39:33 claes Exp $
* Proview $Id: wb_vrep.h,v 1.28 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -93,7 +93,7 @@ public:
virtual wb_orep *object(pwr_tStatus *sts, const wb_orep *parent, wb_name &name) = 0;
virtual wb_orep *object(pwr_tStatus *sts, pwr_tCid cid) = 0;
virtual wb_orep *createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name) = 0;
virtual wb_orep *createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name, pwr_tOix oix = 0) = 0;
virtual wb_orep *copyObject(pwr_tStatus *sts, const wb_orep *orep, wb_destination &d, wb_name &name) = 0;
virtual bool copyOset(pwr_tStatus *sts, wb_oset *oset, wb_destination &d) = 0;
......
This diff is collapsed.
/*
* Proview $Id: wb_vrepced.h,v 1.1 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
#ifndef wb_vrepced_h
#define wb_vrepced_h
#include <string>
#include "wb_vrep.h"
#include "wb_erep.h"
#include "wb_attrname.h"
#include "wb_treeimport.h"
#include "co_dbs.h"
#include "co_tree.h"
#include "wb_import.h"
class wb_orepced;
class wb_vrepced : public wb_vrep
{
wb_erep *m_erep;
wb_merep *m_merep;
unsigned int m_nRef;
wb_vrep *m_vrep;
int m_errorCount;
tree_sTable *m_classbuild_th;
tree_sTable *m_typebuild_th;
public:
wb_vrepced( wb_erep *erep, wb_vrep *vrep) :
m_erep(erep), m_merep(erep->merep()), m_nRef(0), m_vrep(vrep) {
m_vid = m_vrep->vid();
m_cid = m_vrep->cid();
}
~wb_vrepced();
virtual ldh_eVolRep type() const { return ldh_eVolRep_Ced;}
pwr_tVid vid() const { return m_vid;}
pwr_tCid cid() const { return m_cid;}
wb_vrep *next() { return m_vrep->next();}
virtual bool createSnapshot(const char *fileName, const pwr_tTime *time);
virtual void unref();
virtual wb_vrep *ref();
virtual void name( const char *n);
wb_erep *erep() {return m_vrep->erep();}
wb_merep *merep() const { return m_vrep->merep();}
virtual pwr_tOid oid(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->oid( sts, o);}
virtual pwr_tVid vid(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->vid( sts, o);}
virtual pwr_tOix oix(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->oix( sts, o);}
virtual pwr_tCid cid(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->cid( sts, o);}
virtual pwr_tOid poid(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->poid( sts, o);}
virtual pwr_tOid foid(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->foid( sts, o);}
virtual pwr_tOid loid(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->loid( sts, o);}
virtual pwr_tOid boid(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->boid( sts, o);}
virtual pwr_tOid aoid(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->aoid( sts, o);}
virtual const char * objectName(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->objectName( sts, o);}
virtual wb_name longName(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->longName( sts, o);}
virtual pwr_tTime ohTime(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->ohTime( sts, o);}
virtual pwr_tTime rbTime(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->rbTime( sts, o);}
virtual pwr_tTime dbTime(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->dbTime( sts, o);}
virtual pwr_mClassDef flags(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->flags( sts, o);}
virtual bool isOffspringOf(pwr_tStatus *sts, const wb_orep *child, const wb_orep *parent) { return m_vrep->isOffspringOf( sts, child, parent);}
wb_orep *object(pwr_tStatus *sts) { return m_vrep->object( sts);}
wb_orep *object(pwr_tStatus *sts, pwr_tOid oid) { return m_vrep->object( sts, oid);}
wb_orep *object(pwr_tStatus *sts, pwr_tCid cid) { return m_vrep->object( sts, cid);}
wb_orep *object(pwr_tStatus *sts, wb_name &name) { return m_vrep->object( sts, name);}
wb_orep *object(pwr_tStatus *sts, const wb_orep *parent, wb_name &name) { return m_vrep->object( sts, parent, name);}
wb_orep *createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name,
pwr_tOix oix = 0);
wb_orep *copyObject(pwr_tStatus *sts, const wb_orep *orep, wb_destination &d, wb_name &name);
bool copyOset(pwr_tStatus *sts, wb_oset *oset, wb_destination &d) { return m_vrep->copyOset( sts, oset, d);}
bool moveObject(pwr_tStatus *sts, wb_orep *orep, wb_destination &d);
bool deleteObject(pwr_tStatus *sts, wb_orep *orep);
bool deleteFamily(pwr_tStatus *sts, wb_orep *orep);
bool deleteOset(pwr_tStatus *sts, wb_oset *oset) { return m_vrep->deleteOset( sts, oset);}
bool renameObject(pwr_tStatus *sts, wb_orep *orep, wb_name &name);
bool commit(pwr_tStatus *sts);
bool abort(pwr_tStatus *sts);
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, size_t offset, size_t size, void *p);
virtual void *readAttribute(pwr_tStatus *sts, const wb_orep *o, pwr_eBix bix, size_t offset, size_t size, void *p) { return m_vrep->readAttribute( sts, o, bix, offset, size, p);}
virtual void *readBody(pwr_tStatus *sts, const wb_orep *o, pwr_eBix bix, void *p) { return readBody( sts, o, bix, p);}
virtual bool writeBody(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, void *p);
wb_orep *ancestor(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->ancestor( sts, o);}
wb_orep *parent(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->parent( sts, o);}
wb_orep *after(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->after( sts, o);}
wb_orep *before(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->before( sts, o);}
wb_orep *first(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->first( sts, o);}
wb_orep *child(pwr_tStatus *sts, const wb_orep *o, wb_name &name) { return m_vrep->child( sts, o, name);}
wb_orep *last(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->last( sts, o);}
wb_orep *next(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->next( sts, o);}
wb_orep *previous(pwr_tStatus *sts, const wb_orep *o) { return m_vrep->previous( sts, o);}
wb_srep *newSession() {return m_vrep->newSession();}
bool isLocal(const wb_orep *o) { return m_vrep->isLocal( o);}
void objectName(const wb_orep *o, char *str) { m_vrep->objectName( o, str);}
virtual bool exportVolume(wb_import &i) { return m_vrep->exportVolume( i);}
virtual bool exportHead(wb_import &i) { return m_vrep->exportHead( i);}
virtual bool exportRbody(wb_import &i) { return m_vrep->exportRbody( i);}
virtual bool exportDbody(wb_import &i) { return m_vrep->exportDbody( i);}
virtual bool exportDocBlock(wb_import &i) { return m_vrep->exportDocBlock( i);}
virtual bool exportMeta(wb_import &i) { return m_vrep->exportMeta( i);}
virtual bool exportTree(wb_treeimport &i, pwr_tOid oid) { return m_vrep->exportTree( i, oid);}
virtual bool importTreeObject(wb_merep *merep, pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, const char *name, pwr_mClassDef flags,
size_t rbSize, size_t dbSize, void *rbody, void *dbody) {
return m_vrep->importTreeObject( merep, oid, cid, poid, boid, name, flags, rbSize, dbSize, rbody, dbody);}
virtual bool importTree( bool keepref) { return m_vrep->importTree( 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_mClassDef flags,
size_t rbSize, size_t dbSize, void *rbody, void *dbody,
pwr_tOid *roid) {
return m_vrep->importPasteObject( destination, destcode, keepoid, oid, cid, poid, boid, name, flags,
rbSize, dbSize, rbody, dbody, roid);}
virtual bool importPaste() { return m_vrep->importPaste();}
virtual void importIgnoreErrors() { return m_vrep->importIgnoreErrors();}
virtual bool accessSupported( ldh_eAccess access) { return m_vrep->accessSupported( access);}
virtual const char *fileName() { return m_vrep->fileName();}
private:
bool nextCix( pwr_tStatus *sts, pwr_tOix *cix);
bool nextTix( pwr_tStatus *sts, pwr_tOix *tix);
bool nextAix( pwr_tStatus *sts, wb_orep *co, pwr_tOix *aix);
bool buildType( pwr_tStatus *sts, wb_orep *to);
bool buildClass( pwr_tStatus *sts, wb_orep *co);
void error( char *msg, wb_orep *o);
bool classeditorCheck( ldh_eDest dest_code, wb_orep *dest, pwr_tCid cid,
pwr_tOix *oix, char *name, pwr_tStatus *sts,
bool import_paste);
void printPaletteFile();
};
#endif
/*
* Proview $Id: wb_vrepdb.cpp,v 1.59 2007-11-07 18:07:51 claes Exp $
* Proview $Id: wb_vrepdb.cpp,v 1.60 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -431,7 +431,8 @@ bool wb_vrepdb::copyOset(pwr_tStatus *sts, wb_oset *oset, wb_destination &d)
return false;
}
wb_orep* wb_vrepdb::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name)
wb_orep* wb_vrepdb::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d,
wb_name &name, pwr_tOix oix)
{
*sts = LDH__SUCCESS;
wb_db_txn *txn = m_db->begin(m_db->m_txn);
......@@ -440,7 +441,21 @@ wb_orep* wb_vrepdb::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination
try {
int rs = 0;
pwr_tTime time;
pwr_tOid oid = m_db->new_oid(txn);
pwr_tOid oid;
if ( oix) {
pwr_tOid woid;
woid.oix = oix;
woid.vid = m_vid;
oid = m_db->new_oid(txn, woid);
if ( !oid.oix) {
*sts = LDH__BADOBJID;
return 0;
}
}
else
oid = m_db->new_oid(txn);
wb_db_ohead o(m_db, oid);
clock_gettime(CLOCK_REALTIME, &time);
......@@ -1519,6 +1534,8 @@ bool wb_vrepdb::importPasteObject(pwr_tOid doid, ldh_eDest destcode,
if (keepoid) {
oep->n_oid = m_db->new_oid(m_db->m_txn, oid);
if ( !oep->n_oid.oix)
oep->n_oid = m_db->new_oid(m_db->m_txn);
} else {
oep->n_oid = m_db->new_oid(m_db->m_txn);
}
......@@ -1946,7 +1963,7 @@ int wb_vrepdb::updateArefs(pwr_tOid oid, pwr_tCid cid)
pwr_tStatus wb_vrepdb::updateMeta()
{
int rc = 0;
pwr_tStatus rc = 0;
pwr_tStatus sts = LDH__SUCCESS;
pwr_tStatus db_sts = LDH__SUCCESS;
int nAref = 0;
......@@ -2031,7 +2048,7 @@ pwr_tStatus wb_vrepdb::updateMeta()
commit(&rc);
if (rc) {
if (EVEN(rc)) {
sprintf(buff, "A total of %d object%s of %d classe%s %s updated, but could not be saved to database.",
nObject, (nObject == 1 ? "" : "s"), tree_Cardinality(&sts, m_class_th),
(tree_Cardinality(&sts, m_class_th) == 1 ? "" : "s"),
......
/*
* Proview $Id: wb_vrepdb.h,v 1.35 2007-11-06 13:29:38 claes Exp $
* Proview $Id: wb_vrepdb.h,v 1.36 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -130,7 +130,8 @@ public:
virtual wb_orep *object(pwr_tStatus *sts, wb_name &name);
virtual wb_orep *object(pwr_tStatus *sts, const wb_orep *parent, wb_name &name);
virtual wb_orep *createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name);
virtual wb_orep *createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d,
wb_name &name, pwr_tOix oix = 0);
virtual wb_orep *copyObject(pwr_tStatus *sts, const wb_orep *orep, wb_destination &d, wb_name &name);
virtual bool copyOset(pwr_tStatus *sts, wb_oset *oset, wb_destination &d);
......
/*
* Proview $Id: wb_vrepdbms.cpp,v 1.2 2007-10-19 07:00:02 claes Exp $
* Proview $Id: wb_vrepdbms.cpp,v 1.3 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2007 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -431,7 +431,8 @@ bool wb_vrepdbms::copyOset(pwr_tStatus *sts, wb_oset *oset, wb_destination &d)
return false;
}
wb_orep* wb_vrepdbms::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name)
wb_orep* wb_vrepdbms::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d,
wb_name &name, pwr_tOix oix)
{
*sts = LDH__SUCCESS;
wb_dbms_txn *txn = m_db->subBegin(m_db->m_txn);
......@@ -440,7 +441,20 @@ wb_orep* wb_vrepdbms::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destinatio
try {
int rs = 0;
pwr_tTime time;
pwr_tOid oid = m_db->new_oid(txn);
if ( oix) {
pwr_tOid woid;
woid.oix = oix;
woid.vid = m_vid;
oid = m_db->new_oid(txn, woid);
if ( !oid.oix) {
*sts = LDH__BADOBJID;
return 0;
}
}
else
pwr_tOid oid = m_db->new_oid(txn);
wb_dbms_ohead o(m_db, oid);
clock_gettime(CLOCK_REALTIME, &time);
......@@ -1533,6 +1547,8 @@ bool wb_vrepdbms::importPasteObject(pwr_tOid doid, ldh_eDest destcode,
if (keepoid) {
oep->n_oid = m_db->new_oid(m_db->m_txn, oid);
if ( !oep->n_oid.oix)
oep->n_oid = m_db->new_oid(m_db->m_txn);
} else {
oep->n_oid = m_db->new_oid(m_db->m_txn);
}
......@@ -1945,7 +1961,7 @@ int wb_vrepdbms::updateArefs(pwr_tOid oid, pwr_tCid cid)
pwr_tStatus wb_vrepdbms::updateMeta()
{
int rc = 0;
pwr_tStatus rc = 0;
pwr_tStatus sts = LDH__SUCCESS;
pwr_tStatus db_sts = LDH__SUCCESS;
int nAref = 0;
......@@ -2029,7 +2045,7 @@ pwr_tStatus wb_vrepdbms::updateMeta()
commit(&rc);
if (rc) {
if ( EVEN(rc)) {
sprintf(buff, "A total of %d object%s of %d classe%s %s updated, but could not be saved to database.",
nObject, (nObject == 1 ? "" : "s"), tree_Cardinality(&sts, m_class_th),
(tree_Cardinality(&sts, m_class_th) == 1 ? "" : "s"),
......
/*
* Proview $Id: wb_vrepdbms.h,v 1.2 2007-10-19 07:00:02 claes Exp $
* Proview $Id: wb_vrepdbms.h,v 1.3 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2007 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -131,7 +131,8 @@ public:
virtual wb_orep *object(pwr_tStatus *sts, wb_name &name);
virtual wb_orep *object(pwr_tStatus *sts, const wb_orep *parent, wb_name &name);
virtual wb_orep *createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name);
virtual wb_orep *createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d,
wb_name &name, pwr_tOix oix = 0);
virtual wb_orep *copyObject(pwr_tStatus *sts, const wb_orep *orep, wb_destination &d, wb_name &name);
virtual bool copyOset(pwr_tStatus *sts, wb_oset *oset, wb_destination &d);
......
/*
* Proview $Id: wb_vrepdbs.cpp,v 1.49 2006-06-09 13:16:09 claes Exp $
* Proview $Id: wb_vrepdbs.cpp,v 1.50 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -233,7 +233,8 @@ wb_orep *wb_vrepdbs::object(pwr_tStatus *sts, const wb_orep *parent, wb_name &na
}
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, pwr_tOix oix)
{
*sts = LDH__NYI;
return 0;
......
/*
* Proview $Id: wb_vrepdbs.h,v 1.37 2006-06-08 13:39:33 claes Exp $
* Proview $Id: wb_vrepdbs.h,v 1.38 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -89,7 +89,8 @@ public:
virtual wb_orep *object(pwr_tStatus *sts, wb_name &name);
virtual wb_orep *object(pwr_tStatus *sts, const wb_orep *parent, wb_name &name);
virtual wb_orep *createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name);
virtual wb_orep *createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d,
wb_name &name, pwr_tOix oix = 0);
virtual wb_orep *copyObject(pwr_tStatus *sts, const wb_orep *orep, wb_destination &d, wb_name &name);
virtual bool copyOset(pwr_tStatus *sts, wb_oset *oset, wb_destination &d);
......
/*
* Proview $Id: wb_vrepext.cpp,v 1.8 2006-09-15 09:33:20 claes Exp $
* Proview $Id: wb_vrepext.cpp,v 1.9 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -384,7 +384,8 @@ void *wb_vrepext::readBody(pwr_tStatus *sts, const wb_orep *o, pwr_eBix bix, voi
}
wb_orep *wb_vrepext::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name)
wb_orep *wb_vrepext::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d,
wb_name &name, pwr_tOix oix)
{
if ( d.oid().vid != m_vid) {
*sts = LDH__BADOBJID;
......
/*
* Proview $Id: wb_vrepext.h,v 1.9 2006-09-14 14:16:20 claes Exp $
* Proview $Id: wb_vrepext.h,v 1.10 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -210,7 +210,8 @@ public:
wb_orep *object(pwr_tStatus *sts, wb_name &name);
wb_orep *object(pwr_tStatus *sts, const wb_orep *parent, wb_name &name) {return 0;}
wb_orep *createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name);
wb_orep *createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name,
pwr_tOix oix = 0);
wb_orep *copyObject(pwr_tStatus *sts, const wb_orep *orep, wb_destination &d, wb_name &name);
bool copyOset(pwr_tStatus *sts, wb_oset *oset, wb_destination &d) {return false;}
......
/*
* Proview $Id: wb_vrepmem.cpp,v 1.29 2007-11-07 08:48:56 claes Exp $
* Proview $Id: wb_vrepmem.cpp,v 1.30 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -689,12 +689,13 @@ void wb_vrepmem::freeObject( mem_object *memo)
delete memo;
}
wb_orep *wb_vrepmem::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name)
wb_orep *wb_vrepmem::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d,
wb_name &name, pwr_tOix oix)
{
mem_object *dest;
ldh_eDest code = d.code();
char name_str[32];
pwr_tOix oix;
pwr_tOix soix;
pwr_tTime time;
clock_gettime(CLOCK_REALTIME, &time);
......@@ -720,14 +721,14 @@ wb_orep *wb_vrepmem::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination
}
if ( !m_classeditor) {
oix = nextOix();
soix = nextOix();
if ( name.evenSts())
sprintf( name_str, "O%u", oix);
sprintf( name_str, "O%u", soix);
else
strcpy( name_str, name.object());
}
else {
if ( !classeditorCheck( code, dest, cdef.cid(), &oix, name_str, sts, false))
if ( !classeditorCheck( code, dest, cdef.cid(), &soix, name_str, sts, false))
return 0;
if ( name.oddSts())
......@@ -737,7 +738,7 @@ wb_orep *wb_vrepmem::createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination
mem_object *memo = new mem_object();
strcpy( memo->m_name, name_str);
memo->m_oid.oix = oix;
memo->m_oid.oix = soix;
memo->m_oid.vid = m_vid;
memo->m_cid = cdef.cid();
memo->m_flags = cdef.flags();
......
/*
* Proview $Id: wb_vrepmem.h,v 1.21 2007-10-25 16:05:10 claes Exp $
* Proview $Id: wb_vrepmem.h,v 1.22 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -279,7 +279,8 @@ public:
wb_orep *object(pwr_tStatus *sts, wb_name &name);
wb_orep *object(pwr_tStatus *sts, const wb_orep *parent, wb_name &name) {return 0;}
wb_orep *createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name);
wb_orep *createObject(pwr_tStatus *sts, wb_cdef cdef, wb_destination &d, wb_name &name,
pwr_tOix oix = 0);
wb_orep *copyObject(pwr_tStatus *sts, const wb_orep *orep, wb_destination &d, wb_name &name);
bool copyOset(pwr_tStatus *sts, wb_oset *oset, wb_destination &d) {return false;}
......
/*
* Proview $Id: wb_vrepref.h,v 1.7 2006-05-11 07:12:20 claes Exp $
* Proview $Id: wb_vrepref.h,v 1.8 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -101,7 +101,8 @@ public:
wb_orep *object(pwr_tStatus *sts, pwr_tCid cid) { *sts = LDH__NOSUCHOBJ; return 0;}
wb_orep *object(pwr_tStatus *sts, wb_name &name);
wb_orep *object(pwr_tStatus *sts, const wb_orep *parent, wb_name &name) { *sts = LDH__NOSUCHOBJ; 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,
pwr_tOix oix = 0) {return 0;}
wb_orep *copyObject(pwr_tStatus *sts, const 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;}
......
/*
* Proview $Id: wb_vrepwbl.h,v 1.38 2007-10-23 08:54:16 claes Exp $
* Proview $Id: wb_vrepwbl.h,v 1.39 2007-11-23 14:25:09 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -154,7 +154,8 @@ public:
wb_orep *object(pwr_tStatus *sts, wb_name &name);
wb_orep *object(pwr_tStatus *sts, const 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,
pwr_tOix oix = 0) {return 0;}
wb_orep *copyObject(pwr_tStatus *sts, const wb_orep *orep, wb_destination &d, wb_name &name) {return 0;}
bool copyOset(pwr_tStatus *sts, wb_oset *oset, wb_destination &d) {return false;}
......
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