Bonmin 1.8.9
Loading...
Searching...
No Matches
BonTypes.hpp
Go to the documentation of this file.
1#ifndef __BonTypes_H_
2#define __BonTypes_H_
3#include<vector>
4#include "CoinSmartPtr.hpp"
5
6namespace Bonmin {
8template<typename T>
9class vector : public std::vector<T>{
10public:
12 vector(): std::vector<T>(){}
14 vector(size_t n, const T& v): std::vector<T>(n,v){}
16 vector(const vector<T>& other): std::vector<T>(other){}
18 vector(const std::vector<T>& other): std::vector<T>(other){}
20 vector(size_t n): std::vector<T>(n){}
23 std::vector<T>::operator=(other);
24 return (*this);}
26 vector<T>& operator=(const std::vector<T>& other){
27 return std::vector<T>::operator=(other);
28 return (*this);}
29
31inline T* operator()(){
32 return &(*std::vector<T>::begin());
33}
35inline const T* operator()() const {
36 return &(*std::vector<T>::begin());
37}
38};
39
40//structure to store an object of class X in a Coin::ReferencedObject
41template<class X>
45
46 const X& operator()() const{
47 return object;}
48
50 return object;}
51
52};
53//structure to store a pointer to an object of class X in a
54// Coin::ReferencedObject
55template<class X>
58 X * object;
59
62
65
66 const X& operator()() const{
67 return *object;}
68
70 return *object;}
71
72 const X* ptr() const{
73 return object;}
74
75 X* ptr(){
76 return object;}
77};
78
79template <class X>
82 ret_val->object = other;
83 return ret_val;
84}
85template <class X>
87 SimpleReferencedPtr <X> * ret_val = new SimpleReferencedPtr<X>;
88 ret_val->object = other;
89 return ret_val;
90}
91
92
93}
94#endif
95
A small wrap around std::vector to give easy access to array for interfacing with fortran code.
Definition BonTypes.hpp:9
T * operator()()
Access pointer to first element of storage.
Definition BonTypes.hpp:31
vector(size_t n, const T &v)
Constructor with initialization.
Definition BonTypes.hpp:14
vector()
Default constructor.
Definition BonTypes.hpp:12
vector(const vector< T > &other)
Copy constructor.
Definition BonTypes.hpp:16
vector< T > & operator=(const std::vector< T > &other)
Assignment.
Definition BonTypes.hpp:26
const T * operator()() const
Access pointer to first element of storage.
Definition BonTypes.hpp:35
vector(size_t n)
constructor with size.
Definition BonTypes.hpp:20
vector(const std::vector< T > &other)
Copy constructor.
Definition BonTypes.hpp:18
vector< T > & operator=(const vector< T > &other)
Assignment.
Definition BonTypes.hpp:22
(C) Copyright International Business Machines Corporation 2007
SimpleReferenced< X > * make_referenced(X other)
Definition BonTypes.hpp:80
const X * ptr() const
Definition BonTypes.hpp:72
const X & operator()() const
Definition BonTypes.hpp:66
const X & operator()() const
Definition BonTypes.hpp:46