Alchemy
1.0
A framework to robustly process network messages and structured data
|
The MIT License(MIT)
Classes | |
struct | And |
Takes the logical and of the two input types. The types passed in must have a static boolean value named "value". More... | |
struct | array_trait |
A sequence type that has a fixed size. More... | |
struct | at |
Returns the value of the item at the specified index. More... | |
struct | at< MT, 0 > |
Specialization that handles an MT sequence. More... | |
struct | at< MT, IdxT > |
Specialization that handles an MT sequence. More... | |
struct | at< SeqT, 0 > |
Terminating case that returns the value at the specified index.. More... | |
struct | back< MT > |
Specialization for an MT TypeList. More... | |
struct | back< TypeList< TMP_ARRAY_32(T)> > |
This allows the last type of the list to be returned. More... | |
class | basic_msg |
An object that defines and manages access to a formatted message buffer. More... | |
struct | BitField |
Represents a single entry for a bit field type definition. More... | |
struct | BitFieldArray |
Represents a set of fields that provide homogeneous bit-field access to each of the data values. More... | |
struct | BitFieldVector |
Represents a set of fields that provide homogeneous bit-field access to each of the data values. More... | |
struct | container_trait |
A container_trait describes any type that is not a fundamental type or bitfield. These types facilitate more complex data structures. More... | |
struct | ContainerSize |
Calculates the static size of the container passed in. This value is equivalent to the offset of the "end" item in the container. More... | |
struct | contains |
Searches the integer_sequence and indicates of the specified value is found. More... | |
class | Datum |
A type-wrapper that provides transparent access to a range of memory in a message buffer as if it were the specified type itself. More... | |
struct | dynamic_fields |
Extracts index values of the vector types in a message. More... | |
struct | dynamic_size_trait |
Indicates the field or message has a dynamic size determined at run-time. More... | |
struct | empty_type |
Compares types against the MT type. More... | |
struct | EndianType |
Policy class used to perform byte-order operations. More... | |
struct | EndianType< T, false > |
Policy class used to perform byte-order operations. More... | |
struct | find |
Searches the integer_sequence for a value and returns the position. If the value is not found, Hg::npos is returned. More... | |
struct | find< MT, ValueT > |
Searches the integer_sequence for a value and returns the position. If the value is not found, Hg::npos is returned. More... | |
struct | front< MT > |
Specialization for an MT Type Container. More... | |
struct | front< TypeList< TMP_ARRAY_32(T)> > |
This allows the first type of the list to be returned. More... | |
struct | fundamental_trait |
fundamental_trait identifies fundamental integral types. More... | |
struct | GetTail |
Returns the Tail of an Integral Sequence. This is similar to PopFront, however, as soon as a 0 is encountered, MT will be returned, rather than the remainder of the list. More... | |
struct | GetTail< MT > |
Specialization of GetTail for the MT node type. More... | |
struct | has_dynamic |
Template to determine if a container has any dynamically sized entry types. More... | |
struct | HostByteOrderT |
Byte-order management policy for network data transfers. More... | |
struct | instance_of |
This construct provides mechanism to declare and initialize compile-time global constants. More... | |
struct | integer_sequence |
A parameterized type that is a sequence of integer values. More... | |
struct | is_opaque |
Detect a sequence type that uses an unsigned char (byte_t). More... | |
struct | is_opaque< std::array< byte_t, N > > |
Detect a std::array opaque type. N is the number of entries. More... | |
struct | is_opaque< std::vector< byte_t, A > > |
Detect a std::vector opaque type. A is the allocator. More... | |
struct | is_std_array |
Detect a std::array type. This is the default false case. More... | |
struct | is_std_array< std::array< T, N > > |
Detect a std::array type. This version identifies the std::array. More... | |
struct | is_std_vector |
Detect a std::vector type. This is the default false case. More... | |
struct | is_std_vector< std::vector< T, A > > |
Detect a std::vector type. This version identifies the std::vector. T is the type the vector contains, A is the allocator. More... | |
struct | IsTailEmpty |
Compares the tail-type of the sequence and indicates if the type is empty. More... | |
struct | IsTailEmpty< MT > |
Specialization for an MT type sequence.. More... | |
struct | length |
Count the number of elements in the specified type container. More... | |
struct | make_Hg_type_list |
Creates a type list suitable for processing within Hg messages. More... | |
class | Message |
An object that defines and manages access to a formatted message buffer. More... | |
struct | message_size_trait |
Indicates the type size the specified message is, static or dynamic. More... | |
struct | msg_size |
Reports the number of bytes this message object occupies. This instance of size calculates the size for dynamically sized messages. More... | |
struct | msg_size< T, false > |
Specialization returns the size of a fixed size message. More... | |
class | msg_view |
The MsgView object to manage structured access over an opaque buffer. More... | |
class | msg_view_const_iterator |
Iterator for nonmutable msg_view. More... | |
class | msg_view_iterator |
Iterator for a mutable msg_view. More... | |
class | MsgBuffer |
MsgBuffer Template Definition. This abstracts the behavior of the buffer with respect to the Byte-Order of the message. More... | |
class | MsgBuffer< BufferedStaticStoragePolicy > |
(Static) MsgBuffer Template Definition. This class is a specialization of the template MsgBuffer, and uses a static_storage_policy. More... | |
struct | MT |
A type to represent an MT type for defining type lists and type arrays. More... | |
struct | nested_trait |
A nested type indicates that the data that is contained within, possibly requires an internal inspection to facilitate correct behavior. More... | |
struct | NetByteOrderT |
Byte-order management policy for network data transfers. More... | |
struct | Not |
Takes the logical not of the type. The type passed in must have a static boolean value named "value". More... | |
struct | OffsetOf |
Calculate the pointer offset in bytes for the specified type. More... | |
struct | OffsetOf< 0, ContainerT > |
The item at index 0 will always have an offset of 0. More... | |
struct | one_or_zero |
Casts a static const boolean to an int of one or a zero. More... | |
struct | one_or_zero< false > |
Specialization for the false condition of the bool selector. More... | |
struct | opaque_array_trait |
Indicates the format of the array data is undefined, opaque. More... | |
struct | opaque_trait |
Indicates the fields format is undefined and will be determined by context. More... | |
struct | opaque_value |
Detect if the current value type is opaque. More... | |
struct | opaque_vector_trait |
Indicates the format of the vector data is undefined, opaque. More... | |
struct | Or |
Takes the logical or of the input types. The types passed in must have a static boolean value named "value". More... | |
struct | packed_trait |
packed_trait identifies fundamental integral types, that automatically perform bit-shift and mask operations to simulate bit-fields. More... | |
struct | pop_front< TypeList< TPop, TMP_ARRAY_31(T)> > |
This allows the first type of the list to be removed, and the remainder of the list will become the type typedef. More... | |
struct | pop_front< TypeNode< T1, T2 > > |
Specialization for a TypeNode. More... | |
struct | push_back< TypeList< TMP_ARRAY_32(T)>, T > |
This allows the a new type to be pushed at the back of the list. The new list will become the typedef of the pushed type and the existing type list. More... | |
struct | push_front< MT, T > |
Specialization for an MT TypeList: results with type T and empty. More... | |
struct | push_front< TypeList< TMP_ARRAY_32(T)>, T > |
This allows the a new type to be pushed at the front of the list. The new list will become the typedef of the pushed type and the existing type list. More... | |
struct | push_front< TypeNode< T1, T2 >, T > |
Specialization for a TypeNode: TypeList. More... | |
struct | reverse |
Reverses the order the values in an integral_sequence. More... | |
struct | reverse_nodes |
Reverses the order the nodes in an integral_node list. More... | |
struct | reverse_nodes< ToT, MT > |
A terminating case for reversal of an integral_node list. More... | |
struct | sequence_trait |
Sequence types are a class of types that contain more than one element of the same type in series. More... | |
struct | SizeAt |
Calculate the size in bytes for the specified type. More... | |
struct | SizeOf |
Template to determine the size of a type or type container. More... | |
struct | static_size_trait |
Indicates the field or message has a fixed static size at compile-time. More... | |
struct | StaticStoragePolicy |
Storage Policy implementation for fixed-size memory buffers. More... | |
struct | StoragePolicy |
Storage Policy implementation for contiguous memory buffers. More... | |
struct | TailValue |
Safely extracts the last value in an integral sequence. More... | |
struct | TailValue< MT > |
Specialization to TailValue for the MT type node. More... | |
struct | type_check |
Static Assertion Base Template to verify type constraints for an object. More... | |
struct | TypeAt |
Return the type at the specified array index. More... | |
struct | TypeList |
A template-type list that is composed from a collection of types. More... | |
struct | TypeNode |
A fundamental type used for template meta-programming type containers. More... | |
struct | TypeNode< H, MT > |
A terminator for TypeNode chains. More... | |
struct | value_if |
This construct provides the compile-time equivalent of the ternary operator ?: for value selection. More... | |
struct | value_if< false, T, trueValue, falseValue > |
Specialization for the false condition of the value selector. More... | |
struct | vector_trait |
A sequence type that represents a dynamically sized field. More... | |
struct | yes_t |
Affirmative Type for use in SFINAE selection templates. More... | |
Typedefs | |
typedef unsigned char | byte_t |
A short alias for the 'unsigned char'. | |
typedef MT | empty |
An alias that may be more readable. | |
typedef char | no_t |
Negative Type for use in SFINAE selection templates. | |
Functions | |
template<typename T > | |
size_t | dynamic_size_of (const T &msg) |
Query for the amount of dynamic memory required by a specified Hg::basic_msg. More... | |
template<typename MsgT , typename StorageT > | |
size_t | dynamic_size_of (const basic_msg< MsgT, StorageT > &msg) |
Reports the total size of the dynamic buffers required for this message. | |
template<typename T > | |
T | EndianSwap (T input) |
A generic implementation that performs no action. More... | |
template<> | |
uint16_t | EndianSwap (uint16_t input) |
Endian Swap (Specialization, uint16_t) More... | |
template<> | |
int16_t | EndianSwap (int16_t input) |
Endian Swap (Specialization, int16_t) More... | |
template<> | |
uint32_t | EndianSwap (uint32_t input) |
Endian Swap (Specialization, uint32_t) More... | |
template<> | |
int32_t | EndianSwap (int32_t input) |
Endian Swap (Specialization, int32_t) More... | |
template<> | |
uint64_t | EndianSwap (uint64_t input) |
Endian Swap (Specialization, uint64_t) More... | |
template<> | |
int64_t | EndianSwap (int64_t input) |
Endian Swap (Specialization, int64_t) More... | |
template<size_t BeginIndex, size_t EndIndex, typename ContainerT , typename Function > | |
Function & | ForEachType (Function &fn) |
Meta-template implementation of for_each. More... | |
template<typename T > | |
std::ostream & | operator<< (std::ostream &os, const T &msg) |
Writes the values of a message into an ostream object. More... | |
template<typename T > | |
std::istream & | operator>> (std::istream &is, T &msg) |
Reads the values of a message from an istream object. More... | |
template<typename MsgT , typename BufferT , typename SizeTraitT > | |
size_t | pack_message (MsgT &msg_values, BufferT &buffer, size_t offset) |
Writes the values of a variable-sized message into a packed memory buffer. A separate instance exists to eliminate dynamic size tests from messages that are completely fixed in size. More... | |
template<typename MsgT , typename BufferT , typename SizeTraitT > | |
BufferT & | pack_message (MsgT &msg_values, size_t size, BufferT &buffer) |
Writes the values of a message into a packed memory buffer. More... | |
template<typename MsgT , typename BufferT , typename SizeTraitT > | |
bool | pack_message (MsgT &msg_values, BufferT &fixed_buffer) |
Writes the values of a message into a packed memory buffer. More... | |
template<typename T > | |
T::base_type::big_t | to_big_endian (T &from) |
Parameterized function to convert a Hg::Message to bit endian byte-order. More... | |
template<typename T > | |
T::base_type::host_t | to_host (T &from) |
Parameterized function to convert a Hg::Message to host byte-order. More... | |
template<typename T > | |
T::base_type::little_t | to_little_endian (T &from) |
Parameterized function to convert a Hg::Message to little endian byte-order. More... | |
template<typename T > | |
T::base_type::net_t | to_network (T &from) |
Parameterized function to convert a Hg::Message to network byte-order. More... | |
template<typename MsgT , typename BufferT , typename SizeTraitT > | |
MsgT & | unpack_message (MsgT &msg_values, const BufferT &buffer) |
Reads the values of a message structure from a packed memory buffer. More... | |
template<typename MsgT , typename BufferT , typename SizeTraitT > | |
size_t | unpack_message (MsgT &msg_values, const BufferT &buffer, size_t offset) |
Reads the values of a message structure from a packed memory buffer. More... | |
Variables | |
const Endianess | k_endianess = Endianess(ALCHEMY_ENDIANESS) |
< Constant indicates machine endianess. | |
The MIT License(MIT)
size_t Hg::dynamic_size_of | ( | const T & | msg | ) |
Query for the amount of dynamic memory required by a specified Hg::basic_msg.
T [typename] The Hg::basic_msg format definition of the message to be converted.
msg | The message object to be queried. |
Definition at line 28 of file message_dynamic.h.
T Hg::EndianSwap | ( | T | input | ) |
A generic implementation that performs no action.
No change is required the for generic case of EndianSwap. Specialized definitions of this function will perform endian swap operations.
input | Input value to perform endian-swap operation. |
Definition at line 79 of file byte_order.h.
|
inline |
Endian Swap (Specialization, uint16_t)
Swaps the current byte order between endian formats for a 16-bit value.
Definition at line 91 of file byte_order.h.
|
inline |
Endian Swap (Specialization, int16_t)
Swaps the current byte order between endian formats for a 16-bit value.
Definition at line 104 of file byte_order.h.
|
inline |
Endian Swap (Specialization, uint32_t)
Swaps the current byte order between endian formats for a 32-bit value.
Definition at line 118 of file byte_order.h.
|
inline |
Endian Swap (Specialization, int32_t)
Swaps the current byte order between endian formats for a 32-bit value.
Definition at line 133 of file byte_order.h.
|
inline |
Endian Swap (Specialization, uint64_t)
Swaps the current byte order between endian formats for a 64-bit value.
Definition at line 147 of file byte_order.h.
|
inline |
Endian Swap (Specialization, int64_t)
Swaps the current byte order between endian formats for a 64-bit value.
Definition at line 166 of file byte_order.h.
Function& Hg::ForEachType | ( | Function & | fn | ) |
Meta-template implementation of for_each.
Meta-template to perform a user specified action on every element in the specified type ContainerT. This is the compile-time equivalent of the std::for_each function.
BeginIndex | [size_t] The starting index for processing the type container. This value must be less than EndIndex otherwise a compiler error will be generated. |
EndIndex | [size_t]The last index to be processed in the type container. |
ContainerT | [typename] A type container to process. Each type entry within the specified range will be processed. A compiler error will be generated if this parameter is not a Type Container. |
Function | [typename] The user specified functor to use on each type. |
fn | A functor that will be called for each type entry in the container passed to the forEach function. |
Since this function works on a template type, the functor must support a parameterized functor that accepts one type.
Definition at line 151 of file meta_foreach.h.
std::ostream& Hg::operator<< | ( | std::ostream & | os, |
const T & | msg | ||
) |
Writes the values of a message into an ostream object.
os | The output stream that will accept the serialized form of the message. |
msg | The message to be serialized. |
Definition at line 115 of file pack_message.h.
std::istream& Hg::operator>> | ( | std::istream & | is, |
T & | msg | ||
) |
Reads the values of a message from an istream object.
is | The input stream that will provide the data to populate the message. |
msg | The message to be serialized. |
Definition at line 81 of file unpack_message.h.
size_t Hg::pack_message | ( | MsgT & | msg_values, |
BufferT & | buffer, | ||
size_t | offset | ||
) |
Writes the values of a variable-sized message into a packed memory buffer. A separate instance exists to eliminate dynamic size tests from messages that are completely fixed in size.
msg_values | The message structure that contains the values to be written. |
buffer | The buffer this data should be written into. |
offset | The offset the writing should be at. |
Definition at line 67 of file pack_message.h.
BufferT& Hg::pack_message | ( | MsgT & | msg_values, |
size_t | size, | ||
BufferT & | buffer | ||
) |
Writes the values of a message into a packed memory buffer.
msg_values | The message structure that contains the values to be written. |
size | The calculated size required for this message. |
Definition at line 36 of file pack_message.h.
bool Hg::pack_message | ( | MsgT & | msg_values, |
BufferT & | fixed_buffer | ||
) |
Writes the values of a message into a packed memory buffer.
msg_values | The message structure that contains the values to be written. |
size | The calculated size required for this message. |
Definition at line 95 of file pack_message.h.
T::base_type::big_t Hg::to_big_endian | ( | T & | from | ) |
Parameterized function to convert a Hg::Message to bit endian byte-order.
T | [typename] The Hg::basic_msg format definition of the message to be converted. |
from | The message object to convert from. Ownership of the memory that belongs to the input type will be transferred to the returned instance, and the conversion will occur in-place. |
If the input format was already in big endian byte-order, no conversion operations will be performed.
Definition at line 93 of file message_byte_order.h.
T::base_type::host_t Hg::to_host | ( | T & | from | ) |
Parameterized function to convert a Hg::Message to host byte-order.
T | [typename] The Hg::basic_msg format definition of the message to be converted. |
from | The message object to convert from. Ownership of the memory that belongs to the input type will be transferred to the returned instance, and the conversion will occur in-place. |
If the input format was already in host byte-order, no conversion operations will be performed.
Definition at line 65 of file message_byte_order.h.
T::base_type::little_t Hg::to_little_endian | ( | T & | from | ) |
Parameterized function to convert a Hg::Message to little endian byte-order.
T | [typename] The Hg::basic_msg format definition of the message to be converted. |
from | The message object to convert from. Ownership of the memory that belongs to the input type will be transferred to the returned instance, and the conversion will occur in-place. |
If the input format was already in little endian byte-order, no conversion operations will be performed.
Definition at line 121 of file message_byte_order.h.
T::base_type::net_t Hg::to_network | ( | T & | from | ) |
Parameterized function to convert a Hg::Message to network byte-order.
T | [typename] The Hg::basic_msg format definition of the message to be converted. |
from | The message object to convert from. Ownership of the memory that belongs to the input type will be transferred to the returned instance, and the conversion will occur in-place. |
If the input format was already in network byte-order, no conversion operations will be performed.
Definition at line 36 of file message_byte_order.h.
MsgT & Hg::unpack_message | ( | MsgT & | msg_values, |
const BufferT & | buffer | ||
) |
Reads the values of a message structure from a packed memory buffer.
msg_values | The message structure that contains the values to be read. |
buffer | The buffer this data should be read from. |
Definition at line 36 of file unpack_message.h.
size_t Hg::unpack_message | ( | MsgT & | msg_values, |
const BufferT & | buffer, | ||
size_t | offset | ||
) |
Reads the values of a message structure from a packed memory buffer.
msg_values | The message structure that contains the values to be read. |
buffer | The buffer this data should be read from. |
offset | The offset the reading should occur. |
Definition at line 59 of file unpack_message.h.