1 |
mmeineke |
790 |
#include <stdio.h> |
2 |
|
|
#include <string.h> |
3 |
mmeineke |
675 |
|
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 |
tim |
1093 |
else if( !strcasecmp( lhs, "cantVel" )){ |
73 |
|
|
|
74 |
|
|
cantVel = (double)rhs; |
75 |
|
|
have_cantVel = 1; |
76 |
|
|
return 1; |
77 |
|
|
} |
78 |
mmeineke |
675 |
else if( unhandled == NULL ){ |
79 |
|
|
unhandled = new LinkedAssign( lhs, rhs ); |
80 |
|
|
return 1; |
81 |
|
|
} |
82 |
|
|
else { |
83 |
|
|
unhandled->add( lhs, rhs ); |
84 |
|
|
have_extras = 1; |
85 |
|
|
return 1; |
86 |
|
|
} |
87 |
|
|
|
88 |
|
|
return 0; |
89 |
|
|
} |
90 |
|
|
|
91 |
|
|
int ZconStamp::assignInt( char* lhs, int rhs, char** err ){ |
92 |
|
|
|
93 |
|
|
if( !strcasecmp( lhs, "molIndex" ) ){ |
94 |
|
|
|
95 |
|
|
molIndex = rhs; |
96 |
|
|
have_molIndex = 1; |
97 |
|
|
return 1; |
98 |
|
|
} |
99 |
|
|
else if( !strcasecmp( lhs, "kRatio" ) ){ |
100 |
|
|
|
101 |
|
|
kRatio = (double)rhs; |
102 |
|
|
have_kRatio = 1; |
103 |
|
|
return 1; |
104 |
|
|
} |
105 |
|
|
else if( !strcasecmp( lhs, "zPos" )){ |
106 |
|
|
|
107 |
|
|
zPos = (double)rhs; |
108 |
|
|
have_zPos = 1; |
109 |
|
|
return 1; |
110 |
|
|
} |
111 |
tim |
1093 |
else if( !strcasecmp( lhs, "cantVel" )){ |
112 |
|
|
|
113 |
|
|
cantVel = (double)rhs; |
114 |
|
|
have_cantVel = 1; |
115 |
|
|
return 1; |
116 |
|
|
} |
117 |
mmeineke |
675 |
else if( unhandled == NULL ){ |
118 |
|
|
unhandled = new LinkedAssign( lhs, rhs ); |
119 |
|
|
return 1; |
120 |
|
|
} |
121 |
|
|
else { |
122 |
|
|
unhandled->add( lhs, rhs ); |
123 |
|
|
have_extras = 1; |
124 |
|
|
return 1; |
125 |
|
|
} |
126 |
|
|
return 0; |
127 |
|
|
} |