Esempio n. 1
0
bool BinarySerialize::isValidObjectProperty(void* _1, const string& propname, const int& counter)
{
	AMEFObject* element = static_cast<AMEFObject*>(_1);
	if((int)element->getPackets().size()>counter && element->getPackets().at(counter)->getNameStr()==propname)
		return true;
	return false;
}
Esempio n. 2
0
bool BinarySerialize::isValidObjectProperty(void* _1, string propname, int counter)
{
	AMEFObject* element = (AMEFObject*)_1;
	if((int)element->getPackets().size()>counter && element->getPackets().at(counter)->getNameStr()==propname)
		return true;
	return false;
}
Esempio n. 3
0
void* BinarySerialize::getContainerElement(void* _1, int counter, int counter1)
{
	AMEFDecoder dec;
	AMEFObject* root = (AMEFObject*)_1;
	AMEFObject* root2 = dec.decodeB(root->getPackets().at(counter)->getValue(), true, false);
	return root2;
}
Esempio n. 4
0
void* BinarySerialize::getContainerElement(void* _1, const int& counter, const int& counter1)
{
	AMEFDecoder dec;
	AMEFObject* root = static_cast<AMEFObject*>(_1);
	AMEFObject* root2 = dec.decodeB(root->getPackets().at(counter)->getValue(), true);
	return root2;
}
Esempio n. 5
0
bool BinarySerialize::isValidClassNamespace(void* _1, string className, string namespc, bool iscontainer)
{
	StringUtil::replaceAll(namespc, "::", "_");
	StringUtil::replaceAll(className, "std::", "");
	StringUtil::replaceAll(className, "::", "_");
	StringUtil::replaceAll(className, "<", "-");
	StringUtil::replaceAll(className, ">", "-");
	if(className.at(className.length()-1)=='-')
		className = className.substr(0, className.length()-1);
	if(className.find('-')!=string::npos)
	{
		string pre = className.substr(0, className.find_last_of("-")+1);
		className = className.substr(className.find_last_of("-")+1);
		className = pre + namespc + className;
	}
	else
		className = namespc + className;
	AMEFObject* element = (AMEFObject*)_1;
	if(element->getNameStr()!=className || (iscontainer &&  element->getPackets().size()==0))
		return false;
	return true;
}
Esempio n. 6
0
void* BinarySerialize::getObjectProperty(void* _1, int counter)
{
	AMEFObject* element = (AMEFObject*)_1;
	return element->getPackets().at(counter);
}
Esempio n. 7
0
void* BinarySerialize::getPrimitiveValue(void* _1, string className)
{
	AMEFObject* root = (AMEFObject*)_1;
	root = root->getPackets().at(0);
	if((className=="signed" || className=="int" || className=="signed int") && className==root->getNameStr())
	{
		int *vt = new int;
		*vt = root->getIntValue();
		return vt;
	}
	else if((className=="unsigned" || className=="unsigned int") && className==root->getNameStr())
	{
		unsigned int *vt = new unsigned int;
		*vt = root->getUIntValue();
		return vt;
	}
	else if((className=="short" || className=="short int" || className=="signed short" || className=="signed short int") && className==root->getNameStr())
	{
		short *vt = new short;
		*vt = root->getShortValue();
		return vt;
	}
	else if((className=="unsigned short" || className=="unsigned short int") && className==root->getNameStr())
	{
		unsigned short *vt = new unsigned short;
		*vt = root->getUShortValue();
		return vt;
	}
	else if((className=="long" || className=="long int" || className=="signed long" || className=="signed long int") && className==root->getNameStr())
	{
		long *vt = new long;
		*vt = root->getLongLongValue();
		return vt;
	}
	else if((className=="unsigned long" || className=="unsigned long int") && root->getNameStr()==className)
	{
		long *vt = new long;
		*vt = root->getLongLongValue();
		return vt;
	}
	else if((className=="long long" || className=="long long int") && className==root->getNameStr())
	{
		long long *vt = new long long;
		*vt = root->getULongLongValue();
		return vt;
	}
	else if((className=="unsigned long long" || className=="unsigned long long int") && className==root->getNameStr())
	{
		unsigned long long *vt = new unsigned long long;
		*vt = root->getULongLongValue();
		return vt;
	}
	else if((className=="char" || className=="signed char") && className==root->getNameStr())
	{
		char *vt = new char;
		*vt = root->getCharValue();
		return vt;
	}
	else if(className=="unsigned char" && className==root->getNameStr())
	{
		unsigned char *vt = new unsigned char;
		*vt = root->getUCharValue();
		return vt;
	}
	else if(className=="Date" && className==root->getNameStr())
	{
		DateFormat formt("yyyy-mm-dd hh:mi:ss");
		return formt.parse(root->getValueStr());
	}
	else if(className=="BinaryData" && className==root->getNameStr())
	{
		return BinaryData::unSerilaize(root->getValueStr());
	}
	else if(className=="float" && className==root->getNameStr())
	{
		float *vt = new float;
		*vt = root->getFloatValue();
		return vt;
	}
	else if(className=="double" && className==root->getNameStr())
	{
		double *vt = new double;
		*vt = root->getDoubleValue();
		return vt;
	}
	else if(className=="long double" && className==root->getNameStr())
	{
		long double *vt = new long double;
		*vt = root->getLongDoubleValue();
		return vt;
	}
	else if(className=="bool" && className==root->getNameStr())
	{
		bool *vt = new bool;
		*vt = root->getBoolValue();
		return vt;
	}
	else if((className=="std::string" || className=="string") && className==root->getNameStr())
	{
		string *vt = new string;
		*vt = root->getValueStr();
		return vt;
	}
	return NULL;
}
Esempio n. 8
0
int BinarySerialize::getContainerSize(void* _1)
{
	AMEFObject* root = (AMEFObject*)_1;
	return root->getPackets().size();
}
Esempio n. 9
0
void BinarySerialize::addPrimitiveElementToContainer(void* _1, int counter, string className, void* cont, string container)
{
	AMEFDecoder dec;
	AMEFObject* root = (AMEFObject*)_1;
	AMEFObject* root2 = dec.decodeB(root->getPackets().at(counter)->getValue(), true, false);
	if(className=="std::string" || className=="string")
	{
		string retVal = root2->getPackets().at(0)->getValueStr();
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="int")
	{
		int retVal = root2->getPackets().at(0)->getIntValue();
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="short")
	{
		short retVal = root2->getPackets().at(0)->getShortValue();
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="long")
	{
		long retVal = root2->getPackets().at(0)->getLongValue();
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="long long")
	{
		long long retVal = root2->getPackets().at(0)->getLongLongValue();
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="long double")
	{
		long double retVal = root2->getPackets().at(0)->getLongDoubleValue();
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="unsigned int")
	{
		unsigned int retVal = root2->getPackets().at(0)->getUIntValue();
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="unsigned short")
	{
		unsigned short retVal = root2->getPackets().at(0)->getUShortValue();
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="unsigned long")
	{
		unsigned long retVal = root2->getPackets().at(0)->getULongValue();
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="unsigned long long")
	{
		unsigned long long retVal = root2->getPackets().at(0)->getULongLongValue();
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="float")
	{
		float retVal = root2->getPackets().at(0)->getFloatValue();
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="double")
	{
		double retVal = root2->getPackets().at(0)->getDoubleValue();
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="bool")
	{
		bool retVal = root2->getPackets().at(0)->getBoolValue();
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="char")
	{
		char retVal = root2->getPackets().at(0)->getCharValue();
		addValueToNestedContainer(container, retVal, cont);
	}
	else if(className=="unsigned char")
	{
		unsigned char retVal = root2->getPackets().at(0)->getUCharValue();
		addValueToNestedContainer(container, retVal, cont);
	}
}
Esempio n. 10
0
string BinarySerialize::elementToSerializedString(void* _1, int counter)
{
	AMEFObject* object = (AMEFObject*)_1;
	return object->getPackets().at(counter)->getValueStr();
}
Esempio n. 11
0
void* Serialize::_handleAllUnSerialization(string objXml,string className)
{
	AMEFDecoder dec;
	AMEFObject* root = dec.decodeB(objXml, true, false);
	if(root==NULL)
		return NULL;
	if(className=="std::string" || className=="string" || className=="int" || className=="short" ||
					className=="bool" || className=="long" || className=="float" || className=="double")
	{
		root = root->getPackets().at(0);
		if(className=="int" && className==root->getNameStr())
		{
			int *vt = new int;
			*vt = root->getIntValue();
			return vt;
		}
		else if(className=="short" && className==root->getNameStr())
		{
			short *vt = new short;
			*vt = root->getShortValue();
			return vt;
		}
		else if(className=="long" && className==root->getNameStr())
		{
			long *vt = new long;
			*vt = root->getLongValue();
			return vt;
		}
		else if(className=="Date" && className==root->getNameStr())
		{
			DateFormat formt("yyyy-mm-dd hh:mi:ss");
			return formt.parse(root->getValueStr());
		}
		else if(className=="BinaryData" && className==root->getNameStr())
		{
			return BinaryData::unSerilaize(root->getValueStr());
		}
		else if(className=="float" && className==root->getNameStr())
		{
			float *vt = new float;
			*vt = root->getFloatValue();
			return vt;
		}
		else if(className=="double" && className==root->getNameStr())
		{
			double *vt = new double;
			*vt = root->getDoubleValue();
			return vt;
		}
		else if(className=="bool" && className==root->getNameStr())
		{
			bool *vt = new bool;
			*vt = root->getBoolValue();
			return vt;
		}
		else if((className=="std::string" || className=="string") && className==root->getNameStr())
		{
			string *vt = new string;
			*vt = root->getValueStr();
			return vt;
		}
	}
	else if(root->getNameStr()!="")
	{
		if(root->getNameStr().find("vector<")==0)
		{
			return unserializevec(root, objXml);
		}
		else if(root->getNameStr().find("set<")==0)
		{
			return unserializeset(root, objXml);
		}
		else if(root->getNameStr().find("multiset<")==0)
		{
			return unserializemultiset(root, objXml);
		}
		else if(root->getNameStr().find("list<")==0)
		{
			return unserializelist(root, objXml);
		}
		else if(root->getNameStr().find("std::queue<")==0 || root->getNameStr().find("queue<")==0)
		{
			return unserializeq(root, objXml);
		}
		else if(root->getNameStr().find("deque<")==0)
		{
			return unserializedq(root, objXml);
		}
	}
	return _unser(objXml,className);
}
Esempio n. 12
0
void* BinarySerialize::getObjectProperty(void* _1, const int& counter)
{
	AMEFObject* element = static_cast<AMEFObject*>(_1);
	return element->getPackets().at(counter);
}
Esempio n. 13
0
int BinarySerialize::getContainerSize(void* _1)
{
	AMEFObject* root = static_cast<AMEFObject*>(_1);
	return root->getPackets().size();
}
Esempio n. 14
0
string BinarySerialize::elementToSerializedString(void* _1, const int& counter)
{
	AMEFObject* object = static_cast<AMEFObject*>(_1);
	return object->getPackets().at(counter)->getValueStr();
}