1 /* 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 3 * Copyright (C) 2011 - Igor GRIDCHYN 4 * Copyright (C) 2012 - Scilab Enterprises - Calixte DENIZET 5 * 6 * Copyright (C) 2012 - 2016 - Scilab Enterprises 7 * 8 * This file is hereby licensed under the terms of the GNU GPL v2.0, 9 * pursuant to article 5.3.4 of the CeCILL v.2.1. 10 * This file was originally licensed under the terms of the CeCILL v2.1, 11 * and continues to be available under such terms. 12 * For more information, see the COPYING file which you should have received 13 * along with this program. 14 * 15 */ 16 17 #ifndef __SCILABABSTRACTENVIRONEMNTWRAPPER_HXX__ 18 #define __SCILABABSTRACTENVIRONEMNTWRAPPER_HXX__ 19 20 #include "ScilabAbstractMemoryAllocator.hxx" 21 22 namespace org_modules_external_objects 23 { 24 class ScilabAbstractEnvironmentWrapper 25 { 26 27 public: 28 29 /** 30 * Wrap a double into an external object 31 * @param x the value to wrap 32 * @return an id corresponding to the object 33 */ 34 virtual int wrap(double * x, const bool isRef) const = 0; 35 36 /** 37 * Wrap a row of doubles into an external object 38 * @param x the values to wrap 39 * @param xSize the number of elements 40 * @return an id corresponding to the object 41 */ 42 virtual int wrap(double * x, int xSize, const bool isRef) const = 0; 43 44 /** 45 * Wrap a matrix of doubles into an external object 46 * @param x the values to wrap 47 * @param xSize the number of rows 48 * @param xSizeCol the number of cols 49 * @return an id corresponding to the object 50 */ 51 virtual int wrap(double * x, int xSize, int xSizeCol, const bool isRef) const = 0; 52 53 virtual int wrap(double * re, double * im, const bool isRef) const = 0; 54 55 virtual int wrap(double * re, double * im, int xSize, const bool isRef) const = 0; 56 57 virtual int wrap(double * re, double * im, int xSize, int xSizeCol, const bool isRef) const = 0; 58 59 virtual int wrap(char * x, const bool isRef) const = 0; 60 61 virtual int wrap(char * x, int xSize, const bool isRef) const = 0; 62 63 virtual int wrap(char * x, int xSize, int xSizeCol, const bool isRef) const = 0; 64 65 66 virtual int wrap(unsigned char * x, const bool isRef) const = 0; 67 68 virtual int wrap(unsigned char * x, int xSize, const bool isRef) const = 0; 69 70 virtual int wrap(unsigned char * x, int xSize, int xSizeCol, const bool isRef) const = 0; 71 72 73 virtual int wrap(short * x, const bool isRef) const = 0; 74 75 virtual int wrap(short * x, int xSize, const bool isRef) const = 0; 76 77 virtual int wrap(short * x, int xSize, int xSizeCol, const bool isRef) const = 0; 78 79 80 virtual int wrap(unsigned short * x, const bool isRef) const = 0; 81 82 virtual int wrap(unsigned short * x, int xSize, const bool isRef) const = 0; 83 84 virtual int wrap(unsigned short * x, int xSize, int xSizeCol, const bool isRef) const = 0; 85 86 87 virtual int wrap(int * x, const bool isRef) const = 0; 88 89 virtual int wrap(int * x, int xSize, const bool isRef) const = 0; 90 91 virtual int wrap(int * x, int xSize, int xSizeCol, const bool isRef) const = 0; 92 93 94 virtual int wrap(unsigned int * x, const bool isRef) const = 0; 95 96 virtual int wrap(unsigned int * x, int xSize, const bool isRef) const = 0; 97 98 virtual int wrap(unsigned int * x, int xSize, int xSizeCol, const bool isRef) const = 0; 99 100 #ifdef __SCILAB_INT64__ 101 102 virtual int wrap(long long * x, const bool isRef) const = 0; 103 104 virtual int wrap(long long * x, int xSize, const bool isRef) const = 0; 105 106 virtual int wrap(long long * x, int xSize, int xSizeCol, const bool isRef) const = 0; 107 108 virtual int wrap(unsigned long long * x, const bool isRef) const = 0; 109 110 virtual int wrap(unsigned long long * x, int xSize, const bool isRef) const = 0; 111 112 virtual int wrap(unsigned long long * x, int xSize, int xSizeCol, const bool isRef) const = 0; 113 114 #endif 115 116 virtual int wrap(char ** x, const bool isRef) const = 0; 117 118 virtual int wrap(char ** x, int xSize, const bool isRef) const = 0; 119 120 virtual int wrap(char ** x, int xSize, int xSizeCol, const bool isRef) const = 0; 121 122 123 virtual int wrapFloat(double * x, const bool isRef) const = 0; 124 125 virtual int wrapFloat(double * x, int xSize, const bool isRef) const = 0; 126 127 virtual int wrapFloat(double * x, int xSize, int xSizeCol, const bool isRef) const = 0; 128 129 130 virtual int wrapBool(int * x, const bool isRef) const = 0; 131 132 virtual int wrapBool(int * x, int xSize, const bool isRef) const = 0; 133 134 virtual int wrapBool(int * x, int xSize, int xSizeCol, const bool isRef) const = 0; 135 136 virtual int wrapList(int len, const int * const ids) const = 0; 137 138 virtual int wrapPoly(int len, const double * const coefs) const = 0; 139 140 /** 141 * Unwrap the external object with the given id into a double 142 * @param id the value to wrap 143 * @param pos the position in the Scilab stack where to put the result 144 */ 145 virtual void unwrapdouble(int id, const ScilabDoubleStackAllocator & allocator) const = 0; 146 147 virtual void unwraprowdouble(int id, const ScilabDoubleStackAllocator & allocator) const = 0; 148 149 virtual void unwrapmatdouble(int id, const ScilabDoubleStackAllocator & allocator) const = 0; 150 151 virtual void unwrapcomplex(int id, const ScilabComplexStackAllocator & allocator) const = 0; 152 153 virtual void unwraprowcomplex(int id, const ScilabComplexStackAllocator & allocator) const = 0; 154 155 virtual void unwrapmatcomplex(int id, const ScilabComplexStackAllocator & allocator) const = 0; 156 157 virtual void unwrapchar(int id, const ScilabCharStackAllocator & allocator) const = 0; 158 159 virtual void unwraprowchar(int id, const ScilabCharStackAllocator & allocator) const = 0; 160 161 virtual void unwrapmatchar(int id, const ScilabCharStackAllocator & allocator) const = 0; 162 163 virtual void unwrapuchar(int id, const ScilabUCharStackAllocator & allocator) const = 0; 164 165 virtual void unwraprowuchar(int id, const ScilabUCharStackAllocator & allocator) const = 0; 166 167 virtual void unwrapmatuchar(int id, const ScilabUCharStackAllocator & allocator) const = 0 ; 168 169 virtual void unwrapshort(int id, const ScilabShortStackAllocator & allocator) const = 0; 170 171 virtual void unwraprowshort(int id, const ScilabShortStackAllocator & allocator) const = 0; 172 173 virtual void unwrapmatshort(int id, const ScilabShortStackAllocator & allocator) const = 0; 174 175 virtual void unwrapushort(int id, const ScilabUShortStackAllocator & allocator) const = 0; 176 177 virtual void unwraprowushort(int id, const ScilabUShortStackAllocator & allocator) const = 0; 178 179 virtual void unwrapmatushort(int id, const ScilabUShortStackAllocator & allocator) const = 0; 180 181 virtual void unwrapint(int id, const ScilabIntStackAllocator & allocator) const = 0; 182 183 virtual void unwraprowint(int id, const ScilabIntStackAllocator & allocator) const = 0; 184 185 virtual void unwrapmatint(int id, const ScilabIntStackAllocator & allocator) const = 0; 186 187 virtual void unwrapuint(int id, const ScilabUIntStackAllocator & allocator) const = 0; 188 189 virtual void unwraprowuint(int id, const ScilabUIntStackAllocator & allocator) const = 0; 190 191 virtual void unwrapmatuint(int id, const ScilabUIntStackAllocator & allocator) const = 0; 192 193 virtual void unwraplong(int id, const ScilabLongStackAllocator & allocator) const = 0; 194 195 virtual void unwraprowlong(int id, const ScilabLongStackAllocator & allocator) const = 0; 196 197 virtual void unwrapmatlong(int id, const ScilabLongStackAllocator & allocator) const = 0; 198 199 virtual void unwrapulong(int id, const ScilabULongStackAllocator & allocator) const = 0; 200 201 virtual void unwraprowulong(int id, const ScilabULongStackAllocator & allocator) const = 0; 202 203 virtual void unwrapmatulong(int id, const ScilabULongStackAllocator & allocator) const = 0; 204 205 virtual void unwrapboolean(int id, const ScilabBooleanStackAllocator & allocator) const = 0; 206 207 virtual void unwraprowboolean(int id, const ScilabBooleanStackAllocator & allocator) const = 0; 208 209 virtual void unwrapmatboolean(int id, const ScilabBooleanStackAllocator & allocator) const = 0; 210 211 virtual void unwrapstring(int id, const ScilabStringStackAllocator & allocator) const = 0; 212 213 virtual void unwraprowstring(int id, const ScilabStringStackAllocator & allocator) const = 0; 214 215 virtual void unwrapmatstring(int id, const ScilabStringStackAllocator & allocator) const = 0; 216 217 virtual void unwrapfloat(int id, const ScilabFloatStackAllocator & allocator) const = 0; 218 219 virtual void unwraprowfloat(int id, const ScilabFloatStackAllocator & allocator) const = 0; 220 221 virtual void unwrapmatfloat(int id, const ScilabFloatStackAllocator & allocator) const = 0; 222 }; 223 } 224 225 #endif // __SCILABABSTRACTENVIRONEMNTWRAPPER_HXX__ 226