xc
SQLiteDatastore.h
1 // -*-c++-*-
2 //----------------------------------------------------------------------------
3 // XC program; finite element analysis code
4 // for structural analysis and design.
5 //
6 // Copyright (C) Luis C. Pérez Tato
7 //
8 // This program derives from OpenSees <http://opensees.berkeley.edu>
9 // developed by the «Pacific earthquake engineering research center».
10 //
11 // Except for the restrictions that may arise from the copyright
12 // of the original program (see copyright_opensees.txt)
13 // XC is free software: you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation, either version 3 of the License, or
16 // (at your option) any later version.
17 //
18 // This software is distributed in the hope that it will be useful, but
19 // WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program.
26 // If not, see <http://www.gnu.org/licenses/>.
27 //----------------------------------------------------------------------------
28 //SQLiteDatastore.h
29 
30 #ifndef SQLiteDatastore_h
31 #define SQLiteDatastore_h
32 
33 #include "DBDatastore.h"
34 #include "utility/sqlite/SqLiteDatabase.h"
35 
36 namespace XC {
40 //
42 //
45  {
46  private:
47  bool connection;
48  SqLiteDatabase db;
49  std::string query;
50  bool insertData(const std::string &,const int &,const int &,const void *,const int &,const int &);
51  bool updateData(const std::string &,const int &,const int &,const void *,const int &,const int &);
52  const void *retrieveData(const std::string &tbName,const int &dbTag,const int &commitTag,const int &sz);
53  protected:
54  int createOpenSeesDatabase(const std::string &projectName);
55  int execute(const std::string &query);
56  public:
57  SQLiteDatastore(const std::string &,Preprocessor &, FEM_ObjectBroker &,int dbRun = 0);
58 
59  std::string getTypeId(void) const
60  { return "SQLite"; }
61 
62  // methods for sending and receiving matrices, vectors and id's
63  int sendMsg(int , int , const Message &, ChannelAddress *a= nullptr);
64  int recvMsg(int , int , Message &, ChannelAddress *a= nullptr);
65 
66  int sendMatrix(int , int , const Matrix &,ChannelAddress *a= nullptr);
67  int recvMatrix(int , int , Matrix &, ChannelAddress *a= nullptr);
68 
69  int sendVector(int , int , const Vector &,ChannelAddress *a= nullptr);
70  int recvVector(int , int , Vector &,ChannelAddress *a= nullptr);
71 
72  int sendID(int , int ,const ID &,ChannelAddress *a= nullptr);
73  int recvID(int , int ,ID &,ChannelAddress *a= nullptr);
74 
75  int createTable(const std::string &,const std::vector<std::string> &);
76  int insertData(const std::string &,const std::vector<std::string> &, int , const Vector &);
77  int getData(const std::string &,const std::vector<std::string> &, int , Vector &);
78  };
79 } // end of XC namespace
80 
81 #endif
Base class for classes that store model information on a database.
Definition: DBDatastore.h:40
Float vector abstraction.
Definition: Vector.h:94
Store model data in a SQLite database.
Definition: SQLiteDatastore.h:44
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:59
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:151
Vector of integers.
Definition: ID.h:95
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:77
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:35
Base class for classes that encapsulate channel addresses.
Definition: ChannelAddress.h:78
Clase para consulta SQL.
Definition: SqLiteDatabase.h:35
Matrix of floats.
Definition: Matrix.h:111
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