Main Page
Namespaces
Classes
Files
File List
File Members
tmp
buildd
coinor-ipopt-3.10.2
Ipopt
contrib
MatlabInterface-Old
src
matlabscalar.h
Go to the documentation of this file.
1
// Copyright (C) 2007 Peter Carbonetto. All Rights Reserved.
2
// This code is published under the Eclipse Public License.
3
//
4
// Author: Peter Carbonetto
5
// Dept. of Computer Science
6
// University of British Columbia
7
// May 19, 2007
8
9
#ifndef INCLUDE_MATLABSCALAR
10
#define INCLUDE_MATLABSCALAR
11
12
#include "mex.h"
13
14
// Class MatlabScalar
15
// -----------------------------------------------------------------
16
// The main appeal of this class is that one can create a scalar
17
// object that accesses a MATLAB array.
18
//
19
// Note that the copy assignment operator is not valid for this class
20
// because we cannot reassign a reference.
21
class
MatlabScalar
{
22
public
:
23
24
// This constructor accepts as input a pointer to a Matlab array
25
// which must be a scalar in double precision.
26
explicit
MatlabScalar
(
const
mxArray* ptr);
27
28
// This constructor creates a new Matlab array which is a scalar
29
// in double precision.
30
MatlabScalar
(mxArray*& ptr,
double
value);
31
32
// The copy constructor.
33
MatlabScalar
(
MatlabScalar
& source);
34
35
// The destructor.
36
~MatlabScalar
() { };
37
38
// Access the value of the scalar.
39
operator
const
double ()
const
{
return
x
; };
40
41
// Assign the value of the scalar.
42
MatlabScalar
&
operator=
(
double
value);
43
44
protected
:
45
double
&
x
;
46
47
// The copy assignment operator is kept protected because it is
48
// invalid.
49
MatlabScalar
&
operator=
(
const
MatlabScalar
& source) {
return
*
this
; };
50
};
51
52
#endif
Generated on Tue Jun 26 2012 17:01:43 by
1.8.1.1