ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE/libBASS/ZconStamp.cpp
Revision: 675
Committed: Mon Aug 11 19:38:44 2003 UTC (20 years, 11 months ago) by mmeineke
File size: 1993 byte(s)
Log Message:
Added zConstraint into the BASS language syntax.

File Contents

# User Rev Content
1 mmeineke 675 #include <cstdio>
2     #include <cstring>
3    
4     #include "ZconStamp.hpp"
5    
6    
7     ZconStamp::ZconStamp(int theIndex){
8     index = theIndex;
9    
10     have_zPos = 0;
11     have_molIndex = 0;
12     have_kRatio = 0;
13    
14     unhandled = NULL;
15     have_extras = 0;
16     }
17    
18     ZconStamp::~ZconStamp(){
19    
20     if( unhandled != NULL ) delete unhandled;
21     }
22    
23     char* ZconStamp::checkMe( void ){
24     char myErr[1000];
25    
26     // if( !have_zPos ){
27     // sprintf( myErr,
28     // "No zPos was given to the Zconstraint[%d].",
29     // index );
30     // return strdup( myErr );
31     // }
32    
33     if( !have_molIndex ){
34     sprintf( myErr,
35     "No Index was given to the Zconstraint[%d].",
36     index );
37     return strdup( myErr );
38     }
39    
40     return NULL;
41     }
42    
43     int ZconStamp::assignString( char* lhs, char* rhs, char** err ){
44    
45     if( unhandled == NULL ){
46     unhandled = new LinkedAssign( lhs, rhs );
47     return 1;
48     }
49     else {
50     unhandled->add( lhs, rhs );
51     have_extras = 1;
52     return 1;
53     }
54    
55     return 0;
56     }
57    
58     int ZconStamp::assignDouble( char* lhs, double rhs, char** err ){
59    
60     if( !strcasecmp( lhs, "zPos" )){
61    
62     zPos = rhs;
63     have_zPos = 1;
64     return 1;
65     }
66     else if( !strcasecmp( lhs, "kRatio" ) ){
67    
68     kRatio = rhs;
69     have_kRatio = 1;
70     return 1;
71     }
72     else if( unhandled == NULL ){
73     unhandled = new LinkedAssign( lhs, rhs );
74     return 1;
75     }
76     else {
77     unhandled->add( lhs, rhs );
78     have_extras = 1;
79     return 1;
80     }
81    
82     return 0;
83     }
84    
85     int ZconStamp::assignInt( char* lhs, int rhs, char** err ){
86    
87     if( !strcasecmp( lhs, "molIndex" ) ){
88    
89     molIndex = rhs;
90     have_molIndex = 1;
91     return 1;
92     }
93     else if( !strcasecmp( lhs, "kRatio" ) ){
94    
95     kRatio = (double)rhs;
96     have_kRatio = 1;
97     return 1;
98     }
99     else if( !strcasecmp( lhs, "zPos" )){
100    
101     zPos = (double)rhs;
102     have_zPos = 1;
103     return 1;
104     }
105     else if( unhandled == NULL ){
106     unhandled = new LinkedAssign( lhs, rhs );
107     return 1;
108     }
109     else {
110     unhandled->add( lhs, rhs );
111     have_extras = 1;
112     return 1;
113     }
114     return 0;
115     }