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

SharedHeap and dump function now work together with new concept of

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.
const-correctness - how nice...


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 1201
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 1044530c
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: array_dec.h,v 1.7 2002-12-16 20:16:06 forbrig Exp $
* $Id: array_dec.h,v 1.8 2002-12-16 21:03:25 uid1201 Exp $
* \author Thomas Forbriger
* \since 08/12/2002
*
......@@ -30,7 +30,7 @@
#define AFF_ARRAY_DEC_H_VERSION \
"AFF_ARRAY_DEC_H V1.1"
#define AFF_ARRAY_DEC_H_CVSID \
"$Id: array_dec.h,v 1.7 2002-12-16 20:16:06 forbrig Exp $"
"$Id: array_dec.h,v 1.8 2002-12-16 21:03:25 uid1201 Exp $"
#include <aff/lib/sharedheap.h>
#include <aff/lib/strided.h>
......@@ -179,25 +179,25 @@ namespace prebuilt {
*/
//@{
//! full dimensionality access
Tvalue& operator()(const TIndexVec& index)
T& operator()(const TIndexVec& index)
{ return(this->Tbase::operator()(index)); }
//! access from 1 index value
Tvalue& operator()(const Tsubscript& i0)
T& operator()(const Tsubscript& i0)
{ return(this->Tbase::operator()(i0)); }
//! access from 2 index values
Tvalue& operator()(const Tsubscript& i0,
const Tsubscript& i1)
T& operator()(const Tsubscript& i0,
const Tsubscript& i1)
{ return(this->Tbase::operator()(i0, i1)); }
//! access from 3 index values
Tvalue& operator()(const Tsubscript& i0,
const Tsubscript& i1,
const Tsubscript& i2)
T& operator()(const Tsubscript& i0,
const Tsubscript& i1,
const Tsubscript& i2)
{ return(this->Tbase::operator()(i0, i1, i2)); }
//! access from 4 index values
Tvalue& operator()(const Tsubscript& i0,
const Tsubscript& i1,
const Tsubscript& i2,
const Tsubscript& i3)
T& operator()(const Tsubscript& i0,
const Tsubscript& i1,
const Tsubscript& i2,
const Tsubscript& i3)
{ return(this->Tbase::operator()(i0, i1, i2, i3)); }
//! set whole array to value
......@@ -209,6 +209,36 @@ namespace prebuilt {
Array& copyin(const Array<TT>& a)
{ return(this->Tbase::copyin(a)); }
//@}
/*! \name Data access operators
*
* These functions are declared protected in the base class. Make them
* visible here. Since we declare the non-const operators, the const
* operators of the base class are hidden. Redeclare them here.
*/
//@{
//! full dimensionality access
const T& operator()(const TIndexVec& index) const
{ return(this->Tbase::operator()(index)); }
//! access from 1 index value
const T& operator()(const Tsubscript& i0) const
{ return(this->Tbase::operator()(i0)); }
//! access from 2 index values
const T& operator()(const Tsubscript& i0,
const Tsubscript& i1) const
{ return(this->Tbase::operator()(i0, i1)); }
//! access from 3 index values
const T& operator()(const Tsubscript& i0,
const Tsubscript& i1,
const Tsubscript& i2) const
{ return(this->Tbase::operator()(i0, i1, i2)); }
//! access from 4 index values
const T& operator()(const Tsubscript& i0,
const Tsubscript& i1,
const Tsubscript& i2,
const Tsubscript& i3) const
{ return(this->Tbase::operator()(i0, i1, i2, i3)); }
//@}
//! tricky: only this class allows the conversion
operator Trepresentation()
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: dump.cc,v 1.2 2002-12-15 20:48:01 forbrig Exp $
* $Id: dump.cc,v 1.3 2002-12-16 21:03:25 uid1201 Exp $
* \author Thomas Forbriger
* \date 12/12/2002
*
......@@ -19,9 +19,8 @@
#define AFF_DUMP_CC_VERSION \
"AFF_DUMP_CC V1.0 "
#define TF_DUMP_CC_CVSID \
"$Id: dump.cc,v 1.2 2002-12-15 20:48:01 forbrig Exp $"
"$Id: dump.cc,v 1.3 2002-12-16 21:03:25 uid1201 Exp $"
#include <aff/array.h>
#include <aff/dump.h>
namespace aff {
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: dump.h,v 1.4 2002-12-16 18:02:00 forbrig Exp $
* $Id: dump.h,v 1.5 2002-12-16 21:03:25 uid1201 Exp $
* \author Thomas Forbriger
* \date 12/12/2002
*
......@@ -29,9 +29,11 @@
#define AFF_DUMP_H_VERSION \
"AFF_DUMP_H V1.1"
#define TF_DUMP_H_CVSID \
"$Id: dump.h,v 1.4 2002-12-16 18:02:00 forbrig Exp $"
"$Id: dump.h,v 1.5 2002-12-16 21:03:25 uid1201 Exp $"
#include<iostream>
#include<aff/lib/sharedheap.h>
#include<aff/lib/simplearray.h>
namespace aff {
......@@ -47,7 +49,7 @@ using std::endl;
* \ingroup group_helpers
*/
template<typename T>
void dump(const aff::SharedHeap<T>& sharedheap,
void dump(const aff::SharedHeap<const T>& sharedheap,
std::ostream& os=std::cout)
{
os << "dump of a SharedHeap object:" << endl;
......@@ -90,8 +92,10 @@ void dump(const SimpleRigidArray<T,N>& array, std::ostream& os=std::cout)
*
* \ingroup group_helpers
*/
/*
template<class T>
void dump(const Array<T>::Tcoc& array, std::ostream& os=std::cout);
*/
/*----------------------------------------------------------------------*/
......@@ -99,7 +103,9 @@ void dump(const Array<T>::Tcoc& array, std::ostream& os=std::cout);
*
* \ingroup group_helpers
*/
/*
void dump(const Strided& shape, std::ostream& os=std::cout);
*/
/*----------------------------------------------------------------------*/
......@@ -107,7 +113,9 @@ void dump(const Strided& shape, std::ostream& os=std::cout);
*
* \ingroup group_helpers
*/
/*
void dump_map(const Strided& shape, std::ostream& os=std::cout);
*/
/*----------------------------------------------------------------------*/
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: error.h,v 1.4 2002-12-16 20:41:53 forbrig Exp $
* $Id: error.h,v 1.5 2002-12-16 21:03:27 uid1201 Exp $
* \author Thomas Forbriger
* \date 27/11/2002
*
......@@ -30,7 +30,9 @@
#define AFF_ERROR_H_VERSION \
"AFF_ERROR_H V1.1"
#define AFF_ERROR_H_CVSID \
"$Id: error.h,v 1.4 2002-12-16 20:41:53 forbrig Exp $"
"$Id: error.h,v 1.5 2002-12-16 21:03:27 uid1201 Exp $"
#include<aff/lib/types.h>
namespace aff {
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sharedheap.h,v 1.9 2002-12-16 20:41:53 forbrig Exp $
* $Id: sharedheap.h,v 1.10 2002-12-16 21:03:27 uid1201 Exp $
* \author Thomas Forbriger
* \since 08/12/2002
*
......@@ -29,7 +29,7 @@
#define AFF_SHAREDHEAP_H_VERSION \
"AFF_SHAREDHEAP_H V1.1"
#define AFF_SHAREDHEAP_H_CVSID \
"$Id: sharedheap.h,v 1.9 2002-12-16 20:41:53 forbrig Exp $"
"$Id: sharedheap.h,v 1.10 2002-12-16 21:03:27 uid1201 Exp $"
#include<new>
#include<aff/lib/error.h>
......@@ -89,7 +89,7 @@ namespace prebuilt {
* \sa aff::SHeap
*/
template <class T>
class SharedHeap: private SharedHeap<const T>
class SharedHeap: public aff::SharedHeap<const T>
{
public:
//! Element type
......@@ -99,7 +99,7 @@ namespace prebuilt {
//! Type of reference to element
typedef T& Treference;
//! base class
typedef SharedHeap<const T> Tbase;
typedef aff::SharedHeap<const T> Tbase;
//! Type of const version of SharedHeap
typedef Tbase Tcontainer_of_const;
//! short for container of const
......@@ -113,7 +113,7 @@ namespace prebuilt {
SharedHeap(const Tsize& size): Tbase(size) { }
//! Create representation for externally managed memory
SharedHeap(Tpointer* pointer, const Tsize& size):
SharedHeap(T* pointer, const Tsize& size):
Tbase(pointer, size) { }
//! Copy representation to share heap.
......@@ -141,6 +141,11 @@ namespace prebuilt {
T& operator[](const Tsubscript& i)
{ return(this->Tbase::operator[](i)); }
//! Index operator (always inline).
inline
const T& operator[](const Tsubscript& i) const
{ return(this->Tbase::operator[](i)); }
}; // class SharedHeap
/*======================================================================*/
......@@ -158,9 +163,9 @@ namespace prebuilt {
//! Type of reference to element
typedef const T& Treference;
//! Type of const version of SharedHeap
typedef SharedHeap<const T> Tcontainer_of_const;
typedef aff::SharedHeap<const T> Tcontainer_of_const;
//! short for container of const
typedef SharedHeap<const T> Tcoc;
typedef aff::SharedHeap<const T> Tcoc;
private:
//! Type of SHeap struct to be used in any case
......@@ -174,7 +179,7 @@ namespace prebuilt {
SharedHeap(const Tsize& size);
//! Create representation for externally managed memory
SharedHeap(Tmutable_pointer* pointer, const Tsize& size);
SharedHeap(T* pointer, const Tsize& size);
//! Copy representation to share heap.
SharedHeap(const SharedHeap<const T>& sharedheap);
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: sharedheap_def.h,v 1.7 2002-12-16 20:41:53 forbrig Exp $
* $Id: sharedheap_def.h,v 1.8 2002-12-16 21:03:27 uid1201 Exp $
* \author Thomas Forbriger
* \since 08/12/2002
*
......@@ -31,7 +31,7 @@
#define AFF_SHAREDHEAP_DEF_H_VERSION \
"AFF_SHAREDHEAP_DEF_H V1.0 "
#define AFF_SHAREDHEAP_DEF_H_CVSID \
"$Id: sharedheap_def.h,v 1.7 2002-12-16 20:41:53 forbrig Exp $"
"$Id: sharedheap_def.h,v 1.8 2002-12-16 21:03:27 uid1201 Exp $"
namespace aff {
......@@ -105,9 +105,8 @@ namespace prebuilt {
*/
template <typename T>
inline
SharedHeap<const T>::SharedHeap(Tpointer* pointer, const Tsize& size)
: Mheapstruct(new Theapstruct(static_cast<Tmutable_pointer>(pointer),
size)) { }
SharedHeap<const T>::SharedHeap(T* pointer, const Tsize& size)
: Mheapstruct(new Theapstruct(pointer, size)) { }
//! create representation from counted reference
template <typename T>
......@@ -138,7 +137,7 @@ namespace prebuilt {
template <typename T>
inline
SharedHeap<const T>&
SharedHeap<const T>::operator=(const SharedHeap<T>& sharedheap)
SharedHeap<const T>::operator=(const SharedHeap<const T>& sharedheap)
{
if (Mheapstruct != sharedheap.Mheapstruct)
{
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: reprtest.cc,v 1.4 2002-12-16 18:17:42 forbrig Exp $
* $Id: reprtest.cc,v 1.5 2002-12-16 21:03:29 uid1201 Exp $
* \author Thomas Forbriger
* \date 10/05/2002
*
......@@ -24,9 +24,8 @@
#define AFF_REPRTEST_CC_VERSION \
"AFF_REPRTEST_CC V1.1"
#define AFF_REPRTEST_CC_CVSID \
"$Id: reprtest.cc,v 1.4 2002-12-16 18:17:42 forbrig Exp $"
"$Id: reprtest.cc,v 1.5 2002-12-16 21:03:29 uid1201 Exp $"
#include<aff/array.h>
#include <aff/lib/sharedheap.h>
#include <aff/dump.h>
......
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