00001 /* 00002 Copyright 2007, 2008, 2009, 2010, 2011 Instituto de Sistemas e Robotica, Instituto Superior Tecnico 00003 00004 This file is part of MeRMaID. 00005 00006 MeRMaID is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU Lesser General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 MeRMaID is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU Lesser General Public License for more details. 00015 00016 You should have received a copy of the GNU Lesser General Public License 00017 along with MeRMaID. If not, see <http://www.gnu.org/licenses/>. 00018 */ 00019 00020 00021 00022 /** 00023 * @Filename ActiveObjectAce.hpp 00024 * @Description ActiveObjectAce declaration 00025 * @Status Work in Progress 00026 * @Version $Id: ActiveObjectAce.hpp 1 2011-03-04 18:13:18Z jreis $ 00027 * @Maintainer nmsra (nmsra@mega.ist.utl.pt) 00028 */ 00029 00030 00031 #ifndef __ACTIVEOBJECT_ACTIVEOBJECTACE_H 00032 #define __ACTIVEOBJECT_ACTIVEOBJECTACE_H 00033 00034 #include "ActiveObject.hpp" 00035 #include "ActiveObjectAceAddTaskMethod.hpp" 00036 00037 00038 //ACE stuff 00039 #include <ace/Activation_Queue.h> 00040 #include "ace/Task.h" 00041 00042 00043 namespace mermaid 00044 { 00045 namespace support 00046 { 00047 namespace activeobject 00048 { 00049 00050 /** 00051 * @Class ActiveObjectAce ActiveObjectAce.hpp "ActiveObjectAce.hpp" 00052 * @Description ActiveObjectAce interface 00053 * @Author Marco Barbosa + Nelson Ramos 00054 */ 00055 class ActiveObjectAce : public ActiveObject, public ACE_Task<ACE_MT_SYNCH> 00056 { 00057 00058 friend class ActiveObjectAceAddTaskMethod; 00059 friend class ActiveObjectAceRunTaskMethod; 00060 00061 public: 00062 ActiveObjectAce (ActiveObjectManager * aom); 00063 00064 virtual ~ActiveObjectAce(); 00065 00066 /** 00067 * this method start the active object. 00068 * @Author Marco Barbosa + Nelson Ramos 00069 */ 00070 void start(); 00071 00072 /** 00073 * this method stop the active object. 00074 * @Author Marco Barbosa + Nelson Ramos 00075 */ 00076 void stop(); 00077 00078 //mermaid internal stuff 00079 00080 virtual void addTask (shared_ptr<Task> t); 00081 00082 virtual void addTaskInternal (shared_ptr<Task> t); 00083 00084 00085 protected: 00086 00087 //mermaid internal stuff implementation 00088 00089 virtual void addTaskImplementation (shared_ptr<Task> t); 00090 //virtual void runTaskImplementation(shared_ptr<Task> t); 00091 00092 00093 private: 00094 00095 //activation queue 00096 ACE_Activation_Queue activationQueue_; 00097 00098 00099 //ACE stuff 00100 00101 /** 00102 * this method is that one that runs when the task is activated. 00103 * @Author Marco Barbosa + Nelson Ramos 00104 */ 00105 int svc (void); 00106 00107 }; // ActiveObject 00108 } // namespace activeobject 00109 } // namespace support 00110 } // namespace mermaid 00111 00112 #endif // __ACTIVEOBJECT_ACTIVEOBJECTACE_H