-
-
-//------------------------------------------------------------------------------
-//--------------------------------------------------------- Avp::clearByFormat()
-//------------------------------------------------------------------------------
-void Avp::clearByFormat() throw() {
- delete a_ISDNNumber;
- delete a_ISDNAddress;
- delete a_Unsigned16;
-}
-
-
-//------------------------------------------------------------------------------
-//---------------------------------------------------- Avp::allocationByFormat()
-//------------------------------------------------------------------------------
-void Avp::allocationByFormat(const stack::Format *stackFormat) throw() {
- if(stackFormat->getName() == "ISDNNumber") a_ISDNNumber = new ISDNNumber();
- else if(stackFormat->getName() == "ISDNAddress") a_ISDNAddress = new ISDNAddress();
- else if(stackFormat->getName() == "Unsigned16") a_Unsigned16 = new Unsigned16();
-}
-
-
-//------------------------------------------------------------------------------
-//----------------------------------------------------- Avp::getLengthByFormat()
-//------------------------------------------------------------------------------
-U24 Avp::getLengthByFormat(const stack::Format *stackFormat) const throw() {
- U24 result = 0;
-
- if(stackFormat->getName() == "ISDNNumber") result += a_ISDNNumber->getSize();
- else if(stackFormat->getName() == "ISDNAddress") result += a_ISDNAddress->getSize();
- else if(stackFormat->getName() == "Unsigned16") result += a_Unsigned16->getSize();
-
- return result;
-}
-
-
-//------------------------------------------------------------------------------
-//------------------------------------------------ Avp::decodeDataPartByFormat()
-//------------------------------------------------------------------------------
-void Avp::decodeDataPartByFormat(const char * buffer, int size, const stack::Format *stackFormat) throw(anna::RuntimeException) {
- if(stackFormat->getName() == "ISDNNumber") a_ISDNNumber->decode(buffer, size);
- else if(stackFormat->getName() == "ISDNAddress") a_ISDNAddress->decode(buffer, size);
- else if(stackFormat->getName() == "Unsigned16") a_Unsigned16->decode(buffer, size);
-}
-
-
-//------------------------------------------------------------------------------
-//---------------------------------------------------------- Avp::codeByFormat()
-//------------------------------------------------------------------------------
-void Avp::codeByFormat(char* dataPart, const stack::Format *stackFormat) const throw(anna::RuntimeException) {
- int dataBytes;
-
- if(stackFormat->getName() == "ISDNNumber") a_ISDNNumber->code(dataPart, dataBytes);
- else if(stackFormat->getName() == "ISDNAddress") a_ISDNAddress->code(dataPart, dataBytes);
- else if(stackFormat->getName() == "Unsigned16") a_Unsigned16->code(dataPart, dataBytes);
-}
-
-
-//------------------------------------------------------------------------------
-//---------------------------------------------------- Avp::getXMLdataByFormat()
-//------------------------------------------------------------------------------
-std::string Avp::getXMLdataByFormat(bool & isHex, const stack::Format *stackFormat) const throw() {
- std::string result;
-
- if(stackFormat->getName() == "ISDNNumber") {
- isHex = true;
- return a_ISDNNumber->asHexString();
- } else if(stackFormat->getName() == "ISDNAddress") {
- isHex = true;
- return a_ISDNAddress->asHexString();
- } else if(stackFormat->getName() == "Unsigned16") return a_Unsigned16->asPrintableString();
-
- return result;
-}
-
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------- Avp::fromXMLByFormat()
-//------------------------------------------------------------------------------
-void Avp::fromXMLByFormat(const anna::xml::Attribute* data, const anna::xml::Attribute* hexData, const stack::Format *stackFormat) throw(anna::RuntimeException) {
- if(stackFormat->getName() == "ISDNNumber") {
- if(data) a_ISDNNumber->fromPrintableString(data->getValue().c_str());
- else if(hexData) a_ISDNNumber->fromHexString(hexData->getValue());
- } else if(stackFormat->getName() == "ISDNAddress") {
- if(data) a_ISDNAddress->fromPrintableString(data->getValue().c_str());
- else if(hexData) a_ISDNAddress->fromHexString(hexData->getValue());
- } else if(stackFormat->getName() == "Unsigned16") {
- if(data) a_Unsigned16->fromPrintableString(data->getValue().c_str());
- else if(hexData) a_Unsigned16->fromHexString(hexData->getValue());
- }
-}
-