ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-4/src/types/AtomStamp.cpp
(Generate patch)

Comparing trunk/OOPSE-4/src/types/AtomStamp.cpp (file contents):
Revision 2204 by gezelter, Fri Apr 15 22:04:00 2005 UTC vs.
Revision 2469 by tim, Fri Dec 2 15:38:03 2005 UTC

# Line 46 | Line 46 | AtomStamp::AtomStamp(){
46  
47   #include "types/AtomStamp.hpp"
48  
49 < AtomStamp::AtomStamp(){
50 <  
51 <  unhandled = NULL;
52 <  have_position = 0;
53 <  have_orientation = 0;
54 <  have_type = 0;
55 <  have_extras = 0;
49 > namespace oopse {
50 > AtomStamp::AtomStamp(int index) : havePos_(false), haveOrt_(false),  index_(index) {
51 >    DefineParameter(Type, "type");
52   }
53  
54 < AtomStamp::~AtomStamp(){
55 <  
56 <  if( unhandled != NULL ) delete unhandled;
54 > bool AtomStamp::setPosition(const std::vector<double>& pos) {
55 >    bool ret = false;
56 >    if (pos.size() == 3) {
57 >        position_[0] = pos[0];
58 >        position_[1] = pos[1];
59 >        position_[2] = pos[2];
60 >        havePos_ = true;
61 >    }else {
62 >        std::cout << "invalid position\n";
63 >    }
64 >    return ret;
65   }
66  
67 < void AtomStamp::setPosition( double x, double y, double z ){
68 <
69 <  pos[0] = x;
70 <  pos[1] = y;
71 <  pos[2] = z;
72 <
73 <  have_position = 1;
67 > bool AtomStamp::setOrientation(const std::vector<double>& ort) {
68 >    bool ret = false;
69 >    if (ort.size() == 3) {
70 >        position_[0] = ort[0];
71 >        position_[1] = ort[1];
72 >        position_[2] = ort[2];
73 >        haveOrt_ = true;
74 >    }else {
75 >        std::cout << "invalid orientation\n";
76 >    }
77 >    
78 >    return ret;
79   }
80  
81 < void AtomStamp::setOrientation( double phi, double theta, double psi ){
81 > AtomStamp* AtomStamp::getNextBondedAtom() {
82  
74  ornt[0] = phi;
75  ornt[1] = theta;
76  ornt[2] = psi;
77
78  have_orientation = 1;
83   }
84  
85 < char* AtomStamp::assignString( char* lhs, char* rhs ){
86 <
87 <  if( !strcmp( lhs, "type" ) ){
84 <    strcpy( type, rhs );
85 <    have_type = 1;
86 <  }
87 <  else{
88 <    if( unhandled == NULL ) unhandled = new LinkedAssign( lhs, rhs );
89 <    else unhandled->add( lhs, rhs );
90 <    have_extras = 1;
91 <  }
92 <  return NULL;
85 > void AtomStamp::validate() {
86 >    DataHolder::validate();
87 >    CheckParameter(Type, isNotEmpty());
88   }
89  
90 < char* AtomStamp::assignDouble( char* lhs, double rhs ){
96 <  
97 <  if( unhandled == NULL ) unhandled = new LinkedAssign( lhs, rhs );
98 <  else unhandled->add( lhs, rhs );
99 <  have_extras = 1;
100 <  return NULL;
101 < }
102 <
103 < char* AtomStamp::assignInt( char* lhs, int rhs ){
104 <  
105 <  if( unhandled == NULL ) unhandled = new LinkedAssign( lhs, rhs );
106 <  else unhandled->add( lhs, rhs );
107 <  have_extras = 1;
108 <  return NULL;
109 < }
110 <
111 < char* AtomStamp::checkMe( void ){
112 <  
113 <  if( !have_type ){
114 <    return strdup( "AtomStamp error. Atom was untyped." );
115 <  }
116 <  return NULL;
117 < }
90 > }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines