JayBeams
0.1
Another project to have fun coding.
|
A helper type to define short (and fixed sized) string fields. More...
#include <fixed_string.hpp>
Public Member Functions | |
fixed_string ()=default | |
Default constructor. More... | |
fixed_string (std::string const &rhs) | |
Constructor from a std::string. More... | |
fixed_string & | operator= (std::string const &rhs) |
Assingment from std::string. More... | |
std::string | str () const |
Return a representation as a std::string. More... | |
Base comparison operators | |
bool | operator== (fixed_string const &rhs) const |
compare vs another fixed_string More... | |
bool | operator< (fixed_string const &rhs) const |
compare vs another fixed_string More... | |
bool | operator== (std::string const &rhs) const |
compare vs a std::string More... | |
bool | operator< (std::string const &rhs) const |
compare vs a std::string More... | |
default assignment and copy operators | |
fixed_string (fixed_string const &rhs)=default | |
fixed_string (fixed_string &&rhs)=default | |
fixed_string & | operator= (fixed_string const &rhs)=default |
fixed_string & | operator= (fixed_string &&rhs)=default |
Static Public Attributes | |
static constexpr std::size_t | wire_size = wire_size_value |
The size of the field on the wire. More... | |
Private Attributes | |
char | buffer_ [wire_size] |
The in-memory representation. More... | |
A helper type to define short (and fixed sized) string fields.
Many market data protocols uses fields that are short strings, that is, fixed-length alpha numeric fields. While it is normally easy to treat these fields as character strings, the fields may not be NUL terminated. In fact, several protocols define such fields as left justified, padded with spaces.
We want an in-memory representation that supports basic comparison operations, streaming to std::ostream, and conversion to std::string. We also want the C++ type to be a POD-type, so we can copy the message buffer directly into memory.
wire_size_value | the size of the field on the wire, in bytes. |
Definition at line 32 of file fixed_string.hpp.
|
default |
Default constructor.
Referenced by jb::fixed_string< 8 >::operator<().
|
inlineexplicit |
Constructor from a std::string.
Definition at line 44 of file fixed_string.hpp.
|
default |
|
default |
|
inline |
compare vs another fixed_string
Definition at line 74 of file fixed_string.hpp.
|
inline |
compare vs a std::string
Definition at line 84 of file fixed_string.hpp.
|
inline |
Assingment from std::string.
Definition at line 53 of file fixed_string.hpp.
Referenced by jb::fixed_string< 8 >::operator<().
|
default |
|
default |
|
inline |
compare vs another fixed_string
Definition at line 69 of file fixed_string.hpp.
|
inline |
compare vs a std::string
Definition at line 79 of file fixed_string.hpp.
|
inline |
Return a representation as a std::string.
Definition at line 60 of file fixed_string.hpp.
Referenced by jb::hash_value().
|
private |
The in-memory representation.
Definition at line 99 of file fixed_string.hpp.
Referenced by jb::fixed_string< 8 >::fixed_string(), jb::fixed_string< 8 >::operator<(), jb::fixed_string< 8 >::operator=(), jb::fixed_string< 8 >::operator==(), and jb::fixed_string< 8 >::str().
|
static |
The size of the field on the wire.
Define the constexpr.
Definition at line 38 of file fixed_string.hpp.
Referenced by jb::fixed_string< 8 >::operator<(), and jb::fixed_string< 8 >::operator==().