/*! \file array_def.h * \brief array class definitions (definitions) * * ---------------------------------------------------------------------------- * * $Id: array_def.h,v 1.16 2003-01-03 20:43:52 forbrig Exp $ * \author Thomas Forbriger * \since 08/12/2002 * * array class definitions (definitions) * * \note * This header containes definitions of functions of class aff::Array. They * will be contained in a binary library. You must not include this header * yourself. It is included via array.h if you use the full template version * of the library. * * Copyright (c) 2002 by Thomas Forbriger (IMG Frankfurt) * * REVISIONS and CHANGES * - 08/12/2002 V1.0 copied from libcontxx * - 16/12/2002 V1.1 (thof) * - definitions are now for base class * (i.e. spcialization for const T) * - added standard constructors * - 18/12/2002 V1.2 (thof) * - added stepper code to scalar assignment operator * - 19/12/2002 V1.3 (thof) * - size constructors did not work * - replaced four size-argument constructors by one * constructor with default arguments * - distinguish between mutable and non-mutable * representation * - 23/12/2002 V1.4 (thof) * - copyin() and copyout() work * - 28/12/2002 V1.5 (thof) * - changed base class from specialization to * independent class template * - 29/12/2002 V1.6 (thof) * - due to clearer concept of representation access * constructors became more simple and are defined in * declaration - only copy operations remain here * - member template cannot be explicitely instantiated * - 03/01/2003 V1.7 (thof) * - copyout function now returns an aff::Array rather * than an aff::ConstArray * * ============================================================================ */ #ifndef AFF_ARRAY_DEC_H_VERSION #error "include this only through array_dec.h" #endif // include guard #ifndef AFF_ARRAY_DEF_H_VERSION #define AFF_ARRAY_DEF_H_VERSION \ "AFF_ARRAY_DEF_H V1.7" #define AFF_ARRAY_DEF_H_CVSID \ "$Id: array_def.h,v 1.16 2003-01-03 20:43:52 forbrig Exp $" #include namespace aff { #ifdef AFF_PREBUILT namespace prebuilt { #endif #ifdef AFF_PREBUILT #ifndef AFF_COMPILING_LIBRARY #error "definition read in prebuilt mode and not during library compilation" #endif #endif /*----------------------------------------------------------------------*/ //! check shape and representation template void ConstArray::check_consistency() const { AFF_assert((this->Tshape::first_offset()>=0), "ERROR (ConstArray): invalid shape"); AFF_assert((this->Tshape::last_offset()< Tsubscript(Mrepresentation.size())), "ERROR (ConstArray): shape and representation are inconsistent"); } /*----------------------------------------------------------------------*/ //! create a value (deep) copy template Array ConstArray::copyout() const { aff::Array copy(Tshape(this->first(),this->last())); copy.copyin(*this); return(copy); } /*======================================================================*/ //! set whole array to scalar value template Array& Array::operator=(const T& value) { Tshape::Tstepper st(this->shape()); for(st.tofirst(); st.valid(); st.incr()) { Mrepresentation[st.current()]=value; } return(*this); } #ifdef AFF_PREBUILT } // namespace prebuilt #endif } // namespace aff #endif // AFF_ARRAY_DEF_H_VERSION (includeguard) /* ----- END OF array_def.h ----- */