ActiveObjectManagerAce.hpp

Go to the documentation of this file.
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 ActiveObjectManagerAce.hpp
00024  * @Description ActiveObjectManagerAce declaration
00025  * @Status Work in Progress
00026  * @Version $Id: ActiveObjectManagerAce.hpp 1 2011-03-04 18:13:18Z jreis $
00027  * @Maintainer
00028  */
00029 
00030 
00031 #ifndef __ACTIVEOBJECT_ACTIVEOBJECTMANAGERACE_H
00032 #define __ACTIVEOBJECT_ACTIVEOBJECTMANAGERACE_H
00033 
00034 #include <ActiveObjectManager.hpp>
00035 
00036 #include <ace/Mutex.h>
00037 #include <ace/Semaphore.h>
00038 
00039 namespace mermaid
00040 {
00041   namespace support
00042   {
00043     namespace activeobject
00044     {
00045     
00046       /**
00047       * @Class ActiveObjectManagerAce ActiveObjectManagerAce.hpp "ActiveObjectManagerAce.hpp"
00048       * @Description ActiveObject manager for ACE-based systems
00049       * @Author Marco Barbosa
00050       */
00051       class ActiveObjectManagerAce : public ActiveObjectManager
00052       {
00053         public:
00054         
00055           virtual ~ActiveObjectManagerAce();
00056           
00057           /**
00058           * @Description Gets the current instance of ActiveObjectManager
00059           * This method doesn't support concurrent access.
00060           * Concurrent access may result in erroneous behavior.
00061           * @Returns Current instance.
00062           * @Author Marco Barbosa
00063           */
00064           static shared_ptr<ActiveObjectManagerAce> getInstance();
00065           
00066           virtual shared_ptr<ActiveObject> createActiveObject();
00067           
00068           virtual void addActiveObject (shared_ptr<ActiveObject> ao);
00069           
00070           virtual void notifyActiveObjectStateChange (ActiveObject * ao, ActiveObjectState previousState);
00071           
00072           void waitForActiveObjectsToStop();
00073           
00074           virtual void stopAllActiveObjects();
00075           
00076         private:
00077         
00078           ActiveObjectManagerAce();
00079           
00080           static shared_ptr<ActiveObjectManagerAce> instance_;
00081           
00082           virtual vector<shared_ptr<ActiveObject> > getActiveObjectVector();
00083           
00084           virtual set<shared_ptr<ActiveObject> > getActiveObjectStateSet (ActiveObjectState s);
00085           
00086           ACE_Mutex internalDataMutex_;
00087           
00088           shared_ptr<ACE_Semaphore> waitForTerminateSemaphore_;
00089           
00090           
00091       }; // class ActiveObjectManagerAce
00092       
00093     } // namespace activeobject
00094   } // namespace support
00095 } // namespace mermaid
00096 
00097 #endif // __ACTIVEOBJECT_ACTIVEOBJECTMANAGERACE_H
Generated on Fri Mar 4 22:14:58 2011 for MeRMaID::support by  doxygen 1.6.3