Skip to content
Snippets Groups Projects
Commit c98ae2d9 authored by Jovan Mitrevski's avatar Jovan Mitrevski
Browse files

Move vector<vector<int>> parser definitions to standalone files

parent 7c0b95ce
No related merge requests found
......@@ -8,52 +8,6 @@
// Implementation file for class IsolationBuilder
///////////////////////////////////////////////////////////////////
// Add a parser for vector<vector<int>>
// Includes needed for the custom type
#include <vector>
#include <string>
// A typedef may save a lot of mistakes
typedef std::vector<std::vector<int> > MyCustomType;
// Define the parser
#include "GaudiKernel/ParsersFactory.h"
namespace Gaudi
{
namespace Parsers
{
// // Parser grammar
// template <typename Iterator, typename Skipper>
// struct Grammar_<Iterator, MyCustomType, Skipper> {
// // In this case, the type is a mapping type, so it requires the MapGrammar.
// // For other grammars see GaudiKernel/GrammarsV2.h
// typedef VectorGrammar<Iterator, MyCustomType, Skipper> Grammar;
// };
// Parse function... nothing special, but it must be done explicitely.
StatusCode parse( MyCustomType& result, const std::string& input ) { return parse_( result, input ); }
}
}
// We also need to be able to print an object of our type as a string that both
// Python and our parser can understand,
#include "GaudiKernel/ToStream.h"
namespace std
{
// This is an example valid for any mapping type.
ostream& operator<<( ostream& s, const MyCustomType& vecvec )
{
s << '{';
for ( const auto& vec : vecvec ) {
Gaudi::Utils::toStream( vec, s );
}
s << '}';
return s;
}
}
// Isolation includes
#include "IsolationBuilder.h"
......
......@@ -10,23 +10,15 @@
#ifndef ISOLATIONALGS_ISOLATIONBUILDER_H
#define ISOLATIONALGS_ISOLATIONBUILDER_H 1
// to allow vector<vector<int>> properties
#include "VectorVectorIntParser.h"
// STL includes
#include <string>
#include <set>
#include <vector>
#include <utility>
#include "GaudiKernel/StatusCode.h"
namespace Gaudi
{
namespace Parsers
{
// Parse function... nothing special, but it must be done explicitely.
StatusCode parse( std::vector<std::vector<int> > & result, const std::string& input );
}
}
// FrameWork includes
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
......
///////////////////////// -*- C++ -*- /////////////////////////////
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// Add a parser for vector<vector<int>>
///////////////////////////////////////////////////////////////////
// Includes needed for the custom type
#include <vector>
#include <string>
// A typedef may save a lot of mistakes
typedef std::vector<std::vector<int> > MyCustomType;
// Define the parser
#include "GaudiKernel/ParsersFactory.h"
namespace Gaudi
{
namespace Parsers
{
// Parse function... nothing special, but it must be done explicitely.
StatusCode parse( MyCustomType& result, const std::string& input ) { return parse_( result, input ); }
}
}
// We also need to be able to print an object of our type as a string that both
// Python and our parser can understand,
#include "GaudiKernel/ToStream.h"
namespace std
{
// This is an example valid for any mapping type.
ostream& operator<<( ostream& s, const MyCustomType& vecvec )
{
s << '{';
for ( const auto& vec : vecvec ) {
Gaudi::Utils::toStream( vec, s );
}
s << '}';
return s;
}
}
///////////////////////// -*- C++ -*- /////////////////////////////
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// VectorVectorIntParser.h
// Forward declarations for vector<vector<int>> parser
///////////////////////////////////////////////////////////////////
#ifndef ISOLATIONALGS_VECTORVECTORINTPARSER_H
#define ISOLATIONALGS_VECTORVECTORINTPARSER_H 1
// STL includes
#include <string>
#include <vector>
#include "GaudiKernel/StatusCode.h"
namespace Gaudi
{
namespace Parsers
{
// Parse function... nothing special, but it must be done explicitely.
StatusCode parse( std::vector<std::vector<int> > & result, const std::string& input );
}
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment