Made some fixes in the support header files, and changed functions to fix issues with const-ness in C++

This commit is contained in:
Neil Brown 2007-10-11 01:30:49 +00:00
parent 3b0be45b74
commit a1baa16d9e
2 changed files with 18 additions and 2 deletions

View File

@ -34,6 +34,7 @@
#define EXTERNAL_CALLN(F,I,args...) (F)((I),##args) #define EXTERNAL_CALLN(F,I,args...) (F)((I),##args)
#define EXTERNAL_CALL(F) (F)() #define EXTERNAL_CALL(F) (F)()
#define SetErr() #define SetErr()
#define Channel int
#endif #endif
//{{{ mostneg/mostpos //{{{ mostneg/mostpos

View File

@ -242,7 +242,9 @@ public:
} }
//Retyping: //Retyping:
// Removed for now because it is causing ambiguity problems with the standard constructor (to do with const-ness)
// and because I'm not actually sure if it is used (I think retyping uses the constructor below with tockArrayView)
/*
template <typename U> template <typename U>
inline tockArrayView(U* _realArray,const std::pair< boost::array<unsigned,DIMS> , unsigned >& _dims) inline tockArrayView(U* _realArray,const std::pair< boost::array<unsigned,DIMS> , unsigned >& _dims)
: realArray(reinterpret_cast<T*>(_realArray)),dims(_dims.first),totalSubDim(_dims.second) : realArray(reinterpret_cast<T*>(_realArray)),dims(_dims.first),totalSubDim(_dims.second)
@ -250,6 +252,7 @@ public:
//Assume it's a single U item: //Assume it's a single U item:
correctDimsRetype(sizeof(U)); correctDimsRetype(sizeof(U));
} }
*/
//Retyping, same number of dims: //Retyping, same number of dims:
@ -402,6 +405,12 @@ public:
: aob(N*sizeof(T),arr.data()) : aob(N*sizeof(T),arr.data())
{ {
} }
template <unsigned D>
inline explicit tockSendableArray(const tockArrayView<const T,D>& arr)
: aob(arr.data())
{
}
}; };
template <typename T, unsigned N, unsigned D> template <typename T, unsigned N, unsigned D>
@ -417,6 +426,12 @@ inline void tockRecvArray(const csp::Chanin< tockSendableArray<T,N> >& in,const
in >> tsa; in >> tsa;
} }
template <typename T, unsigned N, unsigned D>
inline void tockSendArray(const csp::Chanout< tockSendableArray<T,N> >& out,const tockArrayView<const T,D>& arr)
{
out << tockSendableArray<T,N>(arr);
}
inline void tockSendArrayOfBytes(const csp::Chanout<tockSendableArrayOfBytes>& c, const tockSendableArrayOfBytes& b) inline void tockSendArrayOfBytes(const csp::Chanout<tockSendableArrayOfBytes>& c, const tockSendableArrayOfBytes& b)
{ {
c << b; c << b;
@ -434,5 +449,5 @@ template <typename T>
inline void tockInitChanArray(T* pointTo,T** pointFrom,int count) inline void tockInitChanArray(T* pointTo,T** pointFrom,int count)
{ {
for (int i = 0;i < count;i++) for (int i = 0;i < count;i++)
pointFrom[count] = &(pointTo[i]); pointFrom[i] = &(pointTo[i]);
} }