Skip to content
Snippets Groups Projects
STLVector.h 1.36 KiB
Newer Older
wfg's avatar
wfg committed
/*
 * Distributed under the OSI-approved Apache License, Version 2.0.  See
 * accompanying file Copyright.txt for details.
 *
wfg's avatar
wfg committed
 * Heap.h
 *
 *  Created on: Dec 19, 2016
 *      Author: wfg
 */

#ifndef STLVECTOR_H_
#define STLVECTOR_H_
wfg's avatar
wfg committed

wfg's avatar
wfg committed
/// \cond EXCLUDE_FROM_DOXYGEN
#include <vector>
/// \endcond

#include "ADIOSConfig.h"
wfg's avatar
wfg committed
#include "core/Capsule.h"

namespace adios
{
wfg's avatar
wfg committed

/**
 * Data and Metadata buffers are allocated in the Heap
wfg's avatar
wfg committed
 */
class STLVector : public Capsule
wfg's avatar
wfg committed
{

public:
    std::vector<char> m_Data; ///< data buffer allocated using the STL in heap
                              /// memory, default size = 16 Mb
    std::vector<char>
        m_Metadata; ///< metadata buffer allocated using the STL in
                    /// heap memory, default size = 100 Kb

    /**
     * Unique constructor
     * @param accessMode read, write or append
     * @param rankMPI MPI rank
     * @param debugMode true: extra checks, slower
     */
    STLVector(const std::string accessMode, const int rankMPI,
              const bool debugMode = false);

    ~STLVector() = default;

    char *GetData();
    char *GetMetadata();

    std::size_t GetDataSize() const;
    std::size_t GetMetadataSize() const;

    void ResizeData(const std::size_t size);
    void ResizeMetadata(const std::size_t size);
wfg's avatar
wfg committed
};

} // end namespace capsule
} // end namespace
wfg's avatar
wfg committed

#endif /* STLVECTOR_H_ */