WidgetBase::WidgetBase (QWidget* widget, IsViewType isView, GetViewCountType getViewCount) : m_widget (widget), m_isView (isView), m_getViewCount (getViewCount) { initCopy (m_actionCopySelection, m_signalMapperCopySelection); initCopy (m_actionCopyTransform, m_signalMapperCopyTransform); initCopy (m_actionCopyForceRatio, m_signalMapperCopyForceRatio); m_actionResetTransformAll = boost::make_shared<QAction> (tr("&All"), m_widget); m_actionResetTransformAll->setStatusTip(tr("Reset transform all")); m_actionResetTransformFocus = boost::make_shared<QAction> ( tr("&Focus"), m_widget); m_actionResetTransformFocus->setStatusTip(tr("Reset transform focus")); m_actionColorMapScalarEdit.reset ( new QAction (tr("&Edit color map"), m_widget)); m_actionColorMapScalarEdit->setStatusTip(tr("Edit color map")); m_actionColorMapScalarClampClear.reset ( new QAction (tr("&Clamp clear"), m_widget)); m_actionColorMapScalarClampClear->setStatusTip(tr("Clamp clear")); initCopy (m_actionColorMapScalarCopy, m_signalMapperColorMapScalarCopy); initCopy (m_actionColorMapVelocityCopy, m_signalMapperColorMapVelocityCopy); m_actionColorMapVelocityEdit.reset ( new QAction (tr("&Edit overlay map"), m_widget)); m_actionColorMapVelocityEdit->setStatusTip(tr("Edit overlay map")); m_actionColorMapVelocityClampClear.reset ( new QAction (tr("&Clamp clear"), m_widget)); m_actionColorMapVelocityClampClear->setStatusTip(tr("Clamp clear")); m_actionColorMapVelocityCopyVelocityMagnitude.reset ( new QAction (tr("&Copy velocity magnitude"), m_widget)); m_actionColorMapVelocityCopyVelocityMagnitude->setStatusTip( tr("Copy velocity magnitude")); m_actionInfoFoam = boost::make_shared<QAction> (tr("&Foam"), m_widget); m_actionInfoFoam->setStatusTip(tr("Info foam")); m_actionInfoSimulation = boost::make_shared<QAction> (tr("&Simulation"), m_widget); m_actionInfoSimulation->setStatusTip(tr("Info simulation")); }
String::String(const String *st) { s = 0; length = 0; if (st && st->s) initCopy(st->s); }
void NXVectorTest::normalizedTest(void) { double init[4] = { 1.0, 1.0, 1.0, 1.0 }; NXVector4d initCopy(init); NXVector4d initNormalized = initCopy.normalized(); double answer[4] = { 0.5, 0.5, 0.5, 0.5 }; cppunit_assert_vectors_equal(initNormalized, answer, 1.0e-8); cppunit_assert_points_unequal(initNormalized, init, 1.0e-8); }
bool StImagePlane::fill(const StImagePlane& theCopy) { if(getSizeY() != theCopy.getSizeY() || getSizeRowBytes() != theCopy.getSizeRowBytes() || getFormat() != theCopy.getFormat()) { return initCopy(theCopy); } for(size_t row = 0; row < theCopy.getSizeY(); ++row) { stMemCpy(changeData(row, 0), theCopy.getData(row, 0), theCopy.getSizeRowBytes()); } return true; }
void NXVectorTest::normalizeSelfTest(void) { double init[4] = { 1.0, 1.0, 1.0, 1.0 }; NXVector4d initCopy(init); initCopy.normalizeSelf(); double answer[4] = { 0.5, 0.5, 0.5, 0.5 }; cppunit_assert_vectors_equal(initCopy, answer, 1.0e-8); NXVector<float,2> pythagoreanPair; pythagoreanPair[0] = 3.0f; pythagoreanPair[1] = 4.0f; pythagoreanPair.normalizeSelf(); float pythagoreanPairNormalizedValues[2] = { 0.6f, 0.8f }; NXVectorRef2f pythagoreanPairNormalized(pythagoreanPairNormalizedValues); cppunit_assert_vectors_equal(pythagoreanPair, pythagoreanPairNormalized, 1.0e-8f); }
void NXVectorTest::dataTest(void) { NXVector4d p; NXVectorRef4d pRef; pRef = p; CPPUNIT_ASSERT(p.data() == pRef.data()); // test copy constructor for deep-copy semantics double init[4] = { 2.0, 3.0, -1.0, 6.0 }; NXVectorRef4d initRef(init); NXVector4d initCopy(initRef); CPPUNIT_ASSERT(initRef.data() != initCopy.data()); cppunit_assert_vectors_equal(initRef, initCopy); // test copy assignment for deep-copy initCopy.zero(); initCopy = initRef; CPPUNIT_ASSERT(initRef.data() != initCopy.data()); cppunit_assert_vectors_equal(initRef, initCopy); }
String::String(const char *str) { s = 0; // Always initialize length = 0; initCopy(str); }
String::String(const String& string) { s = 0; length = 0; initCopy(string.s); }
HOT_FUNC void StringData::initCopy(const char* data) { return initCopy(data, strlen(data)); }