Back to index

salome-kernel  6.5.0
SALOMEDSImpl_AttributeTableOfReal.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SALOME SALOMEDSImpl : data structure of SALOME and sources of Salome data server 
00024 //  File   : SALOMEDSImpl_AttributeTableOfReal.hxx
00025 //  Author : Michael Ponikarov
00026 //  Module : SALOME
00027 //
00028 #ifndef _SALOMEDSImpl_AttributeTableOfReal_HeaderFile
00029 #define _SALOMEDSImpl_AttributeTableOfReal_HeaderFile
00030 
00031 #include "SALOMEDSImpl_Defines.hxx"
00032 #include "DF_Attribute.hxx"
00033 #include "DF_Label.hxx"      
00034 #include "SALOMEDSImpl_GenericAttribute.hxx"
00035 #include "SALOMEDSImpl_AttributeTable.hxx"
00036 
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040 
00041 class SALOMEDSIMPL_EXPORT SALOMEDSImpl_AttributeTableOfReal :
00042   public SALOMEDSImpl_GenericAttribute, public SALOMEDSImpl_AttributeTable
00043 {
00044 
00045 public:
00046   virtual std::string       Save();
00047   virtual void              Load(const std::string&); 
00048 
00049   static const std::string& GetID();
00050   static SALOMEDSImpl_AttributeTableOfReal* Set(const DF_Label& label);
00051 
00052   SALOMEDSImpl_AttributeTableOfReal();
00053 
00054   void                     SetNbColumns(const int theNbColumns);
00055   void                     SetTitle(const std::string& theTitle);
00056   std::string              GetTitle() const;
00057   void                     SetRowData(const int theRow, const std::vector<double>& theData);
00058   std::vector<double>      GetRowData(const int theRow);
00059   void                     SetRowTitle(const int theRow, const std::string& theTitle);
00060   void                     SetRowUnit(const int theRow, const std::string& theUnit);
00061   std::string              GetRowUnit(const int theRow) const;
00062   void                     SetRowUnits(const std::vector<std::string>& theUnits);
00063   std::vector<std::string> GetRowUnits();
00064   void                     SetRowTitles(const std::vector<std::string>& theTitles);
00065   std::vector<std::string> GetRowTitles();
00066   std::string              GetRowTitle(const int theRow) const;
00067   void                     SetColumnData(const int theColumn, const std::vector<double>& theData);
00068   std::vector<double>      GetColumnData(const int theColumn);
00069   void                     SetColumnTitle(const int theColumn, const std::string& theTitle);
00070   void                     SetColumnTitles(const std::vector<std::string>& theTitles);
00071   std::vector<std::string> GetColumnTitles();
00072   std::string              GetColumnTitle(const int theColumn) const;
00073   int                      GetNbRows() const;
00074   int                      GetNbColumns() const;
00075 
00076   void                     PutValue(const double& theValue, const int theRow, const int theColumn);
00077   bool                     HasValue(const int theRow, const int theColumn);
00078   double                   GetValue(const int theRow, const int theColumn);
00079   void                     RemoveValue(const int theRow, const int theColumn);
00080   const std::string&       ID() const;
00081   void                     Restore(DF_Attribute* with);
00082   DF_Attribute*            NewEmpty() const;
00083   void                     Paste(DF_Attribute* into);
00084 
00085   std::vector<int>         GetSetRowIndices(const int theRow);
00086   std::vector<int>         GetSetColumnIndices(const int theColumn);
00087 
00088   std::vector<int>         SortRow(const int theRow, SortOrder sortOrder, SortPolicy sortPolicy);
00089   std::vector<int>         SortColumn(const int theColumn, SortOrder sortOrder, SortPolicy sortPolicy);
00090   std::vector<int>         SortByRow(const int theRow, SortOrder sortOrder, SortPolicy sortPolicy);
00091   std::vector<int>         SortByColumn(const int theColumn, SortOrder sortOrder, SortPolicy sortPolicy);
00092 
00093   void                     SwapCells(const int theRow1, const int theColumn1, const int theRow2, const int theColumn2);
00094   void                     SwapRows(const int theRow1, const int theRow2);
00095   void                     SwapColumns(const int theColumn1, const int theColumn2);
00096 
00097   ~SALOMEDSImpl_AttributeTableOfReal() {}
00098 
00099 private: 
00100   std::map<int, double>    myTable;
00101   std::string              myTitle;
00102   std::vector<std::string> myRows;
00103   std::vector<std::string> myCols;
00104   int                      myNbRows;
00105   int                      myNbColumns;
00106 };
00107 
00108 #endif