Skip to content
Snippets Groups Projects
Commit 316f37d6 authored by Paweł Kędzia's avatar Paweł Kędzia
Browse files

Added constructor to Relation

parent 45b2a9fd
Branches
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ or FITNESS FOR A PARTICULAR PURPOSE. ...@@ -14,6 +14,7 @@ or FITNESS FOR A PARTICULAR PURPOSE.
See the LICENSE and COPYING files for more details. See the LICENSE and COPYING files for more details.
*/ */
#include <boost/make_shared.hpp>
#include <libcorpus2/relation.h> #include <libcorpus2/relation.h>
namespace Corpus2 { namespace Corpus2 {
...@@ -25,6 +26,15 @@ Relation::Relation(const std::string& name, ...@@ -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() Relation::~Relation()
{ {
} }
......
...@@ -81,6 +81,16 @@ public: ...@@ -81,6 +81,16 @@ public:
const boost::shared_ptr<const DirectionPoint> from, const boost::shared_ptr<const DirectionPoint> from,
const boost::shared_ptr<const DirectionPoint> to); 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(); ~Relation();
/// Accessor to "from" direction point /// Accessor to "from" direction point
...@@ -100,7 +110,7 @@ public: ...@@ -100,7 +110,7 @@ public:
private: private:
/// Direction name /// Direction name
const std::string& name_; const std::string name_;
/// Direction points: from and to /// Direction points: from and to
const boost::shared_ptr<const DirectionPoint> from_; const boost::shared_ptr<const DirectionPoint> from_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment