AbstractServerAction.h

Go to the documentation of this file.
00001 // Copyright CERN 2012 - Developed in collaboration with GSI
00002 
00003 #ifndef ABSTRACT_SERVER_ACTION_H_
00004 #define ABSTRACT_SERVER_ACTION_H_
00005 
00006 #include <fesa-core/Core/FesaDefs.h>
00007 #include <fesa-core/Core/AbstractMsgQueue.h>
00008 #include <fesa-core/Core/OnDemandProducer.h>
00009 #include <fesa-core/Core/AbstractAction.h>
00010 
00011 #include <cmw-rda/Data.h>
00012 
00013 #include <vector>
00014 #include <string>
00015 #include <map>
00016 
00017 class rdaData;
00018 
00019 namespace fesa
00020 {
00021 
00022 class MultiplexingContext;
00023 class AbstractServiceLocator;
00024 class RequestEvent;
00025 class AbstractDevice;
00026 class FesaStream;
00027 class Mutex;
00028 class NotificationProducer;
00029 
00035 struct ServerActionConfig
00036 {
00037                 //name of the FESA-class, to which this server-action belongs
00038                 std::string className_;
00039 
00044                 std::string name_;
00045 
00050                 std::vector<std::string> notifiedPropertiesCol_;
00051 
00052                 std::vector<std::string> disablingFieldNamesCol_;
00053 
00054                 std::vector<std::string> disablingGlobalFieldNamesCol_;
00055 
00056                 bool partialSetIsAllowed_;
00057 
00062                 bool needFilter_;
00063 
00068                 bool autoNotification_;
00069 
00070                 bool transactionalSetIsAllowed_;
00071 
00072                 bool defaultImpl_;
00073 };
00074 
00081 class AbstractServerAction : public AbstractAction
00082 {
00083         public:
00084 
00088                 AbstractServerAction(ServerActionConfig& actionConfig, const AbstractServiceLocator* serviceLocator, const std::map<std::string, const AbstractServiceLocator*> serviceLocatorRelatedClasses);
00089 
00090                 virtual ~AbstractServerAction();
00091 
00101                 // Either we can use this (change Property.cpp) or remove the default value from here.
00102                 // Looking at the use we do of reqType, it seems is redundant with the use of ioType, we could use only ioType?
00103                 virtual void execute(RequestEvent* evt, AbstractDevice& dev, const rdaData& filter, rdaData& data,
00104                          IOType ioType, RequestType reqType) = 0;
00105 
00109                 virtual bool needFilter();
00110 
00116                 virtual void performCommit(MultiplexingContext& transactionCtxt,
00117                                                 AbstractDevice *transactionDevice) = 0;
00118 
00124                 virtual void performRollback(MultiplexingContext& transactionCtxt,
00125                                                 AbstractDevice* transactionDevice) = 0;
00126 
00127     const std::string& getName();
00128 
00133                 virtual void printConfig(FesaStream* configStream);
00134 
00140                 virtual void printState(FesaStream* fesaStream, double elapsedTime);
00141 
00142 
00143                 static void releaseStaticObjects();
00144 
00145         protected:
00146 
00147                 std::vector<std::string> notifiedPropertiesCol_;
00148 
00149                 std::vector<std::string> disablingFieldNamesCol_;
00150 
00151                 std::vector<std::string> disablingGlobalFieldNamesCol_;
00152 
00156                 bool partialSetIsAllowed_;
00157 
00161                 bool needFilter_;
00162 
00163                 bool autoNotification_;
00164 
00165                 bool transactionalSetIsAllowed_;
00166 
00170                 bool defaultImpl_;
00171 
00176                 AbstractDevice* pGlobalDevice_;
00177 
00181                 NotificationProducer* theNotificationProducer_;
00182 
00188                 void checkInvalidatingFields(AbstractDevice* device, MultiplexingContext* ctx);
00189 
00195                 void notify(MultiplexingContext& transactionCtxt, AbstractDevice& device,
00196                                                 RequestType reqType = GET);
00197 };
00198 
00199 inline const std::string& AbstractServerAction::getName()
00200 {
00201     return name_;
00202 }
00203 
00204 }
00205 
00206 #endif /* ABSTRACTSERVERACTION_H_ */

Generated on 18 Jan 2013 for Fesa by  doxygen 1.6.1