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

DataObj.h

Go to the documentation of this file.
00001 //------------------------------------------------------------------------
00002 //
00003 //   Joe Kniss
00004 //     6-20-03
00005 //                   ________    ____   ___ 
00006 //                  |        \  /    | /  /
00007 //                  +---+     \/     |/  /
00008 //                  +--+|  |\    /|     < 
00009 //                  |  ||  | \  / |  |\  \ 
00010 //                  |      |  \/  |  | \  \ 
00011 //                   \_____|      |__|  \__\
00012 //                       Copyright  2003 
00013 //                      Joe Michael Kniss
00014 //                   <<< jmk@cs.utah.edu >>>
00015 //               "All Your Base are Belong to Us"
00016 //-------------------------------------------------------------------------
00017 
00018 
00019 /// DataObj.h
00020 ///  core Simian
00021 
00022 #ifndef __SIMIAN_DATA_OBJECT_DOT_H
00023 #define __SIMIAN_DATA_OBJECT_DOT_H
00024 
00025 #include "simCore.h"
00026 
00027 #include <smartptr.h>
00028 #include <simBase/simBase.h>
00029 #include <arrayGutz.h>
00030 
00031 //////////////////////////////////////////////////////////////////////////
00032 /// forward decls
00033 //////////////////////////////////////////////////////////////////////////
00034 class SourceObjIF;
00035 class SimModObjIF;
00036 
00037 //////////////////////////////////////////////////////////////////////////
00038 /// Data Object Interface
00039 ///   This members of this object are all used in the pipeline 
00040 ///   framework, and are not something a developer or user should 
00041 ///   care about.  New DataObj types should sub class from DataObj.
00042 //////////////////////////////////////////////////////////////////////////
00043 class DataObjIF : public SimCore, public gutz::Counted {
00044 public:
00045    virtual ~DataObjIF() {}
00046 
00047    ////////////////////////////////////////////////////////////////
00048    ///@name Framework interface, NOT FOR GENERAL USE
00049    ///   users can ignore these
00050    ///@{
00051 
00052    ///////////////////////////////////////////////
00053    /// Update Interface, propigates down the chain
00054    virtual void update_() = 0;
00055 
00056    ///////////////////////////////////////////////
00057    /// Request Interface, propigates down the chain
00058    virtual bool request_() = 0;
00059    
00060    ///////////////////////////////////////////////
00061    /// Source interface
00062    virtual void setSource(gutz::SmartPtr<SourceObjIF> src) = 0;
00063 
00064    ///@}
00065    ////////////////////////////////////////////////////////////////
00066 
00067    ///////////////////////////////////////////////
00068    ///@name Consumer interface, Framework, NOT FOR GENERAL USE
00069    ///@{
00070    virtual void                   addConsumer(gutz::SmartPtr<SimModObjIF> smo) = 0;
00071    virtual void                   delConsumer(gutz::SmartPtr<SimModObjIF> smo) = 0;
00072    virtual gutz::SmartPtr<SimModObjIF>  
00073                                   getConsumer(unsigned int i) = 0;
00074    virtual bool                   isConsumer(const gutz::SmartPtr<SimModObjIF>  smo) const = 0;
00075    ///@}
00076    ///////////////////////////////////////////////
00077 
00078 
00079 protected:
00080    DataObjIF() : SimCore(), Counted() {};
00081 
00082 };
00083 
00084 typedef gutz::SmartPtr<DataObjIF> DataObjSP;
00085 typedef gutz::arrayOwn1<DataObjSP> DataObjSPArro;
00086 typedef gutz::arrayWrap1<DataObjSP> DataObjSPArrw;
00087 
00088 //////////////////////////////////////////////////////////////////////////
00089 /// Data Object Base class
00090 //////////////////////////////////////////////////////////////////////////
00091 class DataObj : public DataObjIF {
00092 public:
00093    virtual ~DataObj();
00094 
00095    ///////////////////////////////////////////////
00096    /// Update Interface, propigates down the chain
00097    virtual void update_();
00098 
00099    ///////////////////////////////////////////////
00100    /// Request Interface, propigates down the chain
00101    virtual bool request_();
00102 
00103    ///////////////////////////////////////////////
00104    /// Source interface
00105    virtual void setSource(gutz::SmartPtr<SourceObjIF> source);
00106 
00107    ///////////////////////////////////////////////
00108    /// Consumer interface
00109    void         addConsumer(gutz::SmartPtr<SimModObjIF> smo);
00110    void         delConsumer(gutz::SmartPtr<SimModObjIF> smo);
00111    gutz::SmartPtr<SimModObjIF>  
00112                 getConsumer(unsigned int i);
00113    bool         isConsumer(const gutz::SmartPtr<SimModObjIF>  smo) const;
00114 
00115    ///////////////////////////////////////////////
00116    /// Framework interfaces, NOT FOR GENERAL USE, 
00117    ///  ... ignore these
00118    virtual void setForwardModified();
00119 
00120 protected:
00121    DataObj();
00122 
00123    /// Updates
00124    void updateConsumers();
00125 
00126    /// who generated it?
00127    gutz::SmartPtr<SourceObjIF>  _source;
00128 
00129    /// who gets it?
00130    gutz::SmartPtr<SimModObjIF> *_consumers;
00131    int                          _nConsumers;
00132    bool                         _noForward; // don't forward update
00133 
00134    
00135 };
00136 
00137 
00138 #endif
00139 

Send questions, comments, and bug reports to:
jmk