\section{Constraint\-Registry  Class Reference}
\label{class_ConstraintRegistry}\index{ConstraintRegistry@{Constraint\-Registry}}
{\tt \#include $<$constraint\_\-registry.h$>$}

\subsection*{Static Public Methods}
\begin{CompactItemize}
\item 
{\bf Dyn\-String} {\bf get\-Identifier} (int i=0)
\item 
{\bf Constraint}$\ast$ {\bf get\-Constraint} (const {\bf Dyn\-String} \&identifier, {\bf Constraint\-Manager} \&cm)
\item 
int {\bf read\-Constraints} (istream \&is, {\bf Constraint\-Manager} \&cm, bool append=true)
\item 
int {\bf get\-Int\-Type} (const {\bf Dyn\-String} \&identifier)
\end{CompactItemize}


\subsection{Detailed Description}
//////////////////////////////////////////////////////////

File: contsraint\_\-registry.h

The constraint registry generally interfaces the GRAPE system with real constraint types. It allows the reading of multiple different types of constraints and oganizes the correct creation of those constraints.

In the future I want the registry to facilitate run-time manipulation of constraint properties for a subset of constraints. This ability will require the calling function to have the ability to specify constraint types explicitly to the constraint manager. -jd

////////////////////////////////////////////////////////// 



Definition at line 35 of file constraint\_\-registry.h.

\subsection{Member Function Documentation}
\index{ConstraintRegistry@{Constraint\-Registry}!getConstraint@{getConstraint}}
\index{getConstraint@{getConstraint}!ConstraintRegistry@{Constraint\-Registry}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Constraint} $\ast$ Constraint\-Registry::get\-Constraint (const {\bf Dyn\-String} \& {\em identifier}, {\bf Constraint\-Manager} \& {\em cm})\hspace{0.3cm}{\tt  [static]}}\label{class_ConstraintRegistry_d1}




Definition at line 24 of file constraint\_\-registry.C.

Referenced by read\-Constraints().\footnotesize\begin{verbatim}00026 {
00027 
00028   // NB rigth now this is only called by the readConstraints command below.
00029   //
00030   Constraint * c = 0;
00031     // if none matches, then 0 & ignore.
00032     // if # matches, return -1, and skip rest of line. 
00033   
00034   if(identifier == DistanceConstraint::Identifier){
00035     c = new DistanceConstraint(cm);
00036     c->myType = DistanceConstraint::Identifier;
00037   }
00038   else if(identifier == AtomConstraint::Identifier){
00039     c = new AtomConstraint(cm);
00040     c->myType = AtomConstraint::Identifier;
00041     DIE("Atoms are being read during constraint addition.  Not Allowed");
00042   }
00043   else if(identifier == PositionConstraint::Identifier){
00044     c = new PositionConstraint(cm);
00045     c->myType = PositionConstraint::Identifier;
00046   }
00047   else if(identifier == EnvelopeConstraint::Identifier){
00048     c = new EnvelopeConstraint(cm);
00049     c->myType = EnvelopeConstraint::Identifier;
00050     
00051   }
00052 \end{verbatim}\normalsize 
\index{ConstraintRegistry@{Constraint\-Registry}!getIdentifier@{getIdentifier}}
\index{getIdentifier@{getIdentifier}!ConstraintRegistry@{Constraint\-Registry}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Dyn\-String} Constraint\-Registry::get\-Identifier (int {\em i} = 0)\hspace{0.3cm}{\tt  [static]}}\label{class_ConstraintRegistry_d0}


\index{ConstraintRegistry@{Constraint\-Registry}!getIntType@{getIntType}}
\index{getIntType@{getIntType}!ConstraintRegistry@{Constraint\-Registry}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Constraint\-Registry::get\-Int\-Type (const {\bf Dyn\-String} \& {\em identifier})\hspace{0.3cm}{\tt  [static]}}\label{class_ConstraintRegistry_d3}




Definition at line 6 of file constraint\_\-registry.C.

Referenced by Constraint\-Manager::Abs\-Dist\-Residuals(), Bin\-Envelope\-Constraint::Pre\-Setup(), and get\-Constraint().\footnotesize\begin{verbatim}00006                                                               {
00007   // this is the ONLY place these numbers should be accessed
00008   if(identifier == AtomConstraint::Identifier)
00009     return 0;
00010   else if(identifier == DistanceConstraint::Identifier)
00011     return 1;
00012   else if(identifier == PositionConstraint::Identifier)
00013     return 2;
00014   else if(identifier == EnvelopeConstraint::Identifier)
00015     return 3;
00016   else if(identifier == BinEnvelopeConstraint::Identifier)
00017     return 4;
00018   else
00019     DIE("improper identifier");
00020 
00021   return -1; // compiler warning
00022 \end{verbatim}\normalsize 
\index{ConstraintRegistry@{Constraint\-Registry}!readConstraints@{readConstraints}}
\index{readConstraints@{readConstraints}!ConstraintRegistry@{Constraint\-Registry}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int Constraint\-Registry::read\-Constraints (istream \& {\em is}, {\bf Constraint\-Manager} \& {\em cm}, bool {\em append} = true)\hspace{0.3cm}{\tt  [static]}}\label{class_ConstraintRegistry_d2}




Definition at line 66 of file constraint\_\-registry.C.

Referenced by main().\footnotesize\begin{verbatim}00068   {
00069     if(!append)
00070         cm.clearConstraints();
00071 
00072     int start_num = cm.Number(); 
00073     
00074     DynString constraintIdentifier;
00075     Constraint * c=0;
00076     //    while(!is.eof() && !is.bad())
00077     while(is.good())
00078       {
00079         // Read in the constraint identifier:
00080         //
00081         is >> constraintIdentifier;
00082 
00083         // Given this identifer, retrieve the appropriate constraint
00084         // instance:
00085         //
00086         c = getConstraint(constraintIdentifier, cm);
00087 
00088         // cout <<  " \"" << constraintIdentifier << "\"";
00089           
00090         // Now that we have a particular type of constraint, we can
00091         // read it in:
00092         if(c > 0) {
00093           //cout << ",  read " <<  c->myType << endl;
00094           c->Input(is);  // The constraint manager "magically" logs this.
00095         }
00096       }
00097     if (cm.Number() - start_num > 0)
00098       return cm.Number();
00099     else {      
00100       DIE ("Read 0 constaints from constraint file");
00101       return 0;
00102     }
00103 \end{verbatim}\normalsize 


The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
{\bf constraint\_\-registry.h}\item 
{\bf constraint\_\-registry.C}\end{CompactItemize}
