ClassElement.h
Go to the documentation of this file.00001
00002 #ifndef CLASSELEMENT_H_
00003 #define CLASSELEMENT_H_
00004
00005 #include <boost/shared_ptr.hpp>
00006 #include <boost/enable_shared_from_this.hpp>
00007 #include <vector>
00008 #include <string>
00009 #include <map>
00010
00011 namespace fesa
00012 {
00013
00014 class AbstractDeviceClass;
00015 class ElementXML;
00016 class ParserElementFactory;
00017 class EventConfigurationElement;
00018 class LogicalEventElement;
00019 class DeviceElement2;
00020 class EventElement;
00021
00022 typedef std::string LogicalEventName;
00023 typedef boost::shared_ptr<EventElement> EventElementPointer;
00024 typedef std::map<LogicalEventName, std::vector< EventElementPointer > > EventMap;
00025
00029 class ClassElement: public boost::enable_shared_from_this<ClassElement>
00030 {
00031 public:
00032
00036 ClassElement(AbstractDeviceClass* classRef);
00037
00038 virtual ~ClassElement();
00039
00043 virtual void initialize(const std::string& xpath,ElementXML* classElement, ParserElementFactory& parserElementFactory);
00044
00048 virtual boost::shared_ptr<EventConfigurationElement> getEventConfigurationElementRef(const std::string& logicalEventName,const std::string& eventConfigurationName) const;
00049
00050 virtual const std::vector<boost::shared_ptr<LogicalEventElement> >& getLogicalElementCol() const;
00051
00052 virtual AbstractDeviceClass* getClassRef() const;
00053
00054 virtual const std::string& getClassName() const;
00055
00059 virtual const EventMap& getActiveEventMap() const;
00060
00064 virtual std::vector< EventElementPointer > getActiveEvents(const std::string& logicalEventName) const;
00065
00066 protected:
00067
00071 ClassElement();
00072
00073 private:
00074
00078 void loadEventsMappingElement(const std::string& xpath,ElementXML* classElement, ParserElementFactory& parserElementFactory);
00079
00083 void loadLogicalEventElements(const std::string& xpath,ElementXML* eventsMappingElement, ParserElementFactory& parserElementFactory);
00084
00088 void loadDeviceElements(const std::string& xpath,ElementXML* classElement, ParserElementFactory& parserElementFactory);
00089
00093 void connectEventConfigRefs();
00094
00098 void fillActiveEventMap();
00099
00103 std::vector<boost::shared_ptr<LogicalEventElement> > logicalEventElementCol_;
00104
00108 std::vector<boost::shared_ptr<DeviceElement2> > deviceElementCol_;
00109
00110
00111 EventMap activeEventMap_;
00112
00116 AbstractDeviceClass* classRef_;
00117
00121 bool isInitialized_;
00122
00126 bool eventConfigRefsConnected_;
00127 };
00128
00129 }
00130
00131 #endif