ESyS-Particle  2.3
VectorPy.h
Go to the documentation of this file.
1 // //
3 // Copyright (c) 2003-2014 by The University of Queensland //
4 // Centre for Geoscience Computing //
5 // http://earth.uq.edu.au/centre-geoscience-computing //
6 // //
7 // Primary Business: Brisbane, Queensland, Australia //
8 // Licensed under the Open Software License version 3.0 //
9 // http://www.opensource.org/licenses/osl-3.0.php //
10 // //
12 
13 #ifndef ESYS_LSMVECTORPY_H
14 #define ESYS_LSMVECTORPY_H
15 
16 #include <boost/python.hpp>
17 #include <vector>
18 #include <iterator>
19 
20 namespace esys
21 {
22  namespace lsm
23  {
24  template <typename TmplElem>
25  class VectorPy : public std::vector<TmplElem>
26  {
27  public:
28  typedef std::vector<TmplElem> Inherited;
29  typedef typename Inherited::const_reference const_reference;
30  typedef typename Inherited::reference reference;
31 
32  class PickleSuite : public boost::python::pickle_suite
33  {
34  public:
35  static
36  boost::python::tuple
37  getinitargs(VectorPy const& v);
38  };
39 
40  VectorPy();
41 
42  VectorPy(const VectorPy &vec);
43 
44  VectorPy(const Inherited &vec);
45 
46  VectorPy(boost::python::object &iterable);
47 
48  void append(const_reference e);
49 
50  size_t getIndex(int i) const;
51 
52  reference getItem(int i);
53 
54  void setItem(int i, const_reference e);
55 
56  static boost::python::class_<VectorPy>
58  const std::string &pyClassName,
59  const std::string &pyClassDocString
60  );
61  };
62  }
63 }
64 
66 
67 #endif
size_t getIndex(int i) const
Definition: VectorPy.hpp:53
VectorPy()
Definition: VectorPy.hpp:21
Definition: VectorPy.h:25
void setItem(int i, const_reference e)
Definition: VectorPy.hpp:74
std::vector< TmplElem > Inherited
Definition: VectorPy.h:28
Definition: CheckPointable.cpp:16
Inherited::reference reference
Definition: VectorPy.h:30
Definition: VectorPy.h:32
static boost::python::tuple getinitargs(VectorPy const &v)
Definition: VectorPy.hpp:81
static boost::python::class_< VectorPy > exportVector(const std::string &pyClassName, const std::string &pyClassDocString)
Definition: VectorPy.hpp:88
void append(const_reference e)
Definition: VectorPy.hpp:47
Inherited::const_reference const_reference
Definition: VectorPy.h:29
reference getItem(int i)
Definition: VectorPy.hpp:68