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

FIX 消息的面向对象封装 More...

#include <fix_codec.hpp>

Collaboration diagram for fix40::FixMessage:
Collaboration graph

Public Member Functions

void set (int tag, const std::string &value)
 设置字符串类型字段
 
void set (int tag, int value)
 设置整数类型字段
 
std::string get_string (int tag) const
 获取字符串类型字段值
 
int get_int (int tag) const
 获取整数类型字段值
 
bool has (int tag) const
 检查标签是否存在
 
const std::unordered_map< int, std::string > & get_fields () const
 获取所有字段的只读引用
 

Friends

class FixCodec
 

Detailed Description

FIX 消息的面向对象封装

封装 FIX 消息的字段,提供类型安全的访问接口。

使用示例
msg.set(tags::MsgType, "A");
std::string type = msg.get_string(tags::MsgType);
int hb = msg.get_int(tags::HeartBtInt);
FIX 消息的面向对象封装
Definition fix_codec.hpp:46
void set(int tag, const std::string &value)
设置字符串类型字段
Definition fix_codec.hpp:53
std::string get_string(int tag) const
获取字符串类型字段值
Definition fix_codec.hpp:68
int get_int(int tag) const
获取整数类型字段值
Definition fix_codec.hpp:82
constexpr int HeartBtInt
心跳间隔(秒)
Definition fix_tags.hpp:55
constexpr int MsgType
消息类型(如 "A"=Logon, "0"=Heartbeat, "5"=Logout)
Definition fix_tags.hpp:33

Member Function Documentation

◆ get_fields()

const std::unordered_map< int, std::string > & fix40::FixMessage::get_fields ( ) const
inline

获取所有字段的只读引用

Returns
const std::unordered_map<int, std::string>& 字段映射

◆ get_int()

int fix40::FixMessage::get_int ( int  tag) const
inline

获取整数类型字段值

Parameters
tag标签编号
Returns
int 字段值
Exceptions
std::runtime_error标签不存在或转换失败时抛出异常
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_string()

std::string fix40::FixMessage::get_string ( int  tag) const
inline

获取字符串类型字段值

Parameters
tag标签编号
Returns
std::string 字段值
Exceptions
std::runtime_error标签不存在时抛出异常
Here is the caller graph for this function:

◆ has()

bool fix40::FixMessage::has ( int  tag) const
inline

检查标签是否存在

Parameters
tag标签编号
Returns
true 标签存在
false 标签不存在
Here is the caller graph for this function:

◆ set() [1/2]

void fix40::FixMessage::set ( int  tag,
const std::string &  value 
)
inline

设置字符串类型字段

Parameters
tag标签编号
value字段值
Here is the caller graph for this function:

◆ set() [2/2]

void fix40::FixMessage::set ( int  tag,
int  value 
)
inline

设置整数类型字段

Parameters
tag标签编号
value字段值(自动转换为字符串)

Friends And Related Symbol Documentation

◆ FixCodec

friend class FixCodec
friend

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