AbstractField.h

Go to the documentation of this file.
00001 // Copyright CERN 2012 - Developed in collaboration with GSI
00002 
00003 #ifndef ABSTRACT_FIELD_H_
00004 #define ABSTRACT_FIELD_H_
00005 
00006 #include <fesa-core/Core/FesaDefs.h>
00007 
00008 #include <string>
00009 
00010 namespace fesa
00011 {
00012 
00013 class AbstractMultiplexingManager;
00014 class MultiplexingContext;
00015 class FieldElement;
00016 class DataStore;
00017 class FieldValueBase;
00018 
00023 class AbstractField
00024 {
00025 
00026     template<typename GlobalDeviceType, typename DomainStoreType,
00027              typename DevInstType> friend class DeviceFactoryImp;
00028     friend class StoreManager;
00029     friend class InitializeDataStoreManager;
00030 
00031   public:
00032 
00036     virtual ~AbstractField();
00037 
00041     AbstractMultiplexingManager* getMultiplexingManager();
00042 
00047     uint32_t getMuxDepth();
00048 
00052     bool isMultiplexed();
00053 
00057     const std::string& getName();
00058 
00062     FieldCategory getType();
00063 
00067     bool isMultiMux();
00068 
00072     bool isPersistent();
00073 
00074     //  /*!
00075     //   * \brief Changes the pendingChanged flag in the field value class at a given slot
00076     //   * \param changed (true or false)
00077     //   * \param slot
00078     //   */
00079     //  void setPendingChanged(bool changed, int slot);
00080 
00085     std::string getAsString(MultiplexingContext* context=NULL);
00086 
00087   protected:
00088 
00093     virtual void initialize(FieldElement& fieldElement);
00094 
00099     void setMultiplexingManager(AbstractMultiplexingManager* muxManager);
00100 
00104     void setDataIntegrity(DataIntegrity dataIntegrity);
00105 
00111     void restore(FieldElement& fieldElement);
00112 
00117     void store(FieldElement& fieldElement);
00118 
00126     AbstractField(const std::string& fieldName,
00127                   const FieldCategory fieldCategory, bool multiplexed,
00128                   bool multiMultipexed, bool persistent, DataIntegrity buffer,
00129                   DataStore* pDataStore);
00130 
00135     void commit(uint32_t slot);
00136 
00140     void resetToBeSync(uint32_t slot);
00141 
00147     void registerModifiedField(FieldValueBase* pFV, MultiplexingContext* context);
00148 
00149     uint32_t getSlot(MultiplexingContext* context);
00150 
00151     uint32_t requireSlot(MultiplexingContext* context);
00155     virtual FieldValueBase* getFieldValue(int32_t slot) = 0;
00156 
00157     /*
00158      * \return the value of the pending buffer as a string
00159      */
00160     virtual void getValueToStore(int32_t slot, std::string& str) = 0;
00161 
00166     virtual void setFieldValueAddress(char* pFV, bool initFieldsFlag) = 0;
00167 
00173     virtual void copyValue(uint32_t slot, std::string& val) = 0;
00174 
00180     virtual uint32_t getFieldValueSize() = 0;
00181 
00186     std::string name_;
00187 
00192     FieldCategory fieldCategory_;
00193 
00197     bool multiplexed_;
00198 
00203     AbstractMultiplexingManager* multiplexingManager_;
00204 
00209     DataStore* pDataStore_;
00210 
00215     bool isMultiMux_;
00216 
00221     bool isPersistent_;
00222 
00227     bool isShared_;
00228 
00233     void setMultiMuxFlag(bool flag);
00234 
00238     void setMultiplexed(bool multiplexed);
00239 
00243     uint32_t valueSize_;
00244 
00248     DataIntegrity buffer_;
00249 
00250     friend class DataStore;
00251 };
00252 
00253 } // fesa
00254 
00255 #endif // ABSTRACT_FIELD_H_

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1