28#ifndef app_appConfigurator_hpp
29#define app_appConfigurator_hpp
35#include "../mxlib.hpp"
89 typedef std::unordered_map<std::string, configTarget>::iterator
targetIterator;
95 std::unordered_map<std::string, configTarget>
m_targets;
125 void add(
const std::string &n,
126 const std::string &so,
127 const std::string &lo,
130 const std::string &s,
131 const std::string &kw,
133 const std::string &ht =
"",
134 const std::string &he =
""
142 const std::string &oneTarget =
""
150 bool reportFileNotFound =
true
158 bool isSet(
const std::string &name,
159 std::unordered_map<std::string, configTarget> &targets
169 bool isSet(
const std::string &name );
175 int count(
const std::string &name,
176 std::unordered_map<std::string, configTarget> &targets
185 int count(
const std::string &name );
194 std::unordered_map<std::string, configTarget> &targets
205 int verbosity(
const std::string &name );
214 template <
typename typeT>
216 const std::string &name,
218 std::unordered_map<std::string, configTarget> &targets
230 template <
typename typeT>
232 const std::string &name,
245 template <
typename typeT>
247 const std::string &name,
248 std::unordered_map<std::string, configTarget> &targets
260 template <
typename typeT>
262 const std::string &name
273 template <
typename typeT>
274 int get( std::vector<typeT> &v,
275 const std::string &name,
277 std::unordered_map<std::string, configTarget> &targets
288 template <
typename typeT>
289 int get( std::vector<typeT> &v,
290 const std::string &name,
302 template <
typename typeT>
303 int get( std::vector<typeT> &v,
304 const std::string &name,
305 std::unordered_map<std::string, configTarget> &targets
316 template <
typename typeT>
317 int get( std::vector<typeT> &v,
318 const std::string &name
326 template <
typename typeT>
329 const std::string &name
337 template <
typename typeT>
340 const std::string &key
348 template <
typename typeT>
351 const std::string §ion,
352 const std::string &keyword
373 const std::string &name,
375 const std::string &valueStr,
376 const std::string &source
383template <
typename typeT>
385 const std::string &name,
387 std::unordered_map<std::string, configTarget> &targets )
389 targets[name].used =
true;
391 if( !
isSet( name, targets ) )
401 if( targets[name].values.size() <= i )
406 v = ioutils::stoT<typeT>( targets[name].values[i] );
424extern template int appConfigurator::get<char>(
char &v,
425 const std::string &name,
427 std::unordered_map<std::string, configTarget> &targets );
429extern template int appConfigurator::get<signed char>(
signed char &v,
430 const std::string &name,
432 std::unordered_map<std::string, configTarget> &targets );
434extern template int appConfigurator::get<short>(
short &v,
435 const std::string &name,
437 std::unordered_map<std::string, configTarget> &targets );
439extern template int appConfigurator::get<int>(
int &v,
440 const std::string &name,
442 std::unordered_map<std::string, configTarget> &targets );
444extern template int appConfigurator::get<long>(
long &v,
445 const std::string &name,
447 std::unordered_map<std::string, configTarget> &targets );
449extern template int appConfigurator::get<long long>(
long long &v,
450 const std::string &name,
452 std::unordered_map<std::string, configTarget> &targets );
454extern template int appConfigurator::get<unsigned char>(
unsigned char &v,
455 const std::string &name,
457 std::unordered_map<std::string, configTarget> &targets );
459extern template int appConfigurator::get<unsigned short>(
unsigned short &v,
460 const std::string &name,
462 std::unordered_map<std::string, configTarget> &targets );
464extern template int appConfigurator::get<unsigned int>(
unsigned int &v,
465 const std::string &name,
467 std::unordered_map<std::string, configTarget> &targets );
469extern template int appConfigurator::get<unsigned long>(
unsigned long &v,
470 const std::string &name,
472 std::unordered_map<std::string, configTarget> &targets );
474extern template int appConfigurator::get<unsigned long long>(
unsigned long long &v,
475 const std::string &name,
477 std::unordered_map<std::string, configTarget> &targets );
479extern template int appConfigurator::get<float>(
float &v,
480 const std::string &name,
482 std::unordered_map<std::string, configTarget> &targets );
484extern template int appConfigurator::get<double>(
double &v,
485 const std::string &name,
487 std::unordered_map<std::string, configTarget> &targets );
489extern template int appConfigurator::get<long double>(
long double &v,
490 const std::string &name,
492 std::unordered_map<std::string, configTarget> &targets );
495extern template int appConfigurator::get<__float128>( __float128 &v,
496 const std::string &name,
498 std::unordered_map<std::string, configTarget> &targets );
501extern template int appConfigurator::get<bool>(
bool &v,
502 const std::string &name,
504 std::unordered_map<std::string, configTarget> &targets );
506extern template int appConfigurator::get<std::string>( std::string &v,
507 const std::string &name,
509 std::unordered_map<std::string, configTarget> &targets );
513template <
typename typeT>
520extern template int appConfigurator::get<char>(
char &v,
const std::string &name,
size_t i );
522extern template int appConfigurator::get<signed char>(
signed char &v,
const std::string &name,
size_t i );
524extern template int appConfigurator::get<short>(
short &v,
const std::string &name,
size_t i );
526extern template int appConfigurator::get<int>(
int &v,
const std::string &name,
size_t i );
528extern template int appConfigurator::get<long>(
long &v,
const std::string &name,
size_t i );
530extern template int appConfigurator::get<long long>(
long long &v,
const std::string &name,
size_t i );
532extern template int appConfigurator::get<unsigned char>(
unsigned char &v,
const std::string &name,
size_t i );
534extern template int appConfigurator::get<unsigned short>(
unsigned short &v,
const std::string &name,
size_t i );
536extern template int appConfigurator::get<unsigned int>(
unsigned int &v,
const std::string &name,
size_t i );
538extern template int appConfigurator::get<unsigned long>(
unsigned long &v,
const std::string &name,
size_t i );
541appConfigurator::get<unsigned long long>(
unsigned long long &v,
const std::string &name,
size_t i );
543extern template int appConfigurator::get<float>(
float &v,
const std::string &name,
size_t i );
545extern template int appConfigurator::get<double>(
double &v,
const std::string &name,
size_t i );
547extern template int appConfigurator::get<long double>(
long double &v,
const std::string &name,
size_t i );
550extern template int appConfigurator::get<__float128>( __float128 &v,
const std::string &name,
size_t i );
553extern template int appConfigurator::get<bool>(
bool &v,
const std::string &name,
size_t i );
555extern template int appConfigurator::get<std::string>( std::string &v,
const std::string &name,
size_t i );
559template <
typename typeT>
560int appConfigurator::get( typeT &v,
const std::string &name, std::unordered_map<std::string, configTarget> &targets )
562 targets[name].used =
true;
564 if( !
isSet( name, targets ) )
574 int i = targets[name].values.size() - 1;
579 return get( v, name, i, targets );
584appConfigurator::get<char>(
char &v,
const std::string &name, std::unordered_map<std::string, configTarget> &targets );
586extern template int appConfigurator::get<signed char>(
signed char &v,
587 const std::string &name,
588 std::unordered_map<std::string, configTarget> &targets );
590extern template int appConfigurator::get<short>(
short &v,
591 const std::string &name,
592 std::unordered_map<std::string, configTarget> &targets );
595appConfigurator::get<int>(
int &v,
const std::string &name, std::unordered_map<std::string, configTarget> &targets );
598appConfigurator::get<long>(
long &v,
const std::string &name, std::unordered_map<std::string, configTarget> &targets );
600extern template int appConfigurator::get<long long>(
long long &v,
601 const std::string &name,
602 std::unordered_map<std::string, configTarget> &targets );
604extern template int appConfigurator::get<unsigned char>(
unsigned char &v,
605 const std::string &name,
606 std::unordered_map<std::string, configTarget> &targets );
608extern template int appConfigurator::get<unsigned short>(
unsigned short &v,
609 const std::string &name,
610 std::unordered_map<std::string, configTarget> &targets );
612extern template int appConfigurator::get<unsigned int>(
unsigned int &v,
613 const std::string &name,
614 std::unordered_map<std::string, configTarget> &targets );
616extern template int appConfigurator::get<unsigned long>(
unsigned long &v,
617 const std::string &name,
618 std::unordered_map<std::string, configTarget> &targets );
620extern template int appConfigurator::get<unsigned long long>(
unsigned long long &v,
621 const std::string &name,
622 std::unordered_map<std::string, configTarget> &targets );
624extern template int appConfigurator::get<float>(
float &v,
625 const std::string &name,
626 std::unordered_map<std::string, configTarget> &targets );
628extern template int appConfigurator::get<double>(
double &v,
629 const std::string &name,
630 std::unordered_map<std::string, configTarget> &targets );
632extern template int appConfigurator::get<long double>(
long double &v,
633 const std::string &name,
634 std::unordered_map<std::string, configTarget> &targets );
637extern template int appConfigurator::get<__float128>( __float128 &v,
638 const std::string &name,
639 std::unordered_map<std::string, configTarget> &targets );
643appConfigurator::get<bool>(
bool &v,
const std::string &name, std::unordered_map<std::string, configTarget> &targets );
645extern template int appConfigurator::get<std::string>( std::string &v,
646 const std::string &name,
647 std::unordered_map<std::string, configTarget> &targets );
651template <
typename typeT>
658extern template int appConfigurator::get<char>(
char &v,
const std::string &name );
660extern template int appConfigurator::get<signed char>(
signed char &v,
const std::string &name );
662extern template int appConfigurator::get<short>(
short &v,
const std::string &name );
664extern template int appConfigurator::get<int>(
int &v,
const std::string &name );
666extern template int appConfigurator::get<long>(
long &v,
const std::string &name );
668extern template int appConfigurator::get<long long>(
long long &v,
const std::string &name );
670extern template int appConfigurator::get<unsigned char>(
unsigned char &v,
const std::string &name );
672extern template int appConfigurator::get<unsigned short>(
unsigned short &v,
const std::string &name );
674extern template int appConfigurator::get<unsigned int>(
unsigned int &v,
const std::string &name );
676extern template int appConfigurator::get<unsigned long>(
unsigned long &v,
const std::string &name );
678extern template int appConfigurator::get<unsigned long long>(
unsigned long long &v,
const std::string &name );
680extern template int appConfigurator::get<float>(
float &v,
const std::string &name );
682extern template int appConfigurator::get<double>(
double &v,
const std::string &name );
684extern template int appConfigurator::get<long double>(
long double &v,
const std::string &name );
687extern template int appConfigurator::get<__float128>( __float128 &v,
const std::string &name );
690extern template int appConfigurator::get<bool>(
bool &v,
const std::string &name );
692extern template int appConfigurator::get<std::string>( std::string &v,
const std::string &name );
695template <
typename typeT>
697 const std::string &name,
699 std::unordered_map<std::string, configTarget> &targets )
701 targets[name].used =
true;
703 if( !
isSet( name, targets ) )
713 if( targets[name].values.size() <= i )
718 s = ioutils::stoT<std::string>( targets[name].values[i] );
746 while( ::isspace( s[st] ) && st < s.size() - 1 )
749 com = s.find(
',', st );
753 while( com != std::string::npos )
755 v.push_back( ioutils::stoT<typeT>( s.substr( st, com - st ) ) );
757 while( ::isspace( s[st] ) && st < s.size() - 1 )
760 com = s.find(
',', st );
762 v.push_back( ioutils::stoT<typeT>( s.substr( st, s.size() - st ) ) );
781extern template int appConfigurator::get<char>( std::vector<char> &v,
782 const std::string &name,
784 std::unordered_map<std::string, configTarget> &targets );
786extern template int appConfigurator::get<signed char>( std::vector<signed char> &v,
787 const std::string &name,
789 std::unordered_map<std::string, configTarget> &targets );
791extern template int appConfigurator::get<short>( std::vector<short> &v,
792 const std::string &name,
794 std::unordered_map<std::string, configTarget> &targets );
796extern template int appConfigurator::get<int>( std::vector<int> &v,
797 const std::string &name,
799 std::unordered_map<std::string, configTarget> &targets );
801extern template int appConfigurator::get<long>( std::vector<long> &v,
802 const std::string &name,
804 std::unordered_map<std::string, configTarget> &targets );
806extern template int appConfigurator::get<long long>( std::vector<long long> &v,
807 const std::string &name,
809 std::unordered_map<std::string, configTarget> &targets );
811extern template int appConfigurator::get<unsigned char>( std::vector<unsigned char> &v,
812 const std::string &name,
814 std::unordered_map<std::string, configTarget> &targets );
816extern template int appConfigurator::get<unsigned short>( std::vector<unsigned short> &v,
817 const std::string &name,
819 std::unordered_map<std::string, configTarget> &targets );
821extern template int appConfigurator::get<unsigned int>( std::vector<unsigned int> &v,
822 const std::string &name,
824 std::unordered_map<std::string, configTarget> &targets );
826extern template int appConfigurator::get<unsigned long>( std::vector<unsigned long> &v,
827 const std::string &name,
829 std::unordered_map<std::string, configTarget> &targets );
831extern template int appConfigurator::get<unsigned long long>( std::vector<unsigned long long> &v,
832 const std::string &name,
834 std::unordered_map<std::string, configTarget> &targets );
836extern template int appConfigurator::get<float>( std::vector<float> &v,
837 const std::string &name,
839 std::unordered_map<std::string, configTarget> &targets );
841extern template int appConfigurator::get<double>( std::vector<double> &v,
842 const std::string &name,
844 std::unordered_map<std::string, configTarget> &targets );
846extern template int appConfigurator::get<long double>( std::vector<long double> &v,
847 const std::string &name,
849 std::unordered_map<std::string, configTarget> &targets );
852extern template int appConfigurator::get<__float128>( std::vector<__float128> &v,
853 const std::string &name,
855 std::unordered_map<std::string, configTarget> &targets );
858extern template int appConfigurator::get<bool>( std::vector<bool> &v,
859 const std::string &name,
861 std::unordered_map<std::string, configTarget> &targets );
863extern template int appConfigurator::get<std::string>( std::vector<std::string> &v,
864 const std::string &name,
866 std::unordered_map<std::string, configTarget> &targets );
870template <
typename typeT>
878extern template int appConfigurator::get<char>( std::vector<char> &v,
const std::string &name,
size_t i );
880extern template int appConfigurator::get<signed char>( std::vector<signed char> &v,
const std::string &name,
size_t i );
882extern template int appConfigurator::get<short>( std::vector<short> &v,
const std::string &name,
size_t i );
884extern template int appConfigurator::get<int>( std::vector<int> &v,
const std::string &name,
size_t i );
886extern template int appConfigurator::get<long>( std::vector<long> &v,
const std::string &name,
size_t i );
888extern template int appConfigurator::get<long long>( std::vector<long long> &v,
const std::string &name,
size_t i );
891appConfigurator::get<unsigned char>( std::vector<unsigned char> &v,
const std::string &name,
size_t i );
894appConfigurator::get<unsigned short>( std::vector<unsigned short> &v,
const std::string &name,
size_t i );
897appConfigurator::get<unsigned int>( std::vector<unsigned int> &v,
const std::string &name,
size_t i );
900appConfigurator::get<unsigned long>( std::vector<unsigned long> &v,
const std::string &name,
size_t i );
903appConfigurator::get<unsigned long long>( std::vector<unsigned long long> &v,
const std::string &name,
size_t i );
905extern template int appConfigurator::get<float>( std::vector<float> &v,
const std::string &name,
size_t i );
907extern template int appConfigurator::get<double>( std::vector<double> &v,
const std::string &name,
size_t i );
909extern template int appConfigurator::get<long double>( std::vector<long double> &v,
const std::string &name,
size_t i );
912extern template int appConfigurator::get<__float128>( std::vector<__float128> &v,
const std::string &name,
size_t i );
915extern template int appConfigurator::get<bool>( std::vector<bool> &v,
const std::string &name,
size_t i );
917extern template int appConfigurator::get<std::string>( std::vector<std::string> &v,
const std::string &name,
size_t i );
920template <
typename typeT>
922 const std::string &name,
923 std::unordered_map<std::string, configTarget> &targets )
925 targets[name].used =
true;
927 if( !
isSet( name, targets ) )
935 int i = targets[name].values.size() - 1;
940 return get( v, name, i, targets );
944extern template int appConfigurator::get<char>( std::vector<char> &v,
945 const std::string &name,
946 std::unordered_map<std::string, configTarget> &targets );
948extern template int appConfigurator::get<signed char>( std::vector<signed char> &v,
949 const std::string &name,
950 std::unordered_map<std::string, configTarget> &targets );
952extern template int appConfigurator::get<short>( std::vector<short> &v,
953 const std::string &name,
954 std::unordered_map<std::string, configTarget> &targets );
956extern template int appConfigurator::get<int>( std::vector<int> &v,
957 const std::string &name,
958 std::unordered_map<std::string, configTarget> &targets );
960extern template int appConfigurator::get<long>( std::vector<long> &v,
961 const std::string &name,
962 std::unordered_map<std::string, configTarget> &targets );
964extern template int appConfigurator::get<long long>( std::vector<long long> &v,
965 const std::string &name,
966 std::unordered_map<std::string, configTarget> &targets );
968extern template int appConfigurator::get<unsigned char>( std::vector<unsigned char> &v,
969 const std::string &name,
970 std::unordered_map<std::string, configTarget> &targets );
972extern template int appConfigurator::get<unsigned short>( std::vector<unsigned short> &v,
973 const std::string &name,
974 std::unordered_map<std::string, configTarget> &targets );
976extern template int appConfigurator::get<unsigned int>( std::vector<unsigned int> &v,
977 const std::string &name,
978 std::unordered_map<std::string, configTarget> &targets );
980extern template int appConfigurator::get<unsigned long>( std::vector<unsigned long> &v,
981 const std::string &name,
982 std::unordered_map<std::string, configTarget> &targets );
984extern template int appConfigurator::get<unsigned long long>( std::vector<unsigned long long> &v,
985 const std::string &name,
986 std::unordered_map<std::string, configTarget> &targets );
988extern template int appConfigurator::get<float>( std::vector<float> &v,
989 const std::string &name,
990 std::unordered_map<std::string, configTarget> &targets );
992extern template int appConfigurator::get<double>( std::vector<double> &v,
993 const std::string &name,
994 std::unordered_map<std::string, configTarget> &targets );
996extern template int appConfigurator::get<long double>( std::vector<long double> &v,
997 const std::string &name,
998 std::unordered_map<std::string, configTarget> &targets );
1001extern template int appConfigurator::get<__float128>( std::vector<__float128> &v,
1002 const std::string &name,
1003 std::unordered_map<std::string, configTarget> &targets );
1006extern template int appConfigurator::get<bool>( std::vector<bool> &v,
1007 const std::string &name,
1008 std::unordered_map<std::string, configTarget> &targets );
1010extern template int appConfigurator::get<std::string>( std::vector<std::string> &v,
1011 const std::string &name,
1012 std::unordered_map<std::string, configTarget> &targets );
1016template <
typename typeT>
1023extern template int appConfigurator::get<char>( std::vector<char> &v,
const std::string &name );
1025extern template int appConfigurator::get<signed char>( std::vector<signed char> &v,
const std::string &name );
1027extern template int appConfigurator::get<short>( std::vector<short> &v,
const std::string &name );
1029extern template int appConfigurator::get<int>( std::vector<int> &v,
const std::string &name );
1031extern template int appConfigurator::get<long>( std::vector<long> &v,
const std::string &name );
1033extern template int appConfigurator::get<long long>( std::vector<long long> &v,
const std::string &name );
1035extern template int appConfigurator::get<unsigned char>( std::vector<unsigned char> &v,
const std::string &name );
1037extern template int appConfigurator::get<unsigned short>( std::vector<unsigned short> &v,
const std::string &name );
1039extern template int appConfigurator::get<unsigned int>( std::vector<unsigned int> &v,
const std::string &name );
1041extern template int appConfigurator::get<unsigned long>( std::vector<unsigned long> &v,
const std::string &name );
1043extern template int appConfigurator::get<unsigned long long>( std::vector<unsigned long long> &v,
1044 const std::string &name );
1046extern template int appConfigurator::get<float>( std::vector<float> &v,
const std::string &name );
1048extern template int appConfigurator::get<double>( std::vector<double> &v,
const std::string &name );
1050extern template int appConfigurator::get<long double>( std::vector<long double> &v,
const std::string &name );
1053extern template int appConfigurator::get<__float128>( std::vector<__float128> &v,
const std::string &name );
1056extern template int appConfigurator::get<bool>( std::vector<bool> &v,
const std::string &name );
1058extern template int appConfigurator::get<std::string>( std::vector<std::string> &v,
const std::string &name );
1062template <
typename typeT>
1070extern template int appConfigurator::operator()<
char>(
char &v,
const std::string &name );
1072extern template int appConfigurator::operator()<
signed char>(
signed char &v,
const std::string &name );
1074extern template int appConfigurator::operator()<
short>(
short &v,
const std::string &name );
1076extern template int appConfigurator::operator()<
int>(
int &v,
const std::string &name );
1078extern template int appConfigurator::operator()<
long>(
long &v,
const std::string &name );
1080extern template int appConfigurator::operator()<
long long>(
long long &v,
const std::string &name );
1082extern template int appConfigurator::operator()<
unsigned char>(
unsigned char &v,
const std::string &name );
1084extern template int appConfigurator::operator()<
unsigned short>(
unsigned short &v,
const std::string &name );
1086extern template int appConfigurator::operator()<
unsigned int>(
unsigned int &v,
const std::string &name );
1088extern template int appConfigurator::operator()<
unsigned long>(
unsigned long &v,
const std::string &name );
1090extern template int appConfigurator::operator()<
unsigned long long>(
unsigned long long &v,
const std::string &name );
1092extern template int appConfigurator::operator()<
float>(
float &v,
const std::string &name );
1094extern template int appConfigurator::operator()<
double>(
double &v,
const std::string &name );
1096extern template int appConfigurator::operator()<
long double>(
long double &v,
const std::string &name );
1099extern template int appConfigurator::operator()<__float128>( __float128 &v,
const std::string &name );
1102extern template int appConfigurator::operator()<
bool>(
bool &v,
const std::string &name );
1104extern template int appConfigurator::operator()<std::string>( std::string &v,
const std::string &name );
1108template <
typename typeT>
1114extern template int appConfigurator::configUnused<char>(
char &v,
const std::string &key );
1116extern template int appConfigurator::configUnused<signed char>(
signed char &v,
const std::string &key );
1118extern template int appConfigurator::configUnused<short>(
short &v,
const std::string &key );
1120extern template int appConfigurator::configUnused<int>(
int &v,
const std::string &key );
1122extern template int appConfigurator::configUnused<long>(
long &v,
const std::string &key );
1124extern template int appConfigurator::configUnused<long long>(
long long &v,
const std::string &key );
1126extern template int appConfigurator::configUnused<unsigned char>(
unsigned char &v,
const std::string &key );
1128extern template int appConfigurator::configUnused<unsigned short>(
unsigned short &v,
const std::string &key );
1130extern template int appConfigurator::configUnused<unsigned int>(
unsigned int &v,
const std::string &key );
1132extern template int appConfigurator::configUnused<unsigned long>(
unsigned long &v,
const std::string &key );
1134extern template int appConfigurator::configUnused<unsigned long long>(
unsigned long long &v,
const std::string &key );
1136extern template int appConfigurator::configUnused<float>(
float &v,
const std::string &key );
1138extern template int appConfigurator::configUnused<double>(
double &v,
const std::string &key );
1140extern template int appConfigurator::configUnused<long double>(
long double &v,
const std::string &key );
1143extern template int appConfigurator::configUnused<__float128>( __float128 &v,
const std::string &key );
1146extern template int appConfigurator::configUnused<bool>(
bool &v,
const std::string &key );
1148extern template int appConfigurator::configUnused<std::string>( std::string &v,
const std::string &key );
1151template <
typename typeT>
1158appConfigurator::configUnused<char>(
char &v,
const std::string §ion,
const std::string &keyword );
1161appConfigurator::configUnused<signed char>(
signed char &v,
const std::string §ion,
const std::string &keyword );
1164appConfigurator::configUnused<short>(
short &v,
const std::string §ion,
const std::string &keyword );
1167appConfigurator::configUnused<int>(
int &v,
const std::string §ion,
const std::string &keyword );
1170appConfigurator::configUnused<long>(
long &v,
const std::string §ion,
const std::string &keyword );
1173appConfigurator::configUnused<long long>(
long long &v,
const std::string §ion,
const std::string &keyword );
1175extern template int appConfigurator::configUnused<unsigned char>(
unsigned char &v,
1176 const std::string §ion,
1177 const std::string &keyword );
1179extern template int appConfigurator::configUnused<unsigned short>(
unsigned short &v,
1180 const std::string §ion,
1181 const std::string &keyword );
1184appConfigurator::configUnused<unsigned int>(
unsigned int &v,
const std::string §ion,
const std::string &keyword );
1186extern template int appConfigurator::configUnused<unsigned long>(
unsigned long &v,
1187 const std::string §ion,
1188 const std::string &keyword );
1190extern template int appConfigurator::configUnused<unsigned long long>(
unsigned long long &v,
1191 const std::string §ion,
1192 const std::string &keyword );
1195appConfigurator::configUnused<float>(
float &v,
const std::string §ion,
const std::string &keyword );
1198appConfigurator::configUnused<double>(
double &v,
const std::string §ion,
const std::string &keyword );
1201appConfigurator::configUnused<long double>(
long double &v,
const std::string §ion,
const std::string &keyword );
1205appConfigurator::configUnused<__float128>( __float128 &v,
const std::string §ion,
const std::string &keyword );
1209appConfigurator::configUnused<bool>(
bool &v,
const std::string §ion,
const std::string &keyword );
1212appConfigurator::configUnused<std::string>( std::string &v,
const std::string §ion,
const std::string &keyword );
1245 const std::vector<std::string> §ions,
1246 const std::vector<std::string> &keywords,
1247 const std::vector<std::string> &values
void writeConfigFile(const std::string &fname, const std::vector< std::string > §ions, const std::vector< std::string > &keywords, const std::vector< std::string > &values)
A simple config file writing function, useful for testing.
Targets for the configuration manager, and utiltities.
Declares and defines an ini-style (toml) file parser.
Class to manage a set of configurable values, and read their values from config/ini files and the com...
std::unordered_map< std::string, configTarget > m_targets
The targets are stored in an unordered_map for fast access by key.
int readConfig(const std::string &fname, bool reportFileNotFound=true)
Read and parse a config/ini file, updating the targets.
int operator()(typeT &v, const std::string &name)
Access operator, configures a value by calling get.
void add(const configTarget &tgt)
Add a configTarget.
bool m_sources
Flag controlling whether or not to record config sources.
int get(typeT &v, const std::string &name, size_t i, std::unordered_map< std::string, configTarget > &targets)
Get the i-th value of the target, converted to the specified type.
std::vector< std::string > nonOptions
Non-option arguments from the command line.
int configUnused(typeT &v, const std::string &key)
Configure a value from the unused map, using the iniFile key.
void(* configLog)(const std::string &name, const int &code, const std::string &valueStr, const std::string &source)
Call an external logging function whenever a config value is accessed by get or operator().
int verbosity(const std::string &name, std::unordered_map< std::string, configTarget > &targets)
Get the command line verbosity count for this option.
std::unordered_map< std::string, configTarget >::iterator targetIterator
Iterator for the targets unordered_map.
int isSetUnused(const std::string &name)
Check if a target has been set in the unused configuration.
bool isSet(const std::string &name, std::unordered_map< std::string, configTarget > &targets)
Check if a target has been set by the configuration.
void clear()
Clear the containers and free up the associated memory.
int unusedSections(std::vector< std::string > §ions)
Get the unique sections in the unused config targets.
int numUnknownOptions()
Get the number of unknown options found during config processing.
std::list< configTarget > clOnlyTargets
Targets which are only for the command line are stored separately in a list.
int count(const std::string &name, std::unordered_map< std::string, configTarget > &targets)
Get the number of different values set for the specified config target.
void parseCommandLine(int argc, char **argv, const std::string &oneTarget="")
Parse the command line, updating the targets.
int nAdded
Running count of options added, used to track order.
std::unordered_map< std::string, configTarget > m_unusedConfigs
std::list< configTarget >::iterator clOnlyTargetIterator
Iterator for the clOnlyTargets list.
static std::string makeKey(const std::string §ion, const std::string &name)
Return a key generated from the section and name.