Skip to content
Snippets Groups Projects
  • William F Godoy's avatar
    81bcb116
    Added more bug/warning fixes · 81bcb116
    William F Godoy authored
    Removed ADIOS copy constructor explicitly, as it wasn't allowed by clang
    compiler in testing/xml/TestXMLConfig.cpp
    
    Using more portable preprocessor definitions to avoid warning on Windows
    for ctime and fopen
    
    Introduced std::throw_with_nested for bad_alloc in STLVector Capsule
    
    Removed std:: in C function calls to avoid confusion with actual C++
    only calls
    81bcb116
    History
    Added more bug/warning fixes
    William F Godoy authored
    Removed ADIOS copy constructor explicitly, as it wasn't allowed by clang
    compiler in testing/xml/TestXMLConfig.cpp
    
    Using more portable preprocessor definitions to avoid warning on Windows
    for ctime and fopen
    
    Introduced std::throw_with_nested for bad_alloc in STLVector Capsule
    
    Removed std:: in C function calls to avoid confusion with actual C++
    only calls
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
FilePointer.h 1.12 KiB
/*
 * Distributed under the OSI-approved Apache License, Version 2.0.  See
 * accompanying file Copyright.txt for details.
 *
 * FilePointer.h wrapper of C/C++ stdio.h for file I/O
 *
 *  Created on: Jan 6, 2017
 *      Author: William F Godoy godoywf@ornl.gov
 */

#ifndef ADIOS2_TOOLKIT_TRANSPORT_FILE_FILEPOINTER_H_
#define ADIOS2_TOOLKIT_TRANSPORT_FILE_FILEPOINTER_H_

#include <cstdio> // FILE*

#include "adios2/toolkit/transport/Transport.h"

namespace adios2
{
namespace transport
{

/**
 * Class that defines a transport method using C file pointer (FP) to
 * streams
 * FILE*
 */
class FilePointer : public Transport
{

public:
    FilePointer(MPI_Comm mpiComm, const bool debugMode);

    ~FilePointer();

    void Open(const std::string &name, const OpenMode openMode) final;

    void SetBuffer(char *buffer, size_t size) final;

    void Write(const char *buffer, size_t size) final;

    void Flush() final;

    void Close() final;

private:
    /** C File pointer */
    FILE *m_File = nullptr; // NULL or nullptr?
};

} // end namespace transport
} // end namespace

#endif /* ADIOS2_TOOLKIT_TRANSPORT_FILE_FILEPOINTER_H_ */