ESyS-Particle  2.3.4
VectorPy.h
Go to the documentation of this file.
1 // //
3 // Copyright (c) 2003-2017 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.apache.org/licenses/LICENSE-2.0 //
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
esys::lsm::VectorPy
Definition: VectorPy.h:26
esys::lsm::VectorPy::const_reference
Inherited::const_reference const_reference
Definition: VectorPy.h:29
esys::lsm::VectorPy::Inherited
std::vector< TmplElem > Inherited
Definition: VectorPy.h:28
esys::lsm::VectorPy::setItem
void setItem(int i, const_reference e)
Definition: VectorPy.hpp:74
SetPy.h
esys
Definition: CheckPointable.cpp:17
esys::lsm::VectorPy::reference
Inherited::reference reference
Definition: VectorPy.h:30
esys::lsm::VectorPy::exportVector
static boost::python::class_< VectorPy > exportVector(const std::string &pyClassName, const std::string &pyClassDocString)
Definition: VectorPy.hpp:88
esys::lsm::VectorPy::VectorPy
VectorPy()
Definition: VectorPy.hpp:21
esys::lsm::VectorPy::append
void append(const_reference e)
Definition: VectorPy.hpp:47
esys::lsm::VectorPy::PickleSuite
Definition: VectorPy.h:33
esys::lsm::VectorPy::getItem
reference getItem(int i)
Definition: VectorPy.hpp:68
esys::lsm::VectorPy::PickleSuite::getinitargs
static boost::python::tuple getinitargs(VectorPy const &v)
Definition: VectorPy.hpp:81
esys::lsm::VectorPy::getIndex
size_t getIndex(int i) const
Definition: VectorPy.hpp:53
VectorPy.hpp