Esempio n. 1
0
    ObjectType & operator = (ObjectType * object)
    {
		clear();
        mObject = object;
        initRef();
        return *mObject;
    }
Esempio n. 2
0
	inline const Variant& operator=(const Variant& b) {
		type_ = b.type_;
		if (b.type_ & RefType) {
			if (type_ & RefType)
				initRef(b.ref().get());
			else
				ref() = b.ref();
		}
		else {
			if (type_ & RefType)
				killRef();
			int_ = b.int_;
		}
		return *this;
	}
Esempio n. 3
0
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);
}
Esempio n. 4
0
void NXVectorTest::decrementTest(void)
{
	double zeros[4] = { 0.0, 0.0, 0.0, 0.0 };
	NXVector4d p1;
	p1.zero();
	NXVector4d p2;
	p2.zero();
	p1 -= p2;
	cppunit_assert_vectors_equal(p1, zeros, 0.0);
	
	double init[4] = { 1.0, -2.0, 13.0, -27.0 };
	double answer[4] = { -1.0, 2.0, -13.0, 27.0 };
	NXVectorRef4d initRef(init);
	NXVector4d initCopy = initRef;
	cppunit_assert_vectors_equal(initRef, initCopy);
	initCopy -= initRef;
	cppunit_assert_vectors_equal(initCopy, zeros, 0.0);
	initCopy -= initRef;
	cppunit_assert_vectors_equal(initCopy, answer, 0.0);
}
Esempio n. 5
0
 TSharedPointer(ObjectType * object)
 {
     mObject = object;
     initRef();
 }
Esempio n. 6
0
 TSharedPointer()
 {
     mObject = 0;
     initRef();
 }
Esempio n. 7
0
	Variant(Path value)        : type_(PathType)   { initRef(value.toString().bytes()); }
Esempio n. 8
0
	Variant(String value)      : type_(StringType) { initRef(value.bytes()); }
Esempio n. 9
0
	Variant(Ref<T, P> value)   : type_(RefType)    { initRef(value); }
Esempio n. 10
0
	Variant(const char* value) : type_(StringType) { initRef(String(value).bytes()); }