diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-09-04 11:25:04 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-04 11:25:04 +0200 |
| commit | 6789dd7d88a192e3f55b95798cb393e7d12f368a (patch) | |
| tree | 7f04815ad5214f97d0fb2becceceed7ce8089b3d /dev/lib/fix | |
| parent | 443588a42fe9cf48b5f63184b94afe483cb0e761 (diff) | |
| parent | fda7082c54ad46a56ac885d4686b82bad8dbc7c9 (diff) | |
Merge pull request #4 from amlel-el-mahrouss/devv1.0.43
OCL — v1.0.43
Diffstat (limited to 'dev/lib/fix')
| -rw-r--r-- | dev/lib/fix/parser.hpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/dev/lib/fix/parser.hpp b/dev/lib/fix/parser.hpp index 8181359..723506e 100644 --- a/dev/lib/fix/parser.hpp +++ b/dev/lib/fix/parser.hpp @@ -1,12 +1,12 @@ /* * File: fix/parser.hpp * Purpose: Financial Information Exchange parser in C++ - * Author: Amlal El Mahrouss (founder@snu.systems) - * Copyright 2025, Amlal El Mahrouss and SNU Systems Corp. + * Author: Amlal El Mahrouss (amlal@nekernel.org) + * Copyright 2025, Amlal El Mahrouss */ -#ifndef _SNU_FIX_PARSER_HPP -#define _SNU_FIX_PARSER_HPP +#ifndef _OCL_FIX_PARSER_HPP +#define _OCL_FIX_PARSER_HPP #include <cstddef> #include <cassert> @@ -18,7 +18,7 @@ #include <unistd.h> #include <signal.h> -namespace snu::fix +namespace ocl::fix { template <typename char_type> class basic_visitor; @@ -60,8 +60,8 @@ namespace snu::fix template <typename char_type = char> struct basic_range final { - char_type* bytes_; - size_t length_; + char_type* bytes_{nullptr}; + size_t length_{}; bool is_valid() noexcept { @@ -77,7 +77,7 @@ namespace snu::fix /// @brief Convert basic_range to usable string. /// @note This function assumes that the basic_range is valid and contains ASCII bytes. template <typename char_type = char> - std::basic_string<char_type> to_string(basic_range<char_type>& basic_range) noexcept + inline std::basic_string<char_type> to_string(basic_range<char_type>& basic_range) noexcept { if (basic_range.length_ < 0) return std::basic_string<char_type>{}; @@ -201,14 +201,16 @@ namespace snu::fix } }; - template <typename char_type = char> - inline void must_pass(basic_range_data<char_type>& basic_range) + template <typename char_type = char, typename error_handler> + inline void must_pass(basic_range_data<char_type>& basic_range, error_handler& handler) { if (!basic_range.is_valid()) { - ::kill(::getpid(), SIGTRAP); + handler("Invalid FIX packet"); } } -} // namespace snu::fix -#endif // ifndef _SNU_FIX_PARSER_HPP + using fix_tag_type = std::uint32_t; +} // namespace ocl::fix + +#endif // ifndef _OCL_FIX_PARSER_HPP |
