diff --git a/libcorpus2/relation.cpp b/libcorpus2/relation.cpp index 8e22ca957c270838ae16cffea633c38013db9973..91074b10b824515d54b06530dee43aef7e8c2b5e 100644 --- a/libcorpus2/relation.cpp +++ b/libcorpus2/relation.cpp @@ -14,6 +14,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE and COPYING files for more details. */ +#include <boost/make_shared.hpp> #include <libcorpus2/relation.h> namespace Corpus2 { @@ -25,6 +26,15 @@ Relation::Relation(const std::string& name, { } +Relation::Relation(const std::string& name, + const DirectionPoint& from, + const DirectionPoint& to) + : name_(name), + from_(boost::make_shared<const DirectionPoint>(from)), + to_(boost::make_shared<const DirectionPoint>(to)) +{ +} + Relation::~Relation() { } diff --git a/libcorpus2/relation.h b/libcorpus2/relation.h index e9fbcb64f15765acbff0156041459e01697e1d1e..aea36809f85fd17ccf41bc7116aedb0c10ee7e80 100644 --- a/libcorpus2/relation.h +++ b/libcorpus2/relation.h @@ -81,6 +81,16 @@ public: const boost::shared_ptr<const DirectionPoint> from, const boost::shared_ptr<const DirectionPoint> to); + /** + * Makes directed relation + * @param name Name of the relation + * @param from Source of relation direction + * @param to Target of relation direction + */ + Relation(const std::string& name, + const DirectionPoint& from, + const DirectionPoint& to); + ~Relation(); /// Accessor to "from" direction point @@ -100,7 +110,7 @@ public: private: /// Direction name - const std::string& name_; + const std::string name_; /// Direction points: from and to const boost::shared_ptr<const DirectionPoint> from_;