00001
00002
00003
00004
00005
00006 #include "Stl3Util/gl3/gl3Algorithm.h"
00007
00008 #include "Stl3Util/base/FtfLog.h"
00009
00010
00011
00012
00013 gl3Algorithm::gl3Algorithm ( )
00014 {
00015 GI1 = 0; GI2 = 0; GI3 = 0; GI4 = 0; GI5 = 0;
00016 GF1 = 0; GF2 = 0; GF3 = 0; GF4 = 0; GF5 = 0;
00017
00018 preScale = 1;
00019 postScale = 1;
00020
00021 priority = 2;
00022
00023 init();
00024 }
00025
00026
00027
00028
00029 gl3Algorithm::~gl3Algorithm ( )
00030 {
00031 }
00032
00033
00034
00035
00036
00037 int gl3Algorithm::process (gl3Event* event_in)
00038 {
00039 event = event_in;
00040
00041 on = 0; accept = 0; build = 0;
00042
00043
00044 preScale_cnt++;
00045
00046 if ( (preScale > 0) && (preScale_cnt != preScale) ) {
00047 return 0;
00048 }
00049
00050 preScale_cnt = 0;
00051 on = 1;
00052
00053 int decision = this->decide();
00054
00055
00056
00057 if (!decision) {
00058 return 0;
00059 }
00060 accept = 1;
00061
00062
00063 if ( accept_cnt%postScale != 0 ) {
00064 return 0;
00065 }
00066
00067 build = 1;
00068
00069 event = NULL;
00070
00071 return decision ? priority : 0;
00072 }
00073
00074
00075
00076
00077
00078 void gl3Algorithm::incrementCounters ()
00079 {
00080 if (on) call_cnt++;
00081 if (accept) accept_cnt++;
00082 if (build) build_cnt++;
00083 }
00084
00085
00086
00087
00088
00089 int gl3Algorithm::init()
00090 {
00091 resetCounters();
00092 on = 0; accept = 0; build = 0;
00093
00094 for (int i=0; i<10; i++) {
00095 SummaryData[i] = 0;
00096 }
00097
00098 return 0 ;
00099 }
00100
00101
00102
00103
00104 int gl3Algorithm::end ( )
00105 {
00106 return 0 ;
00107 }
00108
00109
00110
00111
00112 int gl3Algorithm::setParameters(int GI1_in, int GI2_in, int GI3_in,
00113 int GI4_in, int GI5_in,
00114 float GF1_in, float GF2_in, float GF3_in,
00115 float GF4_in, float GF5_in)
00116 {
00117 GI1 = GI1_in;
00118 GI2 = GI2_in;
00119 GI3 = GI3_in;
00120 GI4 = GI4_in;
00121 GI5 = GI5_in;
00122
00123 GF1 = GF1_in;
00124 GF2 = GF2_in;
00125 GF3 = GF3_in;
00126 GF4 = GF4_in;
00127 GF5 = GF5_in;
00128
00129 return 0;
00130
00131 }
00132
00133
00134
00135
00136 void gl3Algorithm::setScaling(int preScale_in, int postScale_in)
00137 {
00138 preScale = (preScale_in > 0) ? preScale_in : 1;
00139 postScale = (postScale_in > 0) ? postScale_in : 1;
00140 }
00141
00142
00143
00144
00145 void gl3Algorithm::fillSummary(struct algorithm_data *dest)
00146 {
00147 dest->algId = getAlgorithmID();
00148 dest->on = on;
00149 dest->accept = accept;
00150 dest->build = build;
00151 dest->nProcessed = call_cnt;
00152 dest->nAccept = accept_cnt;
00153 dest->nBuild = build_cnt;;
00154
00155 for (int i=0; i<10; i++) {
00156 dest->data[i] = SummaryData[i];
00157 }
00158 }
00159
00160
00161 void gl3Algorithm::resetCounters()
00162 {
00163 preScale_cnt = 0;
00164 call_cnt =0;
00165 accept_cnt = 0;
00166 build_cnt = 0;
00167 }
00168
00169 void gl3Algorithm::showConfiguration()
00170 {
00171 ftfLog("%s: Pre-PostScale: %d %d\n",
00172 getAlgorithmName(), (int)preScale, (int)postScale);
00173
00174 ftfLog("%s: Int Parameters: %d %d %d %d %d\n",
00175 getAlgorithmName(), GI1, GI2, GI3, GI4, GI5);
00176
00177 ftfLog("%s: Float Parameters: %f %f %f %f %f\n",
00178 getAlgorithmName(), GF1, GF2, GF3, GF4, GF5);
00179 };
00180