Alchemy
1.0
A framework to robustly process network messages and structured data
|
Network Alchemy is a message and structured data processing framework. More...
#include <C/carbon_def.h>
#include <Hg/msg_def.h>
Go to the source code of this file.
Macros | |
#define | ALCHEMY_ALLOC(TYPE, COUNT, NAME) DECLARE_VECTOR_DATUM(TYPE,COUNT,NAME) |
Adds a field with a dynamic size to the message definition. More... | |
#define | ALCHEMY_ALLOC_EX(TYPE, ALLOCATOR, COUNT, NAME) DECLARE_ALLOCATOR_DATUM(TYPE,ALLOCATOR,COUNT,NAME) |
Adds a field with a dynamic size controlled by a user specified allocator. More... | |
#define | ALCHEMY_ARRAY(TYPE, COUNT, NAME) DECLARE_ARRAY_DATUM(TYPE,COUNT,NAME) |
Adds a fixed-size array field to the message definition. More... | |
#define | ALCHEMY_BITS(INDEX, NAME, COUNT) DECLARE_BIT_FIELD(INDEX, NAME, COUNT) |
Adds a bit-field type parameter to the bit-set. More... | |
#define | ALCHEMY_DATUM(TYPE, NAME) DECLARE_DATUM(TYPE,NAME) |
Adds a field to the message definition. More... | |
#define | ALCHEMY_END_PACKED DECLARE_PACKED_FOOTER |
Ends the definition for a message field that represents a set of packed bits. More... | |
#define | ALCHEMY_END_STRUCT(TYPE_LIST) DECLARE_STRUCT_FOOTER(TYPE_LIST) |
Marks the end of a message format. More... | |
#define | ALCHEMY_PACKED(TYPE, NAME,...) |
Starts the definition for a message field that represents a set of packed bits. More... | |
#define | ALCHEMY_STRUCT(NAME,...) |
Marks the beginning of a message format. More... | |
Network Alchemy is a message and structured data processing framework.
Include this file for access to the alchemy message structure framework.
This framework provides the ability to define structured message formats, which can be used portably across platforms. These structured definitions will facilitate the population of the data in the memoery buffers for inter-process communication, file and network transfer as well as direct memory access mapping..
Byte-alignment processing is completely transparent to application level users. Conversion utilities are automatically generated for conversion between host, network, big and little-endian formats for transport developers.
Alchemy is portable across different processor types and platforms. Word alignment and memory access issues are also handled transparently by the framework. Users interface with Hg message structures in the same way structures are accessed. Nested structures are supported.
Message structure definitions are created with the list of MACROs below. Refer to the appropriate MACROs documentation for details on correct usage:
Hg provides a portable bit-field interface that works by generating the appropriate shift and mask operations for each field. Use these MACROS to define a set of bit-fields that are packed into a user-specified integral type. Hg currently is written to allow up to 32 bit-fields in a single parameter.
The MIT License(MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Definition in file Alchemy.h.
#define ALCHEMY_ALLOC | ( | TYPE, | |
COUNT, | |||
NAME | |||
) | DECLARE_VECTOR_DATUM(TYPE,COUNT,NAME) |
Adds a field with a dynamic size to the message definition.
This MACRO generates code based on the TypeList specified in the ALCHEMY_STRUCT MACRO. This MACRO also provides the user the ability to name the property associated with this message format field. Finally, a field is provided to specify how this datum will know how large the field should be when reading data on input.
TYPE | The type to use for this field |
COUNT | Specifies how the size of the field is determined on input. There are a few possible ways to indicate the method:
|
NAME | The name to assign this parameter in the message definition. NAME will be the name used to access this field directly. |
#define ALCHEMY_ALLOC_EX | ( | TYPE, | |
ALLOCATOR, | |||
COUNT, | |||
NAME | |||
) | DECLARE_ALLOCATOR_DATUM(TYPE,ALLOCATOR,COUNT,NAME) |
Adds a field with a dynamic size controlled by a user specified allocator.
This MACRO generates code based on the TypeList specified in the ALCHEMY_STRUCT MACRO. This MACRO also provides the user the ability to name the property associated with this message format field. A field is provided for the user to indicate how the field can determine its own size. This MACRO is similar to ALCHEMY_ALLOC, with the exception that a user specified allocator can be used.
TYPE | The type to use for this field |
ALLOCATOR | An allocator that will be used to allocate space for the dynamically sized field. |
COUNT | Specifies how the size of the field is determined on input. There are a few possible ways to indicate the method:
|
NAME | The name to assign this parameter in the message definition. NAME will be the name used to access this field directly. |
#define ALCHEMY_ARRAY | ( | TYPE, | |
COUNT, | |||
NAME | |||
) | DECLARE_ARRAY_DATUM(TYPE,COUNT,NAME) |
Adds a fixed-size array field to the message definition.
This MACRO generates code based on the TypeList specified in the ALCHEMY_STRUCT MACRO. This MACRO also provides the user the ability to name the property associated with this message format field.
TYPE | The type to use for this field |
COUNT | The number of elements allocated for the array. |
NAME | The name to assign this parameter in the message definition. NAME will be the name used to access this field directly. |
#define ALCHEMY_BITS | ( | INDEX, | |
NAME, | |||
COUNT | |||
) | DECLARE_BIT_FIELD(INDEX, NAME, COUNT) |
Adds a bit-field type parameter to the bit-set.
This MACRO generates the code required to add a bit-field to a parent bit-set. The name of the bit-field can be specified as well as the number of bits this field should occupy.
INDEX | The index of this bit-field in the definition. |
NAME | The name to assign this parameter in the bit-set definition. NAME will be the name used to access this bit-field directly. |
COUNT | The number of bits this Bit-Field occupies. |
#define ALCHEMY_DATUM | ( | TYPE, | |
NAME | |||
) | DECLARE_DATUM(TYPE,NAME) |
Adds a field to the message definition.
This MACRO generates code based on the TypeList specified in the ALCHEMY_STRUCT MACRO. This MACRO also provides the user the ability to name the property associated with this message format field.
TYPE | The type to use for this field |
NAME | The name to assign this parameter in the message definition. NAME will be the name used to access this field directly. |
#define ALCHEMY_END_PACKED DECLARE_PACKED_FOOTER |
#define ALCHEMY_END_STRUCT | ( | TYPE_LIST | ) | DECLARE_STRUCT_FOOTER(TYPE_LIST) |
Marks the end of a message format.
A MACRO used to end the definition for a message format interface. This MACRO adds no functionality, it simply acts as a bookend to indicate the end of the message format definition.
This MACRO will verify that all of the entries have been configured in the data format definition. A compiler error will be emitted if the number of declared HG_MSG_FIELD entries does not match the number expected.
#define ALCHEMY_PACKED | ( | TYPE, | |
NAME, | |||
... | |||
) |
Starts the definition for a message field that represents a set of packed bits.
This definition builds a packed bit definition in place, and allows the user to specify the size and names of each bit-field. This provides a very convenient and natural way to interact with the named bit-fields in an expressive manner.
TYPE | The integer type to use for this field. |
NAME | The name to assign to this bitset definition. |
usage:
#define ALCHEMY_STRUCT | ( | NAME, | |
... | |||
) |
Marks the beginning of a message format.
A MACRO used to start the definition for a message format interface. This definition requires that the parent class derive from the MsgFormat base class.
TYPE_LIST | The TypeList used to defined the layout format. |