void print(int version, FILE *aus) { word i; char is[8]; if (hasdeclaration) { strcpy(sTDECL, " "); if (TID > 9999) TID = 9999; // Größenbegrenzungen wg. Ausdruck if (NTP > 12) NTP = 12; strftime(sTDECL,sizeof sTDECL,"%d%m%y%H%M%S",&TDECL); // If no FDT field was received from the logger (from FW 161 upwards) // we have to create one if (!(FDT[0] | FDT[1] | FDT[2])) { // TDECL is used as a base memcpy(&T_FDT, &TDECL, sizeof T_FDT); // Add the timezone T_FDT.tm_min += zz_min; T_FDT.tm_isdst = -1; //JMW TODO mktime(&T_FDT); FDT[0] = T_FDT.tm_mday; FDT[1] = T_FDT.tm_mon + 1; FDT[2] = T_FDT.tm_year % 100; } if (version >= 422) { FDT[0] = 0; FDT[1] = 0; FDT[2] = 0; } if (FDT[0] > 31) FDT[0] = 31; if (FDT[1] > 12) FDT[1] = 12; if (FDT[2] > 99) FDT[2] = 99; fprintf(aus, "C%s%02u%02u%02u%04u%02u\n", sTDECL, FDT[0], FDT[1], FDT[2], TID, NTP); // print C1-Record TKF.print(version, aus, "Takeoff"); // print Takeoff-Point STA.print(version, aus, "Start "); // print Start-Point // print Turnpoints for (i = 0; i < NTP; i++) { sprintf(is, "TP%02u ", i + 1); TP[i].print(version, aus, is); } FIN.print(version, aus, "Finish "); // print Finish-Point LDG.print(version, aus, "Landing"); // print Landing-Point } }
void set_difference (C1& B, const C2& A) { typename C1::iterator newlast = B.end(); for (typename C2::const_iterator it=A.begin(); it != A.end(); it++) newlast = std::remove (B.begin(), newlast, *it); B.erase (newlast, B.end()); }
void test_friend_3_function() { C1 x; C2 y; x.set_status(IDLE); y.set_status(IDLE); if (x.idle(y)) cout << "Screen can be used.\n"; else cout << "In use.\n"; x.set_status(INUSE); if (x.idle(y)) cout << "Screen can be used.\n"; else cout << "In use.\n"; }
std::vector<std::pair<typename C1::value_type, typename C2::value_type> > zip(C1 const &container1, C2 const &container2) { std::vector<std::pair<typename C1::value_type, typename C2::value_type> > result; auto it1 = container1.begin(); auto it2 = container2.begin(); for (; it1 != container1.end() && it2 != container2.end(); ++it1, ++it2) { result.push_back(std::make_pair(*it1, *it2)); } return result; }
void print(int version, FILE *aus) { word i; char is[8]; if (hasdeclaration) { strcpy(sTDECL," "); if (TID>9999) TID=9999; // Größenbegrenzungen wg. Ausdruck if (NTP>12) NTP = 12; //JMW TODO??? strftime(sTDECL,sizeof sTDECL,"%d%m%y%H%M%S",&TDECL); // Wenn kein FDT-Feld vom Logger kam (Logger ab FW 161) // dann muß eben eines erzeugt werden if (!(FDT[0]|FDT[1]|FDT[2])) { // TDECL als Basis nehmen memcpy(&T_FDT, &TDECL, sizeof T_FDT); // Zeitzone draufrechnen T_FDT.tm_min += zz_min; T_FDT.tm_isdst = -1; ////JMW TODO mktime(&T_FDT); FDT[0] = T_FDT.tm_mday; FDT[1] = T_FDT.tm_mon+1; FDT[2] = T_FDT.tm_year % 100; } if (version >= 422) { FDT[0] = 0; FDT[1] = 0; FDT[2] = 0; } if (FDT[0] > 31) FDT[0] = 31; if (FDT[1] > 12) FDT[1] = 12; if (FDT[2] > 99) FDT[2] = 99; fprintf(aus,"C%s%02u%02u%02u%04u%02u\n",sTDECL,FDT[0],FDT[1],FDT[2],TID,NTP); // C1-Record ausgeben TKF.print(version,aus,"Takeoff"); // Ausgabe von Takeoff-Point STA.print(version,aus,"Start "); // Start-Point for (i=0; i<NTP; i++) { // Turnpoints sprintf(is,"TP%02u ",i+1); TP[i].print(version,aus,is); } FIN.print(version,aus,"Finish "); // Finish-Point LDG.print(version,aus,"Landing"); // Landing-Point } }
int main() { clrscr(); C1 x; C2 y; x.set_status(IDLE); y.set_status(IDLE); if(idle(x, y)) cout << "Screen can be used.\n"; else cout << "In use.\n"; x.set_status(INUSE); if(idle(x, y)) cout << "Screen can be used.\n"; else cout << "In use.\n"; getch(); return 0; }
static void fillStats(C1<Stat> &stats, const Interval &iv, const C2<Value> &vals) { int i = 0, n = stats.size(), dt = iv.secs(); typename C1<Stat>::iterator st = stats.begin(); typename C2<Value>::const_iterator v1 = vals.begin(), v2 = vals.begin(); ++v2; while(v2 != vals.end() && st != stats.end()) { Interval vi(v1->tm, v2->tm);//, ci(iv.t1 + i*dt/n, iv.t1 + (i + 1)*dt/n); uint t = iv.t1 + int((i + 0.5f)*dt/n); if(v2->value != v2->value) vi.t2 = vi.t1 + 1; if(vi.contains(t) && v1->value == v1->value) { //typename C1<Stat>::iterator pst = st; //if(pst != stats.begin()) (--pst)->add(v1->value); st->add(v1->value); } if(t < vi.t2) ++st, ++i; else ++v1, ++v2; } }
bool CheckEqualIt( const T1 &i1, const T2 &i2, const C1 &c1, const C2 &c2 ) { bool c1end = i1 == c1.end(); bool c2end = i2 == c2.end(); if( c1end != c2end ){ return false; } else if(c1end){ return true; } else{ return CheckEqual(*i1, *i2); } }
bool step() { random.fill(Range(key)); random.fill(Range(src)); cipher1.key(key.getPtr()); cipher2.key(key.getPtr()); ApplyBlockCipher(cipher1,src.getPtr(),dst1.getPtr(),blocks); ApplyBlockCipher(cipher2,src.getPtr(),dst2.getPtr(),blocks); #if 0 Printf(Con,"\n#;\n\n#;\n",PrintDump(Range(dst1)),PrintDump(Range(dst2))); #endif return Range(dst1).equal(Range(dst2)); }