/usr/include/CLAM/qtmonitors/BoolControlSender.hxx is in libclam-qtmonitors-dev 1.4.0-3.1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | #ifndef BoolControlSender_hxx
#define BoolControlSender_hxx
#include <CLAM/Processing.hxx>
#include <CLAM/OutControl.hxx>
class BoolControlSender : public CLAM::Processing
{
public:
class Config : public CLAM::ProcessingConfig
{
public:
DYNAMIC_TYPE_USING_INTERFACE (Config, 1, ProcessingConfig);
DYN_ATTRIBUTE (0, public, unsigned, NOutputs );
void DefaultInit(void)
{
AddAll();
UpdateData();
SetNOutputs(1);
}
};
private:
typedef CLAM::OutControl<bool> BoolInControl;
typedef std::vector<BoolInControl*> BoolControls;
BoolControls _outputs;
Config _config;
public:
BoolControlSender(const Config & c=Config())
{
Configure(c);
}
const CLAM::ProcessingConfig & GetConfig() const { return _config; }
bool ConcreteConfigure(const CLAM::ProcessingConfig & config)
{
CopyAsConcreteConfig(_config, config);
if (not _config.HasNOutputs())
{
_config.AddNOutputs();
_config.UpdateData();
_config.SetNOutputs(1);
}
unsigned nOutputs = _config.GetNOutputs();
ResizeControls(nOutputs);
return true;
}
~BoolControlSender()
{
ResizeControls(0);
}
const char * GetClassName() const { return "BoolControlSender"; }
void ControlCallback(unsigned i, const bool & value)
{
}
bool Do()
{
return true;
}
void SendControl(unsigned index, bool value)
{
_outputs[index]->SendControl(value);
}
private:
void ResizeControls(unsigned newSize)
{
unsigned previousSize = _outputs.size();
for (unsigned i=newSize; i<previousSize; i++)
delete _outputs[i];
_outputs.resize(newSize);
for (unsigned i=previousSize; i<newSize; i++)
{
std::ostringstream os;
os << i+1;
_outputs[i]= new BoolInControl(os.str(),this);
}
}
};
#endif//BoolControlSender_hxx
|