05.11.2011 - stable version, 0.1.0, self-test program, work at GCC 2.95 - 4.5, VC 2010, MinGW, Linux, Windows, QNX
This commit is contained in:
@@ -42,21 +42,19 @@ private:
|
||||
|
||||
class PIRepeater: public PIMultiProtocol {
|
||||
public:
|
||||
PIRepeater(const PIString & config, const PIString & name, int data_size) {
|
||||
ba_f = new PIByteArray(data_size);
|
||||
ba_s = new PIByteArray(data_size);
|
||||
PIRepeater(const PIString & config, const PIString & name) {
|
||||
PIConfig conf(config, PIFile::Read);
|
||||
if (!conf.isOpened()) {
|
||||
cout << "[PIRepeater \"" << name << "\"] Can`t open \"" << config << "\"!" << endl;
|
||||
return;
|
||||
}
|
||||
PIConfig::Entry b = conf.getValue(name);
|
||||
PIConfig::Entry & b(conf.getValue(name));
|
||||
if (b.childCount() != 2) {
|
||||
cout << "[PIRepeater \"" << name << "\"] \"" << config << "\" should consist 2 nodes!" << endl;
|
||||
return;
|
||||
}
|
||||
addProtocol(config, b.child(0)->fullName(), 0, 0, ba_f->data(), data_size, ba_s->data(), data_size);
|
||||
addProtocol(config, b.child(1)->fullName(), 0, 0, ba_s->data(), data_size, ba_f->data(), data_size);
|
||||
addProtocol(config, b.child(0)->fullName());
|
||||
addProtocol(config, b.child(1)->fullName());
|
||||
start();
|
||||
}
|
||||
|
||||
@@ -68,10 +66,8 @@ public:
|
||||
ullong sendCount() {if (count() == 2) return protocol(0)->sendCount(); return 0;}
|
||||
ullong * sendCount_ptr() {if (count() == 2) return protocol(0)->sendCount_ptr(); return 0;}
|
||||
|
||||
PIByteArray * ba_f, * ba_s;
|
||||
|
||||
private:
|
||||
void received(PIProtocol * prot, bool , char * , int ) {if (prot == protocol(0)) protocol(1)->send(); else protocol(0)->send();}
|
||||
void received(PIProtocol * prot, bool , char * data, int size) {if (prot == protocol(0)) protocol(1)->send(data, size); else protocol(0)->send(data, size);}
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user