NIREP

C:/Programs/source/NIREP/DisplayDescription/DisplayDescription.h

00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 #pragma once
00014 #ifndef _DISPLAY_DESCRIPTION_H_
00015 #define _DISPLAY_DESCRIPTION_H_
00016 
00017 /* +-----------+
00018 | Libraries |
00019 +-----------+ */
00020 #include <string>
00021 #include <vector>
00022 
00023 #include <iostream>
00024 #include <fstream>
00025 
00026 #include <wx/log.h>
00027 
00028 #include "./WidgetList/WidgetList.h"
00029 #include "./EvaluatorList/EvaluatorList.h"
00030 #include "./DisplayAttributes/DisplayAttributes.h"
00031 
00032 #include "ResourceDescriptionList/ResourceDescriptionList.h"
00033 
00034 
00035 /* +---------+
00036 | Classes |
00037 +---------+ */
00054 /* This combines the widget list and the evaluator list into a single entity */
00055 class DisplayDescription {
00056 public:
00057 
00060         DisplayDescription() {
00061                 variableList = new VariableList();
00062     da = new DisplayAttributes();
00063                 widgetList = new WidgetList(variableList,da);
00064                 evaluatorList = new EvaluatorList(variableList);
00065                 m_rdl = new ResourceDescriptionList();
00066         };
00067 
00070         DisplayDescription(const std::string& FileName) {
00071                 m_fileName = FileName;
00072                 variableList = new VariableList(m_fileName);
00073     da = new DisplayAttributes(FileName);
00074     widgetList = new WidgetList(FileName,variableList, da);
00075     
00076                 evaluatorList = new EvaluatorList(FileName,variableList);
00077                 //widgetList->SetVarList(variableList);
00078                 evaluatorList->SetVarList(variableList);
00079 
00080     // Load Resource Description List
00081     m_rdl = new ResourceDescriptionList();
00082     m_rdl->LoadFromDisplayDescription(FileName);
00083     
00084         };
00085 
00086   ~DisplayDescription() {
00087     if (widgetList){
00088       delete widgetList;
00089     }
00090     widgetList = NULL;
00091 
00092     if (evaluatorList){
00093       delete evaluatorList;
00094     }
00095     evaluatorList = NULL;
00096 
00097     if (variableList){
00098       delete variableList;
00099     }
00100     variableList = NULL;
00101 
00102     if (da){
00103       delete da;
00104     }
00105     da = NULL;
00106 
00107     if (m_rdl){
00108       delete m_rdl;
00109     }
00110     m_rdl = NULL;
00111   };
00112 
00115         int GetDisplayID() { return displayID; }
00116 
00119         EvaluatorList* GetEvaluatorList() { return evaluatorList; }
00120 
00123         WidgetList* GetWidgetList() { return widgetList; }
00124 
00127         VariableList* GetVariableList() { return variableList; }
00128 
00131         DisplayAttributes* GetDisplayAttributes() { return da; }
00132 
00135         int Validate();  //This checks that the widgetList and evaluatorList are consistent,
00136         //i.e. if the widgetList has a taskName and the evaluatorList does not
00137         //have that taskName, report an error code.
00138 
00141         int Read(std::string FileName);  //This calls evaluatorList and widgetList Read() to
00142         //read in the file and populate the lists.  This will also call Validate
00143         //to report any inconsistencies.
00144 
00145         std::string GetFileName(){return m_fileName;};
00146 
00147   // Extract the RDL filename from the display description file
00148   //std::string GetRDLFilename(std::string dataDescriptionFilename);
00149 
00150   ResourceDescriptionList * GetRDL(){ return m_rdl; }
00151   void SetRDL(ResourceDescriptionList * rdl){ m_rdl = rdl; }
00152 
00153 
00154 
00155 private:
00156         int displayID;
00157         WidgetList *widgetList;
00158         EvaluatorList *evaluatorList;
00159         VariableList *variableList;
00160   DisplayAttributes *da;
00161         std::string m_fileName;
00162   ResourceDescriptionList * m_rdl;  // Stores descriptions of namespaces, coordinate systems,
00163                                     // algorithms, spatial data and transformations.  Use this
00164                                     // to get data set filenames.
00165                                     // m_rdl should only be deleted by DispalyDescription.
00166 };
00167 
00168 #endif
 All Classes Functions Variables Typedefs Enumerations Enumerator