Commit c3fd4713 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

huuu

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 1195
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent cc1186b7
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: reprtest.cc,v 1.1 2002-12-06 19:21:08 forbrig Exp $
* $Id: reprtest.cc,v 1.2 2002-12-15 20:57:19 forbrig Exp $
* \author Thomas Forbriger
* \date 10/05/2002
*
......@@ -16,80 +16,57 @@
*
* ============================================================================
*/
#define TF_REPRTEST_CC_VERSION \
"TF_REPRTEST_CC V1.0 "
#define TF_REPRTEST_CC_CVSID \
"$Id: reprtest.cc,v 1.1 2002-12-06 19:21:08 forbrig Exp $"
#define AFF_REPRTEST_CC_VERSION \
"AFF_REPRTEST_CC V1.0 "
#define AFF_REPRTEST_CC_CVSID \
"$Id: reprtest.cc,v 1.2 2002-12-15 20:57:19 forbrig Exp $"
#include <contxx/repr/sharedheap.h>
#include <iostream>
#include<aff/array.h>
#include <aff/lib/sharedheap.h>
#include <aff/dump.h>
using std::cout;
using std::endl;
// output function for representation objects
template<class T>
void print(const T& cont, const char* name)
{
using namespace contxx::util;
const int blocksize=15;
cout << name << ":" << endl;
Tsize size=cont.size();
int blocks=size / blocksize + 1;
for (int i=0; i<blocks; i++)
{
Tsize first=i*blocksize;
Tsize last=first+blocksize;
last = ( last > size ? size : last);
cout << " ";
for (Tsize j=first; j<last; j++)
{ cout.width(5); cout << j; }
cout << endl << " ";
for (Tsize j=first; j<last; j++)
{ cout.width(5); cout << cont[j]; }
cout << endl << endl;
}
}
#define PRINT( x ) print(x, #x );
//! testing SharedHeap
int main()
{
cout << TF_REPRTEST_CC_VERSION << endl;
cout << TF_REPRTEST_CC_CVSID << endl;
using contxx::representation::SharedHeap;
cout << AFF_REPRTEST_CC_VERSION << endl;
cout << AFF_REPRTEST_CC_CVSID << endl;
const int N=10;
const int N2=23;
SharedHeap<int> A(N);
SharedHeap<int> B(N2);
SharedHeap<const int> C(N2);
SharedHeap<float> D(N2);
aff::SharedHeap<int> A(N);
aff::SharedHeap<int> B(N2);
aff::SharedHeap<const int> C(N2);
C=B;
aff::SharedHeap<float> D(N2);
for (int i=0; i<N; i++) { A[i]=(i+1)*10; }
for (int i=0; i<N2; i++) { B[i]=(i+4)*3; }
for (int i=0; i<N2; i++) { D[i]=(i+2.45)*2; }
PRINT(A)
PRINT(B)
C=B;
PRINT(C)
aff::SharedHeap<float>::Tcoc E(D);
DUMP(A)
DUMP(B)
DUMP(C)
DUMP(E)
// modify C through B
B[8]=632;
PRINT(C)
DUMP(C)
// modify C directly - is illegal
#ifdef ILLEGAL1
C[9]=354;
PRINT(C)
DUMP(C)
#endif
// make B a reference to A
B=A;
// modification should be visible through B
A[5]=453;
PRINT(B)
DUMP(B)
// test another type
PRINT(D)
DUMP(D)
cout << endl;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment