1 /*
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2014-2015 - Scilab Enterprises - Calixte DENIZET
4 *
5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
6 *
7 * This file is hereby licensed under the terms of the GNU GPL v2.0,
8 * pursuant to article 5.3.4 of the CeCILL v.2.1.
9 * This file was originally licensed under the terms of the CeCILL v2.1,
10 * and continues to be available under such terms.
11 * For more information, see the COPYING file which you should have received
12 * along with this program.
13 *
14 */
15
16 // This file has been generated, so don't modify it by hand !!
17
18 #ifndef __TITYPE_HXX__
19 #define __TITYPE_HXX__
20
21 #include <cstdint>
22 #include <functional>
23 #include <iostream>
24
25 #include "tools.hxx"
26 #include "gvn/GVN.hxx"
27 #include "gvn/SymbolicDimension.hxx"
28
29 namespace analysis
30 {
31 struct TIType
32 {
33 static const std::wstring _boolean_, _ce_, _constant_, _fptr_, _function_, _int16_, _int32_, _int64_, _int8_, _library_, _list_, _mlist_, _polynomial_, _sparse_, _st_, _string_, _tlist_, _uint16_, _uint32_, _uint64_, _uint8_, _unknown_;
34
35 enum Type { EMPTY = 0, BOOLEAN, COMPLEX, CELL, DOUBLE, FUNCTION, INT16, INT32, INT64, INT8, LIST, LIBRARY, MACRO, MACROFILE, MLIST, POLYNOMIAL, STRING, SPARSE, STRUCT, TLIST, UNKNOWN, UINT16, UINT32, UINT64, UINT8, COUNT };
36 Type type;
37 SymbolicDimension rows;
38 SymbolicDimension cols;
39 bool scalar;
40
TITypeanalysis::TIType41 TIType(const Type _type = UNKNOWN) : type(_type), scalar(true) { }
TITypeanalysis::TIType42 TIType(GVN & gvn) : type(UNKNOWN), rows(gvn, int64_t(0)), cols(gvn, int64_t(0)), scalar(false) { }
TITypeanalysis::TIType43 TIType(GVN & gvn, const Type _type) : type(_type), rows(gvn, _type == EMPTY ? 0 : 1), cols(gvn, _type == EMPTY ? 0 : 1), scalar(_type != EMPTY) { }
TITypeanalysis::TIType44 TIType(GVN & gvn, const Type _type, const int _rows, const int _cols) : type(_type), rows(gvn, _rows), cols(gvn, _cols), scalar(_rows == 1 && _cols == 1) { }
TITypeanalysis::TIType45 TIType(GVN & /*gvn*/, Type _type, const SymbolicDimension & _rows, const SymbolicDimension & _cols) : type(_type), rows(_rows), cols(_cols), scalar(_rows == 1 && _cols == 1) { }
TITypeanalysis::TIType46 TIType(GVN & gvn, const Type _type, const bool _scalar) : type(_type), rows(gvn, _scalar ? 1 : -1), cols(gvn, _scalar ? 1 : -1), scalar(_scalar) { }
47
hasValidDimsanalysis::TIType48 inline bool hasValidDims() const
49 {
50 return rows != -2 && cols != -2;
51 }
52
hasInvalidDimsanalysis::TIType53 inline bool hasInvalidDims() const
54 {
55 return rows == -2;
56 }
57
asUnknownMatrixanalysis::TIType58 inline TIType asUnknownMatrix()
59 {
60 return TIType(*rows.getGVN(), type, false);
61 }
62
isscalaranalysis::TIType63 inline bool isscalar() const
64 {
65 return scalar;
66 }
67
invalidScalaranalysis::TIType68 inline void invalidScalar()
69 {
70 scalar = rows == 1 && cols == 1;
71 }
72
iscomplexanalysis::TIType73 inline bool iscomplex() const
74 {
75 return type == COMPLEX;
76 }
77
isrealanalysis::TIType78 inline bool isreal() const
79 {
80 return type == DOUBLE;
81 }
82
isintegralanalysis::TIType83 inline bool isintegral() const
84 {
85 return type == BOOLEAN || type == INT8 || type == INT16 || type == INT32 || type == INT64 || type == UINT8 || type == UINT16 || type == UINT32 || type == UINT64;
86 }
87
ismatrixanalysis::TIType88 inline bool ismatrix() const
89 {
90 return type != CELL && type != FUNCTION && type != LIST && type != LIBRARY && type != MACRO && type != MACROFILE && type != MLIST && type != STRUCT && type != TLIST && type != UNKNOWN;
91 }
92
issignedanalysis::TIType93 inline bool issigned() const
94 {
95 return type != UINT8 && type != UINT16 && type != UINT32 && type != UINT64;
96 }
97
isfloatinganalysis::TIType98 inline bool isfloating() const
99 {
100 return type == DOUBLE || type == COMPLEX;
101 }
102
isKnownDimsanalysis::TIType103 inline bool isKnownDims() const
104 {
105 return rows.isValid() && cols.isValid();
106 }
107
isUnknownDimsanalysis::TIType108 inline bool isUnknownDims() const
109 {
110 return !isKnownDims();
111 }
112
isknownanalysis::TIType113 inline bool isknown() const
114 {
115 return type != UNKNOWN;
116 }
117
isunknownanalysis::TIType118 inline bool isunknown() const
119 {
120 return type == UNKNOWN;
121 }
122
isConstantDimsanalysis::TIType123 inline bool isConstantDims() const
124 {
125 return rows.isConstant() && cols.isConstant();
126 }
127
swapDimsanalysis::TIType128 inline void swapDims()
129 {
130 GVN::Value * r = rows.getValue();
131 rows.setValue(cols.getValue());
132 cols.setValue(r);
133 }
134
hashPureTypeanalysis::TIType135 inline std::size_t hashPureType() const
136 {
137 return isscalar() ? type : (type + TIType::COUNT + 1);
138 }
139
operator ==analysis::TIType140 inline bool operator==(const TIType & r) const
141 {
142 return type == r.type && scalar == r.scalar && rows == r.rows && cols == r.cols;
143 }
144
operator !=analysis::TIType145 inline bool operator!=(const TIType & r) const
146 {
147 return !(*this == r);
148 }
149
mergeanalysis::TIType150 inline void merge(const TIType & type)
151 {
152 if (this->type == DOUBLE && type.type == COMPLEX)
153 {
154 this->type = COMPLEX;
155 }
156 else if ((this->type != COMPLEX || type.type != DOUBLE) && this->type != type.type)
157 {
158 this->type = UNKNOWN;
159 rows.setValue(int64_t(0));
160 cols.setValue(int64_t(0));
161 }
162 else if ((!scalar || !type.scalar) && (rows != type.rows || cols != type.cols))
163 {
164 if (rows != type.rows)
165 {
166 rows.setValue(rows.getGVN()->getValue());
167 }
168 if (cols != type.cols)
169 {
170 cols.setValue(cols.getGVN()->getValue());
171 }
172 scalar = false;
173 }
174 /*else if ((!scalar || !type.scalar) && (rows != type.rows || cols != type.cols))
175 {
176 rows.invalid();
177 cols.invalid();
178 scalar = false;
179 }*/
180 }
181
182 template<typename> static Type getTI();
183
get_manglinganalysis::TIType184 inline std::string get_mangling() const
185 {
186 const bool kd = isKnownDims();
187 switch (type)
188 {
189 case EMPTY :
190 return "E";
191 case BOOLEAN :
192 return kd ? (scalar ? "Sb" : "Mb") : "Ub";
193 case COMPLEX :
194 return kd ? (scalar ? "Sc" : "Mc") : "Uc";
195 case CELL :
196 return kd ? (scalar ? "Sce" : "Mce") : "Uce";
197 case DOUBLE :
198 return kd ? (scalar ? "Sd" : "Md") : "Ud";
199 case FUNCTION :
200 return kd ? (scalar ? "Sfn" : "Mfn") : "Ufn";
201 case INT16 :
202 return kd ? (scalar ? "Si16" : "Mi16") : "Ui16";
203 case INT32 :
204 return kd ? (scalar ? "Si32" : "Mi32") : "Ui32";
205 case INT64 :
206 return kd ? (scalar ? "Si64" : "Mi64") : "Ui64";
207 case INT8 :
208 return kd ? (scalar ? "Si8" : "Mi8") : "Ui8";
209 case LIST :
210 return kd ? (scalar ? "Sl" : "Ml") : "Ul";
211 case LIBRARY :
212 return kd ? (scalar ? "Slb" : "Mlb") : "Ulb";
213 case MACRO :
214 return kd ? (scalar ? "Sm" : "Mm") : "Um";
215 case MACROFILE :
216 return kd ? (scalar ? "Smf" : "Mmf") : "Umf";
217 case MLIST :
218 return kd ? (scalar ? "Sml" : "Mml") : "Uml";
219 case POLYNOMIAL :
220 return kd ? (scalar ? "Sp" : "Mp") : "Up";
221 case STRING :
222 return kd ? (scalar ? "Ss" : "Ms") : "Us";
223 case SPARSE :
224 return kd ? (scalar ? "Ssp" : "Msp") : "Usp";
225 case STRUCT :
226 return kd ? (scalar ? "Sst" : "Mst") : "Ust";
227 case TLIST :
228 return kd ? (scalar ? "Stl" : "Mtl") : "Utl";
229 case UNKNOWN :
230 return kd ? (scalar ? "Su" : "Mu") : "Uu";
231 case UINT16 :
232 return kd ? (scalar ? "Sui16" : "Mui16") : "Uui16";
233 case UINT32 :
234 return kd ? (scalar ? "Sui32" : "Mui32") : "Uui32";
235 case UINT64 :
236 return kd ? (scalar ? "Sui64" : "Mui64") : "Uui64";
237 case UINT8 :
238 return kd ? (scalar ? "Sui8" : "Mui8") : "Uui8";
239 default :
240 return "??";
241 }
242 }
243
get_manglingWanalysis::TIType244 inline std::wstring get_manglingW() const
245 {
246 const bool kd = isKnownDims();
247 switch (type)
248 {
249 case EMPTY :
250 return L"E";
251 case BOOLEAN :
252 return kd ? (scalar ? L"Sb" : L"Mb") : L"Ub";
253 case COMPLEX :
254 return kd ? (scalar ? L"Sc" : L"Mc") : L"Uc";
255 case CELL :
256 return kd ? (scalar ? L"Sce" : L"Mce") : L"Uce";
257 case DOUBLE :
258 return kd ? (scalar ? L"Sd" : L"Md") : L"Ud";
259 case FUNCTION :
260 return kd ? (scalar ? L"Sfn" : L"Mfn") : L"Ufn";
261 case INT16 :
262 return kd ? (scalar ? L"Si16" : L"Mi16") : L"Ui16";
263 case INT32 :
264 return kd ? (scalar ? L"Si32" : L"Mi32") : L"Ui32";
265 case INT64 :
266 return kd ? (scalar ? L"Si64" : L"Mi64") : L"Ui64";
267 case INT8 :
268 return kd ? (scalar ? L"Si8" : L"Mi8") : L"Ui8";
269 case LIST :
270 return kd ? (scalar ? L"Sl" : L"Ml") : L"Ul";
271 case LIBRARY :
272 return kd ? (scalar ? L"Slb" : L"Mlb") : L"Ulb";
273 case MACRO :
274 return kd ? (scalar ? L"Sm" : L"Mm") : L"Um";
275 case MACROFILE :
276 return kd ? (scalar ? L"Smf" : L"Mmf") : L"Umf";
277 case MLIST :
278 return kd ? (scalar ? L"Sml" : L"Mml") : L"Uml";
279 case POLYNOMIAL :
280 return kd ? (scalar ? L"Sp" : L"Mp") : L"Up";
281 case STRING :
282 return kd ? (scalar ? L"Ss" : L"Ms") : L"Us";
283 case SPARSE :
284 return kd ? (scalar ? L"Ssp" : L"Msp") : L"Usp";
285 case STRUCT :
286 return kd ? (scalar ? L"Sst" : L"Mst") : L"Ust";
287 case TLIST :
288 return kd ? (scalar ? L"Stl" : L"Mtl") : L"Utl";
289 case UNKNOWN :
290 return kd ? (scalar ? L"Su" : L"Mu") : L"Uu";
291 case UINT16 :
292 return kd ? (scalar ? L"Sui16" : L"Mui16") : L"Uui16";
293 case UINT32 :
294 return kd ? (scalar ? L"Sui32" : L"Mui32") : L"Uui32";
295 case UINT64 :
296 return kd ? (scalar ? L"Sui64" : L"Mui64") : L"Uui64";
297 case UINT8 :
298 return kd ? (scalar ? L"Sui8" : L"Mui8") : L"Uui8";
299 default :
300 return L"??";
301 }
302 }
303
get_manglinganalysis::TIType304 inline static std::string get_mangling(const TIType::Type ty, const bool scalar)
305 {
306 switch (ty)
307 {
308 case EMPTY :
309 return "E";
310 case BOOLEAN :
311 return scalar ? "Sb" : "Mb";
312 case COMPLEX :
313 return scalar ? "Sc" : "Mc";
314 case CELL :
315 return scalar ? "Sce" : "Mce";
316 case DOUBLE :
317 return scalar ? "Sd" : "Md";
318 case FUNCTION :
319 return scalar ? "Sfn" : "Mfn";
320 case INT16 :
321 return scalar ? "Si16" : "Mi16";
322 case INT32 :
323 return scalar ? "Si32" : "Mi32";
324 case INT64 :
325 return scalar ? "Si64" : "Mi64";
326 case INT8 :
327 return scalar ? "Si8" : "Mi8";
328 case LIST :
329 return scalar ? "Sl" : "Ml";
330 case LIBRARY :
331 return scalar ? "Slb" : "Mlb";
332 case MACRO :
333 return scalar ? "Sm" : "Mm";
334 case MACROFILE :
335 return scalar ? "Smf" : "Mmf";
336 case MLIST :
337 return scalar ? "Sml" : "Mml";
338 case POLYNOMIAL :
339 return scalar ? "Sp" : "Mp";
340 case STRING :
341 return scalar ? "Ss" : "Ms";
342 case SPARSE :
343 return scalar ? "Ssp" : "Msp";
344 case STRUCT :
345 return scalar ? "Sst" : "Mst";
346 case TLIST :
347 return scalar ? "Stl" : "Mtl";
348 case UNKNOWN :
349 return scalar ? "Su" : "Mu";
350 case UINT16 :
351 return scalar ? "Sui16" : "Mui16";
352 case UINT32 :
353 return scalar ? "Sui32" : "Mui32";
354 case UINT64 :
355 return scalar ? "Sui64" : "Mui64";
356 case UINT8 :
357 return scalar ? "Sui8" : "Mui8";
358 default :
359 return "??";
360 }
361 }
362
get_manglingWanalysis::TIType363 inline static std::wstring get_manglingW(const TIType::Type ty, const bool scalar)
364 {
365 switch (ty)
366 {
367 case EMPTY :
368 return L"E";
369 case BOOLEAN :
370 return scalar ? L"Sb" : L"Mb";
371 case COMPLEX :
372 return scalar ? L"Sc" : L"Mc";
373 case CELL :
374 return scalar ? L"Sce" : L"Mce";
375 case DOUBLE :
376 return scalar ? L"Sd" : L"Md";
377 case FUNCTION :
378 return scalar ? L"Sfn" : L"Mfn";
379 case INT16 :
380 return scalar ? L"Si16" : L"Mi16";
381 case INT32 :
382 return scalar ? L"Si32" : L"Mi32";
383 case INT64 :
384 return scalar ? L"Si64" : L"Mi64";
385 case INT8 :
386 return scalar ? L"Si8" : L"Mi8";
387 case LIST :
388 return scalar ? L"Sl" : L"Ml";
389 case LIBRARY :
390 return scalar ? L"Slb" : L"Mlb";
391 case MACRO :
392 return scalar ? L"Sm" : L"Mm";
393 case MACROFILE :
394 return scalar ? L"Smf" : L"Mmf";
395 case MLIST :
396 return scalar ? L"Sml" : L"Mml";
397 case POLYNOMIAL :
398 return scalar ? L"Sp" : L"Mp";
399 case STRING :
400 return scalar ? L"Ss" : L"Ms";
401 case SPARSE :
402 return scalar ? L"Ssp" : L"Msp";
403 case STRUCT :
404 return scalar ? L"Sst" : L"Mst";
405 case TLIST :
406 return scalar ? L"Stl" : L"Mtl";
407 case UNKNOWN :
408 return scalar ? L"Su" : L"Mu";
409 case UINT16 :
410 return scalar ? L"Sui16" : L"Mui16";
411 case UINT32 :
412 return scalar ? L"Sui32" : L"Mui32";
413 case UINT64 :
414 return scalar ? L"Sui64" : L"Mui64";
415 case UINT8 :
416 return scalar ? L"Sui8" : L"Mui8";
417 default :
418 return L"??";
419 }
420 }
421
get_unary_manglinganalysis::TIType422 inline static std::string get_unary_mangling(const std::string & pre, const TIType & l)
423 {
424 return pre + "_" + l.get_mangling();
425 }
426
get_unary_manglingWanalysis::TIType427 inline static std::wstring get_unary_manglingW(const std::wstring & pre, const TIType & l)
428 {
429 return pre + L"_" + l.get_manglingW();
430 }
431
get_binary_manglinganalysis::TIType432 inline static std::string get_binary_mangling(const std::string & pre, const TIType & l, const TIType & r)
433 {
434 return pre + "_" + l.get_mangling() + r.get_mangling();
435 }
436
get_manglinganalysis::TIType437 inline static std::string get_mangling(const std::string & pre, const std::vector<TIType> & types)
438 {
439 std::string s(pre);
440 s += "_";
441 for (std::vector<TIType>::const_iterator i = types.begin(), end = types.end(); i != end; ++i)
442 {
443 s += i->get_mangling();
444 }
445 return s;
446 }
447
get_base_sizeanalysis::TIType448 inline static unsigned int get_base_size(const Type type)
449 {
450 switch (type)
451 {
452 case EMPTY :
453 return sizeof(double);
454 case BOOLEAN :
455 return sizeof(int);
456 case DOUBLE :
457 return sizeof(double);
458 case INT8 :
459 return sizeof(int8_t);
460 case INT16 :
461 return sizeof(int16_t);
462 case INT32 :
463 return sizeof(int32_t);
464 case INT64 :
465 return sizeof(int64_t);
466 case UINT8 :
467 return sizeof(uint8_t);
468 case UINT16 :
469 return sizeof(uint16_t);
470 case UINT32 :
471 return sizeof(uint32_t);
472 case UINT64 :
473 return sizeof(uint64_t);
474 default :
475 return 0;
476 }
477 }
478
toStringanalysis::TIType479 inline static std::wstring toString(Type t)
480 {
481 switch (t)
482 {
483 case EMPTY :
484 return L"[]";
485 case BOOLEAN :
486 return L"boolean";
487 case COMPLEX :
488 return L"complex";
489 case CELL :
490 return L"cell";
491 case DOUBLE :
492 return L"double";
493 case FUNCTION :
494 return L"function";
495 case INT16 :
496 return L"int16";
497 case INT32 :
498 return L"int32";
499 case INT64 :
500 return L"int64";
501 case INT8 :
502 return L"int8";
503 case LIST :
504 return L"list";
505 case LIBRARY :
506 return L"library";
507 case MACRO :
508 return L"macro";
509 case MACROFILE :
510 return L"macrofile";
511 case MLIST :
512 return L"mlist";
513 case POLYNOMIAL :
514 return L"polynomial";
515 case STRING :
516 return L"string";
517 case SPARSE :
518 return L"sparse";
519 case STRUCT :
520 return L"struct";
521 case TLIST :
522 return L"tlist";
523 case UNKNOWN :
524 return L"unknown";
525 case UINT16 :
526 return L"uint16";
527 case UINT32 :
528 return L"uint32";
529 case UINT64 :
530 return L"uint64";
531 case UINT8 :
532 return L"uint8";
533 default :
534 return L"unknown";
535 }
536 }
537
getScilabStringanalysis::TIType538 inline const std::wstring & getScilabString() const
539 {
540 return getScilabString(type);
541 }
542
getScilabStringanalysis::TIType543 inline static const std::wstring & getScilabString(Type t)
544 {
545 switch (t)
546 {
547 case EMPTY :
548 return _constant_;
549 case BOOLEAN :
550 return _boolean_;
551 case COMPLEX :
552 return _constant_;
553 case CELL :
554 return _ce_;
555 case DOUBLE :
556 return _constant_;
557 case FUNCTION :
558 return _fptr_;
559 case INT16 :
560 return _int16_;
561 case INT32 :
562 return _int32_;
563 case INT64 :
564 return _int64_;
565 case INT8 :
566 return _int8_;
567 case LIST :
568 return _list_;
569 case LIBRARY :
570 return _library_;
571 case MACRO :
572 return _function_;
573 case MACROFILE :
574 return _function_;
575 case MLIST :
576 return _mlist_;
577 case POLYNOMIAL :
578 return _polynomial_;
579 case STRING :
580 return _string_;
581 case SPARSE :
582 return _sparse_;
583 case STRUCT :
584 return _st_;
585 case TLIST :
586 return _tlist_;
587 case UNKNOWN :
588 return _unknown_;
589 case UINT16 :
590 return _uint16_;
591 case UINT32 :
592 return _uint32_;
593 case UINT64 :
594 return _uint64_;
595 case UINT8 :
596 return _uint8_;
597 default :
598 return _unknown_;
599 }
600 }
601
getScilabCodeanalysis::TIType602 inline int getScilabCode() const
603 {
604 return getScilabCode(type);
605 }
606
getScilabCodeanalysis::TIType607 inline static int getScilabCode(Type t)
608 {
609 switch (t)
610 {
611 case EMPTY :
612 return 1;
613 case BOOLEAN :
614 return 4;
615 case COMPLEX :
616 return 1;
617 case CELL :
618 return 17;
619 case DOUBLE :
620 return 1;
621 case FUNCTION :
622 return 130;
623 case INT16 :
624 return 8;
625 case INT32 :
626 return 8;
627 case INT64 :
628 return 8;
629 case INT8 :
630 return 8;
631 case LIST :
632 return 15;
633 case LIBRARY :
634 return 14;
635 case MACRO :
636 return 11;
637 case MACROFILE :
638 return 13;
639 case MLIST :
640 return 17;
641 case POLYNOMIAL :
642 return 2;
643 case STRING :
644 return 10;
645 case SPARSE :
646 return 5;
647 case STRUCT :
648 return 17;
649 case TLIST :
650 return 16;
651 case UNKNOWN :
652 return -1;
653 case UINT16 :
654 return 8;
655 case UINT32 :
656 return 8;
657 case UINT64 :
658 return 8;
659 case UINT8 :
660 return 8;
661 default :
662 return -1;
663 }
664 }
665
operator <<(std::wostream & out,const TIType & type)666 friend std::wostream & operator<<(std::wostream & out, const TIType & type)
667 {
668 switch (type.type)
669 {
670 case EMPTY :
671 out << L"[]";
672 break;
673 case BOOLEAN :
674 out << L"boolean";
675 break;
676 case COMPLEX :
677 out << L"complex";
678 break;
679 case CELL :
680 out << L"cell";
681 break;
682 case DOUBLE :
683 out << L"double";
684 break;
685 case FUNCTION :
686 out << L"function";
687 break;
688 case INT16 :
689 out << L"int16";
690 break;
691 case INT32 :
692 out << L"int32";
693 break;
694 case INT64 :
695 out << L"int64";
696 break;
697 case INT8 :
698 out << L"int8";
699 break;
700 case LIST :
701 out << L"list";
702 break;
703 case LIBRARY :
704 out << L"library";
705 break;
706 case MACRO :
707 out << L"macro";
708 break;
709 case MACROFILE :
710 out << L"macrofile";
711 break;
712 case MLIST :
713 out << L"mlist";
714 break;
715 case POLYNOMIAL :
716 out << L"polynomial";
717 break;
718 case STRING :
719 out << L"string";
720 break;
721 case SPARSE :
722 out << L"sparse";
723 break;
724 case STRUCT :
725 out << L"struct";
726 break;
727 case TLIST :
728 out << L"tlist";
729 break;
730 case UNKNOWN :
731 out << L"unknown";
732 break;
733 case UINT16 :
734 out << L"uint16";
735 break;
736 case UINT32 :
737 out << L"uint32";
738 break;
739 case UINT64 :
740 out << L"uint64";
741 break;
742 case UINT8 :
743 out << L"uint8";
744 break;
745 default :
746 break;
747 }
748
749 if (type.type != EMPTY && type.type != UNKNOWN)
750 {
751 if (type.isUnknownDims())
752 {
753 out << L"[?, ?]";
754 }
755 else
756 {
757 out << L"[" << type.rows << L", " << type.cols << L"]";
758 }
759 }
760
761 return out;
762 }
763 };
764
getTI()765 template<> inline TIType::Type TIType::getTI<bool>()
766 {
767 return TIType::BOOLEAN;
768 }
getTI()769 template<> inline TIType::Type TIType::getTI<double>()
770 {
771 return TIType::DOUBLE;
772 }
getTI()773 template<> inline TIType::Type TIType::getTI<int16_t>()
774 {
775 return TIType::INT16;
776 }
getTI()777 template<> inline TIType::Type TIType::getTI<int32_t>()
778 {
779 return TIType::INT32;
780 }
getTI()781 template<> inline TIType::Type TIType::getTI<int64_t>()
782 {
783 return TIType::INT64;
784 }
getTI()785 template<> inline TIType::Type TIType::getTI<int8_t>()
786 {
787 return TIType::INT8;
788 }
getTI()789 template<> inline TIType::Type TIType::getTI<uint16_t>()
790 {
791 return TIType::UINT16;
792 }
getTI()793 template<> inline TIType::Type TIType::getTI<uint32_t>()
794 {
795 return TIType::UINT32;
796 }
getTI()797 template<> inline TIType::Type TIType::getTI<uint64_t>()
798 {
799 return TIType::UINT64;
800 }
getTI()801 template<> inline TIType::Type TIType::getTI<uint8_t>()
802 {
803 return TIType::UINT8;
804 }
805
806 } // namespace analysis
807
808 namespace std
809 {
810 // useful to be able to put TIType in unorderd_set for example.
811 template<>
812 struct hash<analysis::TIType>
813 {
operator ()std::hash814 inline size_t operator()(const analysis::TIType & /*t*/) const
815 {
816 return 0;//tools::hash_combine(t.type, t.rows, t.cols);
817 }
818 };
819 } // namespace std
820
821 #endif // __TITYPE_HXX__
822