Skip to content

Commit

Permalink
Add licensing information and cleanup imports
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed Nov 14, 2018
1 parent 279c6d2 commit 410b9fe
Show file tree
Hide file tree
Showing 7 changed files with 1,761 additions and 114 deletions.
136 changes: 71 additions & 65 deletions include/openPMD/Datatype.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,9 +538,9 @@ isSame( openPMD::Datatype const d, openPMD::Datatype const e )
*/

#if _MSC_VER && !__INTEL_COMPILER
#define TEMPLATE_OPERATOR operator
#define OPENPMD_TEMPLATE_OPERATOR operator
#else
#define TEMPLATE_OPERATOR template operator
#define OPENPMD_TEMPLATE_OPERATOR template operator
#endif
template<
typename ReturnType = void,
Expand All @@ -552,120 +552,124 @@ ReturnType switchType(
Action action,
Args && ...args
) {
using fun = ReturnType ( Action::* )( Args... );
using fun = decltype(&Action::OPENPMD_TEMPLATE_OPERATOR() < int >);
static std::map<
Datatype,
fun
> funs {
{
Datatype::CHAR,
&Action::TEMPLATE_OPERATOR() < char > },
Datatype::CHAR ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < char > },
{
Datatype::UCHAR,
&Action::TEMPLATE_OPERATOR() < unsigned char > },
Datatype::UCHAR ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < unsigned char > },
{
Datatype::SHORT,
&Action::TEMPLATE_OPERATOR() < short > },
Datatype::SHORT ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < short > },
{
Datatype::INT,
&Action::TEMPLATE_OPERATOR() < int > },
Datatype::INT ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < int > },
{
Datatype::LONG,
&Action::TEMPLATE_OPERATOR() < long > },
Datatype::LONG ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < long > },
{
Datatype::LONGLONG,
&Action::TEMPLATE_OPERATOR() < long long > },
Datatype::LONGLONG ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < long long > },
{
Datatype::USHORT,
&Action::TEMPLATE_OPERATOR() < unsigned short > },
Datatype::USHORT ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < unsigned short > },
{
Datatype::UINT,
&Action::TEMPLATE_OPERATOR() < unsigned int > },
Datatype::UINT ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < unsigned int > },
{
Datatype::ULONG,
&Action::TEMPLATE_OPERATOR() < unsigned long > },
Datatype::ULONG ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < unsigned long > },
{
Datatype::ULONGLONG,
&Action::TEMPLATE_OPERATOR() < unsigned long long > },
Datatype::ULONGLONG ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < unsigned long long > },
{
Datatype::FLOAT,
&Action::TEMPLATE_OPERATOR() < float > },
Datatype::FLOAT ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < float > },
{
Datatype::DOUBLE,
&Action::TEMPLATE_OPERATOR() < double > },
Datatype::DOUBLE ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < double > },
{
Datatype::LONG_DOUBLE,
&Action::TEMPLATE_OPERATOR() < long double > },
Datatype::LONG_DOUBLE ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < long double > },
{
Datatype::STRING,
&Action::TEMPLATE_OPERATOR() < std::string > },
Datatype::STRING ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < std::string > },
{
Datatype::VEC_CHAR,
&Action::TEMPLATE_OPERATOR() < std::vector< char>>
Datatype::VEC_CHAR ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < std::vector< char>>
},
{
Datatype::VEC_SHORT,
&Action::TEMPLATE_OPERATOR() < std::vector< short>>
Datatype::VEC_SHORT ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < std::vector< short>>
},
{
Datatype::VEC_INT,
&Action::TEMPLATE_OPERATOR() < std::vector< int>>
Datatype::VEC_INT ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < std::vector< int>>
},
{
Datatype::VEC_LONG,
&Action::TEMPLATE_OPERATOR() < std::vector< long>>
Datatype::VEC_LONG ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < std::vector< long>>
},
{
Datatype::VEC_UCHAR,
&Action::TEMPLATE_OPERATOR() < std::vector< unsigned char>>
Datatype::VEC_LONGLONG ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < std::vector< long long>>
},
{
Datatype::VEC_USHORT,
&Action::TEMPLATE_OPERATOR() < std::vector< unsigned short>>
Datatype::VEC_UCHAR ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < std::vector< unsigned char>>
},
{
Datatype::VEC_UINT,
&Action::TEMPLATE_OPERATOR() < std::vector< unsigned int>>
Datatype::VEC_USHORT ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < std::vector< unsigned short>>
},
{
Datatype::VEC_ULONG,
&Action::TEMPLATE_OPERATOR() < std::vector< unsigned long>>
Datatype::VEC_UINT ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < std::vector< unsigned int>>
},
{
Datatype::VEC_ULONGLONG,
&Action::TEMPLATE_OPERATOR() < std::vector< unsigned long long>>
Datatype::VEC_ULONG ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < std::vector< unsigned long>>
},
{
Datatype::VEC_FLOAT,
&Action::TEMPLATE_OPERATOR() < std::vector< float>>
Datatype::VEC_ULONGLONG ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < std::vector< unsigned long long>>
},
{
Datatype::VEC_DOUBLE,
&Action::TEMPLATE_OPERATOR() < std::vector< double>>
Datatype::VEC_FLOAT ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < std::vector< float>>
},
{
Datatype::VEC_LONG_DOUBLE,
&Action::TEMPLATE_OPERATOR() < std::vector< long double>>
Datatype::VEC_DOUBLE ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < std::vector< double>>
},
{
Datatype::VEC_STRING,
&Action::TEMPLATE_OPERATOR() < std::vector< std::string>>
Datatype::VEC_LONG_DOUBLE ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < std::vector< long double>>
},
{
Datatype::ARR_DBL_7,
&Action::TEMPLATE_OPERATOR() < std::array<
Datatype::VEC_STRING ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < std::vector< std::string>>
},
{
Datatype::ARR_DBL_7 ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < std::array<
double,
7>>
},
{
Datatype::BOOL,
&Action::TEMPLATE_OPERATOR() < bool > },
Datatype::BOOL ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < bool > },
{
Datatype::DATATYPE,
&Action::TEMPLATE_OPERATOR() < 1000 > },
Datatype::DATATYPE ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < 1000 > },
{
Datatype::UNDEFINED,
&Action::TEMPLATE_OPERATOR() < 0 > }
Datatype::UNDEFINED ,
&Action::OPENPMD_TEMPLATE_OPERATOR() < 0 > }
};
auto it = funs.find( dt );
if( it != funs.end( ) )
Expand All @@ -682,6 +686,8 @@ ReturnType switchType(
}
}

#undef OPENPMD_TEMPLATE_OPERATOR

std::string datatypeToString( Datatype dt );

Datatype stringToDatatype( std::string s );
Expand Down
21 changes: 21 additions & 0 deletions include/openPMD/IO/JSON/JSONFilePosition.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
/* Copyright 2017-2018 Franz Pöschel
*
* This file is part of openPMD-api.
*
* openPMD-api is free software: you can redistribute it and/or modify
* it under the terms of of either the GNU General Public License or
* the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* openPMD-api is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License and the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* and the GNU Lesser General Public License along with openPMD-api.
* If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once


Expand Down
23 changes: 22 additions & 1 deletion include/openPMD/IO/JSON/JSONIOHandler.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
/* Copyright 2017-2018 Franz Pöschel
*
* This file is part of openPMD-api.
*
* openPMD-api is free software: you can redistribute it and/or modify
* it under the terms of of either the GNU General Public License or
* the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* openPMD-api is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License and the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* and the GNU Lesser General Public License along with openPMD-api.
* If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once


Expand All @@ -23,4 +44,4 @@ namespace openPMD
private:
JSONIOHandlerImpl m_impl;
};
} // openPMD
} // openPMD
38 changes: 29 additions & 9 deletions include/openPMD/IO/JSON/JSONIOHandlerImpl.hpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,39 @@
/* Copyright 2017-2018 Franz Pöschel
*
* This file is part of openPMD-api.
*
* openPMD-api is free software: you can redistribute it and/or modify
* it under the terms of of either the GNU General Public License or
* the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* openPMD-api is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License and the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* and the GNU Lesser General Public License along with openPMD-api.
* If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once


#include "openPMD/IO/AbstractIOHandlerImpl.hpp"
#include "openPMD/IO/AbstractIOHandler.hpp"
#include "openPMD/auxiliary/Filesystem.hpp"
#include "openPMD/Datatype.hpp"
#include "openPMD/IO/AbstractIOHandler.hpp"
#include "openPMD/IO/AbstractIOHandlerImpl.hpp"
#include "openPMD/IO/AccessType.hpp"
#include "openPMD/IO/JSON/JSONFilePosition.hpp"

#include <fstream>
#include <memory>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <stdio.h>
#include <vector>
#include <tuple>
#include <fstream>
#include <openPMD/IO/AccessType.hpp>
#include "openPMD/IO/JSON/JSONFilePosition.hpp"


#if openPMD_HAVE_JSON
Expand Down
23 changes: 22 additions & 1 deletion src/IO/JSON/JSONIOHandler.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
/* Copyright 2017-2018 Franz Pöschel
*
* This file is part of openPMD-api.
*
* openPMD-api is free software: you can redistribute it and/or modify
* it under the terms of of either the GNU General Public License or
* the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* openPMD-api is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License and the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* and the GNU Lesser General Public License along with openPMD-api.
* If not, see <http://www.gnu.org/licenses/>.
*/

#include "openPMD/IO/JSON/JSONIOHandler.hpp"


Expand All @@ -23,4 +44,4 @@ namespace openPMD
{
return m_impl.flush( );
}
} // openPMD
} // openPMD
Loading

0 comments on commit 410b9fe

Please sign in to comment.