fix8  version 1.4.0
Open Source C++ FIX Framework
FIX8 Namespace Reference

Namespaces

 defaults
 
 MBUS
 
 States
 Session states and semantics.
 
 TEX
 

Classes

class  _f8_threadcore
 pthread wrapper abstract base More...
 
struct  _pair
 Pair abstraction for use with GeneratedTable. More...
 
struct  _pair< const char *, Val >
 Partial specialisation of Pair abstraction for use with GeneratedTable. More...
 
class  AsyncSocket
 Half duplex async socket wrapper with thread. More...
 
struct  BadCheckSum
 An inbound message had an invalid (incorrect) checksum. More...
 
struct  BadCompidId
 A message was received with an invalid sender/target compid id. More...
 
struct  BadSendingTime
 A message was received with an invalid sending time. More...
 
struct  BaseEntry
 
class  BaseField
 The base field class (ABC) for all fields. More...
 
struct  BaseMsgEntry
 Message instantiation table entry. More...
 
class  BCLogger
 A broadcast logger. More...
 
class  bcostream
 udp stream More...
 
class  bcoutbuf
 Socket output streambuf, inspiration from Josuttis N.M. More...
 
class  buffered_ostream
 
struct  CharRealm
 f8c character realm type. More...
 
class  ClientConnection
 Client (initiator) specialisation of Connection. More...
 
class  ClientSession
 Client wrapper. More...
 
class  ClientSessionBase
 Base Client wrapper. More...
 
class  Configuration
 Class to encapsulate a Fix8 configuration. More...
 
struct  ConfigurationError
 An bad or missing configuration parameter. More...
 
class  Connection
 Complete Fix connection (reader and writer). More...
 
class  ConsoleMenu
 Console test harness menu. More...
 
struct  Ctxt
 f8c compilation context. More...
 
struct  DuplicateField
 A field was decoded in a message that has already been decoded. More...
 
class  ebitset
 Bitset for enums. More...
 
class  ebitset_r
 Atomic bitset for enums. More...
 
struct  EnumType
 Int2Type idiom. Kudos to Andrei Alexandrescu. More...
 
class  f8_mutex
 generic pthread_mutex wrapper More...
 
class  f8_scoped_lock_impl
 
class  f8_spin_lock
 generic spin_lock wrapper More...
 
class  f8_thread
 Thread wrapper. Ctor provides T instance and specifies ptr to member to call or defaults to operator() More...
 
class  f8_thread_cancellation_token
 Thread cancellation token. More...
 
struct  f8_threadException
 A pthread attribute error occured. More...
 
class  f8Exception
 Base exception class. More...
 
struct  F8MetaCntx
 Static metadata context class - one per FIX xml schema. More...
 
class  fdinbuf
 Create a streambuf from an open file descriptor. More...
 
class  fdoutbuf
 File descriptor output streambuf, inspiration from Josuttis N.M. More...
 
class  ff_unbounded_queue
 
class  ff_unbounded_queue< T * >
 
class  Field
 Field template. There will ONLY be partial template specialisations of this template. More...
 
class  Field< Boolean, field >
 Partial specialisation for Boolean field type. More...
 
class  Field< char *, field >
 Partial specialisation for char * field type. More...
 
class  Field< char, field >
 Partial specialisation for unsigned short field type. More...
 
class  Field< DayOfMonth, field >
 Partial specialisation for DayOfMonth field type. More...
 
class  Field< f8String, field >
 Partial specialisation for f8String field type. More...
 
class  Field< fp_type, field >
 Partial specialisation for fp_type field type. fp_type is singe or double. More...
 
class  Field< int, field >
 Partial specialisation for int field type. More...
 
class  Field< Length, field >
 Partial specialisation for Length field type. More...
 
class  Field< LocalMktDate, field >
 Partial specialisation for LocalMktDate field type. More...
 
class  Field< MonthYear, field >
 Partial specialisation for MonthYear field type. More...
 
class  Field< NumInGroup, field >
 Partial specialisation for NumInGroup field type. More...
 
class  Field< SeqNum, field >
 Partial specialisation for SeqNum field type. More...
 
class  Field< TagNum, field >
 Partial specialisation for TagNum field type. More...
 
class  Field< TZTimeOnly, field >
 Partial specialisation for TZTimeOnly field type. More...
 
class  Field< TZTimestamp, field >
 Partial specialisation for TZTimestamp field type. More...
 
class  Field< UTCDateOnly, field >
 Partial specialisation for UTCDateOnly field type. More...
 
class  Field< UTCTimeOnly, field >
 Partial specialisation for UTCTimeOnly field type. More...
 
class  Field< UTCTimestamp, field >
 Partial specialisation for UTCTimestamp field type. More...
 
struct  FieldSpec
 f8c internal field representation. More...
 
struct  FieldTrait
 Used for static trait interrogation. More...
 
struct  FieldTrait_Hash_Array
 Fast index lookup for FieldTrait. More...
 
class  FieldTraits
 A collection of FieldTraits for a message. Which fields are required, which are present. More...
 
class  FileLogger
 A file logger. More...
 
class  FilePersister
 
class  filestdin
 Abstract file or stdin input. More...
 
class  FIXReader
 Fix message reader. More...
 
class  FIXWriter
 Fix message writer. More...
 
class  fptrostream
 File pointer stream. More...
 
class  GeneratedTable
 Fast map for statically generated data types. Assumes table is sorted. Complexity is O(logN). More...
 
class  GroupBase
 Abstract base class for all repeating groups. More...
 
struct  IllegalMessage
 A message was read that was in an illegal format. More...
 
class  Inst
 Field metadata structures. More...
 
class  IntervalTimer
 High resolution interval timer. More...
 
struct  InvalidBodyLength
 A message was decoded with an invalid message body length. More...
 
struct  InvalidConfiguration
 An invalid configuration parameter was passed. More...
 
struct  InvalidDomainValue
 For field types with a specified domain (realm), a value was decoded that was not in the domain set/range. More...
 
struct  InvalidField
 An invalid field was requested or added. More...
 
struct  InvalidMessage
 An invalid message was requested or decoded. More...
 
struct  InvalidMetadata
 Indicates a static metadata lookup failed. With the exception of user defined fields there should never be an instance where a metatdata lookup fails. More...
 
struct  InvalidMsgSequence
 A message was received with an out of sequence sequence number. More...
 
struct  InvalidRepeatingGroup
 An invalid repeating group was found while attempting to encode a message. More...
 
struct  InvalidVersion
 A message was decoded that had a Fix version not configured for this session. More...
 
struct  IPrec
 
class  log_stream
 
struct  LogfileException
 Could not open a logfile. More...
 
class  Logger
 f8_thread delegated async logging class More...
 
struct  LoginParameters
 
class  MemoryPersister
 Memory based message persister. More...
 
class  Message
 A complete Fix message with header, body and trailer. More...
 
class  MessageBase
 Base class for all fix messages. More...
 
struct  MessageSpec
 f8c internal message representation. More...
 
class  Minst
 Structures for framework generated message creation and static trait interrogation. More...
 
struct  MissingMandatoryField
 An outbound message was missing a mandatory field. More...
 
struct  MissingMessageComponent
 An outbound message was missing a header or trailer. More...
 
struct  MissingRepeatingGroupField
 An invalid repeating group field was found while decoding a message (first field is mandatory). More...
 
struct  MsgSequenceTooLow
 A message was received with an out of sequence sequence number. More...
 
struct  null_insert
 Template provides insert operator that inserts nothing. More...
 
struct  PeerResetConnection
 A connected peer has reset the connection (disconnected). More...
 
class  Persister
 Base (ABC) Persister class. More...
 
class  PipeLogger
 A pipe logger. More...
 
struct  Prec
 File persister. More...
 
class  presorted_set
 
class  presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >
 
class  push_dir
 
struct  RealmBase
 Domain range/set static metadata base class. More...
 
class  RealmObject
 f8c range or set domain realm. More...
 
class  RegExp
 POSIX regex wrapper class. More...
 
class  RegMatch
 A class to contain regex matches using RegExp. More...
 
class  ReliableClientSession
 Reliable Client wrapper. This client attempts to recover from disconnects and login rejects. More...
 
class  Router
 Base class for inbound message routing. More...
 
struct  Schedule
 
struct  Server
 Class to hold server settings for failoverable sessions. More...
 
class  ServerConnection
 Server (acceptor) specialisation of Connection. More...
 
class  ServerManager
 Multi Server Manager. More...
 
class  ServerSession
 
class  ServerSessionBase
 Base Server Session. More...
 
class  Session
 Fix8 Base Session. User sessions are derived from this class. More...
 
struct  Session_Schedule
 
struct  SessionConfig
 Base session wrapper. More...
 
class  SessionID
 Quickfix style sessionid. More...
 
class  SessionInstance
 Server session instance. More...
 
class  SessionInstanceBase
 Base Server session instance. More...
 
class  SessionManager
 Session Manager. More...
 
class  SingleLogger
 A global singleton logger. More...
 
class  Singleton
 
struct  SslContext
 Class to hold SSL context for failoverable sessions. More...
 
struct  StringLessThanNoCase
 Case-insensitive string comparison. More...
 
struct  StringPtrLessThan
 Case-sensitive string comparison, pointer version. More...
 
struct  StringPtrLessThanNoCase
 Case-insensitive string comparison, pointer version. More...
 
struct  StringRealm
 f8c string realm type. More...
 
class  Tickval
 
class  Timer
 High resolution timer. More...
 
class  TimerEvent
 Timer event object to provide callback context with Timer. More...
 
class  tty_save_state
 
struct  Type2Type
 Type2Type idiom. Variadic template version. Kudos to Andrei Alexandrescu. More...
 
class  TypedRealm
 f8c typed realm. More...
 
struct  UnknownField
 An invalid field was decoded. More...
 
struct  XMLError
 An invalid configuration parameter was passed. More...
 
class  XmlFileLogger
 A file logger. More...
 

Typedefs

using MsgList = std::deque< FIX8::Message * >
 
using f8String = std::string
 
using fp_type = double
 
using Package_info = std::map< f8String, f8String >
 
using UTCTimestamp = EnumType< FieldTrait::ft_UTCTimestamp >
 
using UTCTimeOnly = EnumType< FieldTrait::ft_UTCTimeOnly >
 
using UTCDateOnly = EnumType< FieldTrait::ft_UTCDateOnly >
 
using LocalMktDate = EnumType< FieldTrait::ft_LocalMktDate >
 
using MonthYear = EnumType< FieldTrait::ft_MonthYear >
 
using TZTimeOnly = EnumType< FieldTrait::ft_TZTimeOnly >
 
using TZTimestamp = EnumType< FieldTrait::ft_TZTimestamp >
 
using Length = EnumType< FieldTrait::ft_Length >
 
using TagNum = EnumType< FieldTrait::ft_TagNum >
 
using SeqNum = EnumType< FieldTrait::ft_SeqNum >
 
using NumInGroup = EnumType< FieldTrait::ft_NumInGroup >
 
using DayOfMonth = EnumType< FieldTrait::ft_DayOfMonth >
 
using Boolean = EnumType< FieldTrait::ft_Boolean >
 
using Qty = fp_type
 
using Amt = fp_type
 
using price = fp_type
 
using PriceOffset = fp_type
 
using Percentage = fp_type
 
using MultipleCharValue = f8String
 
using MultipleStringValue = f8String
 
using country = f8String
 
using currency = f8String
 
using Exchange = f8String
 
using Language = f8String
 
using XMLData = f8String
 
using data = f8String
 
using msg_seq_num = Field< SeqNum, Common_MsgSeqNum >
 
using begin_seq_num = Field< SeqNum, Common_BeginSeqNo >
 
using end_seq_num = Field< SeqNum, Common_EndSeqNo >
 
using new_seq_num = Field< SeqNum, Common_NewSeqNo >
 
using ref_seq_num = Field< SeqNum, Common_RefSeqNum >
 
using body_length = Field< Length, Common_BodyLength >
 
using sender_comp_id = Field< f8String, Common_SenderCompID >
 
using target_comp_id = Field< f8String, Common_TargetCompID >
 
using msg_type = Field< f8String, Common_MsgType >
 
using check_sum = Field< f8String, Common_CheckSum >
 
using begin_string = Field< f8String, Common_BeginString >
 
using test_request_id = Field< f8String, Common_TestReqID >
 
using text = Field< f8String, Common_Text >
 
using default_appl_ver_id = Field< f8String, Common_DefaultApplVerID >
 
using ref_msg_type = Field< f8String, Common_RefMsgType >
 
using sending_time = Field< UTCTimestamp, Common_SendingTime >
 
using orig_sending_time = Field< UTCTimestamp, Common_OrigSendingTime >
 
using gap_fill_flag = Field< Boolean, Common_GapFillFlag >
 
using poss_dup_flag = Field< Boolean, Common_PossDupFlag >
 
using reset_seqnum_flag = Field< Boolean, Common_ResetSeqNumFlag >
 
using heartbeat_interval = Field< int, Common_HeartBtInt >
 
using encrypt_method = Field< int, Common_EncryptMethod >
 
using business_reject_reason = Field< int, Common_BusinessRejectReason >
 
using onbehalfof_comp_id = Field< f8String, Common_OnBehalfOfCompID >
 
using onbehalfof_sub_id = Field< f8String, Common_OnBehalfOfSubID >
 
using onbehalfof_location_id = Field< f8String, Common_OnBehalfOfLocationID >
 
using onbehalfof_sending_time = Field< UTCTimestamp, Common_OnBehalfOfSendingTime >
 
using logger_function = std::function< bool(const std::string &, Logger::Level, const char *, const unsigned)>
 
using GlobalLogger = SingleLogger< glob_log0 >
 
using GroupElement = std::vector< MessageBase * >
 
using Groups = std::map< unsigned short, GroupBase * >
 
using c_str_compare = std::function< bool(const char *, const char *)>
 Field and Message metadata structures. More...
 
using msg_create = std::function< Message *(bool)>
 
using MsgTable = GeneratedTable< const char *, BaseMsgEntry >
 
using ReverseMsgTable = std::map< const char *const, const BaseMsgEntry *, c_str_compare >
 
using FieldTable = GeneratedTable< unsigned, BaseEntry >
 
using ReverseFieldTable = std::map< const char *const, const BaseEntry *, c_str_compare >
 
using Fields = std::map< unsigned short, BaseField * >
 
using Positions = std::multimap< unsigned short, BaseField * >
 
using ClientManager = SessionManager< ClientSessionBase >
 Client Manager. More...
 
using SessionInstanceManager = SessionManager< SessionInstanceBase >
 Session Instance Manager. More...
 
using Client = std::tuple< f8String, Poco::Net::IPAddress >
 Class to hold client info settings for server sessions. More...
 
using Clients = std::unordered_map< f8String, Client >
 
template<typename T >
using f8_atomic = std::atomic< T >
 
using thread_id_t = std::thread::id
 
using f8_scoped_lock = f8_scoped_lock_impl< f8_mutex >
 
using f8_scoped_spin_lock = f8_scoped_lock_impl< f8_spin_lock >
 
template<typename T >
using dthread = f8_thread< T >
 
using _dthreadcore = _f8_threadcore
 
using dthread_cancellation_token = f8_thread_cancellation_token
 
using Presence = presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >
 
using RealmMap = std::map< RealmObject *, std::string, RealmObject::less >
 
using FieldSpecMap = std::map< unsigned, struct FieldSpec >
 
using FieldToNumMap = std::map< std::string, unsigned >
 
using GroupMap = std::map< unsigned, struct MessageSpec >
 
using BaseTypeMap = std::map< std::string, FieldTrait::FieldType >
 
using TypeToCPP = std::map< FieldTrait::FieldType, std::pair< std::string, std::string >>
 
using MessageSpecMap = std::map< const std::string, MessageSpec >
 
using FieldTraitOrder = std::multiset< const FieldTrait *, FieldTrait::PosCompare >
 
using CommonGroups = std::map< uint32_t, struct MessageSpec >
 
using CommonGroupMap = std::map< unsigned, CommonGroups >
 
using Components = std::map< std::string, const XmlElement * >
 
using CSMap = std::map< comp_str, std::string >
 

Enumerations

enum  ProcessModel { pm_thread, pm_pipeline, pm_coro, pm_count }
 Supported session process models. More...
 
enum  TimeIndicator {
  _time_only, _time_with_ms, _short_date_only, _date_only,
  _sec_only, _with_ms
}
 
enum  hyperunits_t {
  h_seconds, h_milliseconds, h_microseconds, h_nanoseconds,
  h_count
}
 
enum  comp_str {
  cs_do_not_edit, cs_start_namespace, cs_end_namespace, cs_start_anon_namespace,
  cs_end_anon_namespace, cs_divider, cs_copyright, cs_copyright2,
  cs_generated_includes, cs_header_preamble, cs_trailer_preamble
}
 

Functions

const unsigned char default_field_separator (0x1)
 default FIX field separator (^A) More...
 
const unsigned char default_assignment_separator ('=')
 default FIX assignment separator (=) More...
 
F8API std::string & InPlaceStrToUpper (std::string &src)
 
F8API std::string & InPlaceStrToLower (std::string &src)
 
F8API std::string StrToLower (const std::string &src)
 
F8API int decode_dow (const std::string &from)
 
F8API std::string & CheckAddTrailingSlash (std::string &source)
 
F8API std::string & InPlaceReplaceInSet (const std::string &iset, std::string &src, const char repl='_')
 
F8API std::string Str_error (const int err, const char *str=0)
 
F8API const std::string & GetTimeAsStringMS (std::string &result, const class Tickval *tv=0, const unsigned dplaces=6, bool use_gm=false)
 
std::string GetTimeAsStringMS (const class Tickval *tv, const unsigned dplaces=6, bool use_gm=false)
 
F8API const std::string & GetTimeAsStringMini (std::string &result, const Tickval *tv)
 
std::string GetTimeAsStringMini (const Tickval *tv)
 
std::string trim (const std::string &source, const std::string &ws=" \t")
 
const std::string & trim (std::string &source, const std::string &ws=" \t")
 
F8API const Package_infopackage_info ()
 
F8API f8String find_package_info_string (const f8String &what)
 
template<typename T >
void ignore_value (T val)
 
template<typename T >
void ignore_value (T *val)
 
template<typename T >
rotl (const T val, const int times)
 
template<typename T >
rotr (const T val, const int times)
 
unsigned ROT13Hash (const std::string &str)
 
unsigned rothash (unsigned result, unsigned value)
 
template<typename _CharT , typename _Traits , typename _Alloc >
bool operator% (const std::basic_string< _CharT, _Traits, _Alloc > &__lhs, const std::basic_string< _CharT, _Traits, _Alloc > &__rhs)
 
template<typename _CharT , typename _Traits , typename _Alloc >
bool operator% (const _CharT *__lhs, const std::basic_string< _CharT, _Traits, _Alloc > &__rhs)
 
template<typename _CharT , typename _Traits , typename _Alloc >
bool operator% (const std::basic_string< _CharT, _Traits, _Alloc > &__lhs, const _CharT *__rhs)
 
template<typename _CharT , typename _Traits , typename _Alloc >
bool operator^ (const std::basic_string< _CharT, _Traits, _Alloc > &__lhs, const std::basic_string< _CharT, _Traits, _Alloc > &__rhs)
 
F8API void create_path (const std::string &path)
 
template<typename T >
get_value (const std::string &source)
 
template<>
unsigned get_value (const std::string &source)
 
template<>
int get_value (const std::string &source)
 
template<>
double get_value (const std::string &source)
 
template<>
float get_value (const std::string &source)
 
template<>
bool get_value (const std::string &source)
 
template<typename T >
fast_atoi (const char *str, const char term='\0')
 
template<typename T >
size_t itoa (T value, char *result, int base)
 Fast itoa. More...
 
template<>
size_t itoa< unsigned int > (unsigned int value, char *result, int base)
 Fast itoa - unsigned int specialisation. More...
 
fp_type fast_atof (const char *p)
 
size_t modp_dtoa (double value, char *str, int prec)
 Convert double to ascii. More...
 
constexpr unsigned bitsum ()
 empty argument version More...
 
template<typename T , typename... Args>
constexpr unsigned bitsum (T value, Args...args)
 
template<typename T >
enum_str_get (const std::vector< std::string > &sset, const std::string &what, const T def, bool ignorecase=false)
 
F8API int get_umask ()
 
bool exist (const std::string &fname)
 
void split_path (const std::string &source, std::string &filepart, std::string &dirpart)
 
char * CopyString (const std::string &src, char *target, unsigned limit=0)
 
const size_t MAX_MSGTYPE_FIELD_LEN (32)
 
const size_t HEADER_CALC_OFFSET (32)
 
void format0 (int data, char *to, int width)
 
size_t parse_decimal (const char *begin, size_t len, int &to)
 
time_t time_to_epoch (const tm &ltm, int utcdiff=0)
 
size_t date_time_format (const Tickval &tickval, char *to, TimeIndicator ind)
 
Tickval::ticks date_time_parse (const char *ptr, size_t len)
 
Tickval::ticks time_parse (const char *ptr, size_t len, bool timeonly=false)
 
Tickval::ticks date_parse (const char *ptr, size_t len)
 
const f8String Common_MsgType_HEARTBEAT ("0")
 
const f8String Common_MsgType_TEST_REQUEST ("1")
 
const f8String Common_MsgType_RESEND_REQUEST ("2")
 
const f8String Common_MsgType_REJECT ("3")
 
const f8String Common_MsgType_SEQUENCE_RESET ("4")
 
const f8String Common_MsgType_LOGOUT ("5")
 
const f8String Common_MsgType_LOGON ("A")
 
const f8String Common_MsgType_BUSINESS_REJECT ("j")
 
const char Common_MsgByte_HEARTBEAT ('0')
 
const char Common_MsgByte_TEST_REQUEST ('1')
 
const char Common_MsgByte_RESEND_REQUEST ('2')
 
const char Common_MsgByte_REJECT ('3')
 
const char Common_MsgByte_SEQUENCE_RESET ('4')
 
const char Common_MsgByte_LOGOUT ('5')
 
const char Common_MsgByte_LOGON ('A')
 
const char Common_MsgByte_BUSINESS_REJECT ('j')
 
const unsigned short Common_BeginSeqNo (7)
 
const unsigned short Common_BeginString (8)
 
const unsigned short Common_BodyLength (9)
 
const unsigned short Common_CheckSum (10)
 
const unsigned short Common_EndSeqNo (16)
 
const unsigned short Common_MsgSeqNum (34)
 
const unsigned short Common_MsgType (35)
 
const unsigned short Common_NewSeqNo (36)
 
const unsigned short Common_PossDupFlag (43)
 
const unsigned short Common_RefSeqNum (45)
 
const unsigned short Common_SenderCompID (49)
 
const unsigned short Common_SendingTime (52)
 
const unsigned short Common_TargetCompID (56)
 
const unsigned short Common_Text (58)
 
const unsigned short Common_EncryptMethod (98)
 
const unsigned short Common_HeartBtInt (108)
 
const unsigned short Common_TestReqID (112)
 
const unsigned short Common_OnBehalfOfCompID (115)
 
const unsigned short Common_OnBehalfOfSubID (116)
 
const unsigned short Common_OrigSendingTime (122)
 
const unsigned short Common_GapFillFlag (123)
 
const unsigned short Common_ResetSeqNumFlag (141)
 
const unsigned short Common_OnBehalfOfLocationID (144)
 
const unsigned short Common_OnBehalfOfSendingTime (370)
 
const unsigned short Common_RefMsgType (372)
 
const unsigned short Common_BusinessRejectReason (380)
 
const unsigned short Common_DefaultApplVerID (1137)
 
template<hyperunits_t >
int hypersleep (unsigned amt)
 
template<>
int hypersleep< h_seconds > (unsigned amt)
 
template<>
int hypersleep< h_milliseconds > (unsigned amt)
 
template<>
int hypersleep< h_microseconds > (unsigned amt)
 
template<>
int hypersleep< h_nanoseconds > (unsigned amt)
 
int hypersleep (unsigned amt, hyperunits_t units)
 
const size_t max_global_filename_length (1024)
 
std::ostream & operator<< (std::ostream &os, const GroupBase &what)
 
F8API std::ostream & operator<< (std::ostream &os, const FieldTrait &what)
 
F8API std::ostream & operator<< (std::ostream &os, const FieldTraits &what)
 
const string & GetTimeAsStringMS (string &result, const Tickval *tv, const unsigned dplaces, bool use_gm)
 
const string & GetTimeAsStringMini (string &result, const Tickval *tv)
 
string & CheckAddTrailingSlash (string &src)
 
string & InPlaceStrToUpper (string &src)
 
string & InPlaceReplaceInSet (const string &iset, string &src, const char repl)
 
string & InPlaceStrToLower (string &src)
 
string StrToLower (const string &src)
 
void create_path (const string &path)
 
int decode_dow (const string &from)
 
int recover_line (const XmlElement &xf)
 
const F8MetaCntxTEX_ctx ()
 

Variables

F8API char glob_log0 [max_global_filename_length] { "global_filename_not_set.log" }
 
const CSMap _csMap
 

Detailed Description

All FIX8 classes and functions reside inside this namespace.

Typedef Documentation

Definition at line 454 of file thread.hpp.

using FIX8::Amt = typedef fp_type

Definition at line 2023 of file field.hpp.

using FIX8::BaseTypeMap = typedef std::map<std::string, FieldTrait::FieldType>

Definition at line 123 of file f8c.hpp.

Definition at line 2138 of file field.hpp.

Definition at line 2149 of file field.hpp.

Definition at line 2143 of file field.hpp.

Definition at line 1910 of file field.hpp.

Definition at line 2164 of file field.hpp.

using FIX8::c_str_compare = typedef std::function<bool(const char *, const char *)>

Field and Message metadata structures.

Definition at line 201 of file message.hpp.

Definition at line 2148 of file field.hpp.

using FIX8::Client = typedef std::tuple<f8String, Poco::Net::IPAddress>

Class to hold client info settings for server sessions.

Definition at line 181 of file session.hpp.

Client Manager.

Definition at line 184 of file multisession.hpp.

using FIX8::Clients = typedef std::unordered_map<f8String, Client>

Definition at line 182 of file session.hpp.

using FIX8::CommonGroupMap = typedef std::map<unsigned, CommonGroups>

Definition at line 180 of file f8c.hpp.

using FIX8::CommonGroups = typedef std::map<uint32_t, struct MessageSpec>

Definition at line 179 of file f8c.hpp.

using FIX8::Components = typedef std::map<std::string, const XmlElement *>

Definition at line 183 of file f8c.hpp.

using FIX8::country = typedef f8String

Definition at line 2031 of file field.hpp.

using FIX8::CSMap = typedef std::map<comp_str, std::string>

Definition at line 201 of file f8c.hpp.

using FIX8::currency = typedef f8String

Definition at line 2032 of file field.hpp.

using FIX8::data = typedef f8String

Definition at line 2036 of file field.hpp.

Definition at line 1875 of file field.hpp.

Definition at line 2152 of file field.hpp.

template<typename T >
using FIX8::dthread = typedef f8_thread<T>

Definition at line 453 of file thread.hpp.

Definition at line 455 of file thread.hpp.

Definition at line 2163 of file field.hpp.

Definition at line 2139 of file field.hpp.

using FIX8::Exchange = typedef f8String

Definition at line 2033 of file field.hpp.

template<typename T >
using FIX8::f8_atomic = typedef std::atomic <T>

Definition at line 55 of file thread.hpp.

Definition at line 451 of file thread.hpp.

Definition at line 452 of file thread.hpp.

using FIX8::f8String = typedef std::string

Definition at line 47 of file f8types.hpp.

using FIX8::Fields = typedef std::map <unsigned short, BaseField *>

Definition at line 377 of file message.hpp.

using FIX8::FieldSpecMap = typedef std::map<unsigned, struct FieldSpec>

Definition at line 118 of file f8c.hpp.

using FIX8::FieldTable = typedef GeneratedTable<unsigned, BaseEntry>

Definition at line 205 of file message.hpp.

using FIX8::FieldToNumMap = typedef std::map<std::string, unsigned>

Definition at line 119 of file f8c.hpp.

using FIX8::FieldTraitOrder = typedef std::multiset<const FieldTrait *, FieldTrait::PosCompare>

Definition at line 176 of file f8c.hpp.

using FIX8::fp_type = typedef double

Definition at line 51 of file f8types.hpp.

Definition at line 2158 of file field.hpp.

Definition at line 593 of file logger.hpp.

using FIX8::GroupElement = typedef std::vector<MessageBase *>

Definition at line 53 of file message.hpp.

using FIX8::GroupMap = typedef std::map<unsigned, struct MessageSpec>

Definition at line 120 of file f8c.hpp.

using FIX8::Groups = typedef std::map<unsigned short, GroupBase *>

Definition at line 56 of file message.hpp.

Definition at line 2162 of file field.hpp.

using FIX8::Language = typedef f8String

Definition at line 2034 of file field.hpp.

Definition at line 1735 of file field.hpp.

Definition at line 1342 of file field.hpp.

using FIX8::logger_function = typedef std::function<bool(const std::string&, Logger::Level, const char *, const unsigned)>

Definition at line 576 of file logger.hpp.

using FIX8::MessageSpecMap = typedef std::map<const std::string, MessageSpec>

Definition at line 175 of file f8c.hpp.

Definition at line 1445 of file field.hpp.

using FIX8::msg_create = typedef std::function<Message *(bool)>

Definition at line 202 of file message.hpp.

Definition at line 2137 of file field.hpp.

Definition at line 2147 of file field.hpp.

using FIX8::MsgList = typedef std::deque<FIX8::Message *>

Definition at line 44 of file consolemenu.hpp.

using FIX8::MsgTable = typedef GeneratedTable<const char *, BaseMsgEntry>

Definition at line 203 of file message.hpp.

Definition at line 2029 of file field.hpp.

Definition at line 2030 of file field.hpp.

Definition at line 2140 of file field.hpp.

Definition at line 1840 of file field.hpp.

Definition at line 2166 of file field.hpp.

Definition at line 2167 of file field.hpp.

Definition at line 2156 of file field.hpp.

using FIX8::Package_info = typedef std::map<f8String, f8String>

Definition at line 172 of file f8utils.hpp.

using FIX8::Percentage = typedef fp_type

Definition at line 2026 of file field.hpp.

using FIX8::Positions = typedef std::multimap<unsigned short, BaseField *>

Definition at line 378 of file message.hpp.

Definition at line 2159 of file field.hpp.

using FIX8::Presence = typedef presorted_set<unsigned short, FieldTrait, FieldTrait::Compare>

Definition at line 434 of file traits.hpp.

using FIX8::price = typedef fp_type

Definition at line 2024 of file field.hpp.

using FIX8::PriceOffset = typedef fp_type

Definition at line 2025 of file field.hpp.

using FIX8::Qty = typedef fp_type

Definition at line 2022 of file field.hpp.

using FIX8::RealmMap = typedef std::map<RealmObject *, std::string, RealmObject::less>

Definition at line 115 of file f8c.hpp.

Definition at line 2153 of file field.hpp.

Definition at line 2141 of file field.hpp.

Definition at line 2160 of file field.hpp.

using FIX8::ReverseFieldTable = typedef std::map<const char * const, const BaseEntry *, c_str_compare>

Definition at line 206 of file message.hpp.

using FIX8::ReverseMsgTable = typedef std::map<const char * const, const BaseMsgEntry *, c_str_compare>

Definition at line 204 of file message.hpp.

Definition at line 2145 of file field.hpp.

Definition at line 2155 of file field.hpp.

Definition at line 1805 of file field.hpp.

Session Instance Manager.

Definition at line 186 of file multisession.hpp.

Definition at line 1770 of file field.hpp.

Definition at line 2146 of file field.hpp.

Definition at line 2150 of file field.hpp.

using FIX8::text = typedef Field<f8String, Common_Text>

Definition at line 2151 of file field.hpp.

using FIX8::thread_id_t = typedef std::thread::id

Definition at line 58 of file thread.hpp.

using FIX8::TypeToCPP = typedef std::map<FieldTrait::FieldType, std::pair<std::string, std::string>>

Definition at line 124 of file f8c.hpp.

Definition at line 1549 of file field.hpp.

Definition at line 1642 of file field.hpp.

Definition at line 1239 of file field.hpp.

Definition at line 1136 of file field.hpp.

Definition at line 1028 of file field.hpp.

using FIX8::XMLData = typedef f8String

Definition at line 2035 of file field.hpp.

Enumeration Type Documentation

Enumerator
cs_do_not_edit 
cs_start_namespace 
cs_end_namespace 
cs_start_anon_namespace 
cs_end_anon_namespace 
cs_divider 
cs_copyright 
cs_copyright2 
cs_generated_includes 
cs_header_preamble 
cs_trailer_preamble 

Definition at line 186 of file f8c.hpp.

Enumerator
h_seconds 
h_milliseconds 
h_microseconds 
h_nanoseconds 
h_count 

Definition at line 43 of file hypersleep.hpp.

Supported session process models.

Enumerator
pm_thread 
pm_pipeline 
pm_coro 
pm_count 

Definition at line 56 of file f8types.hpp.

Enumerator
_time_only 
_time_with_ms 
_short_date_only 
_date_only 
_sec_only 
_with_ms 

Definition at line 882 of file field.hpp.

Function Documentation

constexpr unsigned FIX8::bitsum ( )

empty argument version

Definition at line 826 of file f8utils.hpp.

Referenced by bitsum().

826 { return 0; }
template<typename T , typename... Args>
constexpr unsigned FIX8::bitsum ( value,
Args...  args 
)

Calculate the value of a set of bit positions, e.g. bitsum(1,3,5,6)

Template Parameters
Tfirst value, used to unpack
Argsremaining values
Returns
result

Definition at line 833 of file f8utils.hpp.

References bitsum().

834  { return 1 << value | bitsum(args...); }
constexpr unsigned bitsum(T value, Args...args)
Definition: f8utils.hpp:833
F8API std::string& FIX8::CheckAddTrailingSlash ( std::string &  source)

Check if string has trailing slash, if not add.

Parameters
sourcesource string
Returns
reference to modified string

Referenced by FIX8::FilePersister::initialise(), main(), and open_ofile().

string& FIX8::CheckAddTrailingSlash ( string &  src)

Definition at line 122 of file f8utils.cpp.

123 {
124  if (!src.empty() && *src.rbegin() != '/')
125  src += '/';
126  return src;
127 }
const unsigned short FIX8::Common_BeginSeqNo ( )
const unsigned short FIX8::Common_BeginString ( )
const unsigned short FIX8::Common_BusinessRejectReason ( 380  )
const unsigned short FIX8::Common_CheckSum ( 10  )
const unsigned short FIX8::Common_DefaultApplVerID ( 1137  )
const unsigned short FIX8::Common_EncryptMethod ( 98  )
const unsigned short FIX8::Common_EndSeqNo ( 16  )
const unsigned short FIX8::Common_GapFillFlag ( 123  )
const unsigned short FIX8::Common_HeartBtInt ( 108  )
const char FIX8::Common_MsgByte_BUSINESS_REJECT ( 'j'  )
const char FIX8::Common_MsgByte_HEARTBEAT ( '0'  )

Referenced by FIX8::Session::process().

const char FIX8::Common_MsgByte_LOGON ( 'A'  )

Referenced by FIX8::Session::process().

const char FIX8::Common_MsgByte_LOGOUT ( '5'  )

Referenced by FIX8::Session::process().

const char FIX8::Common_MsgByte_REJECT ( '3'  )

Referenced by FIX8::Session::process().

const char FIX8::Common_MsgByte_RESEND_REQUEST ( '2'  )

Referenced by FIX8::Session::process().

const char FIX8::Common_MsgByte_SEQUENCE_RESET ( '4'  )

Referenced by FIX8::Session::process().

const char FIX8::Common_MsgByte_TEST_REQUEST ( '1'  )

Referenced by FIX8::Session::process().

const unsigned short FIX8::Common_MsgSeqNum ( 34  )
const unsigned short FIX8::Common_MsgType ( 35  )
const f8String FIX8::Common_MsgType_BUSINESS_REJECT ( "j"  )
const f8String FIX8::Common_MsgType_HEARTBEAT ( "0"  )
const f8String FIX8::Common_MsgType_LOGON ( "A"  )
const f8String FIX8::Common_MsgType_LOGOUT ( "5"  )
const f8String FIX8::Common_MsgType_REJECT ( "3"  )
const f8String FIX8::Common_MsgType_RESEND_REQUEST ( "2"  )
const f8String FIX8::Common_MsgType_SEQUENCE_RESET ( "4"  )
const f8String FIX8::Common_MsgType_TEST_REQUEST ( "1"  )
const unsigned short FIX8::Common_NewSeqNo ( 36  )
const unsigned short FIX8::Common_OnBehalfOfCompID ( 115  )
const unsigned short FIX8::Common_OnBehalfOfLocationID ( 144  )
const unsigned short FIX8::Common_OnBehalfOfSendingTime ( 370  )
const unsigned short FIX8::Common_OnBehalfOfSubID ( 116  )
const unsigned short FIX8::Common_OrigSendingTime ( 122  )
const unsigned short FIX8::Common_PossDupFlag ( 43  )
const unsigned short FIX8::Common_RefMsgType ( 372  )
const unsigned short FIX8::Common_RefSeqNum ( 45  )
const unsigned short FIX8::Common_ResetSeqNumFlag ( 141  )
const unsigned short FIX8::Common_SenderCompID ( 49  )
const unsigned short FIX8::Common_SendingTime ( 52  )

Referenced by MyMenu::load_msgs().

const unsigned short FIX8::Common_TargetCompID ( 56  )
const unsigned short FIX8::Common_TestReqID ( 112  )
const unsigned short FIX8::Common_Text ( 58  )
char* FIX8::CopyString ( const std::string &  src,
char *  target,
unsigned  limit = 0 
)
inline

Copy a string safely to a target.

Parameters
srcsource string
targettarget location
limitmaximum bytes to copy, 0 for no limit
Returns
pointer to target

Definition at line 1100 of file f8utils.hpp.

Referenced by FIX8::SingleLogger< fn >::set_global_filename().

1101 {
1102  if (!target)
1103  return nullptr;
1104  const unsigned sz(limit && static_cast<unsigned>(src.size()) > limit ? limit : (unsigned)src.size() + 1);
1105  src.copy(target, sz - 1);
1106  target[sz - 1] = 0;
1107  return target;
1108 }
void FIX8::create_path ( const string &  path)

Definition at line 197 of file f8utils.cpp.

198 {
199  string new_path;
200  for(string::const_iterator pos(path.begin()); pos != path.end(); ++pos)
201  {
202  new_path += *pos;
203  if(*pos == '/' || *pos == '\\' || pos + 1 == path.end())
204  {
205 #ifdef _MSC_VER
206  _mkdir(new_path.c_str());
207 #else
208  mkdir(new_path.c_str(), 0777); // umask applied after
209 #endif
210  }
211  }
212 }
F8API void FIX8::create_path ( const std::string &  path)

Create a full path, including nested directories

Parameters
pathpath to create

Referenced by FIX8::FileLogger::rotate().

Tickval::ticks FIX8::date_parse ( const char *  ptr,
size_t  len 
)
inline

Definition at line 1010 of file field.hpp.

References FIX8::Tickval::billion, FIX8::Tickval::get_ticks(), parse_decimal(), and time_to_epoch().

1011 {
1012  if (len == 0 || (*ptr == 'n' && len == 3 && *(ptr + 1) == 'o' && *(ptr + 2) == 'w')) // special cases initialise to 'now'
1013  return Tickval(true).get_ticks();
1014 
1015  tm tms {};
1016  ptr += parse_decimal(ptr, 4, tms.tm_year);
1017  tms.tm_year -= 1900;
1018  ptr += parse_decimal(ptr, 2, tms.tm_mon);
1019  --tms.tm_mon;
1020  if (len == 8)
1021  parse_decimal(ptr, 2, tms.tm_mday);
1022  else
1023  tms.tm_mday = 1;
1024  return time_to_epoch(tms) * Tickval::billion;
1025 }
size_t parse_decimal(const char *begin, size_t len, int &to)
Definition: field.hpp:844
time_t time_to_epoch(const tm &ltm, int utcdiff=0)
Definition: field.hpp:858
size_t FIX8::date_time_format ( const Tickval tickval,
char *  to,
TimeIndicator  ind 
)
inline

Format Tickval into a string.

Parameters
tickvalinput Tickval object
tooutput buffer, should make sure there is enough space reserved
indindicating whether need millisecond or not _time_only, the format string will be "HH:MM:SS" _time_with_ms, the format string will be "HH:MM:SS.mmm" _short_date_only, the format string will be "YYYYMM" _date_only, the format string will be "YYYYMMDD" _sec_only, the format string will be "YYYYMMDD-HH:MM:SS" _with_ms, the format string will be "YYYYMMDD-HH:MM:SS.mmm"
Returns
length of formatted string

Definition at line 895 of file field.hpp.

References _date_only, _short_date_only, _time_with_ms, _with_ms, format0(), FIX8::Tickval::get_tm(), and FIX8::Tickval::msecs().

Referenced by FIX8::Field< UTCTimestamp, field >::print(), FIX8::Field< UTCTimeOnly, field >::print(), FIX8::Field< UTCDateOnly, field >::print(), FIX8::Field< LocalMktDate, field >::print(), and FIX8::Field< MonthYear, field >::print().

896 {
897  const tm result(tickval.get_tm());
898  const char *start(to);
899 
900  if (ind > _time_with_ms)
901  {
902  format0(result.tm_year + 1900, to, 4);
903  to += 4;
904  format0(result.tm_mon + 1, to, 2);
905  to += 2;
906  if (ind == _short_date_only)
907  return to - start;
908  format0(result.tm_mday, to, 2);
909  to += 2;
910  if (ind == _date_only)
911  return to - start;
912  *to++ = '-';
913  }
914 
915  format0(result.tm_hour, to, 2);
916  to += 2;
917  *to++ = ':';
918  format0(result.tm_min, to, 2);
919  to += 2;
920  *to++ = ':';
921  format0(result.tm_sec, to, 2);
922  to += 2;
923 
924  if (ind == _time_with_ms || ind == _with_ms)
925  {
926  *to++ = '.';
927  format0(tickval.msecs(), to, 3);
928  to += 3;
929  }
930 
931  return to - start;
932 }
void format0(int data, char *to, int width)
Definition: field.hpp:830
Tickval::ticks FIX8::date_time_parse ( const char *  ptr,
size_t  len 
)
inline

Decode a DateTime string into ticks

Parameters
ptrinput DateTime string, if *ptr == '!' return current time
lenlength of string
Returns
ticks decoded

Definition at line 938 of file field.hpp.

References FIX8::Tickval::billion, FIX8::Tickval::get_ticks(), FIX8::Tickval::million, FIX8::Tickval::noticks, parse_decimal(), and time_to_epoch().

939 {
940  if (len == 0 || (*ptr == 'n' && len == 3 && *(ptr + 1) == 'o' && *(ptr + 2) == 'w')) // special cases initialise to 'now'
941  return Tickval(true).get_ticks();
942 
943  Tickval::ticks result(Tickval::noticks);
944  int millisecond(0);
945  tm tms {};
946 
947  ptr += parse_decimal(ptr, 4, tms.tm_year);
948  tms.tm_year -= 1900;
949  ptr += parse_decimal(ptr, 2, tms.tm_mon);
950  --tms.tm_mon;
951  ptr += parse_decimal(ptr, 2, tms.tm_mday);
952  ++ptr;
953  ptr += parse_decimal(ptr, 2, tms.tm_hour);
954  ++ptr;
955  ptr += parse_decimal(ptr, 2, tms.tm_min);
956  ++ptr;
957  ptr += parse_decimal(ptr, 2, tms.tm_sec);
958  switch(len)
959  {
960  case 21: //_with_ms: // 19981231-23:59:59.123
961  parse_decimal(++ptr, 3, millisecond);
962  result = millisecond * Tickval::million; // drop through
963  case 17: //: // 19981231-23:59:59
964  result += time_to_epoch(tms) * Tickval::billion;
965  break;
966  default:
967  break;
968  }
969 
970  return result;
971 }
size_t parse_decimal(const char *begin, size_t len, int &to)
Definition: field.hpp:844
time_t time_to_epoch(const tm &ltm, int utcdiff=0)
Definition: field.hpp:858
F8API int FIX8::decode_dow ( const std::string &  from)

Decode a weekday name into numeric dow (0=SUN), case insensitive only check at most the first 2 unique characters (will ignore any characters after that); alternatively, accept numeric dow 0-6;

Parameters
fromsource dow string
Returns
idx dow or -1 if not found

Referenced by FIX8::Configuration::create_schedule().

int FIX8::decode_dow ( const string &  from)

Definition at line 224 of file f8utils.cpp.

References StrToLower().

225 {
226  if (from.empty())
227  return -1;
228  const string source(StrToLower(from));
229  if (isdigit(source[0]) && source.size() == 1 && source[0] >= '0' && source[0] <= '6') // accept numeric dow
230  return source[0] - '0';
231  pair<Daymap::const_iterator, Daymap::const_iterator> result(daymap.equal_range(source[0]));
232  switch(distance(result.first, result.second))
233  {
234  case 1:
235  return result.first->second;
236  default:
237  if (source.size() == 1) // drop through
238  case 0:
239  return -1;
240  break;
241  }
242  return day_names[result.first->second][1] == source[1]
243  || day_names[(++result.first)->second][1] == source[1] ? result.first->second : -1;
244 }
string StrToLower(const string &src)
Definition: f8utils.cpp:158
const unsigned char FIX8::default_assignment_separator ( = ')
const unsigned char FIX8::default_field_separator ( 0x1  )
template<typename T >
T FIX8::enum_str_get ( const std::vector< std::string > &  sset,
const std::string &  what,
const T  def,
bool  ignorecase = false 
)

From a set of strings representing the names of an enumeration in order, return the enum of the given string.

Template Parameters
Tenum return type
Parameters
ssetthe set of strings; if null return default value
whatthe string to find
defthe default value to return if not found
ignorecaseif true, ignore case
Returns
enum value or default

Definition at line 1048 of file f8utils.hpp.

Referenced by FIX8::Configuration::get_process_model().

1049 {
1050  if (sset.empty())
1051  return def;
1052  auto itr(sset.cbegin());
1053  for (; itr != sset.cend(); ++itr)
1054  if (ignorecase ? *itr % what : *itr == what)
1055  break;
1056  return itr == sset.cend() ? def : static_cast<T>(std::distance(sset.begin(), itr));
1057 }
bool FIX8::exist ( const std::string &  fname)
inline

Check for file existance.

Parameters
fnamefilename to check
Returns
true if file exists

Definition at line 1068 of file f8utils.hpp.

Referenced by FIX8::Configuration::Configuration(), FIX8::FilePersister::initialise(), open_ofile(), FIX8::FileLogger::rotate(), and MyMenu::save_msg().

1069 {
1070 #ifdef _MSC_VER
1071  return _access(fname.c_str(), 0) == 0;
1072 #else
1073  return access(fname.c_str(), F_OK) == 0;
1074 #endif
1075 }
fp_type FIX8::fast_atof ( const char *  p)
inline

Simple and fast atof (ascii to float) function. Executes about 5x faster than standard MSCRT library atof(). An attractive alternative if the number of calls is in the millions. Assumes input is a proper integer, fraction, or scientific format. Matches library atof() to 15 digits (except at extreme exponents). Follows atof() precedent of essentially no error checking. 09-May-2009 Tom Van Baak (tvb) www.LeapSecond.com

Parameters
psource string
Returns
double converted value

Definition at line 727 of file f8utils.hpp.

Referenced by FIX8::Field< fp_type, field >::set_from_raw().

728 {
729  bool frac(false);
730  fp_type sign(1.), value(0.), scale(1.);
731 
732  while (isspace(*p))
733  ++p;
734 
735  // Get sign, if any.
736  if (*p == '-')
737  {
738  sign = -1.;
739  ++p;
740  }
741  else if (*p == '+')
742  ++p;
743 
744  // Get digits before decimal point or exponent, if any.
745  while (isdigit(*p))
746  {
747  value = value * 10. + (*p - '0');
748  ++p;
749  }
750 
751  // Get digits after decimal point, if any.
752  if (*p == '.')
753  {
754  ++p;
755  fp_type mpow10(10.);
756  while (isdigit(*p))
757  {
758  value += (*p - '0') / mpow10;
759  mpow10 *= 10.;
760  ++p;
761  }
762  }
763 
764  // Handle exponent, if any.
765  if (toupper(*p) == 'E')
766  {
767  unsigned int expon(0);
768  ++p;
769 
770  // Get sign of exponent, if any.
771  if (*p == '-')
772  {
773  frac = true;
774  ++p;
775  }
776  else if (*p == '+')
777  ++p;
778 
779  // Get digits of exponent, if any.
780  while (isdigit(*p))
781  {
782  expon = expon * 10 + (*p - '0');
783  ++p;
784  }
785 #if defined FIX8_USE_SINGLE_PRECISION
786  if (expon > 38)
787  expon = 38;
788 #else
789  if (expon > 308)
790  expon = 308;
791 
792  // Calculate scaling factor.
793  while (expon >= 50)
794  {
795  scale *= 1E50;
796  expon -= 50;
797  }
798 #endif
799 
800  while (expon >= 8)
801  {
802  scale *= 1E8;
803  expon -= 8;
804  }
805  while (expon > 0)
806  {
807  scale *= 10.0;
808  expon -= 1;
809  }
810  }
811 
812  // Return signed and scaled floating point result.
813  return sign * (frac ? (value / scale) : (value * scale));
814 }
double fp_type
Definition: f8types.hpp:51
template<typename T >
T FIX8::fast_atoi ( const char *  str,
const char  term = '\0' 
)

Decode a string into an int or unsigned.

Template Parameters
typename
Parameters
strsource string
termterminating character, default = 0
Returns
the converted value

Definition at line 626 of file f8utils.hpp.

627 {
628  T retval(0);
629  for (; *str != term; ++str)
630  retval = (retval << 3) + (retval << 1) + *str - '0';
631  return retval;
632 }
f8String FIX8::find_package_info_string ( const f8String what)

Find a Package_info string value for the given tag

Parameters
whatsource string to look up
Returns
Package_info string value or an empty string

Definition at line 301 of file f8utils.cpp.

References package_info().

302 {
303  auto itr(package_info().find(what));
304  return itr != package_info().cend() ? itr->second : f8String{};
305 }
F8API const Package_info & package_info()
Definition: f8utils.cpp:247
std::string f8String
Definition: f8types.hpp:47
void FIX8::format0 ( int  data,
char *  to,
int  width 
)
inline

Format ASCII decimal value

Parameters
datasource value
totarget location for string
widthlen of string
Returns
number bytes decoded

Definition at line 830 of file field.hpp.

Referenced by date_time_format().

831 {
832  while(width-- > 0)
833  {
834  to[width] = data % 10 + '0';
835  data /= 10;
836  }
837 }
f8String data
Definition: field.hpp:2036
int FIX8::get_umask ( )

Get the current file umask

Returns
int file mask

Definition at line 184 of file f8utils.cpp.

185 {
186 #ifdef _MSC_VER
187  const int mask(_umask(0));
188  _umask(mask);
189 #else
190  const int mask(umask(0));
191  umask(mask);
192 #endif
193  return mask;
194 }
template<typename T >
T FIX8::get_value ( const std::string &  source)
inline

Extract a typed value from a string.

Template Parameters
typename
Parameters
sourcesource string
Returns
the extracted value.

Definition at line 564 of file f8utils.hpp.

Referenced by FIX8::MessageBase::extract_element().

565 {
566  std::istringstream istr(source);
567  T result((T()));
568  istr >> result;
569  return result;
570 }
template<>
unsigned FIX8::get_value ( const std::string &  source)
inline

Extract a unsigned value from a string.

Template Parameters
typename
Parameters
sourcesource string
Returns
the extracted value.

Definition at line 577 of file f8utils.hpp.

577 { return std::stoul(source); }
template<>
int FIX8::get_value ( const std::string &  source)
inline

Extract a int value from a string.

Template Parameters
typename
Parameters
sourcesource string
Returns
the extracted value.

Definition at line 584 of file f8utils.hpp.

584 { return std::stoi(source); }
template<>
double FIX8::get_value ( const std::string &  source)
inline

Extract a double value from a string.

Template Parameters
typename
Parameters
sourcesource string
Returns
the extracted value.

Definition at line 591 of file f8utils.hpp.

591 { return std::stod(source); }
template<>
float FIX8::get_value ( const std::string &  source)
inline

Extract a float value from a string.

Template Parameters
typename
Parameters
sourcesource string
Returns
the extracted value.

Definition at line 598 of file f8utils.hpp.

598 { return std::stof(source); }
template<>
bool FIX8::get_value ( const std::string &  source)
inline

Extract a bool value from a string.

Template Parameters
typename
Parameters
sourcesource string
Returns
the extracted value.

Definition at line 605 of file f8utils.hpp.

606 {
607  if (source.empty())
608  return false;
609 #if !defined FIX8_XMLENTITY_STRICT_BOOL
610  return source % "true" || source % "yes" || source % "y" || source == "1";
611 #else
612  bool result(false);
613  std::istringstream istr(source);
614  istr >> std::boolalpha >> result;
615  return result;
616 #endif
617 }
const string& FIX8::GetTimeAsStringMini ( string &  result,
const Tickval tv 
)

Definition at line 91 of file f8utils.cpp.

References FIX8::Tickval::now(), and FIX8::Tickval::secs().

92 {
93  const Tickval *startTime;
94  Tickval gotTime;
95  if (tv)
96  startTime = tv;
97  else
98  {
99  gotTime.now();
100  startTime = &gotTime;
101  }
102 
103 #ifdef _MSC_VER
104  time_t tval(startTime->secs());
105  struct tm *ptim(localtime (&tval));
106 #else
107  struct tm tim, *ptim;
108  time_t tval(startTime->secs());
109  localtime_r(&tval, &tim);
110  ptim = &tim;
111 #endif
112 
113 // 14-07-02 23:15:51
114  ostringstream oss;
115  oss << setfill('0') << setw(2) << ((ptim->tm_year + 1900) % 100) << '-';
116  oss << setw(2) << (ptim->tm_mon + 1) << '-' << setw(2) << ptim->tm_mday << ' ' << setw(2) << ptim->tm_hour;
117  oss << ':' << setw(2) << ptim->tm_min << ':' << setfill('0') << setw(2) << ptim->tm_sec;
118  return result = oss.str();
119 }
F8API const std::string& FIX8::GetTimeAsStringMini ( std::string &  result,
const Tickval tv 
)

Format Tickval into mini string. 14-07-02 23:15:51

Parameters
resulttarget string
tvtickval to use or 0 for current time
Returns
reference to target string

Referenced by GetTimeAsStringMini(), FIX8::Logger::process_logline(), and FIX8::XmlFileLogger::process_logline().

std::string FIX8::GetTimeAsStringMini ( const Tickval tv)
inline

Format Tickval into mini string. 14-07-02 23:15:51

Parameters
tvtickval to use or 0 for current time
Returns
string

Definition at line 142 of file f8utils.hpp.

References GetTimeAsStringMini().

143 {
144  std::string result;
145  GetTimeAsStringMini(result, tv);
146  return result;
147 }
std::string GetTimeAsStringMini(const Tickval *tv)
Definition: f8utils.hpp:142
const string& FIX8::GetTimeAsStringMS ( string &  result,
const Tickval tv,
const unsigned  dplaces,
bool  use_gm 
)

Definition at line 51 of file f8utils.cpp.

References FIX8::Tickval::now(), FIX8::Tickval::nsecs(), and FIX8::Tickval::secs().

52 {
53  const Tickval *startTime;
54  Tickval gotTime;
55  if (tv)
56  startTime = tv;
57  else
58  {
59  gotTime.now();
60  startTime = &gotTime;
61  }
62 
63 #ifdef _MSC_VER
64  time_t tval(startTime->secs());
65  struct tm *ptim(use_gm ? gmtime(&tval) : localtime (&tval));
66 #else
67  struct tm tim, *ptim;
68  time_t tval(startTime->secs());
69  use_gm ? gmtime_r(&tval, &tim) : localtime_r(&tval, &tim);
70  ptim = &tim;
71 #endif
72 
73  // 2014-07-02 23:15:51.514776595
74  ostringstream oss;
75  oss << setfill('0') << setw(4) << (ptim->tm_year + 1900) << '-';
76  oss << setw(2) << (ptim->tm_mon + 1) << '-' << setw(2) << ptim->tm_mday << ' ' << setw(2) << ptim->tm_hour;
77  oss << ':' << setw(2) << ptim->tm_min << ':';
78  if (dplaces)
79  {
80  const double secs((startTime->secs() % 60) + static_cast<double>(startTime->nsecs()) / Tickval::billion);
81  oss.setf(ios::showpoint);
82  oss.setf(ios::fixed);
83  oss << setw(3 + dplaces) << setfill('0') << setprecision(dplaces) << secs;
84  }
85  else
86  oss << setfill('0') << setw(2) << ptim->tm_sec;
87  return result = oss.str();
88 }
F8API const std::string& FIX8::GetTimeAsStringMS ( std::string &  result,
const class Tickval tv = 0,
const unsigned  dplaces = 6,
bool  use_gm = false 
)

Format Tickval into string. 2014-07-02 23:15:51.514776595

Parameters
resulttarget string
tvtickval to use or 0 for current time
dplacesnumber of decimal places to report seconds (default 6)
use_gmif true, use gmtime, if false localtime
Returns
reference to target string

Referenced by generate_preamble(), and GetTimeAsStringMS().

std::string FIX8::GetTimeAsStringMS ( const class Tickval tv,
const unsigned  dplaces = 6,
bool  use_gm = false 
)
inline

Format Tickval into string. 2014-07-02 23:15:51.514776595

Parameters
tvtickval to use or 0 for current time
dplacesnumber of decimal places to report seconds (default 6)
use_gmif true, use gmtime, if false localtime
Returns
string

Definition at line 126 of file f8utils.hpp.

References GetTimeAsStringMS().

127 {
128  std::string result;
129  GetTimeAsStringMS(result, tv, dplaces, use_gm);
130  return result;
131 }
std::string GetTimeAsStringMS(const class Tickval *tv, const unsigned dplaces=6, bool use_gm=false)
Definition: f8utils.hpp:126
const size_t FIX8::HEADER_CALC_OFFSET ( 32  )
template<hyperunits_t >
int FIX8::hypersleep ( unsigned  amt)
inline
int FIX8::hypersleep ( unsigned  amt,
hyperunits_t  units 
)
inline

A more reliable high precision sleep

Parameters
amtamount to sleep
unitsunits that sleep value is in
Returns
0 on success

Definition at line 171 of file hypersleep.hpp.

References h_count.

172 {
173  enum { Div, Mul, Operation };
174  static const unsigned hv[h_count][Operation]
175  {
176  { 1, billion }, // Seconds
177  { thousand, million }, // Milliseconds
178  { million, thousand }, // Microseconds
179  { billion, 1 }, // Nanoseconds
180  };
181 
182 #if defined FIX8_HAVE_CLOCK_NANOSLEEP
183  timespec ts;
184  clock_gettime(CLOCK_MONOTONIC, &ts);
185  ts.tv_sec += (amt / hv[units][Div]); // calculate time to sleep in secs
186  ts.tv_nsec += (hv[units][Mul] * (amt % hv[units][Div])); // calculate time to sleep in nsecs
187  return execute_clock_nanosleep(ts);
188 #elif defined _MSC_VER
189  Sleep(amt); // milliseconds
190  return 0;
191 #else
192  const timespec tspec { amt / hv[units][Div], hv[units][Mul] * (amt % hv[units][Div]) };
193  return nanosleep(&tspec, 0);
194 #endif
195 }
template<>
int FIX8::hypersleep< h_microseconds > ( unsigned  amt)
inline

A more reliable high precision sleep, microseconds specialisation

Parameters
amtamount to sleep
Returns
0 on success

Definition at line 127 of file hypersleep.hpp.

Referenced by FIX8::Logger::operator()().

128 {
129 #if defined FIX8_HAVE_CLOCK_NANOSLEEP
130  timespec ts;
131  clock_gettime(CLOCK_MONOTONIC, &ts);
132  ts.tv_sec += (amt / million);
133  ts.tv_nsec += (thousand * (amt % million));
134  return execute_clock_nanosleep(ts);
135 #elif defined _MSC_VER
136  Sleep(amt / million * thousand);
137  return 0;
138 #else
139  const timespec tspec { amt / million, thousand * (amt % million) };
140  return nanosleep(&tspec, 0);
141 #endif
142 }
template<>
int FIX8::hypersleep< h_milliseconds > ( unsigned  amt)
inline

A more reliable high precision sleep, milliseconds specialisation

Parameters
amtamount to sleep
Returns
0 on success

Definition at line 105 of file hypersleep.hpp.

Referenced by FIX8::ClientConnection::connect(), FIX8::Timer< T >::operator()(), FIX8::ReliableClientSession< T >::operator()(), server_process(), and FIX8::Session::stop().

106 {
107 #if defined FIX8_HAVE_CLOCK_NANOSLEEP
108  timespec ts;
109  clock_gettime(CLOCK_MONOTONIC, &ts);
110  ts.tv_sec += (amt / thousand);
111  ts.tv_nsec += (million * (amt % thousand));
112  return execute_clock_nanosleep(ts);
113 #elif defined _MSC_VER
114  Sleep(amt); // milliseconds
115  return 0;
116 #else
117  const timespec tspec { amt / thousand, million * (amt % thousand) };
118  return nanosleep(&tspec, 0);
119 #endif
120 }
template<>
int FIX8::hypersleep< h_nanoseconds > ( unsigned  amt)
inline

A more reliable high precision sleep, nanoseconds specialisation

Parameters
amtamount to sleep
Returns
0 on success

Definition at line 149 of file hypersleep.hpp.

Referenced by FIX8::ff_unbounded_queue< T >::pop(), and FIX8::ff_unbounded_queue< T * >::pop().

150 {
151 #if defined FIX8_HAVE_CLOCK_NANOSLEEP
152  timespec ts;
153  clock_gettime(CLOCK_MONOTONIC, &ts);
154  ts.tv_sec += (amt / billion);
155  ts.tv_nsec += amt;
156  return execute_clock_nanosleep(ts);
157 #elif defined _MSC_VER
158  Sleep(amt / billion * million);
159  return 0;
160 #else
161  const timespec tspec { amt / billion, amt };
162  return nanosleep(&tspec, 0);
163 #endif
164 }
template<>
int FIX8::hypersleep< h_seconds > ( unsigned  amt)
inline

A more reliable high precision sleep, seconds specialisation

Parameters
amtamount to sleep
Returns
0 on success

Definition at line 83 of file hypersleep.hpp.

Referenced by MyMenu::do_logout(), main(), and FIX8::Session::~Session().

84 {
85 #if defined FIX8_HAVE_CLOCK_NANOSLEEP
86  timespec ts;
87  clock_gettime(CLOCK_MONOTONIC, &ts);
88  ts.tv_sec += amt;
89  ts.tv_nsec += (amt % (billion));
90  return execute_clock_nanosleep(ts);
91 #elif defined _MSC_VER
92  Sleep(amt * thousand);
93  return 0;
94 #else
95  const timespec tspec { amt, amt % billion };
96  return nanosleep(&tspec, 0);
97 #endif
98 }
template<typename T >
void FIX8::ignore_value ( val)
inline

Sidestep the warn_unused_result attribute

Template Parameters
Ttype
Parameters
valvalue to ignore

Definition at line 188 of file f8utils.hpp.

Referenced by Str_error().

188 { (void) val; }
template<typename T >
void FIX8::ignore_value ( T *  val)
inline

Sidestep the warn_unused_result attribute, ptr version

Template Parameters
Ttype
Parameters
val* value to ignore

Definition at line 194 of file f8utils.hpp.

194 { (void) val; }
F8API std::string& FIX8::InPlaceReplaceInSet ( const std::string &  iset,
std::string &  src,
const char  repl = '_' 
)

Replace any character found in the supplied set in string with supplied character

Parameters
isetset of characters
srcsource string
replcharacter to replace
Returns
reference to modified string

Referenced by process_value_enums().

string& FIX8::InPlaceReplaceInSet ( const string &  iset,
string &  src,
const char  repl 
)

Definition at line 140 of file f8utils.cpp.

141 {
142  for (string::iterator itr(src.begin()); itr != src.end(); ++itr)
143  if (iset.find(*itr) == string::npos)
144  *itr = repl;
145  return src;
146 }
F8API std::string& FIX8::InPlaceStrToLower ( std::string &  src)

In place string to lower case.

Parameters
srcsource string
Returns
reference to modified string
string& FIX8::InPlaceStrToLower ( string &  src)

Definition at line 149 of file f8utils.cpp.

Referenced by StrToLower().

150 {
151  for (auto& itr : src)
152  if (isupper(itr))
153  itr = tolower(itr);
154  return src;
155 }
F8API std::string& FIX8::InPlaceStrToUpper ( std::string &  src)

In place string to upper case.

Parameters
srcsource string
Returns
reference to modified string

Referenced by load_fields().

string& FIX8::InPlaceStrToUpper ( string &  src)

Definition at line 130 of file f8utils.cpp.

131 {
132  //for (string::iterator itr(src.begin()); itr != src.end(); ++itr)
133  for (auto& itr : src)
134  if (islower(itr))
135  itr = toupper(itr);
136  return src;
137 }
template<typename T >
size_t FIX8::itoa ( value,
char *  result,
int  base 
)
inline

Fast itoa.

C++ version 0.4 char* style "itoa": Written by Lukas Chmela see http://www.strudel.org.uk/itoa

Template Parameters
Tsource type
Parameters
valuesource value
resulttarget
basebase
Returns
size in bytes encoded

Definition at line 647 of file f8utils.hpp.

Referenced by FIX8::BaseField::encode(), and FIX8::Field< int, field >::print().

648 {
649  // check that the base if valid
650  if (base < 2 || base > 36)
651  {
652  *result = 0;
653  return 0;
654  }
655 
656  char *ptr(result), *ptr1(result);
657  T tmp_value;
658 
659  do
660  {
661  tmp_value = value;
662  value /= base;
663  *ptr++ = "zyxwvutsrqponmlkjihgfedcba9876543210123456789abcdefghijklmnopqrstuvwxyz" [35 + (tmp_value - value * base)];
664  }
665  while (value);
666 
667  // Apply negative sign
668  if (tmp_value < 0)
669  *ptr++ = '-';
670  *ptr-- = 0;
671  while(ptr1 < ptr)
672  {
673  const char tmp_char(*ptr);
674  *ptr-- = *ptr1;
675  *ptr1++ = tmp_char;
676  }
677  return ::strlen(result);
678 }
template<>
size_t FIX8::itoa< unsigned int > ( unsigned int  value,
char *  result,
int  base 
)
inline

Fast itoa - unsigned int specialisation.

Template Parameters
Tsource type
Parameters
valuesource value
resulttarget
basebase
Returns
size in bytes encoded

Definition at line 687 of file f8utils.hpp.

688 {
689  // check that the base if valid
690  if (base < 2 || base > 36)
691  {
692  *result = 0;
693  return 0;
694  }
695 
696  char *ptr(result), *ptr1(result);
697  unsigned int tmp_value;
698 
699  do
700  {
701  tmp_value = value;
702  value /= base;
703  *ptr++ = "zyxwvutsrqponmlkjihgfedcba9876543210123456789abcdefghijklmnopqrstuvwxyz" [35 + (tmp_value - value * base)];
704  }
705  while (value);
706 
707  *ptr-- = 0;
708  while(ptr1 < ptr)
709  {
710  const char tmp_char(*ptr);
711  *ptr-- = *ptr1;
712  *ptr1++ = tmp_char;
713  }
714  return ::strlen(result);
715 }
const size_t FIX8::max_global_filename_length ( 1024  )
size_t FIX8::modp_dtoa ( double  value,
char *  str,
int  prec 
)

Convert double to ascii.

Parameters
valuethe source value
strthe target string
precnumber of precision digits

Definition at line 68 of file modp_numtoa.c.

References pow10_, and strreverse().

Referenced by FIX8::Field< fp_type, field >::print().

69 {
70  /* if input is larger than thres_max, revert to exponential */
71  const double thres_max = (double)(0x7FFFFFFF);
72 
73  double diff = 0.0;
74  char* wstr = str;
75  int neg = 0;
76  int whole = 0;
77  double tmp = 0.0;
78  uint32_t frac = 0;
79 
80  /* Hacky test for NaN
81  * under -fast-math this won't work, but then you also won't
82  * have correct nan values anyways. The alternative is
83  * to link with libmath (bad) or hack IEEE double bits (bad)
84  */
85  if (! (value == value)) {
86  str[0] = 'n'; str[1] = 'a'; str[2] = 'n'; str[3] = '\0';
87  return 3; // DD
88  }
89 
90  if (prec < 0) {
91  prec = 0;
92  } else if (prec > 9) {
93  /* precision of >= 10 can lead to overflow errors */
94  prec = 9;
95  }
96 
97 
98  /* we'll work in positive values and deal with the
99  negative sign issue later */
100  if (value < 0) {
101  neg = 1;
102  value = -value;
103  }
104 
105  whole = (int) value;
106  tmp = (value - whole) * pow10_[prec];
107  frac = (uint32_t)(tmp);
108  diff = tmp - frac;
109 
110  if (diff > 0.5) {
111  ++frac;
112  /* handle rollover, e.g. case 0.99 with prec 1 is 1.0 */
113  if (frac >= pow10_[prec]) {
114  frac = 0;
115  ++whole;
116  }
117  } else if (diff == 0.5 && ((frac == 0) || (frac & 1))) {
118  /* if halfway, round up if odd, OR
119  if last digit is 0. That last part is strange */
120  ++frac;
121  }
122 
123  /* for very large numbers switch back to native sprintf for exponentials.
124  anyone want to write code to replace this? */
125  /*
126  normal printf behavior is to print EVERY whole number digit
127  which can be 100s of characters overflowing your buffers == bad
128  */
129  if (value > thres_max)
130  return sprintf(str, "%e", neg ? -value : value); // DD
131 
132  if (prec == 0) {
133  diff = value - whole;
134  if (diff > 0.5) {
135  /* greater than 0.5, round up, e.g. 1.6 -> 2 */
136  ++whole;
137  } else if (diff == 0.5 && (whole & 1)) {
138  /* exactly 0.5 and ODD, then round up */
139  /* 1.5 -> 2, but 2.5 -> 2 */
140  ++whole;
141  }
142  } else { // these mods DD: remove trailing zero in prec (unless there is only one 0)
143  int count = prec, done = 0;
144  // now do fractional part, as an unsigned number
145  do
146  {
147  --count;
148  if (frac % 10)
149  done += (*wstr++ = (char)(48 + (frac % 10)));
150  else if (done)
151  *wstr++ = '0';
152  }
153  while (frac /= 10);
154  // add extra 0s
155  if (!done)
156  *wstr++ = '0';
157  else
158  while (count-- > 0)
159  *wstr++ = '0';
160  // add decimal
161  *wstr++ = '.';
162  }
163 
164  // do whole part
165  // Take care of sign
166  // Conversion. Number is reversed.
167  do
168  *wstr++ = (char)(48 + (whole % 10));
169  while (whole /= 10);
170  if (neg)
171  *wstr++ = '-';
172  *wstr = 0;
173  strreverse(str, wstr-1);
174  return wstr - str; // DD
175 }
static void strreverse(char *begin, char *end)
Definition: modp_numtoa.c:60
static const double pow10_[]
Definition: modp_numtoa.c:57
template<typename _CharT , typename _Traits , typename _Alloc >
bool FIX8::operator% ( const std::basic_string< _CharT, _Traits, _Alloc > &  __lhs,
const std::basic_string< _CharT, _Traits, _Alloc > &  __rhs 
)
inline

case insensitive std::string == std::string operator

Template Parameters
_CharTchar type
_Traitschar traits
_Allocallocator
Parameters
__lhsleft hand value
__rhsright hand value
Returns
true if strings are equivalent

Definition at line 245 of file f8utils.hpp.

247 {
248 #ifdef _MSC_VER
249  return _stricmp(__lhs.c_str(), __rhs.c_str()) == 0;
250 #else
251  return strcasecmp(__lhs.c_str(), __rhs.c_str()) == 0;
252 #endif
253 }
template<typename _CharT , typename _Traits , typename _Alloc >
bool FIX8::operator% ( const _CharT *  __lhs,
const std::basic_string< _CharT, _Traits, _Alloc > &  __rhs 
)
inline

case insensitive char* == std::string operator

Template Parameters
_CharTchar type
_Traitschar traits
_Allocallocator
Parameters
__lhsleft hand value
__rhsright hand value
Returns
true if strings are equivalent

Definition at line 263 of file f8utils.hpp.

264  { return strcasecmp(__lhs, __rhs.c_str()) == 0; }
template<typename _CharT , typename _Traits , typename _Alloc >
bool FIX8::operator% ( const std::basic_string< _CharT, _Traits, _Alloc > &  __lhs,
const _CharT *  __rhs 
)
inline

case insensitive std::string == char* operator

Template Parameters
_CharTchar type
_Traitschar traits
_Allocallocator
Parameters
__lhsleft hand value
__rhsright hand value
Returns
true if strings are equivalent

Definition at line 274 of file f8utils.hpp.

275 {
276 #ifdef _MSC_VER
277  return _stricmp(__lhs.c_str(), __rhs) == 0;
278 #else
279  return strcasecmp(__lhs.c_str(), __rhs) == 0;
280 #endif
281 }
ostream & FIX8::operator<< ( std::ostream &  os,
const FieldTrait what 
)

Inserter friend.

Parameters
osstream to send to
whatFieldTrait
Returns
stream

Definition at line 45 of file traits.cpp.

References FIX8::FieldTrait::_component, FIX8::FieldTrait::_field_traits, FIX8::FieldTrait::_fnum, FIX8::FieldTrait::_ftype, FIX8::FieldTrait::_pos, FIX8::FieldTrait::count, FIX8::ebitset< T, B >::get(), and FIX8::FieldTrait::get_type_string().

46 {
47  static const vector<string> bts { "mandatory", "present", "position", "group", "component", "suppress", "automatic" };
48  os << "Tag:" << what._fnum << " Type:" << what._ftype << " (";
49  string strtype;
50  os << FieldTrait::get_type_string(what._ftype, strtype);
51  os << ") Pos:" << what._pos;
52  if (what._component)
53  os << " Component:" << what._component;
54  os << " Flags:";
55  for (unsigned ii(what._field_traits.get()), pos(0); pos < FieldTrait::count; ++pos)
56  if (ii >> pos & 0x1)
57  os << bts[pos] << ' ';
58  return os;
59 }
integral_type get() const
Definition: f8utils.hpp:924
unsigned short _component
Definition: traits.hpp:154
unsigned short _fnum
Definition: traits.hpp:152
ebitset< TraitTypes, unsigned short > _field_traits
Definition: traits.hpp:155
unsigned short _pos
Definition: traits.hpp:154
FieldType _ftype
Definition: traits.hpp:153
ostream & FIX8::operator<< ( std::ostream &  os,
const FieldTraits what 
)

Inserter friend.

Parameters
osstream to send to
whatFieldTraits
Returns
stream

Definition at line 62 of file traits.cpp.

References FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::begin(), FIX8::presorted_set< unsigned short, FieldTrait, FieldTrait::Compare >::end(), and FIX8::FieldTraits::get_presence().

63 {
64  copy(what.get_presence().begin(), what.get_presence().end(), ostream_iterator<FieldTrait>(os, "\n"));
65  return os;
66 }
const Presence & get_presence() const
Definition: traits.hpp:658
std::ostream& FIX8::operator<< ( std::ostream &  os,
const GroupBase what 
)
inline

Inserter friend.

Parameters
osstream to send to
whatmessagebase
Returns
stream

Definition at line 1373 of file message.hpp.

References FIX8::GroupBase::_msgs.

1374 {
1375  for (const auto *pp : what._msgs)
1376  pp->print(os);
1377  return os;
1378 }
template<typename _CharT , typename _Traits , typename _Alloc >
bool FIX8::operator^ ( const std::basic_string< _CharT, _Traits, _Alloc > &  __lhs,
const std::basic_string< _CharT, _Traits, _Alloc > &  __rhs 
)
inline

case insensitive std::string < std::string operator

Template Parameters
_CharTchar type
_Traitschar traits
_Allocallocator
Parameters
__lhsleft hand value
__rhsright hand value
Returns
true if lhs < rhs

Definition at line 291 of file f8utils.hpp.

293 {
294 #ifdef _MSC_VER
295  return _stricmp(__lhs.c_str(), __rhs.c_str()) < 0;
296 #else
297  return strcasecmp(__lhs.c_str(), __rhs.c_str()) < 0;
298 #endif
299 }
const Package_info & FIX8::package_info ( )

Return a Package_info map of strings with current package info

Returns
Package_info object reference

Definition at line 247 of file f8utils.cpp.

References FIX8_CODECTIMING, FIX8_CONFIGURE_OPTIONS, FIX8_CONFIGURE_SDATE, FIX8_CONFIGURE_TIME, FIX8_CONFIGURE_TIME_NUM, FIX8_CPPFLAGS, FIX8_DEBUG, FIX8_DEFAULT_PRECISION, FIX8_HOST_SYSTEM, FIX8_LDFLAGS, FIX8_LIBS, FIX8_MAGIC_NUM, FIX8_MAJOR_VERSION_NUM, FIX8_MAX_FLD_LENGTH, FIX8_MAX_MSG_LENGTH, FIX8_MINOR_VERSION_NUM, FIX8_MPMC_FF, FIX8_MPMC_SYSTEM, FIX8_MPMC_TBB, FIX8_PACKAGE, FIX8_PACKAGE_BUGREPORT, FIX8_PACKAGE_URL, FIX8_PATCH_VERSION_NUM, FIX8_THREAD_PTHREAD, FIX8_THREAD_STDTHREAD, FIX8_THREAD_SYSTEM, FIX8_VERSION, and STRINGIFY.

Referenced by find_package_info_string(), main(), and MyMenu::version_info().

248 {
249  //ostr << "Package info for " PACKAGE " version " VERSION;
250  static const Package_info pinfo
251  {
252  { "FIX8_VERSION", FIX8_VERSION },
253  { "FIX8_PACKAGE", FIX8_PACKAGE },
254 #if defined FIX8_PACKAGE_BUGREPORT
255  { "FIX8_PACKAGE_BUGREPORT", FIX8_PACKAGE_BUGREPORT },
256 #endif
257 #if defined FIX8_PACKAGE_URL
258  { "FIX8_PACKAGE_URL", FIX8_PACKAGE_URL },
259 #endif
260  { "FIX8_MAGIC_NUM", STRINGIFY(FIX8_MAGIC_NUM) },
261  { "FIX8_CONFIGURE_OPTIONS", FIX8_CONFIGURE_OPTIONS },
262  { "FIX8_CPPFLAGS", FIX8_CPPFLAGS },
263  { "FIX8_LIBS", FIX8_LIBS },
264  { "FIX8_LDFLAGS", FIX8_LDFLAGS },
265  { "FIX8_CONFIGURE_SDATE", FIX8_CONFIGURE_SDATE },
266  { "FIX8_CONFIGURE_TIME", FIX8_CONFIGURE_TIME },
267  { "FIX8_MAJOR_VERSION_NUM", STRINGIFY(FIX8_MAJOR_VERSION_NUM) },
268  { "FIX8_MINOR_VERSION_NUM", STRINGIFY(FIX8_MINOR_VERSION_NUM) },
269  { "FIX8_PATCH_VERSION_NUM", STRINGIFY(FIX8_PATCH_VERSION_NUM) },
270  { "FIX8_CONFIGURE_TIME_NUM", STRINGIFY(FIX8_CONFIGURE_TIME_NUM) },
271  { "FIX8_HOST_SYSTEM", FIX8_HOST_SYSTEM },
272  { "FIX8_MAX_FLD_LENGTH", STRINGIFY(FIX8_MAX_FLD_LENGTH) },
273  { "FIX8_MAX_MSG_LENGTH", STRINGIFY(FIX8_MAX_MSG_LENGTH) },
274  { "FIX8_MPMC_FF", STRINGIFY(FIX8_MPMC_FF) },
275  { "FIX8_MPMC_TBB", STRINGIFY(FIX8_MPMC_TBB) },
276  { "FIX8_MPMC_SYSTEM", STRINGIFY(FIX8_MPMC_SYSTEM) },
277  { "FIX8_DEFAULT_PRECISION", STRINGIFY(FIX8_DEFAULT_PRECISION) },
278  { "FIX8_THREAD_PTHREAD", STRINGIFY(FIX8_THREAD_PTHREAD) },
279  { "FIX8_THREAD_STDTHREAD", STRINGIFY(FIX8_THREAD_STDTHREAD) },
280  { "FIX8_THREAD_SYSTEM", STRINGIFY(FIX8_THREAD_SYSTEM) },
281 #if defined FIX8_SLEEP_NO_YIELD
282  { "FIX8_SLEEP_NO_YIELD", STRINGIFY(FIX8_SLEEP_NO_YIELD) },
283 #endif
284 #if defined FIX8_CODECTIMING
285  { "FIX8_CODECTIMING", STRINGIFY(FIX8_CODECTIMING) },
286 #endif
287 #if defined FIX8_HAVE_OPENSSL
288  { "FIX8_HAVE_OPENSSL", STRINGIFY(FIX8_HAVE_OPENSSL) },
289 #endif
290 #if defined FIX8_HAVE_EXTENDED_METADATA
291  { "FIX8_HAVE_EXTENDED_METADATA", STRINGIFY(FIX8_HAVE_EXTENDED_METADATA) },
292 #endif
293 #if defined FIX8_DEBUG
294  { "FIX8_DEBUG", STRINGIFY(FIX8_DEBUG) },
295 #endif
296  };
297 
298  return pinfo;
299 }
#define FIX8_HOST_SYSTEM
Definition: f8config.h:510
#define STRINGIFY(x)
Definition: f8utils.hpp:67
#define FIX8_DEFAULT_PRECISION
Definition: f8config.h:99
#define FIX8_MAX_FLD_LENGTH
Definition: f8config.h:571
#define FIX8_MINOR_VERSION_NUM
Definition: f8config.h:581
#define FIX8_PACKAGE
Definition: f8config.h:601
#define FIX8_LIBS
Definition: f8config.h:520
#define FIX8_PACKAGE_URL
Definition: f8config.h:626
#define FIX8_PATCH_VERSION_NUM
Definition: f8config.h:636
#define FIX8_CPPFLAGS
Definition: f8config.h:81
#define FIX8_CONFIGURE_TIME
Definition: f8config.h:71
#define FIX8_PACKAGE_BUGREPORT
Definition: f8config.h:606
#define FIX8_DEBUG
Definition: f8config.h:94
#define FIX8_CONFIGURE_TIME_NUM
Definition: f8config.h:76
#define FIX8_THREAD_SYSTEM
Definition: f8config.h:723
#define FIX8_THREAD_STDTHREAD
Definition: f8config.h:718
#define FIX8_MPMC_TBB
Definition: f8config.h:596
#define FIX8_MAX_MSG_LENGTH
Definition: f8config.h:576
#define FIX8_CONFIGURE_SDATE
Definition: f8config.h:66
#define FIX8_LDFLAGS
Definition: f8config.h:515
#define FIX8_MAJOR_VERSION_NUM
Definition: f8config.h:546
#define FIX8_VERSION
Definition: f8config.h:742
#define FIX8_MPMC_FF
Definition: f8config.h:586
#define FIX8_MPMC_SYSTEM
Definition: f8config.h:591
#define FIX8_CODECTIMING
Definition: f8config.h:56
#define FIX8_CONFIGURE_OPTIONS
Definition: f8config.h:61
#define FIX8_THREAD_PTHREAD
Definition: f8config.h:713
std::map< f8String, f8String > Package_info
Definition: f8utils.hpp:172
#define FIX8_MAGIC_NUM
Definition: f8config.h:536
size_t FIX8::parse_decimal ( const char *  begin,
size_t  len,
int &  to 
)
inline

Decode ASCII decimal value

Parameters
begindecode from
lennumber of bytes in string
totarget location for value
Returns
number bytes decoded

Definition at line 844 of file field.hpp.

Referenced by date_parse(), date_time_parse(), and time_parse().

845 {
846  const char *bsv(begin);
847  while(len-- > 0)
848  to = (to << 3) + (to << 1) + (*begin++ - '0');
849  return begin - bsv;
850 }
int FIX8::recover_line ( const XmlElement xf)
inline

Definition at line 204 of file f8c.hpp.

References XmlElement::FindAttr(), and XmlElement::GetLine().

Referenced by load_fields(), load_messages(), parse_groups(), and process_message_fields().

204 { return xf.FindAttr("line", xf.GetLine()); }
int GetLine() const
Definition: xml.hpp:268
T FindAttr(const std::string &what, const T defValue) const
Definition: xml.hpp:209
unsigned FIX8::ROT13Hash ( const std::string &  str)
inline

Generate a rot13 hash. No multiplication, algorithm by Serge Vakulenko. See http://vak.ru/doku.php/proj/hash/sources.

Parameters
strsource string
Returns
hash value

Definition at line 216 of file f8utils.hpp.

References rotl().

217 {
218  unsigned int hash(0);
219 
220  for (const auto& pp : str)
221  {
222  hash += pp;
223  hash -= rotl(hash, 13);
224  }
225 
226  return hash;
227 }
T rotl(const T val, const int times)
Definition: f8utils.hpp:203
unsigned FIX8::rothash ( unsigned  result,
unsigned  value 
)
inline

Definition at line 230 of file f8utils.hpp.

Referenced by group_hash().

231 {
232  // hash derived from http://stackoverflow.com/users/905902/wildplasser
233  return result ^= (result >> 2) ^ (result << 5) ^ (result << 13) ^ value ^ 0x80001801;
234 }
template<typename T >
T FIX8::rotl ( const T  val,
const int  times 
)
inline

Rotate left value the specified number of times

Template Parameters
Ttype
Parameters
valsource value
timesnumber of times to rotate left
Returns
the rotated value

Definition at line 203 of file f8utils.hpp.

Referenced by ROT13Hash().

203 { return val << times | val >> (sizeof(T) * 8 - times); }
template<typename T >
T FIX8::rotr ( const T  val,
const int  times 
)
inline

Rotate right value the specified number of times

Template Parameters
Ttype
Parameters
valsource value
timesnumber of times to rotate right
Returns
the rotated value

Definition at line 211 of file f8utils.hpp.

211 { return val >> times | val << (sizeof(T) * 8 - times); }
void FIX8::split_path ( const std::string &  source,
std::string &  filepart,
std::string &  dirpart 
)
inline

Split a pathname into directory and filename parts

Parameters
sourcesource path
fileparttarget for file part
dirparttarget for directory part

Definition at line 1082 of file f8utils.hpp.

Referenced by FIX8::FileLogger::rotate().

1083 {
1084  std::string::size_type slpos(source.find_last_of("/\\"));
1085  if (slpos == std::string::npos)
1086  filepart = source;
1087  else
1088  {
1089  filepart.assign(source.substr(slpos + 1));
1090  dirpart.assign(source.substr(0, slpos));
1091  }
1092 }
const string & filepart(const string &source, string &where)
Definition: f8cutils.cpp:108
string FIX8::Str_error ( const int  err,
const char *  str = 0 
)

Find standard error string for given errno.

Parameters
errerrno value
strif not 0, prepend string to error string
Returns
error string

Definition at line 165 of file f8utils.cpp.

References ignore_value().

Referenced by MyMenu::load_msgs(), MyMenu::save_msg(), FIX8::tty_save_state::set_raw_mode(), and FIX8::tty_save_state::unset_raw_mode().

166 {
167  const size_t max_str(256);
168  char buf[max_str] {};
169 #ifdef _MSC_VER
170  ignore_value(strerror_s(buf, max_str - 1, err));
171 #else
172  ignore_value(strerror_r(err, buf, max_str - 1));
173 #endif
174  if (str && *str)
175  {
176  ostringstream ostr;
177  ostr << str << ": " << buf;
178  return ostr.str();
179  }
180  return string(buf);
181 }
void ignore_value(T val)
Definition: f8utils.hpp:188
F8API std::string FIX8::StrToLower ( const std::string &  src)

String to lower case.

Parameters
srcsource string
Returns
to new lowercase string
string FIX8::StrToLower ( const string &  src)

Definition at line 158 of file f8utils.cpp.

References InPlaceStrToLower().

Referenced by decode_dow().

159 {
160  string result(src);
161  return InPlaceStrToLower(result);
162 }
string & InPlaceStrToLower(string &src)
Definition: f8utils.cpp:149
F8_TEX_API const F8MetaCntx & FIX8::TEX_ctx ( )

Definition at line 437 of file Myfix_classes.cpp.

References FIX8::TEX::ctx().

437 { return TEX::ctx(); }
const F8MetaCntx & ctx()
Compiler generated metadata object, accessed through this function.
Tickval::ticks FIX8::time_parse ( const char *  ptr,
size_t  len,
bool  timeonly = false 
)
inline

Decode a Time string into ticks

Parameters
ptrinput time string, if *ptr == '!' return current time
lenlength of string
timeonlyif true, only calculate ticks for today
Returns
ticks decoded

Definition at line 978 of file field.hpp.

References FIX8::Tickval::billion, FIX8::Tickval::get_ticks(), FIX8::Tickval::million, FIX8::Tickval::noticks, parse_decimal(), and time_to_epoch().

Referenced by FIX8::Configuration::get_time_field().

979 {
980  if (len == 0 || (*ptr == 'n' && len == 3 && *(ptr + 1) == 'o' && *(ptr + 2) == 'w')) // special cases initialise to 'now'
981  return Tickval(true).get_ticks();
982 
983  Tickval::ticks result(Tickval::noticks);
984  int millisecond(0);
985  tm tms {};
986 
987  ptr += parse_decimal(ptr, 2, tms.tm_hour);
988  ++ptr;
989  ptr += parse_decimal(ptr, 2, tms.tm_min);
990  ++ptr;
991  ptr += parse_decimal(ptr, 2, tms.tm_sec);
992  switch(len)
993  {
994  case 12: // 23:59:59.123
995  parse_decimal(++ptr, 3, millisecond);
996  result = millisecond * Tickval::million; // drop through
997  case 8: // 23:59:59
998  if (!timeonly)
999  result += time_to_epoch(tms) * Tickval::billion;
1000  else
1001  result += (tms.tm_hour * 3600ULL + tms.tm_min * 60ULL + tms.tm_sec) * Tickval::billion;
1002  break;
1003  default:
1004  break;
1005  }
1006 
1007  return result;
1008 }
size_t parse_decimal(const char *begin, size_t len, int &to)
Definition: field.hpp:844
time_t time_to_epoch(const tm &ltm, int utcdiff=0)
Definition: field.hpp:858
time_t FIX8::time_to_epoch ( const tm &  ltm,
int  utcdiff = 0 
)
inline

Convert tm to time_t Based on Ghulam M. Babar's "mktime slow? use custom function" see http://gmbabar.wordpress.com/2010/12/01/mktime-slow-use-custom-function/

Parameters
ltmdecode from
utcdiffutc offset in mins
Returns
time_t

Definition at line 858 of file field.hpp.

Referenced by date_parse(), date_time_parse(), and time_parse().

859 {
860  static const int mon_days[] {0,
861  31,
862  31 + 28,
863  31 + 28 + 31,
864  31 + 28 + 31 + 30,
865  31 + 28 + 31 + 30 + 31,
866  31 + 28 + 31 + 30 + 31 + 30,
867  31 + 28 + 31 + 30 + 31 + 30 + 31,
868  31 + 28 + 31 + 30 + 31 + 30 + 31 + 31,
869  31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30,
870  31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31,
871  31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30,
872  31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31
873  };
874 
875  const int tyears(ltm.tm_year ? ltm.tm_year - 70 : 0); // tm->tm_year is from 1900.
876  int tdays(mon_days[ltm.tm_mon] + (ltm.tm_mday ? ltm.tm_mday - 1 : 0) + tyears * 365 + (tyears + 2) / 4);
877  if (ltm.tm_year && ltm.tm_year % 4 == 0 && ltm.tm_mon < 2) // works till 2100, adjust for leap year with jan/feb +1day error
878  --tdays;
879  return tdays * 86400 + (ltm.tm_hour + utcdiff) * 3600 + ltm.tm_min * 60 + ltm.tm_sec;
880 }
std::string FIX8::trim ( const std::string &  source,
const std::string &  ws = " \t" 
)
inline

Trim leading and trailing whitespace from a string

Parameters
sourcesource string
wsstring containing whitespace characters to trim out
Returns
copy of trimmed string

Definition at line 153 of file f8utils.hpp.

Referenced by FIX8::Configuration::create_logger(), FIX8::Configuration::get_logflags(), load_fields(), main(), FIX8::ebitset< TraitTypes, unsigned short >::set(), and FIX8::ebitset_r< SessionControl >::set().

154 {
155  const size_t bgstr(source.find_first_not_of(ws));
156  return bgstr == std::string::npos
157  ? source : source.substr(bgstr, source.find_last_not_of(ws) - bgstr + 1);
158 }
const std::string& FIX8::trim ( std::string &  source,
const std::string &  ws = " \t" 
)
inline

Trim leading and trailing whitespace from a string, inplace.

Parameters
sourcesource string
wsstring containing whitespace characters to trim out
Returns
trimmed string

Definition at line 164 of file f8utils.hpp.

165 {
166  const size_t bgstr(source.find_first_not_of(ws));
167  return bgstr == std::string::npos
168  ? source : source = source.substr(bgstr, source.find_last_not_of(ws) - bgstr + 1);
169 }

Variable Documentation

const CSMap FIX8::_csMap
char FIX8::glob_log0 { "global_filename_not_set.log" }

Definition at line 46 of file logger.cpp.