libcvd-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcvd-members] gvars3/gvars3 gv3_implementation.hh gvars3.h


From: Georg Klein
Subject: [libcvd-members] gvars3/gvars3 gv3_implementation.hh gvars3.h
Date: Fri, 26 Oct 2007 12:29:25 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    gvars3
Changes by:     Georg Klein <georgklein>        07/10/26 12:29:25

Modified files:
        gvars3         : gv3_implementation.hh gvars3.h 

Log message:
        Added FATAL_IF_NOT_DEFINED flag. Makes the program crash if the user 
hasn't
        provided those all-important settings for which defaults don't make 
sense
        (like camera parameters.)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gvars3/gvars3/gv3_implementation.hh?cvsroot=libcvd&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gvars3/gvars3/gvars3.h?cvsroot=libcvd&r1=1.18&r2=1.19

Patches:
Index: gv3_implementation.hh
===================================================================
RCS file: /cvsroot/libcvd/gvars3/gvars3/gv3_implementation.hh,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- gv3_implementation.hh       11 Feb 2007 00:09:14 -0000      1.9
+++ gv3_implementation.hh       26 Oct 2007 12:29:24 -0000      1.10
@@ -29,6 +29,12 @@
   //Look to see if ``name'' has not already been set   
   if(i == unmatched_tags.end())
     {
+      if(flags & FATAL_IF_NOT_DEFINED)
+       {
+         std::cerr << "!!GV3::Register: " << type_name<T>() << " " << name << 
" must be defined. Exception. " << std::endl;
+         throw gvar_was_not_defined();
+       };
+         
       if(!(flags & SILENT))
        std::cerr << "? GV3::Register: " << type_name<T>() << " " << name << " 
undefined. Defaults to " 
                  << serialize::to_string(default_val) << std::endl;
@@ -40,6 +46,11 @@
     {
       int e = serialize::from_string(i->second, *d);
       parse_warning(e, type_name<T>(), name, i->second);
+      if(e > 0 && flags & FATAL_IF_NOT_DEFINED)
+       {
+         std::cerr << "!!GV3::Register: " << type_name<T>() << " " << name << 
" must be defined. Exception. " << std::endl;
+         throw gvar_was_not_defined();
+       }
       
       unmatched_tags.erase(i);
     }

Index: gvars3.h
===================================================================
RCS file: /cvsroot/libcvd/gvars3/gvars3/gvars3.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- gvars3.h    9 Aug 2007 15:34:13 -0000       1.18
+++ gvars3.h    26 Oct 2007 12:29:25 -0000      1.19
@@ -38,6 +38,7 @@
 void parse_warning(int e, std::string type, std::string name, std::string 
from);
 
 struct type_mismatch{};
+struct gvar_was_not_defined{};
 
 
 class GV3;
@@ -90,7 +91,7 @@
 // SILENT makes gvars not complain if it has to use the default;
 // HIDDEN makes vars not appear in gvarlist unless used with -a
 
-enum { SILENT = 1<<0, HIDDEN = 1<<1};
+enum { SILENT = 1<<0, HIDDEN = 1<<1, FATAL_IF_NOT_DEFINED = 1<<2};
        
 
 typedef gvar2<double> gvar2_double;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]