Upgraded code to switch to C++17. Tested on Debian Buster
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <chrono>
|
||||
#include <optional>
|
||||
#include <stdexcept>
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
@@ -31,13 +32,13 @@ std::ostream& operator<<(std::ostream& os, const MetaData::Album& album)
|
||||
|
||||
|
||||
|
||||
void parse(MetaData::Parser& parser, const boost::filesystem::path& file)
|
||||
void parse(MetaData::Parser& parser, const std::filesystem::path& file)
|
||||
{
|
||||
using namespace MetaData;
|
||||
|
||||
parser.setClusterTypeNames( {"MOOD", "GENRE"} );
|
||||
|
||||
boost::optional<Track> track {parser.parse(file, true)};
|
||||
std::optional<Track> track {parser.parse(file, true)};
|
||||
if (!track)
|
||||
{
|
||||
std::cerr << "Parsing failed" << std::endl;
|
||||
@@ -119,11 +120,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
try
|
||||
{
|
||||
Av::AvInit();
|
||||
|
||||
for (std::size_t i {}; i < static_cast<std::size_t>(argc - 1); ++i)
|
||||
{
|
||||
boost::filesystem::path file {argv[i + 1]};
|
||||
std::filesystem::path file {argv[i + 1]};
|
||||
|
||||
std::cout << "Parsing file '" << file << "'" << std::endl;
|
||||
|
||||
|
||||
@@ -8,5 +8,5 @@ lms_metadata_SOURCES = \
|
||||
$(top_srcdir)/src/utils/Logger.cpp \
|
||||
$(top_srcdir)/src/utils/Utils.cpp
|
||||
|
||||
lms_metadata_CXXFLAGS=-std=c++14 -Wall -I$(top_srcdir)/src -D_REENTRANT
|
||||
lms_metadata_CXXFLAGS=-std=c++17 -I$(top_srcdir)/src -D_REENTRANT
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
#include <random>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
|
||||
#include "database/Database.hpp"
|
||||
#include "database/Db.hpp"
|
||||
#include "database/Session.hpp"
|
||||
#include "database/Track.hpp"
|
||||
#include "database/Artist.hpp"
|
||||
@@ -32,7 +32,7 @@ std::ostream& operator<<(std::ostream& os, const Database::Track::pointer& track
|
||||
|
||||
static
|
||||
bool
|
||||
getTrackFeatures(Database::Session &session, const Database::Track::pointer& track, const std::map<std::string, std::size_t>& featuresSettings, SOM::InputVector& res)
|
||||
getTrackFeatures(Database::Session&, const Database::Track::pointer& track, const std::map<std::string, std::size_t>& featuresSettings, SOM::InputVector& res)
|
||||
{
|
||||
std::map<std::string, std::vector<double>> features;
|
||||
for (const auto& featureSettings : featuresSettings)
|
||||
@@ -84,13 +84,13 @@ int main(int argc, char *argv[])
|
||||
for (const auto& featureSettings : featuresSettings)
|
||||
nbDims += featureSettings.second;
|
||||
|
||||
boost::filesystem::path configFilePath = "/etc/lms.conf";
|
||||
std::filesystem::path configFilePath {"/etc/lms.conf"};
|
||||
if (argc >= 2)
|
||||
configFilePath = std::string(argv[1], 0, 256);
|
||||
|
||||
ServiceProvider<Config>::create(configFilePath);
|
||||
|
||||
Database::Database db {getService<Config>()->getPath("working-dir") / "lms.db"};
|
||||
Database::Db db {getService<Config>()->getPath("working-dir") / "lms.db"};
|
||||
auto session {db.createSession()};
|
||||
|
||||
std::cout << "Getting all features..." << std::endl;
|
||||
|
||||
@@ -4,7 +4,7 @@ lms_similarity_SOURCES = \
|
||||
$(srcdir)/LmsSimilarity.cpp \
|
||||
$(top_srcdir)/src/database/Artist.cpp \
|
||||
$(top_srcdir)/src/database/Cluster.cpp \
|
||||
$(top_srcdir)/src/database/Database.cpp \
|
||||
$(top_srcdir)/src/database/Db.cpp \
|
||||
$(top_srcdir)/src/database/TrackFeatures.cpp \
|
||||
$(top_srcdir)/src/database/TrackList.cpp \
|
||||
$(top_srcdir)/src/database/Release.cpp \
|
||||
@@ -20,5 +20,5 @@ lms_similarity_SOURCES = \
|
||||
$(top_srcdir)/src/utils/Logger.cpp \
|
||||
$(top_srcdir)/src/utils/Utils.cpp
|
||||
|
||||
lms_similarity_CXXFLAGS=-std=c++14 -Wall -I$(top_srcdir)/src -D_REENTRANT
|
||||
lms_similarity_CXXFLAGS=-std=c++17 -I$(top_srcdir)/src -D_REENTRANT
|
||||
|
||||
|
||||
Reference in New Issue
Block a user