selectiveone2onewiring.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __SELECTIVEONE2ONEWIRING_H
00025 #define __SELECTIVEONE2ONEWIRING_H
00026
00027 #include "one2onewiring.h"
00028 #include <functional>
00029
00030
00031
00032
00033
00034 struct select_predicate : public std::binary_function< int, int, bool> {
00035 virtual ~select_predicate(){}
00036 virtual bool operator()( int index, int len) { return true; }
00037 };
00038
00039 struct select_all : public select_predicate { };
00040
00041 struct select_firsthalf : public select_predicate {
00042 virtual ~select_firsthalf(){}
00043 virtual bool operator()( int index, int len) { return index < len/2; }
00044 };
00045
00046
00047 struct select_from_to : public select_predicate {
00048 virtual ~select_from_to(){}
00049 select_from_to( int from, int to) : from(from), to(to) {}
00050 virtual bool operator()( int index, int len) { return (index >= from) && (index <= to); }
00051 int from;
00052 int to;
00053 };
00054
00055
00056
00057
00058
00059 class SelectiveOne2OneWiring : public One2OneWiring{
00060 public:
00061
00062
00063
00064
00065
00066 SelectiveOne2OneWiring(NoiseGenerator* noise, select_predicate* sel_sensor, int plotMode = Controller, const std::string& name = "SelectiveOne2OneWiring");
00067 virtual ~SelectiveOne2OneWiring();
00068
00069 protected:
00070 virtual bool initIntern();
00071
00072 virtual bool wireSensorsIntern(const sensor* rsensors, int rsensornumber,
00073 sensor* csensors, int csensornumber,
00074 double noise);
00075
00076 protected:
00077 select_predicate* sel_sensor;
00078
00079 };
00080
00081 #endif