Exemple #1
0
// Deserialize a previously serialized session object.
SessionStore::Session* SessionStore::deserialize_session(const std::string& data)
{
    Session* session = NULL;

    for (std::vector<SerializerDeserializer*>::iterator it = _deserializers.begin();
            it != _deserializers.end();
            ++it)
    {
        SerializerDeserializer* deserializer = *it;

        TRC_DEBUG("Try to deserialize record with '%s' deserializer",
                  deserializer->name().c_str());
        session = deserializer->deserialize_session(data);

        if (session != NULL)
        {
            TRC_DEBUG("Deserialization succeeded");
            break;
        }
        else
        {
            TRC_DEBUG("Deserialization failed");
        }
    }

    return session;
}
Exemple #2
0
AuthStore::Digest* AuthStore::deserialize_digest(const std::string& digest_s)
{
  Digest* digest = NULL;

  for (std::vector<SerializerDeserializer*>::const_iterator it = _deserializers.begin();
       it != _deserializers.end();
       ++it)
  {
    SerializerDeserializer* deserializer = *it;
    TRC_DEBUG("Try '%s' deserializer", deserializer->name().c_str());

    digest = deserializer->deserialize_digest(digest_s);

    if (digest != NULL)
    {
      TRC_DEBUG("Deserialization successful");
      break;
    }
    else
    {
      TRC_DEBUG("Deserialization failed");
    }
  }

  return digest;
}