Alchemy
1.0
A framework to robustly process network messages and structured data
Main Page
Related Pages
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
Hg
message_dynamic.h
Go to the documentation of this file.
1
/// @file message_dynamic.h
2
///
3
/// Provides utility functions related to messages with dynamic fields.
4
///
5
/// The MIT License(MIT)
6
/// @copyright 2014 Paul M Watt
7
// ****************************************************************************
8
#ifndef MESSAGE_DYNAMIC_H_INCLUDED
9
#define MESSAGE_DYNAMIC_H_INCLUDED
10
// Includes *******************************************************************
11
#include <
Hg/detail/message_dynamic_detail.h
>
12
13
namespace
Hg
14
{
15
16
// ****************************************************************************
17
/// Query for the amount of dynamic memory required by a specified Hg::basic_msg.
18
///
19
/// @paramt T [typename] The Hg::basic_msg format definition of the
20
/// message to be converted.
21
/// @param msg The message object to be queried.
22
///
23
/// @return The number of bytes required to populate the dynamically
24
/// sized fields from the message is returned.
25
/// 0 is returned when there is no dynamic data.
26
///
27
template
<
typename
T >
28
size_t
dynamic_size_of
(
const
T& msg)
29
{
30
return
detail::DynamicSizeWorker<T, has_dynamic<T>::value>().size(msg);
31
}
32
33
34
// ****************************************************************************
35
/// Reports the total size of the dynamic buffers required for this message.
36
///
37
template
<
typename
MsgT,
38
typename
StorageT
39
>
40
size_t
dynamic_size_of
(
const
basic_msg<MsgT, StorageT>
& msg)
41
{
42
return
detail::DynamicSizeWorker< MsgT,
43
has_dynamic<typename MsgT::format_type>::value
44
>().size(msg);
45
}
46
47
}
// namespace Hg
48
49
#endif
50
Generated on Sat May 9 2015 21:25:05 for Alchemy by
1.8.3.1