"Fossies" - the Fresh Open Source Software Archive

Member "fimex-1.4.2/src/metgm/MetGmCDMVariableProfile.h" (6 Jan 2020, 3173 Bytes) of package /linux/privat/fimex-1.4.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "MetGmCDMVariableProfile.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.4.1_vs_1.4.2.

    1 /*
    2  * Fimex
    3  *
    4  * (C) Copyright 2011-2019, met.no
    5  *
    6  * Project Info:  https://wiki.met.no/fimex/start
    7  *
    8  * This library is free software; you can redistribute it and/or modify it
    9  * under the terms of the GNU Lesser General Public License as published by
   10  * the Free Software Foundation; either version 2.1 of the License, or
   11  * (at your option) any later version.
   12  *
   13  * This library is distributed in the hope that it will be useful, but
   14  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   15  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
   16  * License for more details.
   17  *
   18  * You should have received a copy of the GNU Lesser General Public
   19  * License along with this library; if not, write to the Free Software
   20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
   21  * USA.
   22  */
   23 
   24 /**
   25   * Used as private/implementation class
   26   */
   27 
   28 #ifndef METGM_CDMVARIABLEPROFILE_H
   29 #define METGM_CDMVARIABLEPROFILE_H
   30 
   31 // internals
   32 //
   33 #include "MetGmTags.h"
   34 #include "MetGmDimensionsTag.h"
   35 
   36 //fimex
   37 //
   38 #include "fimex/CDMVariable.h"
   39 
   40 // standard
   41 //
   42 #include <memory>
   43 #include <set>
   44 #include <string>
   45 #include <vector>
   46 
   47 namespace MetNoFimex {
   48 
   49     struct MetGmCDMVariableProfile {
   50 
   51         MetGmCDMVariableProfile(short pid, const std::string& cdmName, std::shared_ptr<MetGmTags> tags)
   52             : p_id_(pid)
   53             , cdmName_(cdmName)
   54             , pTags_(tags)
   55         {
   56         }
   57 
   58         bool operator<(const MetGmCDMVariableProfile& profile) const {return cdmName_ < profile.cdmName_;}
   59 
   60         short hd() const { return pTags_->hd(); }
   61 
   62         short                         p_id_;
   63         std::string                   cdmName_;
   64         std::string                   standardName_;
   65         std::string                   units_;
   66         std::string                   zDimensionName_;
   67         std::string                   addOffset_;
   68         std::string                   scaleFactor_;
   69         std::string                   fillValue_;
   70         std::shared_ptr<MetGmTags> pTags_;
   71     };
   72 
   73     typedef std::vector<MetGmCDMVariableProfile> cdm_configuration;
   74 
   75     struct MetGmCDMVariableProfileByPId
   76     {
   77         bool operator()(const MetGmCDMVariableProfile& a, const MetGmCDMVariableProfile& b) const { return a.p_id_ < b.p_id_; }
   78         bool operator()(cdm_configuration::const_iterator a, cdm_configuration::const_iterator b) const { return this->operator()(*a, *b); }
   79     };
   80 
   81     struct MetGmCDMVariableProfileEqPId
   82     {
   83         short p_id_;
   84         MetGmCDMVariableProfileEqPId(short p_id)
   85             : p_id_(p_id)
   86         {
   87         }
   88         bool operator()(const MetGmCDMVariableProfile& a) const { return a.p_id_ == p_id_; }
   89     };
   90 
   91     struct MetGmCDMVariableProfileEqName
   92     {
   93         const std::string& cdmName_;
   94         MetGmCDMVariableProfileEqName(const std::string& cdmName)
   95             : cdmName_(cdmName)
   96         {
   97         }
   98         bool operator()(const MetGmCDMVariableProfile& a) const { return a.cdmName_ == cdmName_; }
   99     };
  100 
  101     std::vector<cdm_configuration::iterator> sorted_by_pid(cdm_configuration& xc);
  102 
  103     } // namespace MetNoFimex
  104 
  105 #endif // METGM_CDMVARIABLEPROFILE_H