@@ -76,14 +76,14 @@ namespace ePhotosynthesis {
7676
7777#define CONTEXT_VALUE_SET std::string (__func__) + ": "
7878#define ERROR_VALUE_SET (...) \
79- throw std::runtime_error (error_prefix() + std::string(__func__) + ": " + FOR_EACH_JOIN (utils::to_string, SEP_ADD, __VA_ARGS__))
79+ throw std::runtime_error (error_prefix() + std::string(__func__) + ": " + FOR_EACH_JOIN_UNSAFE (utils::to_string, SEP_ADD, __VA_ARGS__))
8080#define ERROR_VALUE_SET_NESTED (err, msg ) \
8181 throw std::runtime_error (std::string(err.what()) + msg)
8282#define ERROR_VALUE_SET_NOARGS () ERROR_VALUE_SET(" " )
8383#define INFO_VALUE_SET_MSG (x ) \
8484 std::cerr << x
8585#define INFO_VALUE_SET_ (...) \
86- FOR_EACH (INFO_VALUE_SET_MSG, __VA_ARGS__)
86+ FOR_EACH_UNSAFE (INFO_VALUE_SET_MSG, __VA_ARGS__)
8787#define INFO_VALUE_SET (...) \
8888 INFO_VALUE_SET_ (error_prefix(), " : " , __func__, " : " , \
8989 __VA_ARGS__, std::endl)
@@ -391,24 +391,6 @@ namespace ePhotosynthesis {
391391 }
392392 };
393393
394- #define _GET_ARG_TYPE (arg ) DROP_N_ARGS(2 , EXPAND arg)
395- #define _GET_ARG_NAME (arg ) GET_ARG_N_BEFORE_END(1 , EXPAND arg)
396- #define _GET_ARG_DEFV (arg ) \
397- __GET_ARG_DEFV (GET_ARG_N_BEFORE_END(0 , EXPAND arg))
398- #define __GET_ARG_DEFV (defV ) \
399- OBSTRUCT (IF_NOT_EMPTY)(defV, = defV)
400- #define MAKE_ARG (arg ) _GET_ARG_NAME(arg)
401- #define MAKE_ARG_T (arg ) \
402- _GET_ARG_TYPE (arg) _GET_ARG_NAME(arg) _GET_ARG_DEFV(arg)
403- #define MAKE_ARG_T_NODEF (arg ) \
404- _GET_ARG_TYPE (arg) _GET_ARG_NAME(arg)
405- #define VS_ARGS (args ) \
406- EVAL (ADD_PARENS(FOR_EACH_COMMA(MAKE_ARG, EXPAND args)))
407- #define VS_ARGS_T (args ) \
408- EVAL (ADD_PARENS(FOR_EACH_COMMA(MAKE_ARG_T, EXPAND args)))
409- #define VS_ARGS_T_NODEF (args ) \
410- EVAL (ADD_PARENS(FOR_EACH_COMMA(MAKE_ARG_T_NODEF, EXPAND args)))
411-
412394#define STUB_STATIC_VALUE_SET_DECLARE (name, retT, args, retV, suffix ) \
413395 static retT _static_ ## name VS_ARGS_T (args) { \
414396 return name VS_ARGS (args); \
@@ -454,7 +436,7 @@ namespace ePhotosynthesis {
454436 ((const bool , noChildren, false )), , ) \
455437 /* * \copydoc ValueSet::getChildren */ \
456438 method(getChildren, const std::vector<ValueSet_t**>&, \
457- (), {} , const ) \
439+ (), PACK_RETURN_TYPE(VECTOR_INIT_MACRO(ValueSet_t**)) , const ) \
458440 /* * \copydoc ValueSet::resetInstance */ \
459441 method(resetInstance, void , \
460442 ((const bool , noChildren, false )), , ) \
@@ -484,7 +466,7 @@ namespace ePhotosynthesis {
484466*/
485467#define ADD_METHODS_VALUE_SET_T_STATIC_ONLY (method ) \
486468 /* * \copydoc ValueSetEnum::error_prefix */ \
487- method (error_prefix, std::string, (), "" , const )
469+ method (error_prefix, std::string, (), STRING_INIT_MACRO( " " ) , const )
488470
489471/* *
490472 Use macro to define methods static in ValueSet & ValueSetStatic
@@ -498,19 +480,22 @@ namespace ePhotosynthesis {
498480 method(get_param_type, PARAM_TYPE, (), PARAM_TYPE_NONE, const ) \
499481 /* * \copydoc ValueSetBase::get_parameter_types */ \
500482 method(get_parameter_types, \
501- const std::vector<PARAM_TYPE>&, (), {}, const ) \
483+ const std::vector<PARAM_TYPE>&, (), \
484+ PACK_RETURN_TYPE(VECTOR_INIT_MACRO(PARAM_TYPE)), const ) \
502485 /* * \copydoc ValueSetBase::initDefaults */ \
503486 method(initDefaults, void , \
504487 ((const bool , useC3, false ), \
505- (const std::string&, filename, " " ), \
488+ (const std::string&, filename, \
489+ PACK_TYPE (STRING_INIT_MACRO(" " ))), \
506490 (const bool , force, false ), \
507491 (const bool , noChildren, false )), , const ) \
508492 /* * \copydoc ValueSetBase::memberCount */ \
509493 method(memberCount, std::size_t , \
510494 ((const bool , noChildren, false )), 0, const ) \
511495 /* * \copydoc ValueSetBase::memberState */ \
512496 method(memberState, std::string, \
513- ((const bool , noChildren, false )), "", const ) \
497+ ((const bool , noChildren, false )), \
498+ STRING_INIT_MACRO(" " ), const ) \
514499 /* * \copydoc ValueSetBase::initChildClasses */ \
515500 method(initChildClasses, void , \
516501 ((const bool , noChildren, false )), , const ) \
@@ -546,22 +531,26 @@ namespace ePhotosynthesis {
546531 (std::size_t , pad, 0 ), \
547532 (bool , includePrefixes, false ), \
548533 (bool , includeSkipped, false ), \
549- (const std::vector<std::string>, skip_keys, {}), \
550- (const std::map<std::string, std::string>&, key_aliases, {}), \
534+ (const std::vector<std::string>, skip_keys, \
535+ PACK_TYPE (VECTOR_INIT_MACRO(std::string))), \
536+ (PACK_TYPE(const MAP_TYPE_MACRO (std::string, std::string)&), \
537+ key_aliases, \
538+ PACK_TYPE(MAP_INIT_MACRO(std::string, std::string))), \
551539 (bool , show_pointers, false ), \
552- (std::string, iname, " " )), \
540+ (std::string, iname, PACK_TYPE(STRING_INIT_MACRO( " " )))), \
553541 out, const ) \
554542 /* * \copydoc ValueSetBase::has */ \
555543 method(has, bool , \
556544 ((const std::string&, name, ), \
557545 (const bool &, isGlymaID, false )), false, const ) \
558546 /* * \copydoc ValueSetBase::getAliasedName */ \
559547 method(getAliasedName, std::string, \
560- ((const std::string&, name, )), "", const ) \
548+ ((const std::string&, name, )), \
549+ STRING_INIT_MACRO(" " ), const ) \
561550 /* * \copydoc ValueSetBase::fromNameWithAliasesInt */ \
562551 method(fromNameWithAliasesInt, int , \
563552 ((const std::string&, name, ), \
564- (const bool &, isGlymaID, false )), -1 , const ) \
553+ (const bool &, isGlymaID, false )), int(- 1 ) , const ) \
565554 /* * \copydoc ValueSetBase::setDefault */ \
566555 method(setDefault, void , \
567556 ((const std::string&, k, ), (const double &, v, ), \
@@ -570,11 +559,12 @@ namespace ePhotosynthesis {
570559 /* * \copydoc ValueSetBase::getDefault */ \
571560 method(getDefault, double , \
572561 ((const std::string&, x, ), \
573- (const bool &, isGlymaID, false )), 0.0, const ) \
562+ (const bool &, isGlymaID, false )), double( 0.0 ) , const ) \
574563 /* * \copydoc ValueSetBase::getDocs */ \
575564 method(getDocs, std::string, \
576565 ((const std::string&, x, ), \
577- (const bool &, isGlymaID, false )), "", const )
566+ (const bool &, isGlymaID, false )), \
567+ STRING_INIT_MACRO(" " ), const )
578568/* *
579569 Use macro to define methods static in ValueSet & ValueSetStatic
580570 with duplicates
@@ -588,10 +578,10 @@ namespace ePhotosynthesis {
588578 (const bool , dontPreserve, false )), , const ) \
589579 /* * \copydoc ValueSetBase::getDefault */ \
590580 method(getDefault, double , \
591- ((const int &, k, )), 0.0, const ) \
581+ ((const int &, k, )), double( 0.0 ) , const ) \
592582 /* * \copydoc ValueSetBase::getDocs */ \
593583 method(getDocs, std::string, \
594- ((const int &, k, )), "" , const )
584+ ((const int &, k, )), STRING_INIT_MACRO( " " ) , const )
595585
596586/* *
597587 Use macros to define methods static in ValueSetStatic and not static
@@ -603,11 +593,13 @@ namespace ePhotosynthesis {
603593 method (getValueSet, const ValueSet_t*, (), \
604594 nullptr, const ) \
605595 /* * \copydoc ValueSet:getValueMap */ \
606- method(getValueMap, std::map ADD_BRACKETS (OBSTRUCT(int , double )), \
607- ((const bool , preinit, false )), {}, const ) \
596+ method(getValueMap, \
597+ PACK_RETURN_TYPE (MAP_TYPE_MACRO(int , double )), \
598+ ((const bool , preinit, false )), \
599+ PACK_RETURN_TYPE(MAP_INIT_MACRO(int , double )), const ) \
608600 /* * \copydoc ValueSet:setValueMap */ \
609601 method(setValueMap, void , \
610- ((const MAP_TYPE_MACRO (int , double )&, map, ), \
602+ ((PACK_TYPE( const MAP_TYPE_MACRO (int , double )&) , map, ), \
611603 (const bool , setinit, false ), \
612604 (const bool , preinit, false )), , ) \
613605 /* * \copydoc ValueSet::max_value_width */ \
@@ -635,21 +627,24 @@ namespace ePhotosynthesis {
635627 (std::size_t , padKeys, 0 ), \
636628 (std::size_t , padVals, 0 ), \
637629 (bool , includePrefixes, false ), \
638- (bool , noChildren, false )), "" , const ) \
630+ (bool , noChildren, false )), STRING_INIT_MACRO( " " ) , const ) \
639631 /* * \copydoc ValueSet::print */ \
640632 method(print, std::ostream&, \
641633 ((std::ostream&, out, ), (const uint, tab, 0 ), \
642634 (std::size_t , pad, 0 ), \
643635 (bool , includePrefixes, false ), \
644636 (bool , includeSkipped, false ), \
645- (const std::vector<std::string>&, skip_keys, {}), \
646- (const std::map<std::string, std::string>&, key_aliases, {}), \
637+ (const std::vector<std::string>&, skip_keys, \
638+ PACK_TYPE (VECTOR_INIT_MACRO(std::string))), \
639+ (PACK_TYPE(const MAP_TYPE_MACRO (std::string, std::string)&), \
640+ key_aliases, \
641+ PACK_TYPE(MAP_INIT_MACRO(std::string, std::string))), \
647642 (bool , noChildren, false )), \
648643 out, const ) \
649644 /* * \copydoc ValueSet::sizeArray */ \
650645 method(sizeArray, std::size_t , (), 0, const ) \
651646 /* * \copydoc ValueSet::toArray */ \
652- method(toArray, arr, (), {} , const ) \
647+ method(toArray, arr, (), VECTOR_INIT_MACRO( double ) , const ) \
653648 /* * \copydoc ValueSet::fromArray */ \
654649 method(fromArray, void , \
655650 ((const arr&, vec, ), \
@@ -661,7 +656,7 @@ namespace ePhotosynthesis {
661656 /* * \copydoc ValueSetBase::get */ \
662657 method(get, double , \
663658 ((const std::string&, name, ), \
664- (const bool &, isGlymaID, false )), 0.0, const )
659+ (const bool &, isGlymaID, false )), double( 0.0 ) , const )
665660/* *
666661 Use macros to define methods static in ValueSetStatic and not static
667662 in ValueSet with duplicates
@@ -674,7 +669,7 @@ namespace ePhotosynthesis {
674669 ((const int &, k, ), (const double &, v, )), , ) \
675670 /* * \copydoc ValueSetBase::get */ \
676671 method(get, double , \
677- ((const int &, k, )), 0.0, const )
672+ ((const int &, k, )), double( 0.0 ) , const )
678673
679674 /* *
680675 Untemplated base class to allow storage of mixed value sets in
@@ -706,7 +701,8 @@ namespace ePhotosynthesis {
706701#define ADD_METHOD (name, retT, args, retV, suffix ) \
707702 virtual retT name VS_ARGS_T (args) suffix;
708703#define ADD_METHOD_BOTH (name, retT, args, retV, suffix ) \
709- ADD_METHOD (name, PACK_MACRO (retT), args, retV, suffix) \
704+ ADD_METHOD (name, PACK_MACRO (retT), args, \
705+ PACK_MACRO (retV), suffix) \
710706 static retT _static_ ## name VS_ARGS_T (args);
711707#define ADD_METHOD_STATIC (name, retT, args, retV, suffix ) \
712708 virtual retT _virtual_ ## name VS_ARGS_T (args) suffix;
0 commit comments