Bayeux  3.4.1
Core Foundation library for SuperNEMO
i_occurrence.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date : 2014-05-11
4  * Last modified : 2014-08-10
5  *
6  * Copyright (C) 2014 Francois Mauger <mauger@lpccaen.in2p3.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or (at
11  * your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  *
23  * Description:
24  *
25  * Some utilities for the description of configuration variants and parameters.
26  *
27  */
28 
29 #ifndef DATATOOLS_CONFIGURATION_I_OCCURRENCE_H
30 #define DATATOOLS_CONFIGURATION_I_OCCURRENCE_H
31 
32 // Standard library:
33 #include <string>
34 #include <vector>
35 
36 // Third party:
37 // - Boost:
38 #include <boost/cstdint.hpp>
39 
40 namespace datatools {
41 
42  namespace configuration {
43 
44  // Forward declaration:
45  class single_occurrence;
46 
49  {
50  public:
51 
52  static const int INVALID_ID = -2;
53  static const int SINGLE_ID = -1;
54 
56  i_occurrence();
57 
59  virtual ~i_occurrence();
60 
62  virtual size_t get_dimension() const = 0;
63 
65  virtual size_t get_number_of_occurrences() const = 0;
66 
68  virtual void compute_occurrence(int rank_, single_occurrence & occ_) const = 0;
69 
71  bool is_multiple() const;
72 
75 
77  virtual size_t compute_index_path(std::vector<uint32_t> & path_, int rank_) const = 0;
78 
80  virtual std::string to_string() const = 0;
81 
82  };
83 
84  } // end of namespace configuration
85 
86 } // end of namespace datatools
87 
88 #endif // DATATOOLS_CONFIGURATION_I_OCCURRENCE_H
89 
90 // Local Variables: --
91 // mode: c++ --
92 // c-file-style: "gnu" --
93 // tab-width: 2 --
94 // End: --
bool is_multiple() const
Check if occurrence is multiple.
static const int INVALID_ID
Definition: i_occurrence.h:52
static const int SINGLE_ID
Definition: i_occurrence.h:53
virtual std::string to_string() const =0
Convert to a string.
virtual size_t get_number_of_occurrences() const =0
Return the number of occurrences.
virtual size_t compute_index_path(std::vector< uint32_t > &path_, int rank_) const =0
Compute a multidimensional index path from a rank.
virtual size_t get_dimension() const =0
Return the dimension.
Single occurrence for a physical parameter in a variant model.
Definition: single_occurrence.h:47
single_occurrence get_occurrence_by_rank(int rank_) const
Compute the occurrence associated to a given rank.
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
Abstract interface for all occurrence objects.
Definition: i_occurrence.h:48
virtual void compute_occurrence(int rank_, single_occurrence &occ_) const =0
Compute the occurrence associated to a given rank.