00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 // $Id: defaultProcessors.h,v 1.17.10.1 2007/03/25 21:25:25 oliver Exp $ 00005 // 00006 00007 #ifndef BALL_STRUCTURE_DEFAULTPROCESSORS_H 00008 #define BALL_STRUCTURE_DEFAULTPROCESSORS_H 00009 00010 #ifndef BALL_COMMON_H 00011 # include <BALL/common.h> 00012 #endif 00013 00014 #ifndef BALL_KERNEL_atom_H 00015 # include <BALL/KERNEL/atom.h> 00016 #endif 00017 00018 #ifndef BALL_MATHS_VECTOR3_H 00019 # include <BALL/MATHS/vector3.h> 00020 #endif 00021 00022 #ifndef BALL_CONCEPT_PROCESSOR_H 00023 # include <BALL/CONCEPT/processor.h> 00024 #endif 00025 00026 #ifndef BALL_DATATYPE_STRINGHASHMAP_H 00027 # include <BALL/DATATYPE/stringHashMap.h> 00028 #endif 00029 00030 namespace BALL 00031 { 00035 class BALL_EXPORT ClearChargeProcessor 00036 : public UnaryProcessor<Atom> 00037 { 00038 public: 00039 00041 virtual Processor::Result operator()(Atom& atom); 00042 }; 00043 00044 00048 class BALL_EXPORT ClearRadiusProcessor 00049 : public UnaryProcessor<Atom> 00050 { 00051 public: 00052 00054 virtual Processor::Result operator()(Atom& atom); 00055 }; 00056 00057 00064 class BALL_EXPORT AssignRadiusProcessor 00065 : public UnaryProcessor<Atom> 00066 { 00067 public: 00068 00070 AssignRadiusProcessor(); 00071 00075 AssignRadiusProcessor(const String& filename) 00076 throw(Exception::FileNotFound); 00077 00083 virtual bool start(); 00084 00088 virtual bool finish(); 00089 00105 virtual Processor::Result operator()(Atom& atom); 00106 00110 void setFilename(const String& filename) 00111 throw(Exception::FileNotFound); 00112 00115 String& getFilename(); 00116 00119 Size getNumberOfAssignments(); 00120 00125 Size getNumberOfErrors(); 00126 00127 00128 protected: 00129 00130 //_ Extract the data from the file. 00131 bool buildTable_() 00132 throw(Exception::FileNotFound); 00133 00134 String filename_; 00135 StringHashMap<float> table_; 00136 Size number_of_errors_; 00137 Size number_of_assignments_; 00138 }; 00139 00140 00147 class BALL_EXPORT AssignChargeProcessor 00148 : public AssignRadiusProcessor 00149 { 00150 public: 00151 00153 AssignChargeProcessor(); 00154 00158 AssignChargeProcessor(const String& filename) 00159 throw(Exception::FileNotFound); 00160 00166 virtual bool start(); 00167 00172 virtual Processor::Result operator () (Atom& atom); 00173 00176 float getTotalCharge(); 00177 00178 00179 protected: 00180 00181 float total_charge_; 00182 }; 00183 00184 00185 } // namespace BALL 00186 00187 #endif // BALL_STRUCTURE_DEFAULTPROCESSORS_H