BerkeleyDbDatastore.h

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 2002, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020                                                                         
00021 // $Revision: 1.2 $
00022 // $Date: 2003/10/15 16:49:02 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/database/BerkeleyDbDatastore.h,v $
00024 
00025 #ifndef BerkeleyDbDatastore_h
00026 #define BerkeleyDbDatastore_h
00027 
00028 // Written:  fmk
00029 // Created:  02/02
00030 //
00031 // Description: This file contains the class definition for BerkeleyDbDatastore.
00032 // BerkeleyDbDatastore is a concrete subclas of FE_Datastore. A BerkeleyDbDatastore 
00033 // object is used in the program to store/restore the geometry and state 
00034 // information in a domain at a particular instance in the analysis. The
00035 // information is stored using the BerkeleyDB Database.
00036 //
00037 // What: "@(#) BerkeleyDbDatastore.h, revA"
00038 
00039 #include <FE_Datastore.h>
00040 #include <db.h>
00041 
00042 class BerkeleyDbDatastore: public FE_Datastore
00043 {
00044  public:
00045   BerkeleyDbDatastore(const char *projectName, 
00046                       Domain &theDomain, 
00047                       FEM_ObjectBroker &theBroker,
00048                       char *type = NULL);
00049 
00050   ~BerkeleyDbDatastore();
00051 
00052   // method to get a database tag
00053   int getDbTag(void);
00054   
00055   // methods for sending and recieving matrices, vectors and id's
00056   int sendMsg(int dbTag, int commitTag, 
00057               const Message &, 
00058               ChannelAddress *theAddress =0);    
00059   int recvMsg(int dbTag, int commitTag, 
00060               Message &, 
00061               ChannelAddress *theAddress =0);        
00062 
00063   int sendMatrix(int dbTag, int commitTag, 
00064                  const Matrix &theMatrix, 
00065                  ChannelAddress *theAddress =0);
00066   int recvMatrix(int dbTag, int commitTag, 
00067                  Matrix &theMatrix, 
00068                  ChannelAddress *theAddress =0);
00069   
00070   int sendVector(int dbTag, int commitTag, 
00071                  const Vector &theVector, 
00072                  ChannelAddress *theAddress =0);
00073   int recvVector(int dbTag, int commitTag, 
00074                  Vector &theVector, 
00075                  ChannelAddress *theAddress =0);
00076   
00077   int sendID(int dbTag, int commitTag, 
00078              const ID &theID, 
00079              ChannelAddress *theAddress =0);
00080   int recvID(int dbTag, int commitTag, 
00081              ID &theID, 
00082              ChannelAddress *theAddress =0);    
00083 
00084  protected:
00085 
00086  private:
00087   int dbTag;
00088 
00089   DB_ENV *dbenv;      // database enviroment - directory containing files
00090   DB *dbMatrix;       // file holding the data for the Matrices
00091   DB *dbVector;       // file holding the data for the Vectors
00092   DB *dbID;           // file holding the data for the ID's
00093 
00094   bool connection;
00095 
00096   DBT key, data;  // structures for the key data pair
00097   char query[128];
00098 
00099   char *project;
00100 };
00101 
00102 #endif

Generated on Mon Oct 23 15:05:00 2006 for OpenSees by doxygen 1.5.0