FIX 4.0 Demo 1.0
Loading...
Searching...
No Matches
fix40::client::ClientState Class Reference

客户端状态管理器 More...

#include <client_state.hpp>

Collaboration diagram for fix40::client::ClientState:
Collaboration graph

Public Types

using StateChangeCallback = std::function< void()>
 

Public Member Functions

 ClientState ()=default
 
void setConnectionState (ConnectionState state)
 
ConnectionState getConnectionState () const
 
std::string getConnectionStateString () const
 
void setUserId (const std::string &userId)
 
std::string getUserId () const
 
void updateAccount (const AccountInfo &info)
 
AccountInfo getAccount () const
 
void updatePosition (const PositionInfo &pos)
 
void setPositions (const std::vector< PositionInfo > &positions)
 
std::vector< PositionInfogetPositions () const
 
void clearPositions ()
 
void addOrder (const OrderInfo &order)
 
void updateOrder (const std::string &clOrdID, const OrderInfo &order)
 
std::vector< OrderInfogetOrders () const
 
std::vector< OrderInfogetActiveOrders () const
 
void clearOrders ()
 
void setOrders (const std::vector< OrderInfo > &orders)
 批量设置订单列表
 
void saveOrders (const std::string &filepath="")
 保存订单到文件
 
void loadOrders (const std::string &filepath="")
 从文件加载订单
 
void setSearchResults (const std::vector< std::string > &results)
 
std::vector< std::string > getSearchResults () const
 
void setOnStateChange (StateChangeCallback callback)
 
void notifyStateChange ()
 
void setLastError (const std::string &error)
 
std::string getLastError () const
 
void addMessage (const std::string &msg)
 
std::vector< std::string > getMessages () const
 

Detailed Description

客户端状态管理器

线程安全地管理客户端状态,支持:

  • 从 FIX 回调线程更新状态
  • 从 TUI 渲染线程读取状态
  • 状态变更通知

Member Typedef Documentation

◆ StateChangeCallback

using fix40::client::ClientState::StateChangeCallback = std::function<void()>

Constructor & Destructor Documentation

◆ ClientState()

fix40::client::ClientState::ClientState ( )
default

Member Function Documentation

◆ addMessage()

void fix40::client::ClientState::addMessage ( const std::string &  msg)
Here is the call graph for this function:

◆ addOrder()

void fix40::client::ClientState::addOrder ( const OrderInfo order)
Here is the call graph for this function:

◆ clearOrders()

void fix40::client::ClientState::clearOrders ( )
Here is the call graph for this function:

◆ clearPositions()

void fix40::client::ClientState::clearPositions ( )
Here is the call graph for this function:

◆ getAccount()

AccountInfo fix40::client::ClientState::getAccount ( ) const

◆ getActiveOrders()

std::vector< OrderInfo > fix40::client::ClientState::getActiveOrders ( ) const

◆ getConnectionState()

ConnectionState fix40::client::ClientState::getConnectionState ( ) const

◆ getConnectionStateString()

std::string fix40::client::ClientState::getConnectionStateString ( ) const

◆ getLastError()

std::string fix40::client::ClientState::getLastError ( ) const

◆ getMessages()

std::vector< std::string > fix40::client::ClientState::getMessages ( ) const

◆ getOrders()

std::vector< OrderInfo > fix40::client::ClientState::getOrders ( ) const

◆ getPositions()

std::vector< PositionInfo > fix40::client::ClientState::getPositions ( ) const

◆ getSearchResults()

std::vector< std::string > fix40::client::ClientState::getSearchResults ( ) const

◆ getUserId()

std::string fix40::client::ClientState::getUserId ( ) const

◆ loadOrders()

void fix40::client::ClientState::loadOrders ( const std::string &  filepath = "")

从文件加载订单

Parameters
filepath文件路径(默认 ~/.fix_client_orders.dat)

◆ notifyStateChange()

void fix40::client::ClientState::notifyStateChange ( )
Here is the caller graph for this function:

◆ saveOrders()

void fix40::client::ClientState::saveOrders ( const std::string &  filepath = "")

保存订单到文件

Parameters
filepath文件路径(默认 ~/.fix_client_orders.dat)

◆ setConnectionState()

void fix40::client::ClientState::setConnectionState ( ConnectionState  state)
Here is the call graph for this function:

◆ setLastError()

void fix40::client::ClientState::setLastError ( const std::string &  error)
Here is the call graph for this function:

◆ setOnStateChange()

void fix40::client::ClientState::setOnStateChange ( StateChangeCallback  callback)

◆ setOrders()

void fix40::client::ClientState::setOrders ( const std::vector< OrderInfo > &  orders)

批量设置订单列表

用于“从服务端持久化历史刷新订单列表”等场景: 一次性替换内部订单容器并只触发一次 notifyStateChange(),避免逐条 addOrder 导致的频繁刷新。

Parameters
orders新的订单列表(按希望展示的顺序排列)
Note
clOrdID 为空的订单会被忽略(静默跳过)。
Here is the call graph for this function:

◆ setPositions()

void fix40::client::ClientState::setPositions ( const std::vector< PositionInfo > &  positions)
Here is the call graph for this function:

◆ setSearchResults()

void fix40::client::ClientState::setSearchResults ( const std::vector< std::string > &  results)
Here is the call graph for this function:

◆ setUserId()

void fix40::client::ClientState::setUserId ( const std::string &  userId)

◆ updateAccount()

void fix40::client::ClientState::updateAccount ( const AccountInfo info)
Here is the call graph for this function:

◆ updateOrder()

void fix40::client::ClientState::updateOrder ( const std::string &  clOrdID,
const OrderInfo order 
)
Here is the call graph for this function:

◆ updatePosition()

void fix40::client::ClientState::updatePosition ( const PositionInfo pos)
Here is the call graph for this function:

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