int main() {

  GlobalPoint P1(3., 4., 7.);
  GlobalPoint P2(-2., 5., 7.);

  oldCode(P1,P2);
  newCode(P1,P2);

  oldCode(P2,P1);
  newCode(P2,P1);


  return 0;
}
Ejemplo n.º 2
0
 void Client::readyForUse()
 {
     Connection *connection = qobject_cast<Connection *>(sender());
     if (!connection || hasConnection(connection->peerAddress(),
                                      connection->peerPort()))
         return;

     connect(connection, SIGNAL(newMessage(QString,QString)), this, SIGNAL(newMessage(QString,QString)));
    connect(connection, SIGNAL(newCode(QString,QString)), this, SIGNAL(newCode(QString,QString)));
     peers.insert(connection->peerAddress(), connection);
     QString nick = connection->name();
     if (!nick.isEmpty())
         emit newParticipant(nick);
 }
Ejemplo n.º 3
0
int main() {

  GlobalPoint P1(3., 4., 7.);
  GlobalPoint P2(-2., 5., 7.);

  oldCode(P1,P2);
  newCode(P1,P2);

  oldCode(P2,P1);
  newCode(P2,P1);

  {
  ThirdHitPredictionFromInvParabola pred(P1,P2,0.2,0.05,0.1);
  std::cout << "ip min, max " <<  pred.theIpRangePlus.min() << " " << pred.theIpRangePlus.max()
	    << "  " <<  pred.theIpRangeMinus.min() << " " << pred.theIpRangeMinus.max()  << std::endl;
  std::cout << "A,B +pos " << pred.coeffA(0.1) << " " <<  pred.coeffB(0.1) << std::endl;
  std::cout << "A,B -pos " << pred.coeffA(-0.1) << " " <<  pred.coeffB(-0.1) << std::endl;

  auto rp = pred.rangeRPhi(5.,1);
  auto rn = pred.rangeRPhi(5.,-1);
  std::cout << "range " << rp.min() << " " << rp.max()
	    << " " << rn.min() << " " << rn.max() << std::endl;
  }

  ThirdHitPredictionFromInvParabola pred(-1.092805, 4.187564, -2.361283, 7.892722, 0.111413, 0.019043, 0.032000);
  std::cout << "ip min, max " <<  pred.theIpRangePlus.min() << " " << pred.theIpRangePlus.max()
	    << "  " <<  pred.theIpRangeMinus.min() << " " << pred.theIpRangeMinus.max()  << std::endl;
  {
  auto rp = pred.rangeRPhi(11.4356,1);
  auto rn = pred.rangeRPhi(11.4356,-1);
  std::cout << "range " << rp.min() << " " << rp.max()
	    << " " << rn.min() << " " << rn.max() << std::endl;
  }
  {
  auto rp = pred.rangeRPhi(13.2131,1);
  auto rn = pred.rangeRPhi(13.2131,-1);
  std::cout << "range " << rp.min() << " " << rp.max()
	    << " " << rn.min() << " " << rn.max() << std::endl;
  }

  return 0;
}
Ejemplo n.º 4
0
cdgClass::cdgClass(size_t lineNumber):
    cdgScope("class", lineNumber)
{
    CMN_ASSERT(this->AddField("name", "", true, "name of the generated C++ class"));
    CMN_ASSERT(this->AddField("attribute", "", false, "string placed between 'class' and the class name (e.g. CISST_EXPORT)"));

    cdgField * field;
    field = this->AddField("ctor-all-members", "false", false, "adds a constructor requiring an initial value for each member");
    CMN_ASSERT(field);
    field->AddPossibleValue("true");
    field->AddPossibleValue("false");

    field = this->AddField("virtual-dtor", "false", false, "make the destructor virtual");
    CMN_ASSERT(field);
    field->AddPossibleValue("true");
    field->AddPossibleValue("false");

    field = this->AddField("generate-human-readable", "true", false, "generate the code for std::string _type.HumanReadable(void), set this to false to provide own implementation");
    CMN_ASSERT(field);
    field->AddPossibleValue("true");
    field->AddPossibleValue("false");

    CMN_ASSERT(this->AddField("namespace", "", false, "namespace for the class"));

    field = this->AddField("mts-proxy", "true", false, "generate the code to create a cisstMultiTask proxy, set this to false to avoid proxy generation or \"declaration-only\" to manually instantiate the proxy in a different source file (.cpp)");
    CMN_ASSERT(field);
    field->AddPossibleValue("true");
    field->AddPossibleValue("declaration-only");
    field->AddPossibleValue("false");

    this->AddKnownScope(*this);

    cdgBaseClass newBaseClass(0);
    this->AddSubScope(newBaseClass);

    cdgTypedef newTypedef(0);
    this->AddSubScope(newTypedef);

    cdgMember newMember(0);
    this->AddSubScope(newMember);

    cdgEnum newEnum(0);
    this->AddSubScope(newEnum);

    cdgInline newInline(0, cdgInline::CDG_INLINE_HEADER);
    this->AddSubScope(newInline);

    cdgInline newCode(0, cdgInline::CDG_INLINE_CODE);
    this->AddSubScope(newCode);
}
Ejemplo n.º 5
0
void Connection::processData()
{
    buffer = read(numBytesForCurrentDataType);
    if (buffer.size() != numBytesForCurrentDataType) {
        abort();
        return;
    }

    switch (currentDataType) {
    case PlainText:
        emit newMessage(username, QString::fromUtf8(buffer));
        break;
    case Code:
        qDebug()<<"emit code";
        emit newCode(username, QString::fromUtf8(buffer));
        break;
    default:
        break;
    }

    currentDataType = Undefined;
    numBytesForCurrentDataType = 0;
    buffer.clear();
}