unhandled_request.cpp

Go to the documentation of this file.
00001 #ifndef UNHANDLED_REQUEST_IMPLEMENTATION_FILE
00002 #define UNHANDLED_REQUEST_IMPLEMENTATION_FILE
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : unhandled_request                                                 *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *******************************************************************************
00010 * Copyright (c) 2004-$now By Author.  This program is free software; you can  *
00011 * redistribute it and/or modify it under the terms of the GNU General Public  *
00012 * License as published by the Free Software Foundation; either version 2 of   *
00013 * the License or (at your option) any later version.  This is online at:      *
00014 *     http://www.fsf.org/copyleft/gpl.html                                    *
00015 * Please send any updates to: fred@gruntose.com                               *
00016 \*****************************************************************************/
00017 
00018 #include "unhandled_request.h"
00019 
00020 unhandled_request::unhandled_request(const octopus_request_id &original_id,
00021     const string_array &original_classifier, const outcome &reason)
00022 : infoton(the_classifier()),
00023   _original_id(original_id),
00024   _original_classifier(original_classifier),
00025   _reason(reason)
00026 {}
00027 
00028 clonable *unhandled_request::clone() const 
00029 { return new unhandled_request(_original_id, _original_classifier, _reason); }
00030 
00031 int unhandled_request::packed_size() const
00032 {
00033   return _original_id.packed_size() + _original_classifier.packed_size()
00034       + _reason.packed_size();
00035 }
00036 
00037 const char *initter[] = { "__Unhandled__", NIL };
00038 
00039 string_array unhandled_request::the_classifier()
00040 { return string_array(1, initter); }
00041 
00042 void unhandled_request::pack(byte_array &packed_form) const 
00043 {
00044   _original_id.pack(packed_form);
00045   _original_classifier.pack(packed_form);
00046   _reason.pack(packed_form);
00047 }
00048 
00049 bool unhandled_request::unpack(byte_array &packed_form) 
00050 {
00051   if (!_original_id.unpack(packed_form)) return false;
00052   if (!_original_classifier.unpack(packed_form)) return false;
00053   if (!_reason.unpack(packed_form)) return false;
00054   return true;
00055 }
00056 
00057 
00058 #endif //UNHANDLED_REQUEST_IMPLEMENTATION_FILE
00059 

Generated on Tue Aug 19 04:29:46 2008 for HOOPLE Libraries by  doxygen 1.5.1