JobCDialog Class Reference

#include <JobCDialog.h>

List of all members.

Public Member Functions

 JobCDialog ()
 JobCDialog (const Registry &current, const Registry &deflt)
virtual ~JobCDialog ()
virtual RegistryQuerry ()
void SetCurrent (const Registry &r)
void SetDefault (const Registry &r)

Protected Attributes

Registry fCurrent
Registry fDefault
Registry fResult

Detailed Description

Definition at line 14 of file JobCDialog.h.


Constructor & Destructor Documentation

JobCDialog::JobCDialog (  ) 

Definition at line 14 of file JobCDialog.cxx.

00014                        :
00015   fCurrent(),
00016   fDefault(),
00017   fResult()
00018 { }

JobCDialog::JobCDialog ( const Registry current,
const Registry deflt 
)

Definition at line 22 of file JobCDialog.cxx.

00022                                                                 :
00023   fCurrent(cur),
00024   fDefault(defl),
00025   fResult()
00026 { }

JobCDialog::~JobCDialog (  )  [virtual]

Definition at line 30 of file JobCDialog.cxx.

00030 { }


Member Function Documentation

Registry & JobCDialog::Querry (  )  [virtual]

Definition at line 50 of file JobCDialog.cxx.

References fCurrent, fDefault, fResult, Registry::Get(), Registry::Key(), PROMPT, Registry::Set(), and Registry::UnLockValues().

Referenced by JobCModule::Set().

00051 {
00052   Registry::RegistryKey rk = fCurrent.Key();
00053 
00054   // Reset result registry
00055   fResult = fCurrent;
00056   fResult.UnLockValues(); // Random capital 'L' in middle of word...
00057   
00058   const char* k;
00059   while ( (k=rk()) ) {
00060     char        c;
00061     const char* s;
00062     int         i;
00063     double      d;
00064     Registry    r;
00065 
00066     // Use the 'current' registry to divine the types of junk...
00067     // Currently there's no good way to do this and Registry spits
00068     // warnings at you for even trying...
00069     bool isChar   = fCurrent.Get(k, c);
00070     bool isString = fCurrent.Get(k, s);
00071     bool isInt    = fCurrent.Get(k, i);
00072     bool isDouble = fCurrent.Get(k, d);
00073     // bool isRegistry = fCurrent.Get(k, r);
00074     
00075     // OK, now get the user's input. One "if" per type...
00076 #define PROMPT(t,c,d) \
00077     std::cout << " "<<t<<" "<<k<<" = ["<<d<<"] "<<c<<" =? ";
00078     if (isChar) {
00079       char c1;
00080       char c_in;
00081       fDefault.Get(k, c1);
00082       PROMPT("char",c,c1);
00083       std::cin >> c_in;
00084       fResult.Set(k, c_in);
00085     }
00086     else if (isString) {
00087       const char* s1;
00088       std::string s_in;
00089       fDefault.Get(k, s1);
00090       PROMPT("string",s,s1);
00091       std::cin >> s_in;
00092       // This is OK, Registry allocates space and stores a copy
00093       // of the string, not just the pointer
00094       fResult.Set(k, s_in.c_str());
00095     }
00096     else if (isInt) {
00097       int i1;
00098       int i_in;
00099       fDefault.Get(k, i1);
00100       PROMPT("int",i,i1);
00101       std::cin >> i_in;
00102       fResult.Set(k, i_in);
00103     }
00104     else if (isDouble) {
00105       double d1;
00106       double d_in;
00107       fDefault.Get(k, d1);
00108       PROMPT("double",d,d1);
00109       std::cin >> d_in;
00110       fResult.Set(k, d_in);
00111     }
00112 #ifdef REGISTRY_CAN_BE_MADE_FROM_STRING
00113     else if (isRegistry) {
00114       Registry r1;
00115       Registry r_in;
00116       std::string rins;
00117       fDefault.Get(k, r1);
00118       PROMPT("Registry",r,r1);
00119       std::cin >> r_ins;
00120       r_in << r_ins;
00121       fResult.Set(k, r_in);
00122     }
00123 #endif
00124   } // loop over keys
00125   return fResult;
00126 }

void JobCDialog::SetCurrent ( const Registry r  ) 

Definition at line 34 of file JobCDialog.cxx.

References fCurrent, and Registry::UnLockValues().

Referenced by JobCModule::Set().

00035 {
00036   fCurrent.UnLockValues();
00037   fCurrent = r;
00038 }

void JobCDialog::SetDefault ( const Registry r  ) 

Definition at line 42 of file JobCDialog.cxx.

References fDefault, and Registry::UnLockValues().

Referenced by JobCModule::Set().

00043 {
00044   fDefault.UnLockValues();
00045   fDefault = r;
00046 }


Member Data Documentation

Definition at line 27 of file JobCDialog.h.

Referenced by Querry(), and SetCurrent().

Definition at line 28 of file JobCDialog.h.

Referenced by Querry(), and SetDefault().

Definition at line 29 of file JobCDialog.h.

Referenced by Querry().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1