00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 00005 #ifndef BALL_STRUCTURE_DEFAULTPROCESSORS_H 00006 #define BALL_STRUCTURE_DEFAULTPROCESSORS_H 00007 00008 #ifndef BALL_COMMON_H 00009 # include <BALL/common.h> 00010 #endif 00011 00012 #ifndef BALL_KERNEL_atom_H 00013 # include <BALL/KERNEL/atom.h> 00014 #endif 00015 00016 #ifndef BALL_MATHS_VECTOR3_H 00017 # include <BALL/MATHS/vector3.h> 00018 #endif 00019 00020 #ifndef BALL_CONCEPT_PROCESSOR_H 00021 # include <BALL/CONCEPT/processor.h> 00022 #endif 00023 00024 #ifndef BALL_DATATYPE_STRINGHASHMAP_H 00025 # include <BALL/DATATYPE/stringHashMap.h> 00026 #endif 00027 00028 namespace BALL 00029 { 00033 class BALL_EXPORT ClearChargeProcessor 00034 : public UnaryProcessor<Atom> 00035 { 00036 public: 00037 00039 virtual Processor::Result operator()(Atom& atom); 00040 }; 00041 00042 00046 class BALL_EXPORT ClearRadiusProcessor 00047 : public UnaryProcessor<Atom> 00048 { 00049 public: 00050 00052 virtual Processor::Result operator()(Atom& atom); 00053 }; 00054 00055 00062 class BALL_EXPORT AssignRadiusProcessor 00063 : public UnaryProcessor<Atom> 00064 { 00065 public: 00066 00068 AssignRadiusProcessor(); 00069 00073 AssignRadiusProcessor(const String& filename) 00074 throw(Exception::FileNotFound); 00075 00081 virtual bool start(); 00082 00086 virtual bool finish(); 00087 00103 virtual Processor::Result operator()(Atom& atom); 00104 00108 void setFilename(const String& filename) 00109 throw(Exception::FileNotFound); 00110 00113 String& getFilename(); 00114 00117 Size getNumberOfAssignments(); 00118 00123 Size getNumberOfErrors(); 00124 00125 00126 protected: 00127 00128 //_ Extract the data from the file. 00129 bool buildTable_() 00130 throw(Exception::FileNotFound); 00131 00132 String filename_; 00133 StringHashMap<float> table_; 00134 Size number_of_errors_; 00135 Size number_of_assignments_; 00136 }; 00137 00138 00145 class BALL_EXPORT AssignChargeProcessor 00146 : public AssignRadiusProcessor 00147 { 00148 public: 00149 00151 AssignChargeProcessor(); 00152 00156 AssignChargeProcessor(const String& filename) 00157 throw(Exception::FileNotFound); 00158 00164 virtual bool start(); 00165 00170 virtual Processor::Result operator () (Atom& atom); 00171 00174 float getTotalCharge(); 00175 00176 00177 protected: 00178 00179 float total_charge_; 00180 }; 00181 00182 00183 } // namespace BALL 00184 00185 #endif // BALL_STRUCTURE_DEFAULTPROCESSORS_H