Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ippServerQueues.cpp

Go to the documentation of this file.
00001 // 
00002 // DISCLAIMER: 
00003 //  This software was produced by the National Institute of Standards 
00004 //  and Technology (NIST), an agency of the U.S. government, and by statute is 
00005 //  not subject to copyright in the United States.  Recipients of this 
00006 //  software assume all responsibility associated with its operation,
00007 //  modification,maintenance, and subsequent redistribution. 
00008 //
00009 //  See NIST Administration Manual 4.09.07 b and Appendix I. 
00010 //
00011 // History
00012 // Who When     What
00013 // --- -------- ---------------------------------------------------------------
00014 // ER  09/03/06 remove handshaking and improve naming of methods
00015 //-----------------------------------------------------------------------------
00016 
00017 #include "stdafx.h"
00018 
00019 #include "ippdme/Server/ippServerQueues.h"
00020 #include "ippdme/assert.h"
00021 
00022 ippServerQueues::ippServerQueues()
00023 { 
00024   _tagList.reserve(50);
00025 }
00026 
00027 
00028 
00029 void ippServerQueues::addTag(int tag_num)
00030 {
00031          _tagList.push_back(tag_num);
00032 }
00033 
00034 void ippServerQueues::delTag(int tag_num)
00035 {
00036   for ( std::vector<int>::iterator p = _tagList.begin(); p != _tagList.end(); p++){
00037           if (*p == tag_num) {
00038                   _tagList.erase(p);
00039                   break;
00040           }
00041         }
00042 }
00043 
00044 bool ippServerQueues::tagInList(int tag_num) const
00045 {
00046         std::vector<int>::const_iterator p;
00047   for (p = _tagList.begin(); p != _tagList.end(); p++)  {
00048     if (*p == tag_num) {
00049             break;
00050     }
00051         } 
00052         return ((p == _tagList.end()) ? false : true);   
00053 }
00054 
00055 
00056 // Put an event on the event queue
00057 void ippServerQueues::EnqueueEvent(const char * a_string) 
00058 {
00059         _fastQueue.push(a_string);
00060 }
00061 
00062 // Put a command on the command queue
00063 void ippServerQueues::EnqueueCommand(const char * a_string) 
00064 {
00065   _slowQueue.push(a_string);
00066 }
00067 
00068 // Put a response on the response queue
00069 void ippServerQueues::EnqueueResponse(const char * a_string)
00070 {
00071   _responseQueue.push(a_string);
00072 }
00073 
00074 // Remove an event from the event queue
00075 std::string ippServerQueues::DequeueEvent() 
00076 {
00077   IPP_ASSERT(_fastQueue.size()>0);
00078         std::string a_string = _fastQueue.front();
00079   _fastQueue.pop();
00080         return a_string;
00081 }
00082 
00083 // Remove a command from the command queue
00084 std::string ippServerQueues::DequeueCommand() 
00085 {
00086   IPP_ASSERT(_slowQueue.size()>0);
00087         std::string a_string= _slowQueue.front();
00088         _slowQueue.pop();
00089   return a_string;
00090 }
00091 
00092 // Remove a response from the response queue
00093 std::string ippServerQueues::DequeueResponse() 
00094 {
00095   IPP_ASSERT(_responseQueue.size()>0);
00096   std::string a_string= _responseQueue.front();
00097         _responseQueue.pop();
00098         return a_string;
00099 }
00100 
00101 
00102 
00103 // Clear all queues in the case of an abort or a mid session client disconnect
00104 void ippServerQueues::ClearAllQueues()
00105 {
00106         while (_fastQueue.empty() == false) { _fastQueue.pop(); }
00107         while (_slowQueue.empty() == false) { _slowQueue.pop(); }
00108         while (_responseQueue.empty() == false) { _responseQueue.pop(); }
00109         _tagList.erase(_tagList.begin(), _tagList.end());
00110 }
00111 
00112 ippServerQueues::~ippServerQueues()
00113 {
00114 
00115 }

Generated on Wed Nov 8 00:20:06 2006 for IPPDME by  doxygen 1.4.1