UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
VectorCallback.h
1 /***************************************************************************
2  * Copyright (C) 2014 by Jan Stückrath <jan.stueckrath@uni-due.de> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the *
16  * Free Software Foundation, Inc., *
17  * 51 Franklin St, Fifth Floor, Boston, MA 02110, USA *
18  ***************************************************************************/
19 
20 #ifndef VECTORCALLBACK_H_
21 #define VECTORCALLBACK_H_
22 
23 #include "CollectionCallback.h"
24 
25 namespace uncover {
26  namespace basic_types {
27 
33  template<typename E>
34  class VectorCallback : public CollectionCallback<E> {
35 
36  public:
37 
42  VectorCallback(vector<E>& vec) : vec(vec) {}
43 
47  virtual ~VectorCallback() {}
48 
52  virtual void insert(E element) override { vec.push_back(element); }
53 
54  private:
55 
59  vector<E>& vec;
60  };
61 
62  }
63 }
64 
65 #endif /* VECTORCALLBACK_H_ */
virtual void insert(E element) override
Adds an object to the vector encapsulated by the callback object.
Definition: VectorCallback.h:52
virtual ~VectorCallback()
Destroys this callback object.
Definition: VectorCallback.h:47
VectorCallback(vector< E > &vec)
Generates a new callback with the given vector reference.
Definition: VectorCallback.h:42
This template provides a possibility to add elements to a collection without having a reference to th...
Definition: CollectionCallback.h:34
This template class implements a CollectionCallback to a vector.
Definition: VectorCallback.h:34
vector< E > & vec
Stores a reference to a vector.
Definition: VectorCallback.h:59