00001 /*_############################################################################ 00002 _## 00003 _## agentx_queue.h 00004 _## 00005 _## 00006 _## AgentX++ v1.4.17 00007 _## ------------------------------------- 00008 _## Copyright (C) 2000-2009 - Frank Fock 00009 _## 00010 _## Use of this software is subject to the license agreement you received 00011 _## with this software and which can be downloaded from 00012 _## http://www.agentpp.com 00013 _## 00014 _## This is licensed software and may not be used in a commercial 00015 _## environment, except for evaluation purposes, unless a valid 00016 _## license has been purchased. 00017 _## 00018 _## Last updated: Tue May 26 23:31:10 CEST 2009 00019 _## 00020 _##########################################################################*/ 00021 00022 #ifndef _agentx_queue_h_ 00023 #define _agentx_queue_h_ 00024 00025 #include <agentx_pp/agentx_threads.h> 00026 #include <agentx_pp/agentx_pdu.h> 00027 00028 #include <agent_pp/List.h> 00029 00030 #ifdef AGENTPP_NAMESPACE 00031 namespace Agentpp { 00032 #endif 00033 00034 00035 /*-------------------------- class AgentXQueue -----------------------*/ 00036 00046 #if !defined (AGENTXPP_DECL_TEMPL_LIST_AGENTXPDU) 00047 #define AGENTXPP_DECL_TEMPL_LIST_AGENTXPDU 00048 AGENTXPP_DECL_TEMPL template class AGENTXPP_DECL List<AgentXPdu>; 00049 #endif 00050 #if !defined (AGENTXPP_DECL_TEMPL_LISTCURSOR_AGENTXPDU) 00051 #define AGENTXPP_DECL_TEMPL_LISTCURSOR_AGENTXPDU 00052 AGENTXPP_DECL_TEMPL template class AGENTXPP_DECL ListCursor<AgentXPdu>; 00053 #endif 00054 #if !defined (AGENTXPP_DECL_TEMPL_ORDEREDLIST_AGENTXPDU) 00055 #define AGENTXPP_DECL_TEMPL_ORDEREDLIST_AGENTXPDU 00056 AGENTXPP_DECL_TEMPL template class AGENTXPP_DECL OrderedList<AgentXPdu>; 00057 #endif 00058 #if !defined (AGENTXPP_DECL_TEMPL_ORDEREDLISTCURSOR_AGENTXPDU) 00059 #define AGENTXPP_DECL_TEMPL_ORDEREDLISTCURSOR_AGENTXPDU 00060 AGENTXPP_DECL_TEMPL template class AGENTXPP_DECL OrderedListCursor<AgentXPdu>; 00061 #endif 00062 00063 class AGENTXPP_DECL AgentXQueue: public Synchronized { 00064 00065 public: 00066 00070 AgentXQueue(); 00071 00075 virtual ~AgentXQueue(); 00076 00086 virtual u_int add(AgentXPdu*); 00087 00098 virtual time_t timeout(time_t); 00099 00110 virtual AgentXPdu* get_late(time_t); 00111 00122 virtual boolean remove(AgentXPdu*); 00123 00131 virtual void cancel(u_int); 00132 00143 virtual boolean pending(u_int); 00144 00161 virtual AgentXPdu* find(u_int, unsigned long, boolean pending=FALSE); 00162 00173 virtual AgentXPdu* find(u_int); 00174 00182 OrderedListCursor<AgentXPdu> elements(); 00183 00190 static u_int create_packet_id(); 00191 00192 protected: 00193 static u_int pid; 00194 00195 00196 OrderedList<AgentXPdu> queue; 00197 }; 00198 #ifdef AGENTPP_NAMESPACE 00199 } 00200 #endif 00201 00202 00203 #endif