23 #ifndef _TLP_VECTORCAST_H
24 #define _TLP_VECTORCAST_H
27 #include <tulip/Vector.h>
29 #define TEMPLATEVECTORCAST template <typename Obj, unsigned int SIZE, typename TYPE >
31 #define VECTORCAST tlp::VectorCast<Obj, SIZE, TYPE>
47 class TLP_SCOPE VectorCast :
public Vector<Obj,SIZE> {
50 inline explicit VectorCast(
const tlp::Vector<float,3> &v):Vector<Obj,SIZE>(v) {
53 inline TYPE & operator*=(
const Obj obj) {
54 return (TYPE &)this->Vector<Obj,SIZE>::operator*=(obj);
56 inline TYPE & operator*=(
const Vector<Obj,SIZE> &vec) {
57 return (TYPE &)this->Vector<Obj,SIZE>::operator*=(vec);
59 inline TYPE & operator/=(
const Obj obj) {
60 return (TYPE &)this->Vector<Obj,SIZE>::operator/=(obj);
62 inline TYPE & operator/=(
const Vector<Obj,SIZE> &vec) {
63 return (TYPE &)this->Vector<Obj,SIZE>::operator/=(vec);
65 inline TYPE & operator+=(
const Obj obj) {
66 return (TYPE &)this->Vector<Obj,SIZE>::operator+=(obj);
68 inline TYPE & operator+=(
const Vector<Obj,SIZE> &vec) {
69 return (TYPE &)this->Vector<Obj,SIZE>::operator+=(vec);
71 inline TYPE & operator-=(
const Obj obj) {
72 return (TYPE &)this->Vector<Obj,SIZE>::operator-=(obj);
74 inline TYPE & operator-=(
const Vector<Obj,SIZE> &vec) {
75 return (TYPE &)this->Vector<Obj,SIZE>::operator-=(vec);
77 inline TYPE & operator^=(
const Vector<Obj,SIZE> &vec) {
78 return (TYPE &)this->Vector<Obj,SIZE>::operator^=(vec);
80 inline TYPE & fill(
const Obj obj) {
81 return (TYPE &)this->Vector<Obj,SIZE>::fill(obj);
84 inline TYPE operator*(
const Vector<Obj,SIZE> &v)
const {
85 return VECTORCAST(*
this)*=v;
87 inline TYPE operator*(
const Obj v)
const {
88 return VECTORCAST(*
this)*=v;
90 inline TYPE operator+(
const Vector<Obj,SIZE> &v)
const {
91 return VECTORCAST(*
this)+=v;
93 inline TYPE operator+(
const Obj v)
const {
94 return VECTORCAST(*
this)+=v;
96 inline TYPE operator-(
const Vector<Obj,SIZE> &v)
const {
97 return VECTORCAST(*
this)-=v;
99 inline TYPE operator-(
const Obj v)
const {
100 return VECTORCAST(*
this)-=v;
102 inline TYPE operator/(
const Vector<Obj,SIZE> &v)
const {
103 return VECTORCAST(*
this)/=v;
105 inline TYPE operator/(
const Obj v)
const {
106 return VECTORCAST(*
this)/=v;
108 inline TYPE operator^(
const Vector<Obj,SIZE> &v)
const {
109 return VECTORCAST(*
this)^=v;