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