Răsfoiți Sursa

Renamed some RTTI types

Marko Pintera 13 ani în urmă
părinte
comite
4139f9dbb3

+ 1 - 1
CamelotRenderer/Include/CmBlendStateRTTI.h

@@ -7,7 +7,7 @@
 
 namespace CamelotEngine
 {
-	template<> struct SerializableSimpleType<BLEND_STATE_DESC>
+	template<> struct RTTIPlainType<BLEND_STATE_DESC>
 	{	
 		enum { id = TID_BLEND_STATE_DESC }; enum { hasDynamicSize = 1 };
 

+ 3 - 3
CamelotRenderer/Include/CmShaderRTTI.h

@@ -6,7 +6,7 @@
 
 namespace CamelotEngine
 {
-	template<> struct SerializableSimpleType<SHADER_DATA_PARAM_DESC>
+	template<> struct RTTIPlainType<SHADER_DATA_PARAM_DESC>
 	{	
 		enum { id = TID_SHADER_DATA_PARAM_DESC }; enum { hasDynamicSize = 1 };
 
@@ -56,7 +56,7 @@ namespace CamelotEngine
 		}	
 	}; 
 
-	template<> struct SerializableSimpleType<SHADER_OBJECT_PARAM_DESC>
+	template<> struct RTTIPlainType<SHADER_OBJECT_PARAM_DESC>
 	{	
 		enum { id = TID_SHADER_OBJECT_PARAM_DESC }; enum { hasDynamicSize = 1 };
 
@@ -102,7 +102,7 @@ namespace CamelotEngine
 		}	
 	}; 
 
-	template<> struct SerializableSimpleType<SHADER_PARAM_BLOCK_DESC>
+	template<> struct RTTIPlainType<SHADER_PARAM_BLOCK_DESC>
 	{	
 		enum { id = TID_SHADER_PARAM_BLOCK_DESC }; enum { hasDynamicSize = 1 };
 

+ 6 - 6
CamelotUtility/Include/CmRTTIField.h

@@ -20,7 +20,7 @@ namespace CamelotEngine
 	/**
 	 * @brief	Strings need to copy their data in a slightly more intricate way than just memcpy.
 	 */
-	template<> struct SerializableSimpleType<String>
+	template<> struct RTTIPlainType<String>
 	{	
 		enum { id = 20 }; enum { hasDynamicSize = 1 };
 
@@ -67,7 +67,7 @@ namespace CamelotEngine
 	/**
 	 * @brief	Types of fields we can serialize:
 	 * 			
-	 * - Simple - Native data types, POD (Plain old data) structures, or in general types we don't want to (or can't) inherit from IReflectable. 
+	 * - Plain - Native data types, POD (Plain old data) structures, or in general types we don't want to (or can't) inherit from IReflectable. 
 	 *			  
 	 * - DataBlock - Array of bytes of a certain size. When returning a data block you may specify if its managed or unmanaged.  
 	 *				 Managed data blocks have their buffers deleted after they go out of scope. This is useful if you need to return some
@@ -101,7 +101,7 @@ namespace CamelotEngine
 		bool mIsVectorType;
 		SerializableFieldType mType;
 
-		bool isSimpleType() { return mType == SerializableFT_Plain; }
+		bool isPlainType() { return mType == SerializableFT_Plain; }
 		bool isDataBlockType() { return mType == SerializableFT_DataBlock; }
 		bool isComplexType() { return mType == SerializableFT_Reflectable; }
 		bool isComplexPtrType() { return mType == SerializableFT_ReflectablePtr; }
@@ -113,11 +113,11 @@ namespace CamelotEngine
 		virtual bool hasDynamicSize() = 0;
 
 		/**
-		 * @brief	Throws an exception if this field doesn't contain a simple value.
+		 * @brief	Throws an exception if this field doesn't contain a plain value.
 		 *
-		 * @param	array	If true then the field must support simple array types.
+		 * @param	array	If true then the field must support plain array types.
 		 */
-		void checkIsSimple(bool array);
+		void checkIsPlain(bool array);
 
 		/**
 		 * @brief	Throws an exception if this field doesn't contain a complex value.

+ 14 - 14
CamelotUtility/Include/CmRTTIPlainField.h

@@ -152,11 +152,11 @@ namespace CamelotEngine
 		 */
 		void initSingle(const std::string& name, UINT16 uniqueId, boost::any getter, boost::any setter)
 		{
-			int typeId = SerializableSimpleType<DataType>::id; // Just making sure provided type has a type ID
+			int typeId = RTTIPlainType<DataType>::id; // Just making sure provided type has a type ID
 
-			BOOST_STATIC_ASSERT_MSG((SerializableSimpleType<DataType>::hasDynamicSize != 0 || (sizeof(DataType) <= 255)), 
+			BOOST_STATIC_ASSERT_MSG((RTTIPlainType<DataType>::hasDynamicSize != 0 || (sizeof(DataType) <= 255)), 
 				"Trying to create a plain RTTI field with size larger than 255. In order to use larger sizes for plain types please specialize " \
-				" SerializableSimpleType, set hasDynamicSize to true.");
+				" RTTIPlainType, set hasDynamicSize to true.");
 
 			initAll(getter, setter, nullptr, nullptr, name, uniqueId, false, SerializableFT_Plain);
 		}
@@ -179,11 +179,11 @@ namespace CamelotEngine
 		void initArray(const std::string& name, UINT16 uniqueId, boost::any getter, 
 			boost::any getSize, boost::any setter, boost::any setSize)
 		{
-			int typeId = SerializableSimpleType<DataType>::id; // Just making sure provided type has a type ID
+			int typeId = RTTIPlainType<DataType>::id; // Just making sure provided type has a type ID
 
-			BOOST_STATIC_ASSERT_MSG((SerializableSimpleType<DataType>::hasDynamicSize != 0 || (sizeof(DataType) <= 255)), 
+			BOOST_STATIC_ASSERT_MSG((RTTIPlainType<DataType>::hasDynamicSize != 0 || (sizeof(DataType) <= 255)), 
 				"Trying to create a plain RTTI field with size larger than 255. In order to use larger sizes for plain types please specialize " \
-				" SerializableSimpleType, set hasDynamicSize to true.");
+				" RTTIPlainType, set hasDynamicSize to true.");
 
 			initAll(getter, setter, getSize, setSize, name, uniqueId, true, SerializableFT_Plain);
 		}
@@ -195,12 +195,12 @@ namespace CamelotEngine
 
 		virtual UINT32 getTypeId()
 		{
-			return SerializableSimpleType<DataType>::id;
+			return RTTIPlainType<DataType>::id;
 		}
 
 		virtual bool hasDynamicSize()
 		{
-			return SerializableSimpleType<DataType>::hasDynamicSize != 0;
+			return RTTIPlainType<DataType>::hasDynamicSize != 0;
 		}
 
 		virtual UINT32 getDynamicSize(void* object)
@@ -212,7 +212,7 @@ namespace CamelotEngine
 
 			DataType value;
 			getValue(castObject, value);
-			return SerializableSimpleType<DataType>::getDynamicSize(value);
+			return RTTIPlainType<DataType>::getDynamicSize(value);
 		}
 
 		virtual UINT32 getArrayElemDynamicSize(void* object, int index)
@@ -224,7 +224,7 @@ namespace CamelotEngine
 
 			DataType value;
 			getArrayValue(castObject, index, value);
-			return SerializableSimpleType<DataType>::getDynamicSize(value);
+			return RTTIPlainType<DataType>::getDynamicSize(value);
 		}
 
 		virtual UINT32 getArraySize(void* object)
@@ -260,7 +260,7 @@ namespace CamelotEngine
 
 			DataType value;
 			getValue(castObject, value);
-			SerializableSimpleType<DataType>::toMemory(value, (char*)buffer);
+			RTTIPlainType<DataType>::toMemory(value, (char*)buffer);
 		}
 
 		virtual void arrayElemToBuffer(void* object, int index, void* buffer)
@@ -272,7 +272,7 @@ namespace CamelotEngine
 
 			DataType value;
 			getArrayValue(castObject, index, value);
-			SerializableSimpleType<DataType>::toMemory(value, (char*)buffer);
+			RTTIPlainType<DataType>::toMemory(value, (char*)buffer);
 		}
 
 		virtual void fromBuffer(void* object, void* buffer)
@@ -283,7 +283,7 @@ namespace CamelotEngine
 			ObjectType* castObject = static_cast<ObjectType*>(object);
 
 			DataType value;
-			SerializableSimpleType<DataType>::fromMemory(value, (char*)buffer);
+			RTTIPlainType<DataType>::fromMemory(value, (char*)buffer);
 			setValue(castObject, value);
 		}
 
@@ -295,7 +295,7 @@ namespace CamelotEngine
 			ObjectType* castObject = static_cast<ObjectType*>(object);
 
 			DataType value;
-			SerializableSimpleType<DataType>::fromMemory(value, (char*)buffer);
+			RTTIPlainType<DataType>::fromMemory(value, (char*)buffer);
 			setArrayValue(castObject, index, value);
 		}
 	};

+ 11 - 11
CamelotUtility/Include/CmRTTIPrerequisites.h

@@ -4,7 +4,7 @@ namespace CamelotEngine
 {
 	/**
 	* @brief	Helper method when serializing known data types that have valid
-	* 			SerializableSimpleType specializations.
+	* 			RTTIPlainType specializations.
 	* 			
 	*			Returns the size of the element. If elements serializable type is 
 	*			specialized with hasDynamicSize == true, the dynamic size is calculated, 
@@ -13,15 +13,15 @@ namespace CamelotEngine
 	template<class ElemType>
 	UINT32 rttiGetElemSize(ElemType& data)
 	{
-		if(SerializableSimpleType<ElemType>::hasDynamicSize == 1)
-			return SerializableSimpleType<ElemType>::getDynamicSize(data);
+		if(RTTIPlainType<ElemType>::hasDynamicSize == 1)
+			return RTTIPlainType<ElemType>::getDynamicSize(data);
 		else
 			return sizeof(ElemType);
 	}
 
 	/**
 	 * @brief	Helper method when serializing known data types that have valid
-	 * 			SerializableSimpleType specializations.
+	 * 			RTTIPlainType specializations.
 	 * 			
 	 *			Writes the specified data into memory, advances the memory pointer by the
 	 *			bytes written and returns pointer to new memory.
@@ -29,14 +29,14 @@ namespace CamelotEngine
 	template<class ElemType>
 	char* rttiWriteElem(ElemType& data, char* memory)
 	{
-		SerializableSimpleType<ElemType>::toMemory(data, memory);
+		RTTIPlainType<ElemType>::toMemory(data, memory);
 
 		return memory + rttiGetElemSize(data);
 	}
 
 	/**
 	 * @brief	Helper method when serializing known data types that have valid
-	 * 			SerializableSimpleType specializations.
+	 * 			RTTIPlainType specializations.
 	 * 			
 	 *			Reads the specified data into memory, advances the memory pointer by the
 	 *			bytes read and returns pointer to new memory.
@@ -44,17 +44,17 @@ namespace CamelotEngine
 	template<class ElemType>
 	char* rttiReadElem(ElemType& data, char* memory)
 	{
-		SerializableSimpleType<ElemType>::fromMemory(data, memory);
+		RTTIPlainType<ElemType>::fromMemory(data, memory);
 
 		return memory + rttiGetElemSize(data);
 	}
 
 	template<class T>
-	struct SerializableSimpleType 
+	struct RTTIPlainType 
 	{ 
 		static_assert(std::is_pod<T>::value, 
-			"Serializable type isn't plain-old-data. You need to specialize SerializableSimpleType template in order to serialize this type. "\
-			" (Or call CM_MAKE_SERIALIZABLE(type) macro if you are sure the type can be properly serialized using just memcpy.)");
+			"Provided type isn't plain-old-data. You need to specialize RTTIPlainType template in order to serialize this type. "\
+			" (Or call CM_ALLOW_MEMCPY_SERIALIZATION(type) macro if you are sure the type can be properly serialized using just memcpy.)");
 
 		enum { id = 0 }; 
 		enum { hasDynamicSize = 0 };
@@ -77,7 +77,7 @@ namespace CamelotEngine
 	};
 
 #define CM_ALLOW_MEMCPY_SERIALIZATION(type)				\
-	template<> struct SerializableSimpleType<##type##>			\
+	template<> struct RTTIPlainType<##type##>			\
 	{	enum { id=0 }; enum { hasDynamicSize = 0 };		\
 	static void toMemory(##type##& data, char* memory)		\
 	{ memcpy(memory, &data, sizeof(##type##)); }			\

+ 4 - 4
CamelotUtility/Include/CmRTTIType.h

@@ -60,7 +60,7 @@ namespace CamelotEngine
 		void setPlainValue(ObjectType* object, const std::string& name, DataType& value)
 		{
 			RTTIField* genericField = findField(name);
-			genericField->checkIsSimple(false);
+			genericField->checkIsPlain(false);
 
 			RTTIPlainFieldBase* field = static_cast<RTTIPlainFieldBase*>(genericField);
 			field->setValue(object, value);
@@ -70,7 +70,7 @@ namespace CamelotEngine
 		void setPlainArrayValue(ObjectType* object, const std::string& name, UINT32 index, DataType& value)
 		{
 			RTTIField* genericField = findField(name);
-			genericField->checkIsSimple(true);
+			genericField->checkIsPlain(true);
 
 			RTTIPlainFieldBase* field = static_cast<RTTIPlainFieldBase*>(genericField);
 			field->setArrayValue(object, index, value);
@@ -143,7 +143,7 @@ namespace CamelotEngine
 		void getPlainValue(ObjectType* object, const std::string& name, DataType& value)
 		{
 			RTTIField* genericField = findField(name);
-			genericField->checkIsSimple(false);
+			genericField->checkIsPlain(false);
 
 			RTTIPlainFieldBase* field = static_cast<RTTIPlainFieldBase*>(genericField);
 			field->getValue(object, value);
@@ -153,7 +153,7 @@ namespace CamelotEngine
 		void getPlainArrayValue(ObjectType* object, const std::string& name, UINT32 index, DataType& value)
 		{
 			RTTIField* genericField = findField(name);
-			genericField->checkIsSimple(true);
+			genericField->checkIsPlain(true);
 
 			RTTIPlainFieldBase* field = static_cast<RTTIPlainFieldBase*>(genericField);
 			field->getArrayValue(object, index, value);

+ 1 - 1
CamelotUtility/Source/CmBinarySerializer.cpp

@@ -919,7 +919,7 @@ namespace CamelotEngine
 		//// D - Data block
 		//// P - Complex ptr
 		//// O - Object descriptor
-		//// Y - Simple field has dynamic size
+		//// Y - Plain field has dynamic size
 
 		return (id << 16 | size << 8 | 
 			(array ? 0x02 : 0) | 

+ 7 - 7
CamelotUtility/Source/CmRTTIField.cpp

@@ -3,13 +3,13 @@
 
 namespace CamelotEngine
 {
-	void RTTIField::checkIsSimple(bool array)
+	void RTTIField::checkIsPlain(bool array)
 	{
-		if(!isSimpleType())
+		if(!isPlainType())
 		{
 			CM_EXCEPT(InternalErrorException, 
-				"Invalid field type. Needed: Simple type. Got: " + toString(mIsVectorType) + ", " + 
-				toString(isSimpleType()) + ", " + toString(isComplexType()) + ", " + toString(isDataBlockType()) + ", " + toString(isComplexPtrType()));
+				"Invalid field type. Needed: Plain type. Got: " + toString(mIsVectorType) + ", " + 
+				toString(isPlainType()) + ", " + toString(isComplexType()) + ", " + toString(isDataBlockType()) + ", " + toString(isComplexPtrType()));
 		}
 
 		checkIsArray(array);
@@ -21,7 +21,7 @@ namespace CamelotEngine
 		{
 			CM_EXCEPT(InternalErrorException, 
 				"Invalid field type. Needed: Data block. Got: " + toString(mIsVectorType) + ", " + 
-				toString(isSimpleType()) + ", " + toString(isComplexType()) + ", " + toString(isDataBlockType()) + ", " + toString(isComplexPtrType()));
+				toString(isPlainType()) + ", " + toString(isComplexType()) + ", " + toString(isDataBlockType()) + ", " + toString(isComplexPtrType()));
 		}
 	}
 
@@ -31,7 +31,7 @@ namespace CamelotEngine
 		{
 			CM_EXCEPT(InternalErrorException, 
 				"Invalid field type. Needed: Complex type. Got: " + toString(mIsVectorType) + ", " + 
-				toString(isSimpleType()) + ", " + toString(isComplexType()) + ", " + toString(isDataBlockType()) + ", " + toString(isComplexPtrType()));
+				toString(isPlainType()) + ", " + toString(isComplexType()) + ", " + toString(isDataBlockType()) + ", " + toString(isComplexPtrType()));
 		}
 
 		checkIsArray(array);
@@ -43,7 +43,7 @@ namespace CamelotEngine
 		{
 			CM_EXCEPT(InternalErrorException, 
 				"Invalid field type. Needed: Complex ptr type. Got: " + toString(mIsVectorType) + ", " + 
-				toString(isSimpleType()) + ", " + toString(isComplexType()) + ", " + toString(isDataBlockType()) + ", " + toString(isComplexPtrType()));
+				toString(isPlainType()) + ", " + toString(isComplexType()) + ", " + toString(isDataBlockType()) + ", " + toString(isComplexPtrType()));
 		}
 
 		checkIsArray(array);