|
Covalent Bond
0.0.1-alpha
'covalent bond' is a data middle office. As a 2022-2023 Fall SWE final project.
|
Go to the documentation of this file.
11 #ifndef __SERVER_CB_TABLE_HPP_
12 #define __SERVER_CB_TABLE_HPP_
20 #if defined(__unix__) && defined(__clang__)
25 #include "../../pch.hpp"
27 #include "sol/sol.hpp"
28 #include <workflow/MySQLResult.h>
35 typedef std::variant<int32_t, float, std::string, bool>
__metaObj;
38 #define Seq(x, y) std::pair<int32_t, int32_t>(x, y)
99 cbTableHead(
const int32_t& nums,
const std::initializer_list<std::string>& data,
100 const std::initializer_list<typeType>& types)
103 std::vector<std::string>::iterator
begin() {
return m_data.begin(); }
104 std::vector<std::string>::iterator
end() {
return m_data.end(); }
105 const std::vector<std::string>::const_iterator
cbegin() {
return m_data.cbegin(); }
106 const std::vector<std::string>::const_iterator
cend() {
return m_data.cend(); }
110 void set(
const std::string& n, int32_t idx) {
134 template<
int32_t Dims>
139 for (int32_t i = 0; i < Dims; ++i) { this->
m_dims[i] = rhs.
m_dims[i]; }
157 for (int32_t i = 0; i < Dims; ++i) { ans *=
m_dims[i]; }
210 template<
int32_t Dims>
302 int32_t rows = row_i.second - row_i.first;
325 auto tmp_heads_ele = this->
head[i];
327 ans.
head.
set(tmp_heads_ele.first, i);
328 ans.
head.
set(tmp_heads_ele.second, i);
369 typedef std::variant<std::string, float, double, int, unsigned long long>
__cbMySQLMeta;
426 std::string
getDB()
const;
428 std::string
getDef()
const;
436 void setName(
const std::string& value);
438 void setTable(
const std::string& value);
440 void setDB(
const std::string& value);
442 void setDef(
const std::string& value);
493 unsigned long long asULL()
const;
494 std::string
asDate()
const;
495 std::string
asTime()
const;
499 void setString(
const std::string& value);
502 void setULL(
unsigned long long value);
503 void setDate(
const std::string& value);
504 void setTime(
const std::string& value);
597 std::vector<std::vector<cbMySQLCell>>
m_data;
680 std::vector<std::vector<cbMySQLCell*>>&
getData();
738 std::map<int32_t, int32_t>
keyBy(
const std::string& colName)
const;
745 void pushRow(
const std::vector<cbMySQLCell*>& row);
773 std::vector<std::vector<cbMySQLCell*>>
m_data;
806 #endif //! __SERVER_CB_TABLE_HPP_
std::vector< cbMySQLField > m_info
cbTable(cbShape< 2 > &shape, cbCell *dataptr)
cbVirtualSharedTable()=default
Construct a new cb Virtual Shared Table object.
cbTableCol getCol(int32_t i)
void setThisAsTrueDataContainer()
void set(const typeType &t, int32_t idx)
std::string getName() const
std::string genKey4Redis(int32_t row, int32_t col)
void setDataType(int32_t value)
void setAsCppBool(bool rhs)
std::string colTypeAt(int32_t i)
std::string asDate() const
cbMySQLCell * atPtr(int32_t i, int32_t j)
row major
cbCell * operator()(int32_t i, int32_t j)
cbMySQLField * getInfoAt(int32_t i)
Get the Info At object.
cbTable(const cbTable &rhs)
cbMySQLField ** getInfo()
Get the Info object.
cbVirtualTable works as a reference from shared memory. It only use a shape and SqlCell to define dif...
void setDate(const std::string &value)
const int32_t operator[](int32_t idx) const
cbTableHead(const int32_t &nums, const std::initializer_list< std::string > &data, const std::initializer_list< typeType > &types)
std::string getTable() const
void mapShared2Virtual(cbVirtualSharedTable *sharedT, cbVirtualTable *virtualT)
int32_t & operator[](int32_t idx)
cbVirtualTable getRow(int32_t i)
Get the Row object.
cbVirtualTable(const cbVirtualTable &rhs)
void setThisAsTrueDataContainer()
cbMySQLField()
Construct a new cb My S Q L Field object.
void setTime(const std::string &value)
void setAsCppInt(int32_t rhs)
A copy move from workflow MySQLResult.h and .inl file.
cbMySQLCell * atPtr(int32_t i, int32_t j)
void setAsLuaBool(sol::object rhs)
void resetShape(cbShape< 2 > &shape)
cbTableCol(const cbShape< 2 > &shape)
std::string asTime() const
void setPtrAt(int32_t i, int32_t j, cbMySQLCell *v)
Set the Ptr At object.
const std::vector< std::string >::const_iterator cbegin()
void setAsCppFloat(float rhs)
cbTableRow(const cbShape< 2 > &shape)
cbMySQLCell * atPtrRef(int32_t i, int32_t j)
cbTableRow(const cbShape< 2 > &shape, cbCell *dataptr)
std::vector< std::string > m_data
cbTableHead(const int32_t &nums)
std::vector< std::string >::iterator begin()
cbCell * at(int32_t i, int32_t j)
auto storeShapeIndex(T &c, int32_t idx, int32_t const &v) -> void
const std::vector< std::string >::const_iterator cend()
cbShape< 2 > makeShapeCol(int32_t a)
cbCell(const std::string &rhs)
void update(const cbShape< 2 > &shape, cbMySQLField **info)
cbMySQLCell(unsigned long long value)
cbTableCol(const cbShape< 2 > &shape, int32_t stride)
void resetShapeH(const cbShape< 2 > &shape)
std::pair< std::string &, typeType & > operator[](int32_t idx)
void addNameAndType(const std::string &name, const typeType &t)
void setDatetime(const std::string &value)
void pushRow(const std::vector< cbMySQLCell * > &row)
void setInfoAt(int32_t i, cbMySQLField *v)
Set the Info At object.
cbVirtualTable getCol(int32_t i)
Get the Col object.
unsigned long long asULL() const
cbMySQLCell(double value)
void setTable(const std::string &value)
void setOrgName(const std::string &value)
void setDef(const std::string &value)
void mallocMetaMatrix(cbTable &rhs)
auto fetchShapeIndex(T &c, int32_t idx) -> int32_t &
std::string getOrgTable() const
cbTableCol(const cbShape< 2 > &shape, int32_t stride, cbCell *dataptr)
void setDB(const std::string &value)
std::string getDef() const
void setFloat(float value)
void setLength(int32_t value)
std::vector< cbMySQLCell * > __luaPackedCellAsVec(cbMySQLCell *v=nullptr)
std::string getOrgName() const
std::vector< std::vector< cbMySQLCell * > > m_data
void setStride(int32_t rhs)
void setName(const std::string &value)
cbMySQLCell(const std::string &value)
cbTableRow(const cbTableRow &rhs)
cbTableCol(const cbTableCol &rhs)
~cbVirtualSharedTable()
Destroy the cb Virtual Shared Table object.
std::variant< std::string, float, double, int, unsigned long long > __cbMySQLMeta
cbCell operator=(const cbCell &rhs)=delete
void setCatalog(const std::string &value)
cbMySQLField ** getInfo()
Get the Info object.
cbVirtualSharedTable is a container of shared memory.
void setString(const std::string &value)
const cbShape< 2 > getShape() const
Get the Shape object.
cbVirtualTable(const cbShape< 2 > &shape)
void resetFieldInfo(int32_t fieldCount, cbMySQLField **info)
cbMySQLCell *& atPtrRef(int32_t i, int32_t j)
std::vector< std::string > __luaPackedStringAsVec()
void setAsCppString(std::string rhs)
cbMySQLCell(const std::string &value, const cbMySQLType &t)
void setDecimals(int32_t value)
std::vector< std::vector< cbMySQLCell * > > & getData()
Get the Data object.
std::string getDB() const
cbShape(const std::initializer_list< int32_t > &rhs)
std::string colNameAt(int32_t i)
cbTableRow getRow(int32_t i)
std::vector< std::vector< cbMySQLCell > > m_data
void resetShape(const cbShape< 2 > &shape)
std::variant< int32_t, float, std::string, bool > __metaObj
_WIN32
cbTable operator()(const std::pair< int32_t, int32_t > &row_i, const cbTableSlice &cbSl)
cbVirtualTable(cbShape< 2 > &shape)
void setThisAsTrueDataContainer()
std::string asDatetime() const
int32_t getFiledCount()
Get the Filed Count object.
cbShape< 2 > makeShapeFull(int32_t a, int32_t b)
void setCharsetnr(int32_t value)
void setAsLuaInt(sol::object rhs)
void setAsLuaString(sol::object rhs)
void setFlags(int32_t value)
void setAsLuaFloat(sol::object rhs)
cbOutputTableStruct()=delete
void setDouble(double value)
void set(const std::string &n, int32_t idx)
cbShape(const cbShape< Dims > &rhs)
std::vector< std::string >::iterator end()
void setOrgTable(const std::string &value)
cbShape< 2 > getShape()
Get the Shape object.
std::map< int32_t, int32_t > keyBy(const std::string &colName) const
std::string asString() const
std::string getCatalog() const
std::vector< typeType > m_types
void setInfo(cbMySQLField **v)
Set the Info object.
cbTable(cbShape< 2 > &shape)
cbShape< 2 > makeShapeRow(int32_t a)
void setULL(unsigned long long value)