Пример #1
0
//------------------------------------------------------------------------------
// Send and receive test messages
//------------------------------------------------------------------------------
void Echo::updateData(const Eaagles::LCreal dt)
{
    // Update base classes stuff
    BaseClass::updateData(dt);

    if (areNetworksEnabled()) {
        // Looking for a message from the client
        char buffer[MAX_SIZE+1];
        unsigned int n = recvData(buffer, MAX_SIZE);
        std::cout << "n = " << n << std::endl;
        if (n > 0) {
            buffer[n] = 0;
            std::cout << "RECV: " << buffer << std::endl;
            // And send it right back to the client
            Eaagles::lcSleep(1000);
            bool ok = sendData(buffer, n);
            if (ok) {
               std::cout << "SENT: " << buffer << std::endl << std::endl;

               // End check
               loopCounter++;
               if (getLoops() > 0 && loopCounter >= getLoops()) {
                   closeConnections();
                   std::cout << "Exit: " << getLoops() << " loops completed!" << std::endl;
                   std::exit(0);
               }

            }
        }
    }
}
Пример #2
0
void Torus::print()
{
	cout << "| | - Torus" << endl;
	cout << "| | | - inner: " << getInner() << endl;
	cout << "| | | - outer: " << getOuter() << endl;
	cout << "| | | - slices: " << getSlices() << endl;
	cout << "| | | - loops: " << getLoops() << endl;
}
static int tracker( struct RE *rexp, struct RE *track ){
  if( rexp->len == 0 ) return FALSE;

  switch( *rexp->ptr ){
  case ':': cutByLen ( rexp, track, 2, META  ); break;
  case '.': cutByLen ( rexp, track, 1, POINT ); break;
  case '@': cutByLen ( rexp, track, 1 +
                      countCharDigits( rexp->ptr + 1 ),
                                     BACKREF ); break;
  case '(': cutByType( rexp, track,  GROUP   ); break;
  case '<': cutByType( rexp, track,  HOOK    ); break;
  case '[': cutByType( rexp, track,  SET     ); break;
  default : cutSimple( rexp, track           ); break;
  }

  getLoops( rexp, track );
  getMods ( rexp, track );
  return TRUE;
}