Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

BeanDeliverySubjectImpl.h

Go to the documentation of this file.
00001 /***************** <Tweek heading BEGIN do not edit this line> ****************
00002  * Tweek
00003  *
00004  * -----------------------------------------------------------------
00005  * File:          $RCSfile: BeanDeliverySubjectImpl.h,v $
00006  * Date modified: $Date: 2003/08/03 00:08:28 $
00007  * Version:       $Revision: 1.7 $
00008  * -----------------------------------------------------------------
00009  ***************** <Tweek heading END do not edit this line> *****************/
00010 
00011 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
00012  *
00013  * VR Juggler is (C) Copyright 1998-2003 by Iowa State University
00014  *
00015  * Original Authors:
00016  *   Allen Bierbaum, Christopher Just,
00017  *   Patrick Hartling, Kevin Meinert,
00018  *   Carolina Cruz-Neira, Albert Baker
00019  *
00020  * This library is free software; you can redistribute it and/or
00021  * modify it under the terms of the GNU Library General Public
00022  * License as published by the Free Software Foundation; either
00023  * version 2 of the License, or (at your option) any later version.
00024  *
00025  * This library is distributed in the hope that it will be useful,
00026  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00027  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00028  * Library General Public License for more details.
00029  *
00030  * You should have received a copy of the GNU Library General Public
00031  * License along with this library; if not, write to the
00032  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00033  * Boston, MA 02111-1307, USA.
00034  *
00035  *************** <auto-copyright.pl END do not edit this line> ***************/
00036 
00037 #ifndef _TWEEK_BEAN_DELIVERY_SUBJECT_IMPL_H_
00038 #define _TWEEK_BEAN_DELIVERY_SUBJECT_IMPL_H_
00039 
00040 #include <tweek/tweekConfig.h>
00041 
00042 #include <map>
00043 #include <vector>
00044 #include <string>
00045 
00046 #include <vpr/vpr.h>
00047 #include <vpr/Sync/Mutex.h>
00048 #include <vpr/Sync/Guard.h>
00049 
00050 #include <tweek/CORBA/SubjectImpl.h>
00051 #include <tweek/CORBA/BeanDeliverySubject.h>
00052 
00053 
00054 namespace tweek
00055 {
00056 
00066 class BeanDeliverySubjectImpl : public POA_tweek::BeanDeliverySubject,
00067                                 public tweek::SubjectImpl
00068 {
00069 public:
00075    struct BeanData
00076    {
00078       std::string filename;
00079 
00084       std::string introspectorClassName;
00085 
00087       std::vector<CORBA::Octet> fileContents;
00088    };
00089 
00093    BeanDeliverySubjectImpl() : mHasActiveBean(false)
00094    {
00095       ;
00096    }
00097 
00101    virtual ~BeanDeliverySubjectImpl()
00102    {
00103       ;
00104    }
00105 
00112    virtual BeanNameList* getAllBeanNames();
00113 
00128    virtual BeanInfo* getBean(const char* beanName);
00129 
00135    virtual CORBA::Boolean hasActiveBean()
00136    {
00137       vpr::Guard<vpr::Mutex> lock(mActiveBeanLock);
00138       return mHasActiveBean;
00139    }
00140 
00148    virtual BeanInfo* getActiveBeanInfo();
00149 
00163    void addBean(const std::string& beanName, const BeanData& beanData);
00164 
00173    void setActiveBean(const std::string& beanName);
00174 
00186    void removeActiveBean();
00187 
00188    tweek::BeanDeliverySubject_ptr _this()
00189    {
00190       return POA_tweek::BeanDeliverySubject::_this();
00191    }
00192 
00193 private:
00194    // These two have to be here because Visual C++ will try to make them
00195    // exported public symbols.  This causes problems because copying
00196    // vpr::Mutex objects is not allowed.
00197    BeanDeliverySubjectImpl(const BeanDeliverySubjectImpl& subj);
00198 
00199    BeanDeliverySubjectImpl& operator=(const BeanDeliverySubjectImpl& subj)
00200    {
00201       return *this;
00202    }
00203 
00205    std::map<std::string, BeanData> mBeanCollection;
00206    vpr::Mutex mBeanCollectionLock;
00207 
00208    CORBA::Boolean mHasActiveBean;  
00209    std::string    mActiveBean;     
00210    vpr::Mutex     mActiveBeanLock;
00211 };
00212 
00213 } // End of tweek namespace
00214 
00215 
00216 #endif /* _TWEEK_BEAN_DELIVERY_SUBJECT_IMPL_H_ */

Generated on Sun May 2 14:41:03 2004 for Tweek by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002