xc
SQLiteDatastore.h
1 //----------------------------------------------------------------------------
2 // XC program; finite element analysis code
3 // for structural analysis and design.
4 //
5 // Copyright (C) Luis Claudio Pérez Tato
6 //
7 // This program derives from OpenSees <http://opensees.berkeley.edu>
8 // developed by the «Pacific earthquake engineering research center».
9 //
10 // Except for the restrictions that may arise from the copyright
11 // of the original program (see copyright_opensees.txt)
12 // XC is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation, either version 3 of the License, or
15 // (at your option) any later version.
16 //
17 // This software is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program.
25 // If not, see <http://www.gnu.org/licenses/>.
26 //----------------------------------------------------------------------------
27 //SQLiteDatastore.h
28 
29 #ifndef SQLiteDatastore_h
30 #define SQLiteDatastore_h
31 
32 #include "DBDatastore.h"
33 #include "xc_utils/src/sqlite/SqLiteDatabase.h"
34 
35 namespace XC {
39 //
41 //
43  {
44  private:
45  bool connection;
46  SqLiteDatabase db;
47  std::string query;
48  bool insertData(const std::string &,const int &,const int &,const void *,const int &,const int &);
49  bool updateData(const std::string &,const int &,const int &,const void *,const int &,const int &);
50  const void *retrieveData(const std::string &tbName,const int &dbTag,const int &commitTag,const int &sz);
51  protected:
52  int createOpenSeesDatabase(const std::string &projectName);
53  int execute(const std::string &query);
54  public:
55  SQLiteDatastore(const std::string &,Preprocessor &, FEM_ObjectBroker &,int dbRun = 0);
56 
57  // methods for sending and recieving matrices, vectors and id's
58  int sendMsg(int , int , const Message &, ChannelAddress *a= nullptr);
59  int recvMsg(int , int , Message &, ChannelAddress *a= nullptr);
60 
61  int sendMatrix(int , int , const Matrix &,ChannelAddress *a= nullptr);
62  int recvMatrix(int , int , Matrix &, ChannelAddress *a= nullptr);
63 
64  int sendVector(int , int , const Vector &,ChannelAddress *a= nullptr);
65  int recvVector(int , int , Vector &,ChannelAddress *a= nullptr);
66 
67  int sendID(int , int ,const ID &,ChannelAddress *a= nullptr);
68  int recvID(int , int ,ID &,ChannelAddress *a= nullptr);
69 
70  int createTable(const std::string &,const std::vector<std::string> &);
71  int insertData(const std::string &,const std::vector<std::string> &, int , const Vector &);
72  int getData(const std::string &,const std::vector<std::string> &, int , Vector &);
73  };
74 } // end of XC namespace
75 
76 #endif
Definition: DBDatastore.h:38
Float vector abstraction.
Definition: Vector.h:93
Definition: SQLiteDatastore.h:42
int sendID(int, int, const ID &, ChannelAddress *a=nullptr)
Invoked to receive the data in the ID object theID to another Channel object.
Definition: SQLiteDatastore.cc:204
Finite element model generation tools.
Definition: Preprocessor.h:58
int recvVector(int, int, Vector &, ChannelAddress *a=nullptr)
Invoked to receive the data in the Vector object theVector to another Channel object.
Definition: SQLiteDatastore.cc:181
FEM_ObjectBroker is is an object broker class for the finite element method.
Definition: FEM_ObjectBroker.h:145
Vector of integers.
Definition: ID.h:93
int sendMsg(int, int, const Message &, ChannelAddress *a=nullptr)
A method invoked to send the data in the Message object theMsg to another Channel object...
Definition: SQLiteDatastore.cc:45
int recvMsg(int, int, Message &, ChannelAddress *a=nullptr)
Invoked to send the data in the Message object theMsg to another Channel object.
Definition: SQLiteDatastore.cc:51
int sendVector(int, int, const Vector &, ChannelAddress *a=nullptr)
Invoked to receive the data in the Vector object theVector to another Channel object.
Definition: SQLiteDatastore.cc:161
Message between processes.
Definition: Message.h:76
int sendMatrix(int, int, const Matrix &, ChannelAddress *a=nullptr)
Invoked to receive the data in the Matrix object theMatrix to another Channel object.
Definition: SQLiteDatastore.cc:116
Open source finite element program for structural analysis.
Definition: ContinuaReprComponent.h:34
Definition: ChannelAddress.h:69
Matrix of floats.
Definition: Matrix.h:108
int recvID(int, int, ID &, ChannelAddress *a=nullptr)
Invoked to receive the data in the ID object theID to another Channel object.
Definition: SQLiteDatastore.cc:224
int recvMatrix(int, int, Matrix &, ChannelAddress *a=nullptr)
Invoked to receive the data in the Matrix object theMatrix to another Channel object.
Definition: SQLiteDatastore.cc:136