aGrUM  0.14.2
scheduleOperation.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Pierre-Henri WUILLEMIN et Christophe GONZALES *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
25 #ifndef GUM_SCHEDULE_OPERATION_H
26 #define GUM_SCHEDULE_OPERATION_H
27 
28 #include <string>
29 #include <utility>
30 
31 #include <agrum/agrum.h>
32 
33 #include <agrum/core/sequence.h>
35 
36 namespace gum {
37 
38  template < typename GUM_SCALAR >
40  public:
42  enum class Type : char {
53  };
54 
55  // ############################################################################
57  // ############################################################################
59 
61  virtual ScheduleOperation< GUM_SCALAR >* newFactory() const = 0;
62 
64  virtual ~ScheduleOperation();
65 
67 
68  // ############################################################################
70  // ############################################################################
72 
74 
76  virtual bool operator==(const ScheduleOperation< GUM_SCALAR >&) const = 0;
77 
79 
81  virtual bool operator!=(const ScheduleOperation< GUM_SCALAR >&) const = 0;
82 
84 
85  // ############################################################################
87  // ############################################################################
89 
91  Type type() const;
92 
94  Idx id() const;
95 
98  multiDimArgs() const = 0;
99 
102  multiDimResults() const = 0;
103 
105  virtual void execute() = 0;
106 
109  virtual float nbOperations() const = 0;
110 
112 
120  virtual std::pair< long, long > memoryUsage() const = 0;
121 
123  virtual std::string toString() const = 0;
124 
126 
127  protected:
129  explicit ScheduleOperation(Type t);
130 
133 
137 
138  private:
141 
144 
146  static Idx __newId();
147  };
148 
149 } /* namespace gum */
150 
151 // always include the template implementation
153 
154 #endif /* GUM_SCHEDULE_OPERATION_H */
virtual const Sequence< const ScheduleMultiDim< GUM_SCALAR > *> & multiDimResults() const =0
returns the set of multidims that should be the result of the operation
project a ScheduleMultiDim over a subset of its variables
virtual float nbOperations() const =0
returns an estimation of the number of elementary operations needed to perform the ScheduleOperation ...
Type type() const
returns the name of the operation
a MultiDimImplementation Wrapper used for scheduling inferences
Header file of gum::Sequence, a class for storing (ordered) sequences of objects. ...
Idx __id
the id corresponding to the operation
The generic class for storing (ordered) sequences of objects.
Definition: sequence.h:1019
Type __type
the name of the operation to perform
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
virtual const Sequence< const ScheduleMultiDim< GUM_SCALAR > *> & multiDimArgs() const =0
returns the set of multidims passed in argument to the operation
virtual bool operator!=(const ScheduleOperation< GUM_SCALAR > &) const =0
operator !=
Idx id() const
returns the id of the operation
virtual bool operator==(const ScheduleOperation< GUM_SCALAR > &) const =0
operator ==
virtual void execute()=0
executes the operation
Type
the currently supported types of operations
static Idx __newId()
returns a new distinct ID for each operation
ScheduleOperation(Type t)
default constructor
virtual std::string toString() const =0
displays the content of the operation
virtual ~ScheduleOperation()
destructor
ScheduleOperation< GUM_SCALAR > & operator=(const ScheduleOperation< GUM_SCALAR > &)
copy operator
Size Idx
Type for indexes.
Definition: types.h:50
virtual ScheduleOperation< GUM_SCALAR > * newFactory() const =0
virtual copy constructor: creates a clone of the operation
virtual std::pair< long, long > memoryUsage() const =0
returns the memory consumption used during the operation
delete a MultiDim from memory