Back to index

salome-gui  6.5.0
DataProcessor.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 // Author: Guillaume Boulant (EDF/R&D)
00021 
00022 #ifndef _DATAPROCESSOR_H_
00023 #define _DATAPROCESSOR_H_
00024 
00025 #include "TreeData.hxx"
00026 
00027 #include "DataModel.hxx"
00028 #include "DataObject.hxx"
00029 #include <QStringList>
00030 #include <QString>
00031 
00032 #include <vector>
00033 typedef std::vector<DataObject *> DataObjectVector;
00034 
00035 //
00036 // =================================================================
00037 // This class can be used to automize processing on data objects.
00038 // The inputs of public functions are list of selected items in the
00039 // tree view. The function automize the extraction of associated
00040 // DataObject and can automize the processing of these object if the
00041 // virtual function processDataObject is implemented.
00042 // =================================================================
00043 //
00044 
00045 class TREEDATA_EXPORT DataProcessor {
00046 
00047 public:
00048   DataProcessor(DataModel * dataModel);
00049 
00050   DataObjectVector * extract(QStringList itemNameIdList);
00051   void               process(QStringList itemNameIdList);
00052 
00053   
00054 protected:
00055   virtual void preprocess(QStringList itemNameIdList) {
00056       // Implement something to be executed at the begining of the process function
00057   };
00058   virtual void postprocess(QStringList itemNameIdList) {
00059       // Implement something to be executed at the end of the process function
00060   };
00061   // Implement what must be done with each DataObject during the process function
00062   virtual void processDataObject(DataObject * dataObject) = 0;
00063 
00064 private:
00065   DataModel * _dataModel;
00066 };
00067 
00068 #endif