//#####################################################################
// Copyright 2009, Michael Lentine.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
// Class ARRAY_COLLECTION_ELEMENT
//#####################################################################
#ifndef __ARRAY_COLLECTION_ELEMENT__
#define __ARRAY_COLLECTION_ELEMENT__

#include <Core/Arrays/ARRAY_VIEW.h>
#include <Core/Particles/ARRAY_COLLECTION_ELEMENT_BASE.h>
namespace PhysBAM{

template<class T>
class ARRAY_COLLECTION_ELEMENT:public ARRAY_COLLECTION_ELEMENT_BASE
{
    typedef ARRAY_COLLECTION_ELEMENT_BASE BASE;
public:
    using BASE::owns_data;using BASE::name;
    ARRAY_VIEW<T>* array;
    int buffer_size;

    ARRAY_COLLECTION_ELEMENT(ARRAY_VIEW<T>* array_input);
    ARRAY_COLLECTION_ELEMENT();
    ~ARRAY_COLLECTION_ELEMENT();

    void Clean_Memory() override;
    void Clear(const int p) override;
    void Clear_Range(const int start,const int end) override;
    void Set_Size(const int new_size) override;
    void Reallocate(const int new_size) override;
    void Copy_Element(const int from,const int to) override;
    void Copy_Element(const ARRAY_COLLECTION_ELEMENT_BASE& from_attribute,const int from,const int to) override;
    void Copy_With_Offset(const ARRAY_COLLECTION_ELEMENT_BASE& from_attribute,const int offset) override;
    const char* Type_Name() const override;
    void Read(TYPED_ISTREAM& input) override;
    void Write(TYPED_OSTREAM& output) const override;
    void Print(std::ostream& output,const int p) const override;
    void Text_Write(std::ostream& output,const int p) const override;
    ARRAY_COLLECTION_ELEMENT_BASE* Clone_Default() const override;
};
}
#endif
