47 #ifndef _MIRA_BASE_INCLUDE_RPC_RPCPATTERNCHECK_H_ 48 #define _MIRA_BASE_INCLUDE_RPC_RPCPATTERNCHECK_H_ 50 #include <type_traits> 64 static char test(decltype(&C::operator()));
66 static long test(...);
69 constexpr
static bool value =
sizeof(test<T>(0)) ==
sizeof(char);
73 template<
typename A,
typename B>
81 template<
typename... ARGS>
87 template<
class F,
typename Enable =
void>
116 template<
class R,
class... Args>
120 template<
typename R,
typename... Args>
131 template<
class C,
class R,
class... Args>
136 template<
class C,
class R,
class... Args>
141 template<
class C,
class R>
151 template<
typename... Args,
typename... Descriptions>
152 constexpr
typename std::enable_if<((
sizeof...(Args)) * 3 !=
sizeof...(Descriptions)) &&
153 ((
sizeof...(Args)) * 2 !=
sizeof...(Descriptions)),
bool>
::type 165 template<
typename HeadArg,
typename... TailArgs,
typename Name,
typename Description,
typename Example,
166 typename... TailDocs>
167 constexpr
typename std::enable_if<(
sizeof...(TailArgs)) * 3 ==
sizeof...(TailDocs),
bool>::
type 171 return isConstr<Example, HeadArg>() && isConstr<Name, std::string>()
172 && isConstr<Description, std::string>()
176 template<
typename HeadArg,
typename... TailArgs,
typename Name,
typename Description,
177 typename... TailDocs>
178 constexpr
typename std::enable_if<(
sizeof...(TailArgs)) * 2 ==
sizeof...(TailDocs),
bool>::
type 182 return isConstr<Name, std::string>() && isConstr<Description, std::string>()
186 template<
typename HeadArg,
typename... TailArgs>
192 template<
typename F,
typename Comment,
typename... Description>
193 constexpr
typename std::enable_if<!FunctionTraits<F>::isFunction,
bool>
::type isValid()
198 template<
typename F,
typename Comment,
typename... Description>
199 constexpr
typename std::enable_if<FunctionTraits<F>::isFunction,
bool>
::type isValid()
201 return Private::isConstr<Comment, std::string>()
214 isConstr<T, std::string>(),
215 "_____________THE PROVIDED TYPE OF A PARAMETER NAME CAN NOT " 216 "BE USED TO INITIALIZE A STRING IN CALL TO Reflector::method(). " 217 "PLEASE PROVIDE NAME AND DESCRIPTION FOR EACH RPC METHOD PARAMETER, " 218 "OR NAME, DESCRIPTION AND A CORRECTLY TYPED SAMPLE VALUE FOR EACH PARAMETER_____________");
225 isConstr<T, std::string>(),
226 "_____________THE PROVIDED TYPE OF A PARAMETER DESCRIPTION CAN NOT BE USED " 227 "TO INITIALIZE A STRING IN CALL TO Reflector::method(). " 228 "PLEASE PROVIDE NAME AND DESCRIPTION FOR EACH RPC METHOD PARAMETER, " 229 "OR NAME, DESCRIPTION AND A CORRECTLY TYPED SAMPLE VALUE FOR EACH PARAMETER_____________");
232 template<
typename ARG,
typename EXAMPLE>
236 isConstr<EXAMPLE, ARG>(),
237 "_____________THE DEDUCED TYPE OF A PARAMETER EXAMPLE CAN NOT BE USED TO " 238 "CONSTRUCT ITS FUNCTION PARAMETER IN CALL TO Reflector::method(). " 239 "PLEASE PROVIDE NAME AND DESCRIPTION FOR EACH RPC METHOD PARAMETER, " 240 "OR NAME, DESCRIPTION AND A CORRECTLY TYPED SAMPLE VALUE FOR EACH PARAMETER_____________");
243 template<
typename... Args,
typename... Docs>
244 typename std::enable_if<((
sizeof...(Args)) * 3 !=
sizeof...(Docs)) &&
245 ((
sizeof...(Args)) * 2 !=
sizeof...(Docs))>
::type 249 "_____________NUMBER OF NAMES/DESCRIPTIONS/SAMPLEVALUES FOR PARAMETERS " 250 "IN CALL TO Reflector::method() DOES NOT MATCH THE PROVIDED FUNCTION'S SIGNATURE. " 251 "PLEASE PROVIDE NAME AND DESCRIPTION FOR EACH RPC METHOD PARAMETER, " 252 "OR NAME, DESCRIPTION AND A CORRECTLY TYPED SAMPLE VALUE FOR EACH PARAMETER_____________");
258 template<
typename HeadArg,
typename... TailArgs,
typename Name,
typename Description,
typename Example,
259 typename... TailDocs>
260 typename std::enable_if<(
sizeof...(TailArgs)) * 3 ==
sizeof...(TailDocs)>::
type 265 assertDescription<Description>();
266 assertExample<HeadArg, Example>();
270 template<
typename HeadArg,
typename... TailArgs,
typename Name,
typename Description,
271 typename... TailDocs>
272 typename std::enable_if<(
sizeof...(TailArgs)) * 2 ==
sizeof...(TailDocs)>::
type 277 assertDescription<Description>();
281 template<
typename F,
typename Comment,
typename... Description>
284 static_assert(
sizeof(F*) == 0,
285 "_____________RECEIVED INVALID FUNCTION TYPE " 286 "IN CALL TO Reflector::method(). PLEASE PROVIDE A VALID FUNCTION OBJECT_____________");
289 template<
typename F,
typename Comment,
typename... Description>
293 Private::isConstr<Comment, std::string>(),
294 "_____________THE PROVIDED TYPE OF THE COMMENT CAN NOT BE USED TO INITIALIZE A " 295 "STRING IN CALL TO Reflector::method(). PLEASE PROVIDE A VALID TEXT DESCRIBING THE FUNCTION _____________");
306 template<
typename F,
typename... Description>
309 template<
typename F,
typename... Description>
void assertDescription()
Definition: RPCPatternCheck.h:222
static constexpr bool isConstr()
Definition: RPCPatternCheck.h:74
std::enable_if<((sizeof...(Args)) *3 !=sizeof...(Docs)) &&((sizeof...(Args)) *2 !=sizeof...(Docs))>::type patternError(ArgumentTuple< Args... > a, ArgumentTuple< Docs... > b)
Definition: RPCPatternCheck.h:246
typename InternalParser::Arguments Arguments
Definition: RPCPatternCheck.h:101
Definition: RPCPatternCheck.h:82
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
constexpr std::enable_if<((sizeof...(Args)) *3 !=sizeof...(Descriptions)) &&((sizeof...(Args)) *2 !=sizeof...(Descriptions)), bool >::type correctPattern(ArgumentTuple< Args... > a, ArgumentTuple< Descriptions... > b)
Definition: RPCPatternCheck.h:154
constexpr std::enable_if<!FunctionTraits< F >::isFunction, bool >::type isValid()
Definition: RPCPatternCheck.h:193
R ReturnValue
Definition: RPCPatternCheck.h:125
static constexpr bool isFunction
Definition: RPCPatternCheck.h:91
PropertyHint type(const std::string &t)
Sets the attribute "type" to the specified value.
Definition: PropertyHint.h:295
typename std::enable_if< Private::rpc::isValid< F, Description... >()>::type ValidRPCDescription
Definition: RPCPatternCheck.h:307
typename std::enable_if<!Private::rpc::isValid< F, Description... >()>::type InvalidRPCDescription
Definition: RPCPatternCheck.h:310
void assertExample()
Definition: RPCPatternCheck.h:233
Definition: RPCPatternCheck.h:88
static constexpr bool value
Definition: RPCPatternCheck.h:69
void assertName()
Definition: RPCPatternCheck.h:211
Definition: RPCPatternCheck.h:58
constexpr std::enable_if<!FunctionTraits< F >::isFunction >::type invalidAssertion()
Definition: RPCPatternCheck.h:282
typename InternalParser::ReturnValue ReturnValue
Definition: RPCPatternCheck.h:100