| 1 | #include <cstdlib> | 
| 2 | #include <cstring> | 
| 3 |  | 
| 4 | #include "BendStamp.hpp" | 
| 5 |  | 
| 6 | BendStamp::BendStamp(){ | 
| 7 |  | 
| 8 | have_mbrs = 0; | 
| 9 | have_constraint = 0; | 
| 10 |  | 
| 11 | unhandled = NULL; | 
| 12 | have_extras = 0; | 
| 13 | } | 
| 14 |  | 
| 15 | BendStamp::~BendStamp(){ | 
| 16 |  | 
| 17 | if( unhandled != NULL ) delete unhandled; | 
| 18 | } | 
| 19 |  | 
| 20 | void BendStamp::members( int the_a, int the_b, int the_c ){ | 
| 21 |  | 
| 22 | a = the_a; | 
| 23 | b = the_b; | 
| 24 | c = the_c; | 
| 25 | have_mbrs = 1; | 
| 26 | } | 
| 27 |  | 
| 28 | void BendStamp::constrain( double the_constraint ){ | 
| 29 |  | 
| 30 | constraint = the_constraint; | 
| 31 | have_constraint = 1; | 
| 32 | } | 
| 33 |  | 
| 34 | void BendStamp::assignString( char* lhs, char* rhs ){ | 
| 35 |  | 
| 36 | if( unhandled == NULL ) unhandled = new LinkedAssign( lhs, rhs ); | 
| 37 | else unhandled->add( lhs, rhs ); | 
| 38 | have_extras = 1; | 
| 39 | } | 
| 40 |  | 
| 41 | void BendStamp::assignDouble( char* lhs, double rhs ){ | 
| 42 |  | 
| 43 | if( unhandled == NULL ) unhandled = new LinkedAssign( lhs, rhs ); | 
| 44 | else unhandled->add( lhs, rhs ); | 
| 45 | have_extras = 1; | 
| 46 | } | 
| 47 |  | 
| 48 | void BendStamp::assignInt( char* lhs, int rhs ){ | 
| 49 |  | 
| 50 | if( unhandled == NULL ) unhandled = new LinkedAssign( lhs, rhs ); | 
| 51 | else unhandled->add( lhs, rhs ); | 
| 52 | have_extras = 1; | 
| 53 | } | 
| 54 |  | 
| 55 | char* BendStamp::checkMe(){ | 
| 56 |  | 
| 57 | if( !have_mbrs ){ | 
| 58 | return strdup( "BendStamp error. Bend was not given members." ); | 
| 59 | } | 
| 60 |  | 
| 61 | return NULL; | 
| 62 | } |