From 3a8e332b426d2c9bea091f1eb993e6c2cbb5dddd Mon Sep 17 00:00:00 2001 From: Daniel Krebs Date: Tue, 13 Feb 2018 17:42:01 +0100 Subject: [PATCH] lib/vlnv: add != operator and minor cleanup --- fpga/include/villas/fpga/vlnv.hpp | 17 +++++------------ fpga/lib/vlnv.cpp | 12 ++++++++++++ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/fpga/include/villas/fpga/vlnv.hpp b/fpga/include/villas/fpga/vlnv.hpp index 52066a8d7..cce08f654 100644 --- a/fpga/include/villas/fpga/vlnv.hpp +++ b/fpga/include/villas/fpga/vlnv.hpp @@ -34,10 +34,8 @@ namespace villas { namespace fpga { - class Vlnv { public: - static constexpr char delimiter = ':'; Vlnv() : @@ -52,20 +50,15 @@ public: { return Vlnv(); } std::string - toString() const - { - std::stringstream stream; - std::string string; - - stream << *this; - stream >> string; - - return string; - } + toString() const; bool operator==(const Vlnv& other) const; + bool + operator!=(const Vlnv& other) const + { return !(*this == other); } + friend std::ostream& operator<< (std::ostream& stream, const Vlnv& vlnv) { diff --git a/fpga/lib/vlnv.cpp b/fpga/lib/vlnv.cpp index f9eaa6bb1..5d65d1329 100644 --- a/fpga/lib/vlnv.cpp +++ b/fpga/lib/vlnv.cpp @@ -66,5 +66,17 @@ Vlnv::parseFromString(std::string vlnv) if(version == "*") version = ""; } +std::string +Vlnv::toString() const +{ + std::stringstream stream; + std::string string; + + stream << *this; + stream >> string; + + return string; +} + } // namespace fpga } // namespace villas