Covalent Bond  0.0.1-alpha
'covalent bond' is a data middle office. As a 2022-2023 Fall SWE final project.
Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes | List of all members
cb::graph::cbComputeGraph Class Reference

#include <cbComputeGraph.hpp>

Collaboration diagram for cb::graph::cbComputeGraph:
Collaboration graph
[legend]

Public Member Functions

 cbComputeGraph (int32_t idx)
 
 ~cbComputeGraph ()
 
bool isDAG ()
 To judge the Graph is DAG or not. More...
 
bool isSingleOutput ()
 To judge the graph has single output or not. More...
 
cbMySQLCellcreateCell ()
 Create a Cell object. More...
 
cbMySQLCellcreateCell (int value)
 Create a Cell object. More...
 
cbMySQLCellcreateCell (float value)
 Create a Cell object. More...
 
cbMySQLCellcreateCell (double value)
 Create a Cell object. More...
 
cbMySQLCellcreateCell (unsigned long long value)
 Create a Cell object. More...
 
cbMySQLCellcreateCell (const std::string &value)
 Create a Cell object. More...
 
cbMySQLCellcreateCell (const std::string &value, const cbMySQLType &t)
 Create a Cell object. More...
 
cbVirtualDeviceNodecreateVirtualDeviceNode (int32_t idx)
 create nodes belongs to this graph. More...
 
cbRedisCachingNodecreateRedisCachingNode (int32_t idx)
 ! for sql only, now. More...
 
cbOperatorNodecreateCombineNode (const std::vector< std::string > &keys, const std::string &name)
 Create a Combine Node object. More...
 
cbOperatorNodecreateFilterNode (const sol::function &boolF, const sol::function &exF)
 Create a Filter Node object. More...
 
void setVirtualDeviceManager (trivial::cbVirtualDeviceManager *virtualDeviceM)
 Set the Virtual Device Manager object. More...
 
void registerNode (cbNode *node)
 register a node. Not used by lua binding. More...
 
int32_t getId ()
 Get the Id object. More...
 
WFGraphTask * generateGraphTask (const graph_callback &func=nullptr)
 Create the graph task. More...
 
void execScriptFile (const std::string &filePath)
 execute the script from file. More...
 
void execScript (const std::string &script)
 execute the script More...
 
void addCacheServer (cbRedisCachingNode *v)
 The cache server node. Lua binding in. More...
 
cbOutputTableStructgetOutput ()
 Get the Output object. More...
 
std::vector< cbNode * > getNodes ()
 Get the Nodes object. More...
 

Static Public Member Functions

static void execMain (WFGraphTask *task, cbComputeGraph *graph)
 Execute the graph task. More...
 

Public Attributes

friend cbVirtualDeviceNode
 
friend cbRedisCachingNode
 
friend cbOperatorNode
 

Private Attributes

int32_t m_idx = 0
 
cbOpIO io
 
std::vector< cbNode * > m_nodes
 
cbRedisCachingNodem_cacheNode = nullptr
 
cbGraphSharedMemm_sharedMem = nullptr
 
cbGraphSharedLuaStackm_sharedLuaStack = nullptr
 
trivial::cbVirtualDeviceManagerm_virtualDevice = nullptr
 

Detailed Description

Definition at line 342 of file cbComputeGraph.hpp.

Constructor & Destructor Documentation

◆ cbComputeGraph()

cb::graph::cbComputeGraph::cbComputeGraph ( int32_t  idx)

◆ ~cbComputeGraph()

cb::graph::cbComputeGraph::~cbComputeGraph ( )

Definition at line 375 of file cbComputeGraph.cpp.

References m_cacheNode, m_nodes, m_sharedLuaStack, and m_sharedMem.

Member Function Documentation

◆ addCacheServer()

void cb::graph::cbComputeGraph::addCacheServer ( cbRedisCachingNode v)

The cache server node. Lua binding in.

Parameters
vthe redis caching server node.

Definition at line 580 of file cbComputeGraph.cpp.

References cb::graph::cbNode::graph, and m_cacheNode.

Referenced by cbComputeGraph().

Here is the caller graph for this function:

◆ createCell() [1/7]

cbMySQLCell * cb::graph::cbComputeGraph::createCell ( )

Create a Cell object.

Returns
cbMySQLCell*

Definition at line 407 of file cbComputeGraph.cpp.

References m_sharedMem, and cb::graph::cbGraphSharedMem::push().

Referenced by cbComputeGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createCell() [2/7]

cbMySQLCell * cb::graph::cbComputeGraph::createCell ( const std::string &  value)

Create a Cell object.

Parameters
valuestring
Returns
cbMySQLCell*

Definition at line 437 of file cbComputeGraph.cpp.

References m_sharedMem, and cb::graph::cbGraphSharedMem::push().

Here is the call graph for this function:

◆ createCell() [3/7]

cbMySQLCell * cb::graph::cbComputeGraph::createCell ( const std::string &  value,
const cbMySQLType t 
)

Create a Cell object.

Parameters
valuestring
tthe type. such as String, Date, DateTime.
Returns
cbMySQLCell*

Definition at line 443 of file cbComputeGraph.cpp.

References m_sharedMem, and cb::graph::cbGraphSharedMem::push().

Here is the call graph for this function:

◆ createCell() [4/7]

cbMySQLCell * cb::graph::cbComputeGraph::createCell ( double  value)

Create a Cell object.

Parameters
valuedouble
Returns
cbMySQLCell*

Definition at line 425 of file cbComputeGraph.cpp.

References m_sharedMem, and cb::graph::cbGraphSharedMem::push().

Here is the call graph for this function:

◆ createCell() [5/7]

cbMySQLCell * cb::graph::cbComputeGraph::createCell ( float  value)

Create a Cell object.

Parameters
valuefloat
Returns
cbMySQLCell*

Definition at line 419 of file cbComputeGraph.cpp.

References m_sharedMem, and cb::graph::cbGraphSharedMem::push().

Here is the call graph for this function:

◆ createCell() [6/7]

cbMySQLCell * cb::graph::cbComputeGraph::createCell ( int  value)

Create a Cell object.

Parameters
valueint
Returns
cbMySQLCell*

Definition at line 413 of file cbComputeGraph.cpp.

References m_sharedMem, and cb::graph::cbGraphSharedMem::push().

Here is the call graph for this function:

◆ createCell() [7/7]

cbMySQLCell * cb::graph::cbComputeGraph::createCell ( unsigned long long  value)

Create a Cell object.

Parameters
valueunsigned long long
Returns
cbMySQLCell*

Definition at line 431 of file cbComputeGraph.cpp.

References m_sharedMem, and cb::graph::cbGraphSharedMem::push().

Here is the call graph for this function:

◆ createCombineNode()

cbOperatorNode * cb::graph::cbComputeGraph::createCombineNode ( const std::vector< std::string > &  keys,
const std::string &  name 
)

Create a Combine Node object.

Parameters
keys
name
Returns
cbOperatorNode*

Definition at line 462 of file cbComputeGraph.cpp.

References cbOperatorNode, cb::graph::cbGraphSharedLuaStack::get(), m_sharedLuaStack, cbOpCombine::overload(), and registerNode().

Referenced by cbComputeGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createFilterNode()

cbOperatorNode * cb::graph::cbComputeGraph::createFilterNode ( const sol::function &  boolF,
const sol::function &  exF 
)

Create a Filter Node object.

Parameters
boolF
exF
Returns
cbOperatorNode*

Definition at line 473 of file cbComputeGraph.cpp.

References cbOperatorNode, cb::graph::cbGraphSharedLuaStack::get(), m_sharedLuaStack, cbOpFilter::overload(), and registerNode().

Referenced by cbComputeGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createRedisCachingNode()

cbRedisCachingNode * cb::graph::cbComputeGraph::createRedisCachingNode ( int32_t  idx)

! for sql only, now.

Create a Redis Caching Node object

Parameters
idx
Returns
cbRedisCachingNode*

Definition at line 456 of file cbComputeGraph.cpp.

References cbRedisCachingNode, trivial::cbVirtualDeviceManager::getRedisDevice(), m_virtualDevice, and cb::graph::cbRedisCachingNode::setRedisDevice().

Referenced by cbComputeGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createVirtualDeviceNode()

cbVirtualDeviceNode * cb::graph::cbComputeGraph::createVirtualDeviceNode ( int32_t  idx)

create nodes belongs to this graph.

Parameters
idx
Returns
cbVirtualDeviceNode*

Definition at line 449 of file cbComputeGraph.cpp.

References cbVirtualDeviceNode, trivial::cbVirtualDeviceManager::getMySqlDevice(), m_virtualDevice, registerNode(), and cb::graph::cbVirtualDeviceNode::setMySQLDevice().

Referenced by cbComputeGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ execMain()

void cb::graph::cbComputeGraph::execMain ( WFGraphTask *  task,
cbComputeGraph graph 
)
static

Execute the graph task.

Parameters
task
graph

Definition at line 564 of file cbComputeGraph.cpp.

◆ execScript()

void cb::graph::cbComputeGraph::execScript ( const std::string &  script)

execute the script

Parameters
script

Definition at line 578 of file cbComputeGraph.cpp.

References cb::graph::cbGraphSharedLuaStack::execScript(), and m_sharedLuaStack.

Referenced by cb::apiCPP::addGraph().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ execScriptFile()

void cb::graph::cbComputeGraph::execScriptFile ( const std::string &  filePath)

execute the script from file.

Parameters
filePath

Definition at line 574 of file cbComputeGraph.cpp.

References cb::graph::cbGraphSharedLuaStack::execScriptFile(), and m_sharedLuaStack.

Here is the call graph for this function:

◆ generateGraphTask()

WFGraphTask * cb::graph::cbComputeGraph::generateGraphTask ( const graph_callback func = nullptr)

◆ getId()

int32_t cb::graph::cbComputeGraph::getId ( )

Get the Id object.

Returns
int32_t

Definition at line 492 of file cbComputeGraph.cpp.

References m_idx.

◆ getNodes()

std::vector< cbNode * > cb::graph::cbComputeGraph::getNodes ( )

Get the Nodes object.

Returns
std::vector<cbNode*>

Definition at line 587 of file cbComputeGraph.cpp.

References m_nodes.

Referenced by cb::pipeline::app::initRHttp().

Here is the caller graph for this function:

◆ getOutput()

cbOutputTableStruct * cb::graph::cbComputeGraph::getOutput ( )

Get the Output object.

Returns
cbOutputTableStruct*

Definition at line 585 of file cbComputeGraph.cpp.

References cb::graph::cbGraphSharedMem::getOutStruct(), and m_sharedMem.

Referenced by cb::pipeline::app::initRHttp().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isDAG()

bool cb::graph::cbComputeGraph::isDAG ( )

To judge the Graph is DAG or not.

Returns
true
false

Definition at line 382 of file cbComputeGraph.cpp.

References isSingleOutput(), m_nodes, and cb::graph::cbNode::nextNode.

Referenced by cbComputeGraph(), and generateGraphTask().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isSingleOutput()

bool cb::graph::cbComputeGraph::isSingleOutput ( )

To judge the graph has single output or not.

Returns
true
false

Definition at line 396 of file cbComputeGraph.cpp.

References m_nodes.

Referenced by cbComputeGraph(), generateGraphTask(), and isDAG().

Here is the caller graph for this function:

◆ registerNode()

void cb::graph::cbComputeGraph::registerNode ( cbNode node)

register a node. Not used by lua binding.

Parameters
node

Definition at line 487 of file cbComputeGraph.cpp.

References m_nodes.

Referenced by createCombineNode(), createFilterNode(), and createVirtualDeviceNode().

Here is the caller graph for this function:

◆ setVirtualDeviceManager()

void cb::graph::cbComputeGraph::setVirtualDeviceManager ( trivial::cbVirtualDeviceManager virtualDeviceM)

Set the Virtual Device Manager object.

Parameters
virtualDeviceM

Definition at line 483 of file cbComputeGraph.cpp.

References m_virtualDevice.

Referenced by cb::apiCPP::addGraph().

Here is the caller graph for this function:

Member Data Documentation

◆ cbOperatorNode

friend cb::graph::cbComputeGraph::cbOperatorNode

Definition at line 346 of file cbComputeGraph.hpp.

Referenced by createCombineNode(), and createFilterNode().

◆ cbRedisCachingNode

friend cb::graph::cbComputeGraph::cbRedisCachingNode

Definition at line 345 of file cbComputeGraph.hpp.

Referenced by createRedisCachingNode().

◆ cbVirtualDeviceNode

friend cb::graph::cbComputeGraph::cbVirtualDeviceNode

Definition at line 344 of file cbComputeGraph.hpp.

Referenced by createVirtualDeviceNode().

◆ io

cbOpIO cb::graph::cbComputeGraph::io
private

◆ m_cacheNode

cbRedisCachingNode* cb::graph::cbComputeGraph::m_cacheNode = nullptr
private

Definition at line 534 of file cbComputeGraph.hpp.

Referenced by addCacheServer(), generateGraphTask(), and ~cbComputeGraph().

◆ m_idx

int32_t cb::graph::cbComputeGraph::m_idx = 0
private

Definition at line 531 of file cbComputeGraph.hpp.

Referenced by generateGraphTask(), and getId().

◆ m_nodes

std::vector<cbNode*> cb::graph::cbComputeGraph::m_nodes
private

◆ m_sharedLuaStack

cbGraphSharedLuaStack* cb::graph::cbComputeGraph::m_sharedLuaStack = nullptr
private

◆ m_sharedMem

cbGraphSharedMem* cb::graph::cbComputeGraph::m_sharedMem = nullptr
private

◆ m_virtualDevice

trivial::cbVirtualDeviceManager* cb::graph::cbComputeGraph::m_virtualDevice = nullptr
private

The documentation for this class was generated from the following files: